]> andersk Git - gssapi-openssh.git/blame - openssh/configure.ac
merged OpenSSH 5.1p1 to trunk
[gssapi-openssh.git] / openssh / configure.ac
CommitLineData
3c0ef626 1# $Id$
12a403af 2#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3c0ef626 16
2ce0bfe4 17AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
4b6dae8f 18AC_REVISION($Revision$)
3c0ef626 19AC_CONFIG_SRCDIR([ssh.c])
20
21AC_CONFIG_HEADER(config.h)
282f473f 22
23# Handle Globus configuration right away, because the Globus flavor
24# determines our compiler options.
25
26# Check whether the user wants GSI (Globus) support
27gsi_path="no"
28AC_ARG_WITH(gsi,
29 [ --with-gsi Enable Globus GSI authentication support],
30 [
31 gsi_path="$withval"
32 ]
33)
34
35AC_ARG_WITH(globus,
36 [ --with-globus Enable Globus GSI authentication support],
37 [
38 gsi_path="$withval"
39 ]
40)
41
42AC_ARG_WITH(globus-static,
43 [ --with-globus-static Link statically with Globus GSI libraries],
44 [
45 gsi_static="-static"
46 if test "x$gsi_path" = "xno" ; then
47 gsi_path="$withval"
48 fi
49 ]
50)
51
52# Check whether the user has a Globus flavor type
53globus_flavor_type="no"
54AC_ARG_WITH(globus-flavor,
55 [ --with-globus-flavor=TYPE Specify Globus flavor type (ex: gcc32dbg)],
56 [
57 globus_flavor_type="$withval"
58 if test "x$gsi_path" = "xno" ; then
59 gsi_path="yes"
60 fi
61 ]
62)
63
64if test "x$gsi_path" != "xno" ; then
65 # Globus GSSAPI configuration
66 AC_MSG_CHECKING(for Globus GSI)
67 AC_DEFINE(GSI, 1, [Define if you want GSI/Globus authentication support.])
68
69 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
70 AC_MSG_ERROR([Previously configured GSSAPI library conflicts with Globus GSI.])
71 fi
72 if test -z "$GSSAPI"; then
73 AC_DEFINE(GSSAPI)
74 GSSAPI="GSI"
75 fi
76
77 if test "x$gsi_path" = "xyes" ; then
78 if test -z "$GLOBUS_LOCATION" ; then
79 AC_MSG_ERROR(GLOBUS_LOCATION environment variable must be set.)
80 else
81 gsi_path="$GLOBUS_LOCATION"
82 fi
83 fi
84 GLOBUS_LOCATION="$gsi_path"
85 export GLOBUS_LOCATION
86 if test ! -d "$GLOBUS_LOCATION" ; then
87 AC_MSG_ERROR(Cannot find Globus installation. Set GLOBUS_LOCATION environment variable.)
88 fi
89
90 if test "x$globus_flavor_type" = "xno" ; then
91 AC_MSG_ERROR(--with-globus-flavor=TYPE must be specified)
92 fi
93 if test "x$globus_flavor_type" = "xyes" ; then
94 AC_MSG_ERROR(--with-globus-flavor=TYPE must specify a flavor type)
95 fi
96
97 GLOBUS_INCLUDE="${gsi_path}/include/${globus_flavor_type}"
98 if test ! -d "$GLOBUS_INCLUDE" ; then
99 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_INCLUDE})
100 fi
282f473f 101
102 if test -x ${gsi_path}/bin/globus-makefile-header ; then
103 ${gsi_path}/bin/globus-makefile-header --flavor=${globus_flavor_type} ${gsi_static} globus_gss_assist | sed 's/ = \(.*\)/="\1"/' > ./gpt_build_tmp.sh
104 elif test -x ${gsi_path}/sbin/globus-makefile-header ; then
105 ${gsi_path}/sbin/globus-makefile-header --flavor=${globus_flavor_type} ${gsi_static} globus_gss_assist | sed 's/ = \(.*\)/="\1"/' > ./gpt_build_tmp.sh
106 else
107 AC_MSG_ERROR(Cannot find globus-makefile-header: Globus installation is incomplete)
108 fi
109 . ./gpt_build_tmp.sh
282f473f 110 if test -z "$GLOBUS_PKG_LIBS" ; then
111 AC_MSG_ERROR(globus-makefile-header failed)
112 fi
113
5156b1a1 114 AC_MSG_RESULT($GLOBUS_LOCATION)
282f473f 115 AC_DEFINE(HAVE_GSSAPI_H)
116
117 CC="$GLOBUS_CC"
118 CFLAGS="$GLOBUS_CFLAGS"
119 CPP="$GLOBUS_CPP"
120 CPPFLAGS="$GLOBUS_CPPFLAGS $GLOBUS_INCLUDES"
121 LIBS="$LIBS $GLOBUS_LIBS $GLOBUS_PKG_LIBS"
122 LD="$GLOBUS_LD"
123 LDFLAGS="$LDFLAGS $GLOBUS_LDFLAGS"
124
125 # test that we got the libraries OK
126 AC_TRY_LINK(
127 [],
128 [],
5156b1a1 129 [],
282f473f 130 [
131 AC_MSG_ERROR(link with Globus libraries failed)
132 ]
133 )
134 AC_CHECK_FUNCS(globus_gss_assist_map_and_authorize)
135 INSTALL_GSISSH="yes"
136else
137 INSTALL_GSISSH=""
138fi
139AC_SUBST(INSTALL_GSISSH)
140# End Globus/GSI section
141
3c0ef626 142AC_PROG_CC
143AC_CANONICAL_HOST
144AC_C_BIGENDIAN
145
146# Checks for programs.
7cac2b65 147AC_PROG_AWK
3c0ef626 148AC_PROG_CPP
149AC_PROG_RANLIB
150AC_PROG_INSTALL
4b6dae8f 151AC_PROG_EGREP
3c0ef626 152AC_PATH_PROG(AR, ar)
7e82606e 153AC_PATH_PROG(CAT, cat)
154AC_PATH_PROG(KILL, kill)
3c0ef626 155AC_PATH_PROGS(PERL, perl5 perl)
bfe49944 156AC_PATH_PROG(SED, sed)
3c0ef626 157AC_SUBST(PERL)
158AC_PATH_PROG(ENT, ent)
159AC_SUBST(ENT)
3c0ef626 160AC_PATH_PROG(TEST_MINUS_S_SH, bash)
161AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
162AC_PATH_PROG(TEST_MINUS_S_SH, sh)
350391c5 163AC_PATH_PROG(SH, sh)
7e82606e 164AC_SUBST(TEST_SHELL,sh)
165
166dnl for buildpkg.sh
167AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
168 [/usr/sbin${PATH_SEPARATOR}/etc])
169AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
170 [/usr/sbin${PATH_SEPARATOR}/etc])
171AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
08822d99 172if test -x /sbin/sh; then
173 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
174else
175 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
176fi
3c0ef626 177
178# System features
179AC_SYS_LARGEFILE
180
181if test -z "$AR" ; then
182 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
183fi
184
185# Use LOGIN_PROGRAM from environment if possible
186if test ! -z "$LOGIN_PROGRAM" ; then
08822d99 187 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
188 [If your header files don't define LOGIN_PROGRAM,
189 then use this (detected) from environment and PATH])
3c0ef626 190else
191 # Search for login
192 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
193 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
194 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
195 fi
196fi
197
540d72c3 198AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
199if test ! -z "$PATH_PASSWD_PROG" ; then
08822d99 200 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
201 [Full path of your "passwd" program])
540d72c3 202fi
203
3c0ef626 204if test -z "$LD" ; then
205 LD=$CC
206fi
207AC_SUBST(LD)
8b32eddc 208
3c0ef626 209AC_C_INLINE
2ce0bfe4 210
211AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
212
e74dc197 213use_stack_protector=1
214AC_ARG_WITH(stackprotect,
215 [ --without-stackprotect Don't use compiler's stack protection], [
216 if test "x$withval" = "xno"; then
217 use_stack_protector=0
218 fi ])
219
540d72c3 220if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
2ce0bfe4 221 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
08822d99 222 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
2ce0bfe4 223 case $GCC_VER in
fa0f0f45 224 1.*) no_attrib_nonnull=1 ;;
225 2.8* | 2.9*)
226 CFLAGS="$CFLAGS -Wsign-compare"
227 no_attrib_nonnull=1
228 ;;
229 2.*) no_attrib_nonnull=1 ;;
5156b1a1 230 3.*) CFLAGS="$CFLAGS -Wsign-compare -Wformat-security" ;;
231 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign -Wformat-security" ;;
08822d99 232 *) ;;
2ce0bfe4 233 esac
234
5156b1a1 235 AC_MSG_CHECKING(if $CC accepts -fno-builtin-memset)
236 saved_CFLAGS="$CFLAGS"
237 CFLAGS="$CFLAGS -fno-builtin-memset"
238 AC_LINK_IFELSE( [AC_LANG_SOURCE([[
239#include <string.h>
240int main(void){char b[10]; memset(b, 0, sizeof(b));}
241 ]])],
242 [ AC_MSG_RESULT(yes) ],
243 [ AC_MSG_RESULT(no)
244 CFLAGS="$saved_CFLAGS" ]
245)
246
e74dc197 247 # -fstack-protector-all doesn't always work for some GCC versions
248 # and/or platforms, so we test if we can. If it's not supported
249 # on a give platform gcc will emit a warning so we use -Werror.
250 if test "x$use_stack_protector" = "x1"; then
251 for t in -fstack-protector-all -fstack-protector; do
252 AC_MSG_CHECKING(if $CC supports $t)
253 saved_CFLAGS="$CFLAGS"
254 saved_LDFLAGS="$LDFLAGS"
255 CFLAGS="$CFLAGS $t -Werror"
256 LDFLAGS="$LDFLAGS $t -Werror"
257 AC_LINK_IFELSE(
258 [AC_LANG_SOURCE([
259#include <stdlib.h>
260int main(void){return 0;}
261 ])],
262 [ AC_MSG_RESULT(yes)
263 CFLAGS="$saved_CFLAGS $t"
264 LDFLAGS="$saved_LDFLAGS $t"
265 AC_MSG_CHECKING(if $t works)
266 AC_RUN_IFELSE(
267 [AC_LANG_SOURCE([
268#include <stdlib.h>
269int main(void){exit(0);}
270 ])],
271 [ AC_MSG_RESULT(yes)
272 break ],
273 [ AC_MSG_RESULT(no) ],
274 [ AC_MSG_WARN([cross compiling: cannot test])
275 break ]
276 )
277 ],
278 [ AC_MSG_RESULT(no) ]
279 )
280 CFLAGS="$saved_CFLAGS"
281 LDFLAGS="$saved_LDFLAGS"
282 done
283 fi
284
2ce0bfe4 285 if test -z "$have_llong_max"; then
286 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
287 unset ac_cv_have_decl_LLONG_MAX
288 saved_CFLAGS="$CFLAGS"
289 CFLAGS="$CFLAGS -std=gnu99"
290 AC_CHECK_DECL(LLONG_MAX,
291 [have_llong_max=1],
292 [CFLAGS="$saved_CFLAGS"],
293 [#include <limits.h>]
294 )
295 fi
296fi
297
fa0f0f45 298if test "x$no_attrib_nonnull" != "x1" ; then
299 AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
300fi
301
540d72c3 302AC_ARG_WITH(rpath,
303 [ --without-rpath Disable auto-added -R linker paths],
304 [
8b32eddc 305 if test "x$withval" = "xno" ; then
540d72c3 306 need_dash_r=""
307 fi
308 if test "x$withval" = "xyes" ; then
309 need_dash_r=1
310 fi
311 ]
312)
313
240debe0 314# Allow user to specify flags
315AC_ARG_WITH(cflags,
316 [ --with-cflags Specify additional flags to pass to compiler],
317 [
318 if test -n "$withval" && test "x$withval" != "xno" && \
319 test "x${withval}" != "xyes"; then
320 CFLAGS="$CFLAGS $withval"
321 fi
322 ]
323)
324AC_ARG_WITH(cppflags,
325 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
326 [
327 if test -n "$withval" && test "x$withval" != "xno" && \
328 test "x${withval}" != "xyes"; then
329 CPPFLAGS="$CPPFLAGS $withval"
330 fi
331 ]
332)
333AC_ARG_WITH(ldflags,
334 [ --with-ldflags Specify additional flags to pass to linker],
335 [
336 if test -n "$withval" && test "x$withval" != "xno" && \
337 test "x${withval}" != "xyes"; then
338 LDFLAGS="$LDFLAGS $withval"
339 fi
340 ]
341)
342AC_ARG_WITH(libs,
343 [ --with-libs Specify additional libraries to link with],
344 [
345 if test -n "$withval" && test "x$withval" != "xno" && \
346 test "x${withval}" != "xyes"; then
347 LIBS="$LIBS $withval"
348 fi
349 ]
350)
351AC_ARG_WITH(Werror,
352 [ --with-Werror Build main code with -Werror],
353 [
354 if test -n "$withval" && test "x$withval" != "xno"; then
355 werror_flags="-Werror"
356 if test "x${withval}" != "xyes"; then
357 werror_flags="$withval"
358 fi
359 fi
360 ]
361)
362
363AC_CHECK_HEADERS( \
364 bstring.h \
365 crypt.h \
366 crypto/sha2.h \
367 dirent.h \
368 endian.h \
369 features.h \
370 fcntl.h \
371 floatingpoint.h \
372 getopt.h \
373 glob.h \
374 ia.h \
375 iaf.h \
376 limits.h \
377 login.h \
378 maillock.h \
379 ndir.h \
380 net/if_tun.h \
381 netdb.h \
382 netgroup.h \
383 pam/pam_appl.h \
384 paths.h \
fa0f0f45 385 poll.h \
240debe0 386 pty.h \
387 readpassphrase.h \
388 rpc/types.h \
389 security/pam_appl.h \
390 sha2.h \
391 shadow.h \
392 stddef.h \
393 stdint.h \
394 string.h \
395 strings.h \
396 sys/audit.h \
397 sys/bitypes.h \
398 sys/bsdtty.h \
399 sys/cdefs.h \
400 sys/dir.h \
401 sys/mman.h \
5156b1a1 402 sys/mount.h \
240debe0 403 sys/ndir.h \
e74dc197 404 sys/poll.h \
240debe0 405 sys/prctl.h \
406 sys/pstat.h \
407 sys/select.h \
408 sys/stat.h \
409 sys/stream.h \
410 sys/stropts.h \
411 sys/strtio.h \
5156b1a1 412 sys/statvfs.h \
240debe0 413 sys/sysmacros.h \
414 sys/time.h \
415 sys/timers.h \
416 sys/un.h \
417 time.h \
418 tmpdir.h \
419 ttyent.h \
fa0f0f45 420 ucred.h \
240debe0 421 unistd.h \
422 usersec.h \
423 util.h \
424 utime.h \
425 utmp.h \
426 utmpx.h \
427 vis.h \
428)
429
430# lastlog.h requires sys/time.h to be included first on Solaris
431AC_CHECK_HEADERS(lastlog.h, [], [], [
432#ifdef HAVE_SYS_TIME_H
433# include <sys/time.h>
434#endif
435])
436
437# sys/ptms.h requires sys/stream.h to be included first on Solaris
438AC_CHECK_HEADERS(sys/ptms.h, [], [], [
439#ifdef HAVE_SYS_STREAM_H
440# include <sys/stream.h>
441#endif
442])
443
444# login_cap.h requires sys/types.h on NetBSD
445AC_CHECK_HEADERS(login_cap.h, [], [], [
446#include <sys/types.h>
447])
448
30460aeb 449# Messages for features tested for in target-specific section
450SIA_MSG="no"
451SPC_MSG="no"
452
3c0ef626 453# Check for some target-specific stuff
454case "$host" in
455*-*-aix*)
30460aeb 456 # Some versions of VAC won't allow macro redefinitions at
457 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
458 # particularly with older versions of vac or xlc.
459 # It also throws errors about null macro argments, but these are
460 # not fatal.
461 AC_MSG_CHECKING(if compiler allows macro redefinitions)
462 AC_COMPILE_IFELSE(
463 [AC_LANG_SOURCE([[
464#define testmacro foo
465#define testmacro bar
466int main(void) { exit(0); }
467 ]])],
468 [ AC_MSG_RESULT(yes) ],
469 [ AC_MSG_RESULT(no)
470 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
471 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
472 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
473 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
474 ]
475 )
476
540d72c3 477 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
256cb466 478 if (test -z "$blibpath"); then
540d72c3 479 blibpath="/usr/lib:/lib"
3c0ef626 480 fi
256cb466 481 saved_LDFLAGS="$LDFLAGS"
30460aeb 482 if test "$GCC" = "yes"; then
483 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
484 else
485 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
486 fi
487 for tryflags in $flags ;do
256cb466 488 if (test -z "$blibflags"); then
489 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
490 AC_TRY_LINK([], [], [blibflags=$tryflags])
491 fi
492 done
493 if (test -z "$blibflags"); then
494 AC_MSG_RESULT(not found)
495 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
496 else
497 AC_MSG_RESULT($blibflags)
498 fi
499 LDFLAGS="$saved_LDFLAGS"
7cac2b65 500 dnl Check for authenticate. Might be in libs.a on older AIXes
08822d99 501 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
502 [Define if you want to enable AIX4's authenticate function])],
d03f4262 503 [AC_CHECK_LIB(s,authenticate,
504 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
505 LIBS="$LIBS -ls"
506 ])
507 ])
dfddba3d 508 dnl Check for various auth function declarations in headers.
509 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
8b32eddc 510 passwdexpired, setauthdb], , , [#include <usersec.h>])
7cac2b65 511 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
dfddba3d 512 AC_CHECK_DECLS(loginfailed,
7cac2b65 513 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
514 AC_TRY_COMPILE(
515 [#include <usersec.h>],
516 [(void)loginfailed("user","host","tty",0);],
517 [AC_MSG_RESULT(yes)
08822d99 518 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
519 [Define if your AIX loginfailed() function
520 takes 4 arguments (AIX >= 5.2)])],
7cac2b65 521 [AC_MSG_RESULT(no)]
522 )],
523 [],
524 [#include <usersec.h>]
525 )
e74dc197 526 AC_CHECK_FUNCS(getgrset setauthdb)
30460aeb 527 AC_CHECK_DECL(F_CLOSEM,
528 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
529 [],
530 [ #include <limits.h>
531 #include <fcntl.h> ]
532 )
dfddba3d 533 check_for_aix_broken_getaddrinfo=1
08822d99 534 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
535 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
536 [Define if your platform breaks doing a seteuid before a setuid])
537 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
538 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
3c0ef626 539 dnl AIX handles lastlog as part of its login message
08822d99 540 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
541 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
542 [Some systems need a utmpx entry for /bin/login to work])
543 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
544 [Define to a Set Process Title type if your system is
545 supported by bsd-setproctitle.c])
546 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
547 [AIX 5.2 and 5.3 (and presumably newer) require this])
30460aeb 548 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
3c0ef626 549 ;;
550*-*-cygwin*)
bfe49944 551 check_for_libcrypt_later=1
0b90ac93 552 LIBS="$LIBS /usr/lib/textreadmode.o"
08822d99 553 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
554 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
555 AC_DEFINE(DISABLE_SHADOW, 1,
556 [Define if you want to disable shadow passwords])
557 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
558 [Define if your system choked on IP TOS setting])
559 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
560 [Define if X11 doesn't support AF_UNIX sockets on that system])
561 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
562 [Define if the concept of ports only accessible to
563 superusers isn't known])
564 AC_DEFINE(DISABLE_FD_PASSING, 1,
565 [Define if your platform needs to skip post auth
566 file descriptor passing])
3c0ef626 567 ;;
568*-*-dgux*)
569 AC_DEFINE(IP_TOS_IS_BROKEN)
540d72c3 570 AC_DEFINE(SETEUID_BREAKS_SETUID)
571 AC_DEFINE(BROKEN_SETREUID)
572 AC_DEFINE(BROKEN_SETREGID)
3c0ef626 573 ;;
574*-*-darwin*)
0b90ac93 575 AC_DEFINE(BROKEN_GETADDRINFO, 1, [Define if getaddrinfo is broken)])
576 AC_DEFINE(BROKEN_GETADDRINFO)
29d88157 577 AC_DEFINE(SETEUID_BREAKS_SETUID)
578 AC_DEFINE(BROKEN_SETREUID)
579 AC_DEFINE(BROKEN_SETREGID)
e74dc197 580 AC_DEFINE(BROKEN_GLOB, 1, [OS X glob does not do what we expect])
08822d99 581 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
582 [Define if your resolver libs need this for getrrsetbyname])
30460aeb 583 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
584 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
585 [Use tunnel device compatibility to OpenBSD])
586 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
587 [Prepend the address family to IP tunnel traffic])
e74dc197 588 m4_pattern_allow(AU_IPv)
589 AC_CHECK_DECL(AU_IPv4, [],
590 AC_DEFINE(AU_IPv4, 0, [System only supports IPv4 audit records])
591 [#include <bsm/audit.h>]
592 )
f713db99 593 AC_MSG_CHECKING(if we have the Security Authorization Session API)
594 AC_TRY_COMPILE([#include <Security/AuthSession.h>],
595 [SessionCreate(0, 0);],
596 [ac_cv_use_security_session_api="yes"
597 AC_DEFINE(USE_SECURITY_SESSION_API, 1,
598 [platform has the Security Authorization Session API])
599 LIBS="$LIBS -framework Security"
600 AC_MSG_RESULT(yes)],
601 [ac_cv_use_security_session_api="no"
602 AC_MSG_RESULT(no)])
603 AC_MSG_CHECKING(if we have an in-memory credentials cache)
604 AC_TRY_COMPILE(
605 [#include <Kerberos/Kerberos.h>],
606 [cc_context_t c;
607 (void) cc_initialize (&c, 0, NULL, NULL);],
608 [AC_DEFINE(USE_CCAPI, 1,
609 [platform uses an in-memory credentials cache])
610 LIBS="$LIBS -framework Security"
611 AC_MSG_RESULT(yes)
612 if test "x$ac_cv_use_security_session_api" = "xno"; then
613 AC_MSG_ERROR(*** Need a security framework to use the credentials cache API ***)
614 fi],
615 [AC_MSG_RESULT(no)]
616 )
e74dc197 617 ;;
30460aeb 618*-*-dragonfly*)
619 SSHDLIBS="$SSHDLIBS -lcrypt"
3c0ef626 620 ;;
2ce0bfe4 621*-*-hpux*)
622 # first we define all of the options common to all HP-UX releases
3c0ef626 623 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
624 IPADDR_IN_DISPLAY=yes
3c0ef626 625 AC_DEFINE(USE_PIPES)
08822d99 626 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
627 [Define if your login program cannot handle end of options ("--")])
350391c5 628 AC_DEFINE(LOGIN_NEEDS_UTMPX)
08822d99 629 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
630 [String used in /etc/passwd to denote locked account])
7cac2b65 631 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
08822d99 632 MAIL="/var/mail/username"
d03f4262 633 LIBS="$LIBS -lsec"
2ce0bfe4 634 AC_CHECK_LIB(xnet, t_error, ,
635 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
636
637 # next, we define all of the options specific to major releases
638 case "$host" in
639 *-*-hpux10*)
640 if test -z "$GCC"; then
641 CFLAGS="$CFLAGS -Ae"
642 fi
643 ;;
644 *-*-hpux11*)
08822d99 645 AC_DEFINE(PAM_SUN_CODEBASE, 1,
646 [Define if you are using Solaris-derived PAM which
647 passes pam_messages to the conversation function
648 with an extra level of indirection])
649 AC_DEFINE(DISABLE_UTMP, 1,
650 [Define if you don't want to use utmp])
2ce0bfe4 651 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
652 check_for_hpux_broken_getaddrinfo=1
653 check_for_conflicting_getspnam=1
654 ;;
655 esac
656
657 # lastly, we define options specific to minor releases
658 case "$host" in
659 *-*-hpux10.26)
08822d99 660 AC_DEFINE(HAVE_SECUREWARE, 1,
661 [Define if you have SecureWare-based
662 protected password database])
2ce0bfe4 663 disable_ptmx_check=yes
664 LIBS="$LIBS -lsecpw"
665 ;;
666 esac
3c0ef626 667 ;;
668*-*-irix5*)
3c0ef626 669 PATH="$PATH:/usr/etc"
08822d99 670 AC_DEFINE(BROKEN_INET_NTOA, 1,
671 [Define if you system's inet_ntoa is busted
672 (e.g. Irix gcc issue)])
540d72c3 673 AC_DEFINE(SETEUID_BREAKS_SETUID)
674 AC_DEFINE(BROKEN_SETREUID)
675 AC_DEFINE(BROKEN_SETREGID)
08822d99 676 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
677 [Define if you shouldn't strip 'tty' from your
678 ttyname in [uw]tmp])
7cac2b65 679 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
3c0ef626 680 ;;
681*-*-irix6*)
3c0ef626 682 PATH="$PATH:/usr/etc"
08822d99 683 AC_DEFINE(WITH_IRIX_ARRAY, 1,
684 [Define if you have/want arrays
685 (cluster-wide session managment, not C arrays)])
686 AC_DEFINE(WITH_IRIX_PROJECT, 1,
687 [Define if you want IRIX project management])
688 AC_DEFINE(WITH_IRIX_AUDIT, 1,
689 [Define if you want IRIX audit trails])
690 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
691 [Define if you want IRIX kernel jobs])])
3c0ef626 692 AC_DEFINE(BROKEN_INET_NTOA)
29d88157 693 AC_DEFINE(SETEUID_BREAKS_SETUID)
694 AC_DEFINE(BROKEN_SETREUID)
695 AC_DEFINE(BROKEN_SETREGID)
08822d99 696 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
350391c5 697 AC_DEFINE(WITH_ABBREV_NO_TTY)
7cac2b65 698 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
3c0ef626 699 ;;
700*-*-linux*)
701 no_dev_ptmx=1
702 check_for_libcrypt_later=1
7cac2b65 703 check_for_openpty_ctty_bug=1
08822d99 704 AC_DEFINE(PAM_TTY_KLUDGE, 1,
705 [Work around problematic Linux PAM modules handling of PAM_TTY])
706 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
707 [String used in /etc/passwd to denote locked account])
7cac2b65 708 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
08822d99 709 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
710 [Define to whatever link() returns for "not supported"
711 if it doesn't return EOPNOTSUPP.])
dfddba3d 712 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
08822d99 713 AC_DEFINE(USE_BTMP)
3c0ef626 714 inet6_default_4in6=yes
7cac2b65 715 case `uname -r` in
716 1.*|2.0.*)
08822d99 717 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
718 [Define if cmsg_type is not passed correctly])
7cac2b65 719 ;;
720 esac
08822d99 721 # tun(4) forwarding compat code
722 AC_CHECK_HEADERS(linux/if_tun.h)
723 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
724 AC_DEFINE(SSH_TUN_LINUX, 1,
725 [Open tunnel devices the Linux tun/tap way])
726 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
727 [Use tunnel device compatibility to OpenBSD])
728 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
729 [Prepend the address family to IP tunnel traffic])
730 fi
3c0ef626 731 ;;
732mips-sony-bsd|mips-sony-newsos4)
4b6dae8f 733 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
3c0ef626 734 SONY=1
3c0ef626 735 ;;
736*-*-netbsd*)
d03f4262 737 check_for_libcrypt_before=1
8b32eddc 738 if test "x$withval" != "xno" ; then
540d72c3 739 need_dash_r=1
740 fi
08822d99 741 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
742 AC_CHECK_HEADER([net/if_tap.h], ,
743 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
744 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
745 [Prepend the address family to IP tunnel traffic])
3c0ef626 746 ;;
747*-*-freebsd*)
748 check_for_libcrypt_later=1
08822d99 749 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
750 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
751 AC_CHECK_HEADER([net/if_tap.h], ,
752 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
e74dc197 753 AC_DEFINE(BROKEN_GLOB, 1, [FreeBSD glob does not do what we need])
3c0ef626 754 ;;
29d88157 755*-*-bsdi*)
756 AC_DEFINE(SETEUID_BREAKS_SETUID)
757 AC_DEFINE(BROKEN_SETREUID)
758 AC_DEFINE(BROKEN_SETREGID)
759 ;;
3c0ef626 760*-next-*)
761 conf_lastlog_location="/usr/adm/lastlog"
762 conf_utmp_location=/etc/utmp
763 conf_wtmp_location=/usr/adm/wtmp
764 MAIL=/usr/spool/mail
08822d99 765 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
3c0ef626 766 AC_DEFINE(BROKEN_REALPATH)
767 AC_DEFINE(USE_PIPES)
08822d99 768 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
3c0ef626 769 ;;
2ce0bfe4 770*-*-openbsd*)
771 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
08822d99 772 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
773 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
30460aeb 774 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
775 [syslog_r function is safe to use in in a signal handler])
2ce0bfe4 776 ;;
3c0ef626 777*-*-solaris*)
8b32eddc 778 if test "x$withval" != "xno" ; then
12a403af 779 need_dash_r=1
780 fi
3c0ef626 781 AC_DEFINE(PAM_SUN_CODEBASE)
782 AC_DEFINE(LOGIN_NEEDS_UTMPX)
08822d99 783 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
784 [Some versions of /bin/login need the TERM supplied
785 on the commandline])
3c0ef626 786 AC_DEFINE(PAM_TTY_KLUDGE)
08822d99 787 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
788 [Define if pam_chauthtok wants real uid set
789 to the unpriv'ed user])
7cac2b65 790 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
791 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
08822d99 792 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
793 [Define if sshd somehow reacquires a controlling TTY
794 after setsid()])
30460aeb 795 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
796 in case the name is longer than 8 chars])
7cac2b65 797 external_path_file=/etc/default/login
3c0ef626 798 # hardwire lastlog location (can't detect it on some versions)
799 conf_lastlog_location="/var/adm/lastlog"
800 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
801 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
802 if test "$sol2ver" -ge 8; then
803 AC_MSG_RESULT(yes)
804 AC_DEFINE(DISABLE_UTMP)
08822d99 805 AC_DEFINE(DISABLE_WTMP, 1,
806 [Define if you don't want to use wtmp])
3c0ef626 807 else
808 AC_MSG_RESULT(no)
809 fi
30460aeb 810 AC_ARG_WITH(solaris-contracts,
811 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
812 [
813 AC_CHECK_LIB(contract, ct_tmpl_activate,
814 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
815 [Define if you have Solaris process contracts])
816 SSHDLIBS="$SSHDLIBS -lcontract"
817 AC_SUBST(SSHDLIBS)
818 SPC_MSG="yes" ], )
819 ],
820 )
3c0ef626 821 ;;
822*-*-sunos4*)
823 CPPFLAGS="$CPPFLAGS -DSUNOS4"
824 AC_CHECK_FUNCS(getpwanam)
825 AC_DEFINE(PAM_SUN_CODEBASE)
3c0ef626 826 conf_utmp_location=/etc/utmp
827 conf_wtmp_location=/var/adm/wtmp
828 conf_lastlog_location=/var/adm/lastlog
829 AC_DEFINE(USE_PIPES)
830 ;;
831*-ncr-sysv*)
3c0ef626 832 LIBS="$LIBS -lc89"
e9702f7d 833 AC_DEFINE(USE_PIPES)
7cac2b65 834 AC_DEFINE(SSHD_ACQUIRES_CTTY)
29d88157 835 AC_DEFINE(SETEUID_BREAKS_SETUID)
836 AC_DEFINE(BROKEN_SETREUID)
837 AC_DEFINE(BROKEN_SETREGID)
3c0ef626 838 ;;
839*-sni-sysv*)
3c0ef626 840 # /usr/ucblib MUST NOT be searched on ReliantUNIX
540d72c3 841 AC_CHECK_LIB(dl, dlsym, ,)
08822d99 842 # -lresolv needs to be at the end of LIBS or DNS lookups break
843 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
3c0ef626 844 IPADDR_IN_DISPLAY=yes
845 AC_DEFINE(USE_PIPES)
846 AC_DEFINE(IP_TOS_IS_BROKEN)
540d72c3 847 AC_DEFINE(SETEUID_BREAKS_SETUID)
848 AC_DEFINE(BROKEN_SETREUID)
849 AC_DEFINE(BROKEN_SETREGID)
7cac2b65 850 AC_DEFINE(SSHD_ACQUIRES_CTTY)
851 external_path_file=/etc/default/login
3c0ef626 852 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
853 # Attention: always take care to bind libsocket and libnsl before libc,
854 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
855 ;;
dfddba3d 856# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
3c0ef626 857*-*-sysv4.2*)
3c0ef626 858 AC_DEFINE(USE_PIPES)
7cac2b65 859 AC_DEFINE(SETEUID_BREAKS_SETUID)
860 AC_DEFINE(BROKEN_SETREUID)
861 AC_DEFINE(BROKEN_SETREGID)
8b32eddc 862 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
08822d99 863 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
3c0ef626 864 ;;
dfddba3d 865# UnixWare 7.x, OpenUNIX 8
3c0ef626 866*-*-sysv5*)
2ce0bfe4 867 check_for_libcrypt_later=1
868 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
3c0ef626 869 AC_DEFINE(USE_PIPES)
7cac2b65 870 AC_DEFINE(SETEUID_BREAKS_SETUID)
871 AC_DEFINE(BROKEN_SETREUID)
872 AC_DEFINE(BROKEN_SETREGID)
08822d99 873 AC_DEFINE(PASSWD_NEEDS_USERNAME)
2ce0bfe4 874 case "$host" in
875 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
876 TEST_SHELL=/u95/bin/sh
08822d99 877 AC_DEFINE(BROKEN_LIBIAF, 1,
878 [ia_uinfo routines not supported by OS yet])
30460aeb 879 AC_DEFINE(BROKEN_UPDWTMPX)
08822d99 880 ;;
881 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
2ce0bfe4 882 ;;
883 esac
3c0ef626 884 ;;
885*-*-sysv*)
3c0ef626 886 ;;
dfddba3d 887# SCO UNIX and OEM versions of SCO UNIX
3c0ef626 888*-*-sco3.2v4*)
dfddba3d 889 AC_MSG_ERROR("This Platform is no longer supported.")
3c0ef626 890 ;;
dfddba3d 891# SCO OpenServer 5.x
3c0ef626 892*-*-sco3.2v5*)
bfe49944 893 if test -z "$GCC"; then
894 CFLAGS="$CFLAGS -belf"
895 fi
3c0ef626 896 LIBS="$LIBS -lprot -lx -ltinfo -lm"
897 no_dev_ptmx=1
3c0ef626 898 AC_DEFINE(USE_PIPES)
350391c5 899 AC_DEFINE(HAVE_SECUREWARE)
3c0ef626 900 AC_DEFINE(DISABLE_SHADOW)
d03f4262 901 AC_DEFINE(DISABLE_FD_PASSING)
7cac2b65 902 AC_DEFINE(SETEUID_BREAKS_SETUID)
903 AC_DEFINE(BROKEN_SETREUID)
904 AC_DEFINE(BROKEN_SETREGID)
905 AC_DEFINE(WITH_ABBREV_NO_TTY)
7e82606e 906 AC_DEFINE(BROKEN_UPDWTMPX)
08822d99 907 AC_DEFINE(PASSWD_NEEDS_USERNAME)
3c0ef626 908 AC_CHECK_FUNCS(getluid setluid)
909 MANTYPE=man
7e82606e 910 TEST_SHELL=ksh
3c0ef626 911 ;;
d03f4262 912*-*-unicosmk*)
08822d99 913 AC_DEFINE(NO_SSH_LASTLOG, 1,
914 [Define if you don't want to use lastlog in session.c])
540d72c3 915 AC_DEFINE(SETEUID_BREAKS_SETUID)
916 AC_DEFINE(BROKEN_SETREUID)
917 AC_DEFINE(BROKEN_SETREGID)
d03f4262 918 AC_DEFINE(USE_PIPES)
919 AC_DEFINE(DISABLE_FD_PASSING)
920 LDFLAGS="$LDFLAGS"
921 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
922 MANTYPE=cat
923 ;;
7cac2b65 924*-*-unicosmp*)
540d72c3 925 AC_DEFINE(SETEUID_BREAKS_SETUID)
926 AC_DEFINE(BROKEN_SETREUID)
927 AC_DEFINE(BROKEN_SETREGID)
7cac2b65 928 AC_DEFINE(WITH_ABBREV_NO_TTY)
929 AC_DEFINE(USE_PIPES)
930 AC_DEFINE(DISABLE_FD_PASSING)
931 LDFLAGS="$LDFLAGS"
540d72c3 932 LIBS="$LIBS -lgen -lacid -ldb"
7cac2b65 933 MANTYPE=cat
934 ;;
3c0ef626 935*-*-unicos*)
540d72c3 936 AC_DEFINE(SETEUID_BREAKS_SETUID)
937 AC_DEFINE(BROKEN_SETREUID)
938 AC_DEFINE(BROKEN_SETREGID)
3c0ef626 939 AC_DEFINE(USE_PIPES)
d03f4262 940 AC_DEFINE(DISABLE_FD_PASSING)
941 AC_DEFINE(NO_SSH_LASTLOG)
942 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
943 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
944 MANTYPE=cat
3c0ef626 945 ;;
946*-dec-osf*)
947 AC_MSG_CHECKING(for Digital Unix SIA)
948 no_osfsia=""
949 AC_ARG_WITH(osfsia,
950 [ --with-osfsia Enable Digital Unix SIA],
951 [
952 if test "x$withval" = "xno" ; then
953 AC_MSG_RESULT(disabled)
954 no_osfsia=1
955 fi
956 ],
957 )
958 if test -z "$no_osfsia" ; then
959 if test -f /etc/sia/matrix.conf; then
960 AC_MSG_RESULT(yes)
08822d99 961 AC_DEFINE(HAVE_OSF_SIA, 1,
962 [Define if you have Digital Unix Security
963 Integration Architecture])
964 AC_DEFINE(DISABLE_LOGIN, 1,
965 [Define if you don't want to use your
966 system's login() call])
bfe49944 967 AC_DEFINE(DISABLE_FD_PASSING)
3c0ef626 968 LIBS="$LIBS -lsecurity -ldb -lm -laud"
30460aeb 969 SIA_MSG="yes"
3c0ef626 970 else
971 AC_MSG_RESULT(no)
08822d99 972 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
973 [String used in /etc/passwd to denote locked account])
3c0ef626 974 fi
975 fi
7cac2b65 976 AC_DEFINE(BROKEN_GETADDRINFO)
29d88157 977 AC_DEFINE(SETEUID_BREAKS_SETUID)
978 AC_DEFINE(BROKEN_SETREUID)
979 AC_DEFINE(BROKEN_SETREGID)
5156b1a1 980 AC_DEFINE(BROKEN_READV_COMPARISON, 1, [Can't do comparisons on readv])
3c0ef626 981 ;;
982
4b6dae8f 983*-*-nto-qnx*)
3c0ef626 984 AC_DEFINE(USE_PIPES)
985 AC_DEFINE(NO_X11_UNIX_SOCKETS)
08822d99 986 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
987 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
988 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
4b6dae8f 989 AC_DEFINE(DISABLE_LASTLOG)
30460aeb 990 AC_DEFINE(SSHD_ACQUIRES_CTTY)
e74dc197 991 AC_DEFINE(BROKEN_SHADOW_EXPIRE, 1, [QNX shadow support is broken])
30460aeb 992 enable_etc_default_login=no # has incompatible /etc/default/login
fa0f0f45 993 case "$host" in
994 *-*-nto-qnx6*)
995 AC_DEFINE(DISABLE_FD_PASSING)
996 ;;
997 esac
3c0ef626 998 ;;
2ce0bfe4 999
1000*-*-ultrix*)
08822d99 1001 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
1002 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
4b6dae8f 1003 AC_DEFINE(NEED_SETPGRP)
2ce0bfe4 1004 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
1005 ;;
1006
1007*-*-lynxos)
1008 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
08822d99 1009 AC_DEFINE(MISSING_HOWMANY)
2ce0bfe4 1010 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
1011 ;;
3c0ef626 1012esac
1013
7cac2b65 1014AC_MSG_CHECKING(compiler and flags for sanity)
dfddba3d 1015AC_RUN_IFELSE(
1016 [AC_LANG_SOURCE([
7cac2b65 1017#include <stdio.h>
1018int main(){exit(0);}
dfddba3d 1019 ])],
7cac2b65 1020 [ AC_MSG_RESULT(yes) ],
1021 [
1022 AC_MSG_RESULT(no)
1023 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
dfddba3d 1024 ],
1025 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
7cac2b65 1026)
1027
2ce0bfe4 1028dnl Checks for header files.
3c0ef626 1029# Checks for libraries.
1030AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
1031AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
1032
7cac2b65 1033dnl IRIX and Solaris 2.5.1 have dirname() in libgen
1034AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
1035 AC_CHECK_LIB(gen, dirname,[
1036 AC_CACHE_CHECK([for broken dirname],
1037 ac_cv_have_broken_dirname, [
1038 save_LIBS="$LIBS"
1039 LIBS="$LIBS -lgen"
08822d99 1040 AC_RUN_IFELSE(
1041 [AC_LANG_SOURCE([[
7cac2b65 1042#include <libgen.h>
1043#include <string.h>
1044
1045int main(int argc, char **argv) {
1046 char *s, buf[32];
1047
1048 strncpy(buf,"/etc", 32);
1049 s = dirname(buf);
1050 if (!s || strncmp(s, "/", 32) != 0) {
1051 exit(1);
1052 } else {
1053 exit(0);
1054 }
1055}
08822d99 1056 ]])],
1057 [ ac_cv_have_broken_dirname="no" ],
1058 [ ac_cv_have_broken_dirname="yes" ],
7cac2b65 1059 [ ac_cv_have_broken_dirname="no" ],
7cac2b65 1060 )
1061 LIBS="$save_LIBS"
1062 ])
1063 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1064 LIBS="$LIBS -lgen"
1065 AC_DEFINE(HAVE_DIRNAME)
1066 AC_CHECK_HEADERS(libgen.h)
1067 fi
1068 ])
1069])
1070
3c0ef626 1071AC_CHECK_FUNC(getspnam, ,
1072 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
08822d99 1073AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
1074 [Define if you have the basename function.]))
3c0ef626 1075
1076dnl zlib is required
1077AC_ARG_WITH(zlib,
1078 [ --with-zlib=PATH Use zlib in PATH],
8b32eddc 1079 [ if test "x$withval" = "xno" ; then
1080 AC_MSG_ERROR([*** zlib is required ***])
1081 elif test "x$withval" != "xyes"; then
3c0ef626 1082 if test -d "$withval/lib"; then
1083 if test -n "${need_dash_r}"; then
1084 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1085 else
1086 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1087 fi
1088 else
1089 if test -n "${need_dash_r}"; then
1090 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1091 else
1092 LDFLAGS="-L${withval} ${LDFLAGS}"
1093 fi
1094 fi
1095 if test -d "$withval/include"; then
1096 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1097 else
1098 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1099 fi
8b32eddc 1100 fi ]
3c0ef626 1101)
1102
540d72c3 1103AC_CHECK_LIB(z, deflate, ,
1104 [
1105 saved_CPPFLAGS="$CPPFLAGS"
1106 saved_LDFLAGS="$LDFLAGS"
1107 save_LIBS="$LIBS"
1108 dnl Check default zlib install dir
1109 if test -n "${need_dash_r}"; then
1110 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1111 else
1112 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1113 fi
1114 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1115 LIBS="$LIBS -lz"
1116 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
1117 [
1118 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1119 ]
1120 )
1121 ]
1122)
1123AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
1124
1125AC_ARG_WITH(zlib-version-check,
1126 [ --without-zlib-version-check Disable zlib version check],
1127 [ if test "x$withval" = "xno" ; then
1128 zlib_check_nonfatal=1
1129 fi
1130 ]
1131)
1132
8b32eddc 1133AC_MSG_CHECKING(for possibly buggy zlib)
dfddba3d 1134AC_RUN_IFELSE([AC_LANG_SOURCE([[
8b32eddc 1135#include <stdio.h>
540d72c3 1136#include <zlib.h>
1137int main()
1138{
8b32eddc 1139 int a=0, b=0, c=0, d=0, n, v;
1140 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1141 if (n != 3 && n != 4)
540d72c3 1142 exit(1);
8b32eddc 1143 v = a*1000000 + b*10000 + c*100 + d;
1144 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1145
1146 /* 1.1.4 is OK */
1147 if (a == 1 && b == 1 && c >= 4)
540d72c3 1148 exit(0);
8b32eddc 1149
2ce0bfe4 1150 /* 1.2.3 and up are OK */
1151 if (v >= 1020300)
8b32eddc 1152 exit(0);
1153
540d72c3 1154 exit(2);
1155}
dfddba3d 1156 ]])],
8b32eddc 1157 AC_MSG_RESULT(no),
1158 [ AC_MSG_RESULT(yes)
540d72c3 1159 if test -z "$zlib_check_nonfatal" ; then
1160 AC_MSG_ERROR([*** zlib too old - check config.log ***
1161Your reported zlib version has known security problems. It's possible your
1162vendor has fixed these problems without changing the version number. If you
1163are sure this is the case, you can disable the check by running
1164"./configure --without-zlib-version-check".
2ce0bfe4 1165If you are in doubt, upgrade zlib to version 1.2.3 or greater.
8b32eddc 1166See http://www.gzip.org/zlib/ for details.])
540d72c3 1167 else
1168 AC_MSG_WARN([zlib version may have security problems])
1169 fi
dfddba3d 1170 ],
1171 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
540d72c3 1172)
3c0ef626 1173
3c0ef626 1174dnl UnixWare 2.x
540d72c3 1175AC_CHECK_FUNC(strcasecmp,
3c0ef626 1176 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
1177)
08822d99 1178AC_CHECK_FUNCS(utimes,
d03f4262 1179 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
1180 LIBS="$LIBS -lc89"]) ]
3c0ef626 1181)
1182
1183dnl Checks for libutil functions
1184AC_CHECK_HEADERS(libutil.h)
08822d99 1185AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
1186 [Define if your libraries define login()])])
5156b1a1 1187AC_CHECK_FUNCS(fmt_scaled logout updwtmp logwtmp)
3c0ef626 1188
1189AC_FUNC_STRFTIME
1190
3c0ef626 1191# Check for ALTDIRFUNC glob() extension
1192AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
1193AC_EGREP_CPP(FOUNDIT,
1194 [
1195 #include <glob.h>
1196 #ifdef GLOB_ALTDIRFUNC
1197 FOUNDIT
1198 #endif
540d72c3 1199 ],
3c0ef626 1200 [
08822d99 1201 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
1202 [Define if your system glob() function has
1203 the GLOB_ALTDIRFUNC extension])
3c0ef626 1204 AC_MSG_RESULT(yes)
1205 ],
1206 [
1207 AC_MSG_RESULT(no)
1208 ]
1209)
1210
1211# Check for g.gl_matchc glob() extension
1212AC_MSG_CHECKING(for gl_matchc field in glob_t)
30460aeb 1213AC_TRY_COMPILE(
1214 [ #include <glob.h> ],
1215 [glob_t g; g.gl_matchc = 1;],
540d72c3 1216 [
08822d99 1217 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1218 [Define if your system glob() function has
1219 gl_matchc options in glob_t])
540d72c3 1220 AC_MSG_RESULT(yes)
1221 ],
1222 [
1223 AC_MSG_RESULT(no)
1224 ]
3c0ef626 1225)
1226
30460aeb 1227AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1228
3c0ef626 1229AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
dfddba3d 1230AC_RUN_IFELSE(
1231 [AC_LANG_SOURCE([[
3c0ef626 1232#include <sys/types.h>
1233#include <dirent.h>
d03f4262 1234int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
dfddba3d 1235 ]])],
540d72c3 1236 [AC_MSG_RESULT(yes)],
3c0ef626 1237 [
1238 AC_MSG_RESULT(no)
08822d99 1239 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
1240 [Define if your struct dirent expects you to
1241 allocate extra space for d_name])
dfddba3d 1242 ],
8b32eddc 1243 [
dfddba3d 1244 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1245 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
3c0ef626 1246 ]
1247)
1248
7e82606e 1249AC_MSG_CHECKING([for /proc/pid/fd directory])
1250if test -d "/proc/$$/fd" ; then
08822d99 1251 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
7e82606e 1252 AC_MSG_RESULT(yes)
1253else
1254 AC_MSG_RESULT(no)
1255fi
1256
3c0ef626 1257# Check whether user wants S/Key support
540d72c3 1258SKEY_MSG="no"
3c0ef626 1259AC_ARG_WITH(skey,
dfddba3d 1260 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
3c0ef626 1261 [
1262 if test "x$withval" != "xno" ; then
1263
1264 if test "x$withval" != "xyes" ; then
1265 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1266 LDFLAGS="$LDFLAGS -L${withval}/lib"
1267 fi
1268
08822d99 1269 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
3c0ef626 1270 LIBS="-lskey $LIBS"
540d72c3 1271 SKEY_MSG="yes"
8b32eddc 1272
e9702f7d 1273 AC_MSG_CHECKING([for s/key support])
08822d99 1274 AC_LINK_IFELSE(
1275 [AC_LANG_SOURCE([[
e9702f7d 1276#include <stdio.h>
1277#include <skey.h>
d03f4262 1278int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
08822d99 1279 ]])],
e9702f7d 1280 [AC_MSG_RESULT(yes)],
3c0ef626 1281 [
e9702f7d 1282 AC_MSG_RESULT(no)
3c0ef626 1283 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1284 ])
12a403af 1285 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1286 AC_TRY_COMPILE(
1287 [#include <stdio.h>
1288 #include <skey.h>],
1289 [(void)skeychallenge(NULL,"name","",0);],
1290 [AC_MSG_RESULT(yes)
08822d99 1291 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1292 [Define if your skeychallenge()
1293 function takes 4 arguments (NetBSD)])],
12a403af 1294 [AC_MSG_RESULT(no)]
1295 )
3c0ef626 1296 fi
1297 ]
1298)
1299
1300# Check whether user wants TCP wrappers support
1301TCPW_MSG="no"
1302AC_ARG_WITH(tcp-wrappers,
dfddba3d 1303 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
3c0ef626 1304 [
1305 if test "x$withval" != "xno" ; then
1306 saved_LIBS="$LIBS"
1307 saved_LDFLAGS="$LDFLAGS"
1308 saved_CPPFLAGS="$CPPFLAGS"
8b32eddc 1309 if test -n "${withval}" && \
1310 test "x${withval}" != "xyes"; then
3c0ef626 1311 if test -d "${withval}/lib"; then
1312 if test -n "${need_dash_r}"; then
1313 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1314 else
1315 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1316 fi
1317 else
1318 if test -n "${need_dash_r}"; then
1319 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1320 else
1321 LDFLAGS="-L${withval} ${LDFLAGS}"
1322 fi
1323 fi
1324 if test -d "${withval}/include"; then
1325 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1326 else
1327 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1328 fi
1329 fi
fa0f0f45 1330 LIBS="-lwrap $LIBS"
3c0ef626 1331 AC_MSG_CHECKING(for libwrap)
1332 AC_TRY_LINK(
1333 [
12a403af 1334#include <sys/types.h>
1335#include <sys/socket.h>
1336#include <netinet/in.h>
3c0ef626 1337#include <tcpd.h>
1338 int deny_severity = 0, allow_severity = 0;
1339 ],
1340 [hosts_access(0);],
1341 [
1342 AC_MSG_RESULT(yes)
08822d99 1343 AC_DEFINE(LIBWRAP, 1,
1344 [Define if you want
1345 TCP Wrappers support])
fa0f0f45 1346 SSHDLIBS="$SSHDLIBS -lwrap"
3c0ef626 1347 TCPW_MSG="yes"
1348 ],
1349 [
1350 AC_MSG_ERROR([*** libwrap missing])
1351 ]
1352 )
e9702f7d 1353 LIBS="$saved_LIBS"
3c0ef626 1354 fi
1355 ]
1356)
1357
dfddba3d 1358# Check whether user wants libedit support
1359LIBEDIT_MSG="no"
1360AC_ARG_WITH(libedit,
1361 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1362 [ if test "x$withval" != "xno" ; then
8b32eddc 1363 if test "x$withval" != "xyes"; then
08822d99 1364 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1365 if test -n "${need_dash_r}"; then
1366 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1367 else
1368 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1369 fi
8b32eddc 1370 fi
dfddba3d 1371 AC_CHECK_LIB(edit, el_init,
08822d99 1372 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
dfddba3d 1373 LIBEDIT="-ledit -lcurses"
1374 LIBEDIT_MSG="yes"
1375 AC_SUBST(LIBEDIT)
1376 ],
8b32eddc 1377 [ AC_MSG_ERROR(libedit not found) ],
1378 [ -lcurses ]
dfddba3d 1379 )
2ce0bfe4 1380 AC_MSG_CHECKING(if libedit version is compatible)
1381 AC_COMPILE_IFELSE(
1382 [AC_LANG_SOURCE([[
1383#include <histedit.h>
1384int main(void)
1385{
1386 int i = H_SETSIZE;
1387 el_init("", NULL, NULL, NULL);
1388 exit(0);
1389}
1390 ]])],
1391 [ AC_MSG_RESULT(yes) ],
1392 [ AC_MSG_RESULT(no)
1393 AC_MSG_ERROR(libedit version is not compatible) ]
1394 )
dfddba3d 1395 fi ]
1396)
1397
1398AUDIT_MODULE=none
1399AC_ARG_WITH(audit,
1400 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1401 [
1402 AC_MSG_CHECKING(for supported audit module)
1403 case "$withval" in
1404 bsm)
1405 AC_MSG_RESULT(bsm)
1406 AUDIT_MODULE=bsm
1407 dnl Checks for headers, libs and functions
1408 AC_CHECK_HEADERS(bsm/audit.h, [],
30460aeb 1409 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1410 [
1411#ifdef HAVE_TIME_H
1412# include <time.h>
1413#endif
1414 ]
1415)
dfddba3d 1416 AC_CHECK_LIB(bsm, getaudit, [],
1417 [AC_MSG_ERROR(BSM enabled and required library not found)])
1418 AC_CHECK_FUNCS(getaudit, [],
1419 [AC_MSG_ERROR(BSM enabled and required function not found)])
1420 # These are optional
e74dc197 1421 AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
08822d99 1422 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
dfddba3d 1423 ;;
1424 debug)
1425 AUDIT_MODULE=debug
1426 AC_MSG_RESULT(debug)
08822d99 1427 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
dfddba3d 1428 ;;
2ce0bfe4 1429 no)
1430 AC_MSG_RESULT(no)
1431 ;;
dfddba3d 1432 *)
1433 AC_MSG_ERROR([Unknown audit module $withval])
1434 ;;
1435 esac ]
1436)
1437
bfe49944 1438dnl Checks for library functions. Please keep in alphabetical order
2ce0bfe4 1439AC_CHECK_FUNCS( \
1440 arc4random \
5156b1a1 1441 arc4random_buf \
1442 arc4random_uniform \
08822d99 1443 asprintf \
2ce0bfe4 1444 b64_ntop \
1445 __b64_ntop \
1446 b64_pton \
1447 __b64_pton \
1448 bcopy \
1449 bindresvport_sa \
1450 clock \
1451 closefrom \
1452 dirfd \
1453 fchmod \
1454 fchown \
1455 freeaddrinfo \
5156b1a1 1456 fstatvfs \
2ce0bfe4 1457 futimes \
1458 getaddrinfo \
1459 getcwd \
1460 getgrouplist \
1461 getnameinfo \
1462 getopt \
1463 getpeereid \
fa0f0f45 1464 getpeerucred \
2ce0bfe4 1465 _getpty \
1466 getrlimit \
1467 getttyent \
1468 glob \
1469 inet_aton \
1470 inet_ntoa \
1471 inet_ntop \
1472 innetgr \
1473 login_getcapbool \
1474 md5_crypt \
1475 memmove \
1476 mkdtemp \
1477 mmap \
1478 ngetaddrinfo \
1479 nsleep \
1480 ogetaddrinfo \
1481 openlog_r \
1482 openpty \
fa0f0f45 1483 poll \
2ce0bfe4 1484 prctl \
1485 pstat \
1486 readpassphrase \
1487 realpath \
1488 recvmsg \
1489 rresvport_af \
1490 sendmsg \
1491 setdtablesize \
1492 setegid \
1493 setenv \
1494 seteuid \
1495 setgroups \
1496 setlogin \
1497 setpcred \
1498 setproctitle \
1499 setregid \
1500 setreuid \
1501 setrlimit \
1502 setsid \
1503 setvbuf \
1504 sigaction \
1505 sigvec \
1506 snprintf \
1507 socketpair \
5156b1a1 1508 statfs \
1509 statvfs \
2ce0bfe4 1510 strdup \
1511 strerror \
1512 strlcat \
1513 strlcpy \
1514 strmode \
1515 strnvis \
1516 strtonum \
1517 strtoll \
1518 strtoul \
fa0f0f45 1519 swap32 \
2ce0bfe4 1520 sysconf \
1521 tcgetpgrp \
1522 truncate \
1523 unsetenv \
1524 updwtmpx \
08822d99 1525 vasprintf \
2ce0bfe4 1526 vhangup \
1527 vsnprintf \
1528 waitpid \
bfe49944 1529)
1530
29d88157 1531# IRIX has a const char return value for gai_strerror()
1532AC_CHECK_FUNCS(gai_strerror,[
1533 AC_DEFINE(HAVE_GAI_STRERROR)
1534 AC_TRY_COMPILE([
1535#include <sys/types.h>
1536#include <sys/socket.h>
1537#include <netdb.h>
1538
1539const char *gai_strerror(int);],[
1540char *str;
1541
1542str = gai_strerror(0);],[
1543 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1544 [Define if gai_strerror() returns const char *])])])
1545
08822d99 1546AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1547 [Some systems put nanosleep outside of libc]))
bfe49944 1548
7cac2b65 1549dnl Make sure prototypes are defined for these before using them.
7cac2b65 1550AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
2ce0bfe4 1551AC_CHECK_DECL(strsep,
1552 [AC_CHECK_FUNCS(strsep)],
1553 [],
1554 [
1555#ifdef HAVE_STRING_H
1556# include <string.h>
1557#endif
1558 ])
3c0ef626 1559
7cac2b65 1560dnl tcsendbreak might be a macro
1561AC_CHECK_DECL(tcsendbreak,
1562 [AC_DEFINE(HAVE_TCSENDBREAK)],
540d72c3 1563 [AC_CHECK_FUNCS(tcsendbreak)],
7cac2b65 1564 [#include <termios.h>]
1565)
3c0ef626 1566
7e82606e 1567AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1568
30460aeb 1569AC_CHECK_DECLS(SHUT_RD, , ,
1570 [
1571#include <sys/types.h>
1572#include <sys/socket.h>
1573 ])
1574
1575AC_CHECK_DECLS(O_NONBLOCK, , ,
1576 [
1577#include <sys/types.h>
1578#ifdef HAVE_SYS_STAT_H
1579# include <sys/stat.h>
1580#endif
1581#ifdef HAVE_FCNTL_H
1582# include <fcntl.h>
1583#endif
1584 ])
1585
1586AC_CHECK_DECLS(writev, , , [
1587#include <sys/types.h>
1588#include <sys/uio.h>
1589#include <unistd.h>
1590 ])
1591
fa0f0f45 1592AC_CHECK_DECLS(MAXSYMLINKS, , , [
1593#include <sys/param.h>
1594 ])
1595
1596AC_CHECK_DECLS(offsetof, , , [
1597#include <stddef.h>
1598 ])
1599
540d72c3 1600AC_CHECK_FUNCS(setresuid, [
1601 dnl Some platorms have setresuid that isn't implemented, test for this
1602 AC_MSG_CHECKING(if setresuid seems to work)
dfddba3d 1603 AC_RUN_IFELSE(
1604 [AC_LANG_SOURCE([[
540d72c3 1605#include <stdlib.h>
1606#include <errno.h>
1607int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
dfddba3d 1608 ]])],
540d72c3 1609 [AC_MSG_RESULT(yes)],
08822d99 1610 [AC_DEFINE(BROKEN_SETRESUID, 1,
1611 [Define if your setresuid() is broken])
dfddba3d 1612 AC_MSG_RESULT(not implemented)],
1613 [AC_MSG_WARN([cross compiling: not checking setresuid])]
540d72c3 1614 )
1615])
1616
1617AC_CHECK_FUNCS(setresgid, [
1618 dnl Some platorms have setresgid that isn't implemented, test for this
1619 AC_MSG_CHECKING(if setresgid seems to work)
dfddba3d 1620 AC_RUN_IFELSE(
1621 [AC_LANG_SOURCE([[
540d72c3 1622#include <stdlib.h>
1623#include <errno.h>
1624int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
dfddba3d 1625 ]])],
540d72c3 1626 [AC_MSG_RESULT(yes)],
08822d99 1627 [AC_DEFINE(BROKEN_SETRESGID, 1,
1628 [Define if your setresgid() is broken])
dfddba3d 1629 AC_MSG_RESULT(not implemented)],
1630 [AC_MSG_WARN([cross compiling: not checking setresuid])]
540d72c3 1631 )
1632])
1633
3c0ef626 1634dnl Checks for time functions
1635AC_CHECK_FUNCS(gettimeofday time)
1636dnl Checks for utmp functions
1637AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1638AC_CHECK_FUNCS(utmpname)
1639dnl Checks for utmpx functions
1640AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1641AC_CHECK_FUNCS(setutxent utmpxname)
1642
540d72c3 1643AC_CHECK_FUNC(daemon,
08822d99 1644 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1645 [AC_CHECK_LIB(bsd, daemon,
1646 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
3c0ef626 1647)
1648
540d72c3 1649AC_CHECK_FUNC(getpagesize,
08822d99 1650 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1651 [Define if your libraries define getpagesize()])],
1652 [AC_CHECK_LIB(ucb, getpagesize,
1653 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
3c0ef626 1654)
1655
1656# Check for broken snprintf
1657if test "x$ac_cv_func_snprintf" = "xyes" ; then
1658 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
dfddba3d 1659 AC_RUN_IFELSE(
1660 [AC_LANG_SOURCE([[
3c0ef626 1661#include <stdio.h>
d03f4262 1662int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
dfddba3d 1663 ]])],
540d72c3 1664 [AC_MSG_RESULT(yes)],
3c0ef626 1665 [
1666 AC_MSG_RESULT(no)
08822d99 1667 AC_DEFINE(BROKEN_SNPRINTF, 1,
1668 [Define if your snprintf is busted])
3c0ef626 1669 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
dfddba3d 1670 ],
1671 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
3c0ef626 1672 )
1673fi
1674
08822d99 1675# If we don't have a working asprintf, then we strongly depend on vsnprintf
1676# returning the right thing on overflow: the number of characters it tried to
1677# create (as per SUSv3)
1678if test "x$ac_cv_func_asprintf" != "xyes" && \
1679 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1680 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1681 AC_RUN_IFELSE(
1682 [AC_LANG_SOURCE([[
1683#include <sys/types.h>
1684#include <stdio.h>
1685#include <stdarg.h>
1686
1687int x_snprintf(char *str,size_t count,const char *fmt,...)
1688{
1689 size_t ret; va_list ap;
1690 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1691 return ret;
1692}
1693int main(void)
1694{
1695 char x[1];
1696 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1697} ]])],
1698 [AC_MSG_RESULT(yes)],
1699 [
1700 AC_MSG_RESULT(no)
1701 AC_DEFINE(BROKEN_SNPRINTF, 1,
1702 [Define if your snprintf is busted])
1703 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1704 ],
1705 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1706 )
1707fi
1708
1709# On systems where [v]snprintf is broken, but is declared in stdio,
1710# check that the fmt argument is const char * or just char *.
1711# This is only useful for when BROKEN_SNPRINTF
1712AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1713AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1714 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1715 int main(void) { snprintf(0, 0, 0); }
1716 ]])],
1717 [AC_MSG_RESULT(yes)
1718 AC_DEFINE(SNPRINTF_CONST, [const],
1719 [Define as const if snprintf() can declare const char *fmt])],
1720 [AC_MSG_RESULT(no)
1721 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1722
7e82606e 1723# Check for missing getpeereid (or equiv) support
1724NO_PEERCHECK=""
fa0f0f45 1725if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
7e82606e 1726 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1727 AC_TRY_COMPILE(
1728 [#include <sys/types.h>
1729 #include <sys/socket.h>],
1730 [int i = SO_PEERCRED;],
8b32eddc 1731 [ AC_MSG_RESULT(yes)
08822d99 1732 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
8b32eddc 1733 ],
7e82606e 1734 [AC_MSG_RESULT(no)
1735 NO_PEERCHECK=1]
1736 )
1737fi
1738
bfe49944 1739dnl see whether mkstemp() requires XXXXXX
1740if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1741AC_MSG_CHECKING([for (overly) strict mkstemp])
08822d99 1742AC_RUN_IFELSE(
1743 [AC_LANG_SOURCE([[
bfe49944 1744#include <stdlib.h>
1745main() { char template[]="conftest.mkstemp-test";
1746if (mkstemp(template) == -1)
1747 exit(1);
1748unlink(template); exit(0);
1749}
08822d99 1750 ]])],
bfe49944 1751 [
1752 AC_MSG_RESULT(no)
1753 ],
540d72c3 1754 [
bfe49944 1755 AC_MSG_RESULT(yes)
08822d99 1756 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
bfe49944 1757 ],
1758 [
1759 AC_MSG_RESULT(yes)
1760 AC_DEFINE(HAVE_STRICT_MKSTEMP)
540d72c3 1761 ]
bfe49944 1762)
1763fi
1764
7cac2b65 1765dnl make sure that openpty does not reacquire controlling terminal
1766if test ! -z "$check_for_openpty_ctty_bug"; then
1767 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
08822d99 1768 AC_RUN_IFELSE(
1769 [AC_LANG_SOURCE([[
7cac2b65 1770#include <stdio.h>
1771#include <sys/fcntl.h>
1772#include <sys/types.h>
1773#include <sys/wait.h>
1774
1775int
1776main()
1777{
1778 pid_t pid;
1779 int fd, ptyfd, ttyfd, status;
1780
1781 pid = fork();
1782 if (pid < 0) { /* failed */
1783 exit(1);
1784 } else if (pid > 0) { /* parent */
1785 waitpid(pid, &status, 0);
540d72c3 1786 if (WIFEXITED(status))
7cac2b65 1787 exit(WEXITSTATUS(status));
1788 else
1789 exit(2);
1790 } else { /* child */
1791 close(0); close(1); close(2);
1792 setsid();
1793 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1794 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1795 if (fd >= 0)
1796 exit(3); /* Acquired ctty: broken */
1797 else
1798 exit(0); /* Did not acquire ctty: OK */
1799 }
1800}
08822d99 1801 ]])],
7cac2b65 1802 [
1803 AC_MSG_RESULT(yes)
1804 ],
1805 [
1806 AC_MSG_RESULT(no)
1807 AC_DEFINE(SSHD_ACQUIRES_CTTY)
08822d99 1808 ],
1809 [
1810 AC_MSG_RESULT(cross-compiling, assuming yes)
7cac2b65 1811 ]
1812 )
1813fi
1814
8b32eddc 1815if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1816 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
12a403af 1817 AC_MSG_CHECKING(if getaddrinfo seems to work)
08822d99 1818 AC_RUN_IFELSE(
1819 [AC_LANG_SOURCE([[
12a403af 1820#include <stdio.h>
1821#include <sys/socket.h>
1822#include <netdb.h>
1823#include <errno.h>
1824#include <netinet/in.h>
1825
1826#define TEST_PORT "2222"
1827
1828int
1829main(void)
1830{
1831 int err, sock;
1832 struct addrinfo *gai_ai, *ai, hints;
1833 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1834
1835 memset(&hints, 0, sizeof(hints));
1836 hints.ai_family = PF_UNSPEC;
1837 hints.ai_socktype = SOCK_STREAM;
1838 hints.ai_flags = AI_PASSIVE;
1839
1840 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1841 if (err != 0) {
1842 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1843 exit(1);
1844 }
1845
1846 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1847 if (ai->ai_family != AF_INET6)
1848 continue;
1849
1850 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1851 sizeof(ntop), strport, sizeof(strport),
1852 NI_NUMERICHOST|NI_NUMERICSERV);
1853
1854 if (err != 0) {
1855 if (err == EAI_SYSTEM)
1856 perror("getnameinfo EAI_SYSTEM");
1857 else
1858 fprintf(stderr, "getnameinfo failed: %s\n",
1859 gai_strerror(err));
1860 exit(2);
1861 }
1862
1863 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1864 if (sock < 0)
1865 perror("socket");
1866 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1867 if (errno == EBADF)
1868 exit(3);
1869 }
1870 }
1871 exit(0);
1872}
08822d99 1873 ]])],
12a403af 1874 [
1875 AC_MSG_RESULT(yes)
1876 ],
1877 [
1878 AC_MSG_RESULT(no)
1879 AC_DEFINE(BROKEN_GETADDRINFO)
08822d99 1880 ],
1881 [
1882 AC_MSG_RESULT(cross-compiling, assuming yes)
12a403af 1883 ]
1884 )
1885fi
1886
8b32eddc 1887if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1888 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
dfddba3d 1889 AC_MSG_CHECKING(if getaddrinfo seems to work)
08822d99 1890 AC_RUN_IFELSE(
1891 [AC_LANG_SOURCE([[
dfddba3d 1892#include <stdio.h>
1893#include <sys/socket.h>
1894#include <netdb.h>
1895#include <errno.h>
1896#include <netinet/in.h>
1897
1898#define TEST_PORT "2222"
1899
1900int
1901main(void)
1902{
1903 int err, sock;
1904 struct addrinfo *gai_ai, *ai, hints;
1905 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1906
1907 memset(&hints, 0, sizeof(hints));
1908 hints.ai_family = PF_UNSPEC;
1909 hints.ai_socktype = SOCK_STREAM;
1910 hints.ai_flags = AI_PASSIVE;
1911
1912 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1913 if (err != 0) {
1914 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1915 exit(1);
1916 }
1917
1918 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1919 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1920 continue;
1921
1922 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1923 sizeof(ntop), strport, sizeof(strport),
1924 NI_NUMERICHOST|NI_NUMERICSERV);
1925
1926 if (ai->ai_family == AF_INET && err != 0) {
1927 perror("getnameinfo");
1928 exit(2);
1929 }
1930 }
1931 exit(0);
1932}
08822d99 1933 ]])],
dfddba3d 1934 [
1935 AC_MSG_RESULT(yes)
08822d99 1936 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1937 [Define if you have a getaddrinfo that fails
1938 for the all-zeros IPv6 address])
dfddba3d 1939 ],
1940 [
1941 AC_MSG_RESULT(no)
1942 AC_DEFINE(BROKEN_GETADDRINFO)
08822d99 1943 ],
30460aeb 1944 [
08822d99 1945 AC_MSG_RESULT(cross-compiling, assuming no)
dfddba3d 1946 ]
1947 )
1948fi
1949
1950if test "x$check_for_conflicting_getspnam" = "x1"; then
1951 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1952 AC_COMPILE_IFELSE(
1953 [
1954#include <shadow.h>
1955int main(void) {exit(0);}
1956 ],
1957 [
1958 AC_MSG_RESULT(no)
1959 ],
1960 [
1961 AC_MSG_RESULT(yes)
1962 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1963 [Conflicting defs for getspnam])
1964 ]
1965 )
1966fi
1967
3c0ef626 1968AC_FUNC_GETPGRP
1969
350391c5 1970# Search for OpenSSL
1971saved_CPPFLAGS="$CPPFLAGS"
1972saved_LDFLAGS="$LDFLAGS"
3c0ef626 1973AC_ARG_WITH(ssl-dir,
1974 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1975 [
1976 if test "x$withval" != "xno" ; then
dfddba3d 1977 case "$withval" in
1978 # Relative paths
1979 ./*|../*) withval="`pwd`/$withval"
1980 esac
350391c5 1981 if test -d "$withval/lib"; then
1982 if test -n "${need_dash_r}"; then
1983 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1984 else
1985 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
3c0ef626 1986 fi
1987 else
350391c5 1988 if test -n "${need_dash_r}"; then
1989 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1990 else
1991 LDFLAGS="-L${withval} ${LDFLAGS}"
3c0ef626 1992 fi
1993 fi
350391c5 1994 if test -d "$withval/include"; then
1995 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
3c0ef626 1996 else
350391c5 1997 CPPFLAGS="-I${withval} ${CPPFLAGS}"
3c0ef626 1998 fi
1999 fi
350391c5 2000 ]
2001)
9fb46e52 2002if test -z "$GLOBUS_LDFLAGS" ; then
540d72c3 2003LIBS="-lcrypto $LIBS"
22798398 2004fi
08822d99 2005AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
2006 [Define if your ssl headers are included
2007 with #include <openssl/header.h>]),
3c0ef626 2008 [
350391c5 2009 dnl Check default openssl install dir
2010 if test -n "${need_dash_r}"; then
2011 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
3c0ef626 2012 else
350391c5 2013 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
3c0ef626 2014 fi
350391c5 2015 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
2016 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
2017 [
2018 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2019 ]
2020 )
2021 ]
2022)
2023
d03f4262 2024# Determine OpenSSL header version
2025AC_MSG_CHECKING([OpenSSL header version])
dfddba3d 2026AC_RUN_IFELSE(
2027 [AC_LANG_SOURCE([[
d03f4262 2028#include <stdio.h>
2029#include <string.h>
2030#include <openssl/opensslv.h>
2031#define DATA "conftest.sslincver"
2032int main(void) {
540d72c3 2033 FILE *fd;
2034 int rc;
d03f4262 2035
540d72c3 2036 fd = fopen(DATA,"w");
2037 if(fd == NULL)
2038 exit(1);
d03f4262 2039
2040 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2041 exit(1);
2042
2043 exit(0);
2044}
dfddba3d 2045 ]])],
d03f4262 2046 [
2047 ssl_header_ver=`cat conftest.sslincver`
2048 AC_MSG_RESULT($ssl_header_ver)
2049 ],
2050 [
2051 AC_MSG_RESULT(not found)
2052 AC_MSG_ERROR(OpenSSL version header not found.)
dfddba3d 2053 ],
2054 [
2055 AC_MSG_WARN([cross compiling: not checking])
d03f4262 2056 ]
2057)
2058
2059# Determine OpenSSL library version
2060AC_MSG_CHECKING([OpenSSL library version])
dfddba3d 2061AC_RUN_IFELSE(
2062 [AC_LANG_SOURCE([[
d03f4262 2063#include <stdio.h>
2064#include <string.h>
2065#include <openssl/opensslv.h>
2066#include <openssl/crypto.h>
2067#define DATA "conftest.ssllibver"
2068int main(void) {
540d72c3 2069 FILE *fd;
2070 int rc;
d03f4262 2071
540d72c3 2072 fd = fopen(DATA,"w");
2073 if(fd == NULL)
2074 exit(1);
d03f4262 2075
2076 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2077 exit(1);
2078
2079 exit(0);
2080}
dfddba3d 2081 ]])],
d03f4262 2082 [
2083 ssl_library_ver=`cat conftest.ssllibver`
2084 AC_MSG_RESULT($ssl_library_ver)
2085 ],
2086 [
2087 AC_MSG_RESULT(not found)
2088 AC_MSG_ERROR(OpenSSL library not found.)
dfddba3d 2089 ],
2090 [
2091 AC_MSG_WARN([cross compiling: not checking])
d03f4262 2092 ]
2093)
3c0ef626 2094
0b90ac93 2095AC_ARG_WITH(openssl-header-check,
2096 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2097 [ if test "x$withval" = "xno" ; then
2098 openssl_check_nonfatal=1
2099 fi
2100 ]
2101)
2102
e9702f7d 2103# Sanity check OpenSSL headers
2104AC_MSG_CHECKING([whether OpenSSL's headers match the library])
dfddba3d 2105AC_RUN_IFELSE(
2106 [AC_LANG_SOURCE([[
e9702f7d 2107#include <string.h>
2108#include <openssl/opensslv.h>
d03f4262 2109int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
dfddba3d 2110 ]])],
e9702f7d 2111 [
2112 AC_MSG_RESULT(yes)
2113 ],
2114 [
2115 AC_MSG_RESULT(no)
0b90ac93 2116 if test "x$openssl_check_nonfatal" = "x"; then
2117 AC_MSG_ERROR([Your OpenSSL headers do not match your
2118library. Check config.log for details.
2119If you are sure your installation is consistent, you can disable the check
2120by running "./configure --without-openssl-header-check".
2121Also see contrib/findssl.sh for help identifying header/library mismatches.
2122])
2123 else
2124 AC_MSG_WARN([Your OpenSSL headers do not match your
2125library. Check config.log for details.
7cac2b65 2126Also see contrib/findssl.sh for help identifying header/library mismatches.])
0b90ac93 2127 fi
dfddba3d 2128 ],
2129 [
2130 AC_MSG_WARN([cross compiling: not checking])
e9702f7d 2131 ]
2132)
2133
30460aeb 2134AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2135AC_LINK_IFELSE(
2136 [AC_LANG_SOURCE([[
2137#include <openssl/evp.h>
2138int main(void) { SSLeay_add_all_algorithms(); }
2139 ]])],
2140 [
2141 AC_MSG_RESULT(yes)
2142 ],
2143 [
2144 AC_MSG_RESULT(no)
2145 saved_LIBS="$LIBS"
2146 LIBS="$LIBS -ldl"
2147 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2148 AC_LINK_IFELSE(
2149 [AC_LANG_SOURCE([[
2150#include <openssl/evp.h>
2151int main(void) { SSLeay_add_all_algorithms(); }
2152 ]])],
2153 [
2154 AC_MSG_RESULT(yes)
2155 ],
2156 [
2157 AC_MSG_RESULT(no)
2158 LIBS="$saved_LIBS"
2159 ]
2160 )
2161 ]
2162)
2163
2164AC_ARG_WITH(ssl-engine,
2165 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2166 [ if test "x$withval" != "xno" ; then
2167 AC_MSG_CHECKING(for OpenSSL ENGINE support)
2168 AC_TRY_COMPILE(
2169 [ #include <openssl/engine.h>],
2170 [
240debe0 2171ENGINE_load_builtin_engines();ENGINE_register_all_complete();
30460aeb 2172 ],
2173 [ AC_MSG_RESULT(yes)
2174 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
2175 [Enable OpenSSL engine support])
2176 ],
2177 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
2178 )
2179 fi ]
2180)
2181
08822d99 2182# Check for OpenSSL without EVP_aes_{192,256}_cbc
2183AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
30460aeb 2184AC_LINK_IFELSE(
08822d99 2185 [AC_LANG_SOURCE([[
2186#include <string.h>
2187#include <openssl/evp.h>
4b6dae8f 2188int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
08822d99 2189 ]])],
2190 [
2191 AC_MSG_RESULT(no)
2192 ],
2193 [
2194 AC_MSG_RESULT(yes)
2195 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2196 [libcrypto is missing AES 192 and 256 bit functions])
2197 ]
2198)
2199
540d72c3 2200# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2201# because the system crypt() is more featureful.
2202if test "x$check_for_libcrypt_before" = "x1"; then
2203 AC_CHECK_LIB(crypt, crypt)
2204fi
2205
2206# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2207# version in OpenSSL.
7cac2b65 2208if test "x$check_for_libcrypt_later" = "x1"; then
3c0ef626 2209 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
2210fi
2211
30460aeb 2212# Search for SHA256 support in libc and/or OpenSSL
2213AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2214
fa0f0f45 2215saved_LIBS="$LIBS"
2216AC_CHECK_LIB(iaf, ia_openinfo, [
2217 LIBS="$LIBS -liaf"
e74dc197 2218 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2219 AC_DEFINE(HAVE_LIBIAF, 1,
2220 [Define if system has libiaf that supports set_id])
2221 ])
fa0f0f45 2222])
2223LIBS="$saved_LIBS"
e9702f7d 2224
2225### Configure cryptographic random number support
2226
2227# Check wheter OpenSSL seeds itself
2228AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
dfddba3d 2229AC_RUN_IFELSE(
2230 [AC_LANG_SOURCE([[
e9702f7d 2231#include <string.h>
2232#include <openssl/rand.h>
d03f4262 2233int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
dfddba3d 2234 ]])],
e9702f7d 2235 [
2236 OPENSSL_SEEDS_ITSELF=yes
2237 AC_MSG_RESULT(yes)
2238 ],
2239 [
2240 AC_MSG_RESULT(no)
2241 # Default to use of the rand helper if OpenSSL doesn't
2242 # seed itself
2243 USE_RAND_HELPER=yes
dfddba3d 2244 ],
2245 [
2246 AC_MSG_WARN([cross compiling: assuming yes])
2247 # This is safe, since all recent OpenSSL versions will
8b32eddc 2248 # complain at runtime if not seeded correctly.
dfddba3d 2249 OPENSSL_SEEDS_ITSELF=yes
e9702f7d 2250 ]
2251)
2252
30460aeb 2253# Check for PAM libs
2254PAM_MSG="no"
2255AC_ARG_WITH(pam,
2256 [ --with-pam Enable PAM support ],
2257 [
2258 if test "x$withval" != "xno" ; then
2259 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2260 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2261 AC_MSG_ERROR([PAM headers not found])
2262 fi
2263
2264 saved_LIBS="$LIBS"
2265 AC_CHECK_LIB(dl, dlopen, , )
2266 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2267 AC_CHECK_FUNCS(pam_getenvlist)
2268 AC_CHECK_FUNCS(pam_putenv)
2269 LIBS="$saved_LIBS"
2270
2271 PAM_MSG="yes"
2272
fa0f0f45 2273 SSHDLIBS="$SSHDLIBS -lpam"
30460aeb 2274 AC_DEFINE(USE_PAM, 1,
2275 [Define if you want to enable PAM support])
2276
2277 if test $ac_cv_lib_dl_dlopen = yes; then
2278 case "$LIBS" in
2279 *-ldl*)
2280 # libdl already in LIBS
2281 ;;
2282 *)
fa0f0f45 2283 SSHDLIBS="$SSHDLIBS -ldl"
30460aeb 2284 ;;
2285 esac
2286 fi
30460aeb 2287 fi
2288 ]
2289)
2290
2291# Check for older PAM
2292if test "x$PAM_MSG" = "xyes" ; then
2293 # Check PAM strerror arguments (old PAM)
2294 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2295 AC_TRY_COMPILE(
2296 [
2297#include <stdlib.h>
2298#if defined(HAVE_SECURITY_PAM_APPL_H)
2299#include <security/pam_appl.h>
2300#elif defined (HAVE_PAM_PAM_APPL_H)
2301#include <pam/pam_appl.h>
2302#endif
2303 ],
2304 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2305 [AC_MSG_RESULT(no)],
2306 [
2307 AC_DEFINE(HAVE_OLD_PAM, 1,
2308 [Define if you have an old version of PAM
2309 which takes only one argument to pam_strerror])
2310 AC_MSG_RESULT(yes)
2311 PAM_MSG="yes (old library)"
2312 ]
2313 )
2314fi
e9702f7d 2315
2316# Do we want to force the use of the rand helper?
2317AC_ARG_WITH(rand-helper,
2318 [ --with-rand-helper Use subprocess to gather strong randomness ],
2319 [
2320 if test "x$withval" = "xno" ; then
540d72c3 2321 # Force use of OpenSSL's internal RNG, even if
e9702f7d 2322 # the previous test showed it to be unseeded.
2323 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2324 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2325 OPENSSL_SEEDS_ITSELF=yes
2326 USE_RAND_HELPER=""
2327 fi
2328 else
2329 USE_RAND_HELPER=yes
2330 fi
2331 ],
8b32eddc 2332)
e9702f7d 2333
2334# Which randomness source do we use?
8b32eddc 2335if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
e9702f7d 2336 # OpenSSL only
08822d99 2337 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2338 [Define if you want OpenSSL's internally seeded PRNG only])
e9702f7d 2339 RAND_MSG="OpenSSL internal ONLY"
2340 INSTALL_SSH_RAND_HELPER=""
2341elif test ! -z "$USE_RAND_HELPER" ; then
2342 # install rand helper
2343 RAND_MSG="ssh-rand-helper"
2344 INSTALL_SSH_RAND_HELPER="yes"
2345fi
2346AC_SUBST(INSTALL_SSH_RAND_HELPER)
2347
2348### Configuration of ssh-rand-helper
2349
2350# PRNGD TCP socket
2351AC_ARG_WITH(prngd-port,
2352 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2353 [
2354 case "$withval" in
2355 no)
2356 withval=""
2357 ;;
2358 [[0-9]]*)
2359 ;;
2360 *)
2361 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2362 ;;
2363 esac
2364 if test ! -z "$withval" ; then
2365 PRNGD_PORT="$withval"
08822d99 2366 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2367 [Port number of PRNGD/EGD random number socket])
e9702f7d 2368 fi
2369 ]
2370)
2371
2372# PRNGD Unix domain socket
2373AC_ARG_WITH(prngd-socket,
2374 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2375 [
2376 case "$withval" in
2377 yes)
2378 withval="/var/run/egd-pool"
2379 ;;
2380 no)
2381 withval=""
2382 ;;
2383 /*)
2384 ;;
2385 *)
2386 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2387 ;;
2388 esac
2389
2390 if test ! -z "$withval" ; then
2391 if test ! -z "$PRNGD_PORT" ; then
2392 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2393 fi
2394 if test ! -r "$withval" ; then
2395 AC_MSG_WARN(Entropy socket is not readable)
2396 fi
2397 PRNGD_SOCKET="$withval"
08822d99 2398 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2399 [Location of PRNGD/EGD random number socket])
e9702f7d 2400 fi
2401 ],
2402 [
2403 # Check for existing socket only if we don't have a random device already
2404 if test "$USE_RAND_HELPER" = yes ; then
2405 AC_MSG_CHECKING(for PRNGD/EGD socket)
2406 # Insert other locations here
2407 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2408 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2409 PRNGD_SOCKET="$sock"
2410 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2411 break;
2412 fi
2413 done
2414 if test ! -z "$PRNGD_SOCKET" ; then
2415 AC_MSG_RESULT($PRNGD_SOCKET)
2416 else
2417 AC_MSG_RESULT(not found)
2418 fi
2419 fi
2420 ]
2421)
2422
2423# Change default command timeout for hashing entropy source
2424entropy_timeout=200
2425AC_ARG_WITH(entropy-timeout,
2426 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2427 [
8b32eddc 2428 if test -n "$withval" && test "x$withval" != "xno" && \
2429 test "x${withval}" != "xyes"; then
e9702f7d 2430 entropy_timeout=$withval
2431 fi
8b32eddc 2432 ]
e9702f7d 2433)
08822d99 2434AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2435 [Builtin PRNG command timeout])
e9702f7d 2436
276b07a3 2437SSH_PRIVSEP_USER=sshd
350391c5 2438AC_ARG_WITH(privsep-user,
2439 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
2440 [
8b32eddc 2441 if test -n "$withval" && test "x$withval" != "xno" && \
2442 test "x${withval}" != "xyes"; then
276b07a3 2443 SSH_PRIVSEP_USER=$withval
350391c5 2444 fi
8b32eddc 2445 ]
350391c5 2446)
08822d99 2447AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2448 [non-privileged user for privilege separation])
276b07a3 2449AC_SUBST(SSH_PRIVSEP_USER)
350391c5 2450
2451# We do this little dance with the search path to insure
2452# that programs that we select for use by installed programs
2453# (which may be run by the super-user) come from trusted
2454# locations before they come from the user's private area.
2455# This should help avoid accidentally configuring some
2456# random version of a program in someone's personal bin.
2457
2458OPATH=$PATH
2459PATH=/bin:/usr/bin
2460test -h /bin 2> /dev/null && PATH=/usr/bin
2461test -d /sbin && PATH=$PATH:/sbin
2462test -d /usr/sbin && PATH=$PATH:/usr/sbin
2463PATH=$PATH:/etc:$OPATH
2464
540d72c3 2465# These programs are used by the command hashing source to gather entropy
e9702f7d 2466OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2467OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2468OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2469OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2470OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2471OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2472OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2473OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2474OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2475OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2476OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2477OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2478OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2479OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2480OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2481OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
350391c5 2482# restore PATH
2483PATH=$OPATH
e9702f7d 2484
2485# Where does ssh-rand-helper get its randomness from?
2486INSTALL_SSH_PRNG_CMDS=""
2487if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2488 if test ! -z "$PRNGD_PORT" ; then
2489 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2490 elif test ! -z "$PRNGD_SOCKET" ; then
2491 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2492 else
2493 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2494 RAND_HELPER_CMDHASH=yes
2495 INSTALL_SSH_PRNG_CMDS="yes"
2496 fi
2497fi
2498AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2499
2500
3c0ef626 2501# Cheap hack to ensure NEWS-OS libraries are arranged right.
2502if test ! -z "$SONY" ; then
2503 LIBS="$LIBS -liberty";
2504fi
2505
08822d99 2506# Check for long long datatypes
2507AC_CHECK_TYPES([long long, unsigned long long, long double])
2508
2509# Check datatype sizes
3c0ef626 2510AC_CHECK_SIZEOF(char, 1)
2511AC_CHECK_SIZEOF(short int, 2)
2512AC_CHECK_SIZEOF(int, 4)
2513AC_CHECK_SIZEOF(long int, 4)
2514AC_CHECK_SIZEOF(long long int, 8)
2515
350391c5 2516# Sanity check long long for some platforms (AIX)
2517if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2518 ac_cv_sizeof_long_long_int=0
2519fi
2520
08822d99 2521# compute LLONG_MIN and LLONG_MAX if we don't know them.
2522if test -z "$have_llong_max"; then
2523 AC_MSG_CHECKING([for max value of long long])
2524 AC_RUN_IFELSE(
2525 [AC_LANG_SOURCE([[
2526#include <stdio.h>
2527/* Why is this so damn hard? */
2528#ifdef __GNUC__
2529# undef __GNUC__
2530#endif
2531#define __USE_ISOC99
2532#include <limits.h>
2533#define DATA "conftest.llminmax"
30460aeb 2534#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2535
2536/*
2537 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2538 * we do this the hard way.
2539 */
2540static int
2541fprint_ll(FILE *f, long long n)
2542{
2543 unsigned int i;
2544 int l[sizeof(long long) * 8];
2545
2546 if (n < 0)
2547 if (fprintf(f, "-") < 0)
2548 return -1;
2549 for (i = 0; n != 0; i++) {
2550 l[i] = my_abs(n % 10);
2551 n /= 10;
2552 }
2553 do {
2554 if (fprintf(f, "%d", l[--i]) < 0)
2555 return -1;
2556 } while (i != 0);
2557 if (fprintf(f, " ") < 0)
2558 return -1;
2559 return 0;
2560}
2561
08822d99 2562int main(void) {
2563 FILE *f;
2564 long long i, llmin, llmax = 0;
2565
2566 if((f = fopen(DATA,"w")) == NULL)
2567 exit(1);
2568
2569#if defined(LLONG_MIN) && defined(LLONG_MAX)
2570 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2571 llmin = LLONG_MIN;
2572 llmax = LLONG_MAX;
2573#else
2574 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2575 /* This will work on one's complement and two's complement */
2576 for (i = 1; i > llmax; i <<= 1, i++)
2577 llmax = i;
2578 llmin = llmax + 1LL; /* wrap */
2579#endif
2580
2581 /* Sanity check */
2582 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
30460aeb 2583 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2584 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
08822d99 2585 fprintf(f, "unknown unknown\n");
2586 exit(2);
2587 }
2588
30460aeb 2589 if (fprint_ll(f, llmin) < 0)
08822d99 2590 exit(3);
30460aeb 2591 if (fprint_ll(f, llmax) < 0)
2592 exit(4);
2593 if (fclose(f) < 0)
2594 exit(5);
08822d99 2595 exit(0);
2596}
2597 ]])],
2598 [
2599 llong_min=`$AWK '{print $1}' conftest.llminmax`
2600 llong_max=`$AWK '{print $2}' conftest.llminmax`
2601
08822d99 2602 AC_MSG_RESULT($llong_max)
2603 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2604 [max value of long long calculated by configure])
2605 AC_MSG_CHECKING([for min value of long long])
2606 AC_MSG_RESULT($llong_min)
2607 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2608 [min value of long long calculated by configure])
2609 ],
2610 [
2611 AC_MSG_RESULT(not found)
2612 ],
2613 [
2614 AC_MSG_WARN([cross compiling: not checking])
2615 ]
2616 )
2617fi
2618
2619
3c0ef626 2620# More checks for data types
2621AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2622 AC_TRY_COMPILE(
540d72c3 2623 [ #include <sys/types.h> ],
2624 [ u_int a; a = 1;],
3c0ef626 2625 [ ac_cv_have_u_int="yes" ],
2626 [ ac_cv_have_u_int="no" ]
2627 )
2628])
2629if test "x$ac_cv_have_u_int" = "xyes" ; then
08822d99 2630 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
3c0ef626 2631 have_u_int=1
2632fi
2633
2634AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2635 AC_TRY_COMPILE(
540d72c3 2636 [ #include <sys/types.h> ],
2637 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
3c0ef626 2638 [ ac_cv_have_intxx_t="yes" ],
2639 [ ac_cv_have_intxx_t="no" ]
2640 )
2641])
2642if test "x$ac_cv_have_intxx_t" = "xyes" ; then
08822d99 2643 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
3c0ef626 2644 have_intxx_t=1
2645fi
2646
2647if (test -z "$have_intxx_t" && \
540d72c3 2648 test "x$ac_cv_header_stdint_h" = "xyes")
3c0ef626 2649then
2650 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2651 AC_TRY_COMPILE(
540d72c3 2652 [ #include <stdint.h> ],
2653 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
3c0ef626 2654 [
2655 AC_DEFINE(HAVE_INTXX_T)
2656 AC_MSG_RESULT(yes)
2657 ],
2658 [ AC_MSG_RESULT(no) ]
2659 )
2660fi
2661
2662AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2663 AC_TRY_COMPILE(
d03f4262 2664 [
2665#include <sys/types.h>
2666#ifdef HAVE_STDINT_H
2667# include <stdint.h>
2668#endif
2669#include <sys/socket.h>
2670#ifdef HAVE_SYS_BITYPES_H
2671# include <sys/bitypes.h>
2672#endif
540d72c3 2673 ],
2674 [ int64_t a; a = 1;],
3c0ef626 2675 [ ac_cv_have_int64_t="yes" ],
2676 [ ac_cv_have_int64_t="no" ]
2677 )
2678])
2679if test "x$ac_cv_have_int64_t" = "xyes" ; then
08822d99 2680 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
e9702f7d 2681fi
2682
3c0ef626 2683AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2684 AC_TRY_COMPILE(
540d72c3 2685 [ #include <sys/types.h> ],
2686 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
3c0ef626 2687 [ ac_cv_have_u_intxx_t="yes" ],
2688 [ ac_cv_have_u_intxx_t="no" ]
2689 )
2690])
2691if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
08822d99 2692 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
3c0ef626 2693 have_u_intxx_t=1
2694fi
2695
2696if test -z "$have_u_intxx_t" ; then
2697 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2698 AC_TRY_COMPILE(
540d72c3 2699 [ #include <sys/socket.h> ],
2700 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
3c0ef626 2701 [
2702 AC_DEFINE(HAVE_U_INTXX_T)
2703 AC_MSG_RESULT(yes)
2704 ],
2705 [ AC_MSG_RESULT(no) ]
2706 )
2707fi
2708
2709AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2710 AC_TRY_COMPILE(
540d72c3 2711 [ #include <sys/types.h> ],
2712 [ u_int64_t a; a = 1;],
3c0ef626 2713 [ ac_cv_have_u_int64_t="yes" ],
2714 [ ac_cv_have_u_int64_t="no" ]
2715 )
2716])
2717if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
08822d99 2718 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
3c0ef626 2719 have_u_int64_t=1
2720fi
2721
e9702f7d 2722if test -z "$have_u_int64_t" ; then
2723 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2724 AC_TRY_COMPILE(
540d72c3 2725 [ #include <sys/bitypes.h> ],
e9702f7d 2726 [ u_int64_t a; a = 1],
2727 [
2728 AC_DEFINE(HAVE_U_INT64_T)
2729 AC_MSG_RESULT(yes)
2730 ],
2731 [ AC_MSG_RESULT(no) ]
2732 )
2733fi
2734
3c0ef626 2735if test -z "$have_u_intxx_t" ; then
2736 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2737 AC_TRY_COMPILE(
2738 [
2739#include <sys/types.h>
540d72c3 2740 ],
2741 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
3c0ef626 2742 [ ac_cv_have_uintxx_t="yes" ],
2743 [ ac_cv_have_uintxx_t="no" ]
2744 )
2745 ])
2746 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
08822d99 2747 AC_DEFINE(HAVE_UINTXX_T, 1,
2748 [define if you have uintxx_t data type])
3c0ef626 2749 fi
2750fi
2751
2752if test -z "$have_uintxx_t" ; then
2753 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2754 AC_TRY_COMPILE(
540d72c3 2755 [ #include <stdint.h> ],
2756 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
3c0ef626 2757 [
2758 AC_DEFINE(HAVE_UINTXX_T)
2759 AC_MSG_RESULT(yes)
2760 ],
2761 [ AC_MSG_RESULT(no) ]
2762 )
2763fi
2764
2765if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
540d72c3 2766 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
3c0ef626 2767then
2768 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2769 AC_TRY_COMPILE(
2770 [
2771#include <sys/bitypes.h>
540d72c3 2772 ],
3c0ef626 2773 [
2774 int8_t a; int16_t b; int32_t c;
2775 u_int8_t e; u_int16_t f; u_int32_t g;
2776 a = b = c = e = f = g = 1;
540d72c3 2777 ],
3c0ef626 2778 [
2779 AC_DEFINE(HAVE_U_INTXX_T)
2780 AC_DEFINE(HAVE_INTXX_T)
2781 AC_MSG_RESULT(yes)
2782 ],
2783 [AC_MSG_RESULT(no)]
540d72c3 2784 )
3c0ef626 2785fi
2786
2787
2788AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2789 AC_TRY_COMPILE(
2790 [
2791#include <sys/types.h>
2792 ],
2793 [ u_char foo; foo = 125; ],
2794 [ ac_cv_have_u_char="yes" ],
2795 [ ac_cv_have_u_char="no" ]
2796 )
2797])
2798if test "x$ac_cv_have_u_char" = "xyes" ; then
08822d99 2799 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
3c0ef626 2800fi
2801
2802TYPE_SOCKLEN_T
2803
e9702f7d 2804AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
5156b1a1 2805AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t],,,[
2806#include <sys/types.h>
2807#ifdef HAVE_SYS_BITYPES_H
2808#include <sys/bitypes.h>
2809#endif
2810#ifdef HAVE_SYS_STATFS_H
2811#include <sys/statfs.h>
2812#endif
2813#ifdef HAVE_SYS_STATVFS_H
2814#include <sys/statvfs.h>
2815#endif
2816])
e9702f7d 2817
dfddba3d 2818AC_CHECK_TYPES(in_addr_t,,,
2819[#include <sys/types.h>
2820#include <netinet/in.h>])
2821
3c0ef626 2822AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2823 AC_TRY_COMPILE(
2824 [
2825#include <sys/types.h>
2826 ],
2827 [ size_t foo; foo = 1235; ],
2828 [ ac_cv_have_size_t="yes" ],
2829 [ ac_cv_have_size_t="no" ]
2830 )
2831])
2832if test "x$ac_cv_have_size_t" = "xyes" ; then
08822d99 2833 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
3c0ef626 2834fi
2835
2836AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2837 AC_TRY_COMPILE(
2838 [
2839#include <sys/types.h>
2840 ],
2841 [ ssize_t foo; foo = 1235; ],
2842 [ ac_cv_have_ssize_t="yes" ],
2843 [ ac_cv_have_ssize_t="no" ]
2844 )
2845])
2846if test "x$ac_cv_have_ssize_t" = "xyes" ; then
08822d99 2847 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
3c0ef626 2848fi
2849
2850AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2851 AC_TRY_COMPILE(
2852 [
2853#include <time.h>
2854 ],
2855 [ clock_t foo; foo = 1235; ],
2856 [ ac_cv_have_clock_t="yes" ],
2857 [ ac_cv_have_clock_t="no" ]
2858 )
2859])
2860if test "x$ac_cv_have_clock_t" = "xyes" ; then
08822d99 2861 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
3c0ef626 2862fi
2863
2864AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2865 AC_TRY_COMPILE(
2866 [
2867#include <sys/types.h>
2868#include <sys/socket.h>
2869 ],
2870 [ sa_family_t foo; foo = 1235; ],
2871 [ ac_cv_have_sa_family_t="yes" ],
2872 [ AC_TRY_COMPILE(
2873 [
2874#include <sys/types.h>
2875#include <sys/socket.h>
2876#include <netinet/in.h>
2877 ],
2878 [ sa_family_t foo; foo = 1235; ],
2879 [ ac_cv_have_sa_family_t="yes" ],
2880
2881 [ ac_cv_have_sa_family_t="no" ]
2882 )]
2883 )
2884])
2885if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
08822d99 2886 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2887 [define if you have sa_family_t data type])
3c0ef626 2888fi
2889
2890AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2891 AC_TRY_COMPILE(
2892 [
2893#include <sys/types.h>
2894 ],
2895 [ pid_t foo; foo = 1235; ],
2896 [ ac_cv_have_pid_t="yes" ],
2897 [ ac_cv_have_pid_t="no" ]
2898 )
2899])
2900if test "x$ac_cv_have_pid_t" = "xyes" ; then
08822d99 2901 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
3c0ef626 2902fi
2903
2904AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2905 AC_TRY_COMPILE(
2906 [
2907#include <sys/types.h>
2908 ],
2909 [ mode_t foo; foo = 1235; ],
2910 [ ac_cv_have_mode_t="yes" ],
2911 [ ac_cv_have_mode_t="no" ]
2912 )
2913])
2914if test "x$ac_cv_have_mode_t" = "xyes" ; then
08822d99 2915 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
3c0ef626 2916fi
2917
2918
2919AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2920 AC_TRY_COMPILE(
2921 [
2922#include <sys/types.h>
2923#include <sys/socket.h>
2924 ],
2925 [ struct sockaddr_storage s; ],
2926 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2927 [ ac_cv_have_struct_sockaddr_storage="no" ]
2928 )
2929])
2930if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
08822d99 2931 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2932 [define if you have struct sockaddr_storage data type])
3c0ef626 2933fi
2934
2935AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2936 AC_TRY_COMPILE(
2937 [
2938#include <sys/types.h>
2939#include <netinet/in.h>
2940 ],
2941 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2942 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2943 [ ac_cv_have_struct_sockaddr_in6="no" ]
2944 )
2945])
2946if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
08822d99 2947 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2948 [define if you have struct sockaddr_in6 data type])
3c0ef626 2949fi
2950
2951AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2952 AC_TRY_COMPILE(
2953 [
2954#include <sys/types.h>
2955#include <netinet/in.h>
2956 ],
2957 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2958 [ ac_cv_have_struct_in6_addr="yes" ],
2959 [ ac_cv_have_struct_in6_addr="no" ]
2960 )
2961])
2962if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
08822d99 2963 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2964 [define if you have struct in6_addr data type])
3c0ef626 2965fi
2966
2967AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2968 AC_TRY_COMPILE(
2969 [
2970#include <sys/types.h>
2971#include <sys/socket.h>
2972#include <netdb.h>
2973 ],
2974 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2975 [ ac_cv_have_struct_addrinfo="yes" ],
2976 [ ac_cv_have_struct_addrinfo="no" ]
2977 )
2978])
2979if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
08822d99 2980 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2981 [define if you have struct addrinfo data type])
3c0ef626 2982fi
2983
2984AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2985 AC_TRY_COMPILE(
540d72c3 2986 [ #include <sys/time.h> ],
2987 [ struct timeval tv; tv.tv_sec = 1;],
3c0ef626 2988 [ ac_cv_have_struct_timeval="yes" ],
2989 [ ac_cv_have_struct_timeval="no" ]
2990 )
2991])
2992if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
08822d99 2993 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
3c0ef626 2994 have_struct_timeval=1
2995fi
2996
bfe49944 2997AC_CHECK_TYPES(struct timespec)
2998
2999# We need int64_t or else certian parts of the compile will fail.
8b32eddc 3000if test "x$ac_cv_have_int64_t" = "xno" && \
3001 test "x$ac_cv_sizeof_long_int" != "x8" && \
3002 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
bfe49944 3003 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3004 echo "an alternative compiler (I.E., GCC) before continuing."
3005 echo ""
3006 exit 1;
3c0ef626 3007else
3008dnl test snprintf (broken on SCO w/gcc)
dfddba3d 3009 AC_RUN_IFELSE(
3010 [AC_LANG_SOURCE([[
3c0ef626 3011#include <stdio.h>
3012#include <string.h>
3013#ifdef HAVE_SNPRINTF
3014main()
3015{
3016 char buf[50];
3017 char expected_out[50];
3018 int mazsize = 50 ;
3019#if (SIZEOF_LONG_INT == 8)
3020 long int num = 0x7fffffffffffffff;
3021#else
3022 long long num = 0x7fffffffffffffffll;
3023#endif
3024 strcpy(expected_out, "9223372036854775807");
3025 snprintf(buf, mazsize, "%lld", num);
3026 if(strcmp(buf, expected_out) != 0)
540d72c3 3027 exit(1);
3c0ef626 3028 exit(0);
3029}
3030#else
3031main() { exit(0); }
3032#endif
dfddba3d 3033 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
3034 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
3c0ef626 3035 )
3036fi
3c0ef626 3037
3038dnl Checks for structure members
3039OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
3040OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
3041OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
3042OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
3043OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
3044OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
3045OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
3046OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
3047OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
3048OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
3049OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
3050OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
3051OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
3052OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
3053OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
3054OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
3055OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
3056
3057AC_CHECK_MEMBERS([struct stat.st_blksize])
08822d99 3058AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
3059 [Define if we don't have struct __res_state in resolv.h])],
3060[
3061#include <stdio.h>
3062#if HAVE_SYS_TYPES_H
3063# include <sys/types.h>
3064#endif
3065#include <netinet/in.h>
3066#include <arpa/nameser.h>
3067#include <resolv.h>
3068])
3c0ef626 3069
3070AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3071 ac_cv_have_ss_family_in_struct_ss, [
3072 AC_TRY_COMPILE(
3073 [
3074#include <sys/types.h>
3075#include <sys/socket.h>
3076 ],
3077 [ struct sockaddr_storage s; s.ss_family = 1; ],
3078 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3079 [ ac_cv_have_ss_family_in_struct_ss="no" ],
3080 )
3081])
3082if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
08822d99 3083 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
3c0ef626 3084fi
3085
3086AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3087 ac_cv_have___ss_family_in_struct_ss, [
3088 AC_TRY_COMPILE(
3089 [
3090#include <sys/types.h>
3091#include <sys/socket.h>
3092 ],
3093 [ struct sockaddr_storage s; s.__ss_family = 1; ],
3094 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3095 [ ac_cv_have___ss_family_in_struct_ss="no" ]
3096 )
3097])
3098if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
08822d99 3099 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
3100 [Fields in struct sockaddr_storage])
3c0ef626 3101fi
3102
3103AC_CACHE_CHECK([for pw_class field in struct passwd],
3104 ac_cv_have_pw_class_in_struct_passwd, [
3105 AC_TRY_COMPILE(
3106 [
3107#include <pwd.h>
3108 ],
3109 [ struct passwd p; p.pw_class = 0; ],
3110 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3111 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
3112 )
3113])
3114if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
08822d99 3115 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
3116 [Define if your password has a pw_class field])
3c0ef626 3117fi
3118
3119AC_CACHE_CHECK([for pw_expire field in struct passwd],
3120 ac_cv_have_pw_expire_in_struct_passwd, [
3121 AC_TRY_COMPILE(
3122 [
3123#include <pwd.h>
3124 ],
3125 [ struct passwd p; p.pw_expire = 0; ],
3126 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3127 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
3128 )
3129])
3130if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
08822d99 3131 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
3132 [Define if your password has a pw_expire field])
3c0ef626 3133fi
3134
3135AC_CACHE_CHECK([for pw_change field in struct passwd],
3136 ac_cv_have_pw_change_in_struct_passwd, [
3137 AC_TRY_COMPILE(
3138 [
3139#include <pwd.h>
3140 ],
3141 [ struct passwd p; p.pw_change = 0; ],
3142 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3143 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
3144 )
3145])
3146if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
08822d99 3147 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
3148 [Define if your password has a pw_change field])
3c0ef626 3149fi
3150
541874c2 3151dnl make sure we're using the real structure members and not defines
350391c5 3152AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3153 ac_cv_have_accrights_in_msghdr, [
dfddba3d 3154 AC_COMPILE_IFELSE(
350391c5 3155 [
3156#include <sys/types.h>
3157#include <sys/socket.h>
3158#include <sys/uio.h>
541874c2 3159int main() {
3160#ifdef msg_accrights
dfddba3d 3161#error "msg_accrights is a macro"
541874c2 3162exit(1);
3163#endif
3164struct msghdr m;
3165m.msg_accrights = 0;
3166exit(0);
3167}
350391c5 3168 ],
350391c5 3169 [ ac_cv_have_accrights_in_msghdr="yes" ],
3170 [ ac_cv_have_accrights_in_msghdr="no" ]
3171 )
3172])
3173if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
08822d99 3174 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
3175 [Define if your system uses access rights style
3176 file descriptor passing])
350391c5 3177fi
3178
5156b1a1 3179AC_MSG_CHECKING(if f_fsid has val members)
3180AC_TRY_COMPILE([
3181#include <sys/types.h>
3182#include <sys/statvfs.h>],
3183[struct fsid_t t; t.val[0] = 0;],
3184 [ AC_MSG_RESULT(yes)
3185 AC_DEFINE(FSID_HAS_VAL, 1, f_fsid has members) ],
3186 [ AC_MSG_RESULT(no) ]
3187)
3188
350391c5 3189AC_CACHE_CHECK([for msg_control field in struct msghdr],
3190 ac_cv_have_control_in_msghdr, [
dfddba3d 3191 AC_COMPILE_IFELSE(
350391c5 3192 [
3193#include <sys/types.h>
3194#include <sys/socket.h>
3195#include <sys/uio.h>
541874c2 3196int main() {
3197#ifdef msg_control
dfddba3d 3198#error "msg_control is a macro"
541874c2 3199exit(1);
3200#endif
3201struct msghdr m;
3202m.msg_control = 0;
3203exit(0);
3204}
350391c5 3205 ],
350391c5 3206 [ ac_cv_have_control_in_msghdr="yes" ],
3207 [ ac_cv_have_control_in_msghdr="no" ]
3208 )
3209])
3210if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
08822d99 3211 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
3212 [Define if your system uses ancillary data style
3213 file descriptor passing])
350391c5 3214fi
3215
3c0ef626 3216AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
540d72c3 3217 AC_TRY_LINK([],
3218 [ extern char *__progname; printf("%s", __progname); ],
3c0ef626 3219 [ ac_cv_libc_defines___progname="yes" ],
3220 [ ac_cv_libc_defines___progname="no" ]
3221 )
3222])
3223if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
08822d99 3224 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
3c0ef626 3225fi
3226
350391c5 3227AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3228 AC_TRY_LINK([
3229#include <stdio.h>
540d72c3 3230],
3231 [ printf("%s", __FUNCTION__); ],
350391c5 3232 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3233 [ ac_cv_cc_implements___FUNCTION__="no" ]
3234 )
3235])
3236if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
08822d99 3237 AC_DEFINE(HAVE___FUNCTION__, 1,
3238 [Define if compiler implements __FUNCTION__])
350391c5 3239fi
3240
3241AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3242 AC_TRY_LINK([
3243#include <stdio.h>
540d72c3 3244],
3245 [ printf("%s", __func__); ],
350391c5 3246 [ ac_cv_cc_implements___func__="yes" ],
3247 [ ac_cv_cc_implements___func__="no" ]
3248 )
3249])
3250if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
08822d99 3251 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
3252fi
3253
3254AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3255 AC_TRY_LINK(
3256 [#include <stdarg.h>
3257 va_list x,y;],
3258 [va_copy(x,y);],
3259 [ ac_cv_have_va_copy="yes" ],
3260 [ ac_cv_have_va_copy="no" ]
3261 )
3262])
3263if test "x$ac_cv_have_va_copy" = "xyes" ; then
3264 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3265fi
3266
3267AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3268 AC_TRY_LINK(
3269 [#include <stdarg.h>
3270 va_list x,y;],
3271 [__va_copy(x,y);],
3272 [ ac_cv_have___va_copy="yes" ],
3273 [ ac_cv_have___va_copy="no" ]
3274 )
3275])
3276if test "x$ac_cv_have___va_copy" = "xyes" ; then
3277 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
350391c5 3278fi
3279
3c0ef626 3280AC_CACHE_CHECK([whether getopt has optreset support],
3281 ac_cv_have_getopt_optreset, [
3282 AC_TRY_LINK(
3283 [
3284#include <getopt.h>
3285 ],
3286 [ extern int optreset; optreset = 0; ],
3287 [ ac_cv_have_getopt_optreset="yes" ],
3288 [ ac_cv_have_getopt_optreset="no" ]
3289 )
3290])
3291if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
08822d99 3292 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3293 [Define if your getopt(3) defines and uses optreset])
3c0ef626 3294fi
3295
3296AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
540d72c3 3297 AC_TRY_LINK([],
3298 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
3c0ef626 3299 [ ac_cv_libc_defines_sys_errlist="yes" ],
3300 [ ac_cv_libc_defines_sys_errlist="no" ]
3301 )
3302])
3303if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
08822d99 3304 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3305 [Define if your system defines sys_errlist[]])
3c0ef626 3306fi
3307
3308
3309AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
540d72c3 3310 AC_TRY_LINK([],
3311 [ extern int sys_nerr; printf("%i", sys_nerr);],
3c0ef626 3312 [ ac_cv_libc_defines_sys_nerr="yes" ],
3313 [ ac_cv_libc_defines_sys_nerr="no" ]
3314 )
3315])
3316if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
08822d99 3317 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
3c0ef626 3318fi
3319
540d72c3 3320SCARD_MSG="no"
350391c5 3321# Check whether user wants sectok support
3322AC_ARG_WITH(sectok,
3323 [ --with-sectok Enable smartcard support using libsectok],
3c0ef626 3324 [
3325 if test "x$withval" != "xno" ; then
3326 if test "x$withval" != "xyes" ; then
3327 CPPFLAGS="$CPPFLAGS -I${withval}"
3328 LDFLAGS="$LDFLAGS -L${withval}"
3329 if test ! -z "$need_dash_r" ; then
3330 LDFLAGS="$LDFLAGS -R${withval}"
3331 fi
3332 if test ! -z "$blibpath" ; then
3333 blibpath="$blibpath:${withval}"
3334 fi
3335 fi
3336 AC_CHECK_HEADERS(sectok.h)
3337 if test "$ac_cv_header_sectok_h" != yes; then
3338 AC_MSG_ERROR(Can't find sectok.h)
3339 fi
3340 AC_CHECK_LIB(sectok, sectok_open)
3341 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3342 AC_MSG_ERROR(Can't find libsectok)
3343 fi
08822d99 3344 AC_DEFINE(SMARTCARD, 1,
3345 [Define if you want smartcard support])
3346 AC_DEFINE(USE_SECTOK, 1,
3347 [Define if you want smartcard support
3348 using sectok])
540d72c3 3349 SCARD_MSG="yes, using sectok"
3c0ef626 3350 fi
3351 ]
3352)
3353
350391c5 3354# Check whether user wants OpenSC support
8b32eddc 3355OPENSC_CONFIG="no"
350391c5 3356AC_ARG_WITH(opensc,
08822d99 3357 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
8b32eddc 3358 [
3359 if test "x$withval" != "xno" ; then
3360 if test "x$withval" != "xyes" ; then
3361 OPENSC_CONFIG=$withval/bin/opensc-config
3362 else
3363 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3364 fi
3365 if test "$OPENSC_CONFIG" != "no"; then
3366 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3367 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3368 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
30460aeb 3369 LIBS="$LIBS $LIBOPENSC_LIBS"
8b32eddc 3370 AC_DEFINE(SMARTCARD)
08822d99 3371 AC_DEFINE(USE_OPENSC, 1,
3372 [Define if you want smartcard support
3373 using OpenSC])
8b32eddc 3374 SCARD_MSG="yes, using OpenSC"
3375 fi
3376 fi
3377 ]
3378)
350391c5 3379
540d72c3 3380# Check libraries needed by DNS fingerprint support
3381AC_SEARCH_LIBS(getrrsetbyname, resolv,
08822d99 3382 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3383 [Define if getrrsetbyname() exists])],
7cac2b65 3384 [
540d72c3 3385 # Needed by our getrrsetbyname()
3386 AC_SEARCH_LIBS(res_query, resolv)
3387 AC_SEARCH_LIBS(dn_expand, resolv)
7e82606e 3388 AC_MSG_CHECKING(if res_query will link)
3389 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3390 [AC_MSG_RESULT(no)
3391 saved_LIBS="$LIBS"
3392 LIBS="$LIBS -lresolv"
3393 AC_MSG_CHECKING(for res_query in -lresolv)
3394 AC_LINK_IFELSE([
3395#include <resolv.h>
3396int main()
3397{
3398 res_query (0, 0, 0, 0, 0);
3399 return 0;
3400}
3401 ],
3402 [LIBS="$LIBS -lresolv"
3403 AC_MSG_RESULT(yes)],
3404 [LIBS="$saved_LIBS"
3405 AC_MSG_RESULT(no)])
3406 ])
540d72c3 3407 AC_CHECK_FUNCS(_getshort _getlong)
2ce0bfe4 3408 AC_CHECK_DECLS([_getshort, _getlong], , ,
3409 [#include <sys/types.h>
3410 #include <arpa/nameser.h>])
540d72c3 3411 AC_CHECK_MEMBER(HEADER.ad,
08822d99 3412 [AC_DEFINE(HAVE_HEADER_AD, 1,
3413 [Define if HEADER.ad exists in arpa/nameser.h])],,
540d72c3 3414 [#include <arpa/nameser.h>])
3415 ])
7cac2b65 3416
fa0f0f45 3417AC_MSG_CHECKING(if struct __res_state _res is an extern)
3418AC_LINK_IFELSE([
3419#include <stdio.h>
3420#if HAVE_SYS_TYPES_H
3421# include <sys/types.h>
3422#endif
3423#include <netinet/in.h>
3424#include <arpa/nameser.h>
3425#include <resolv.h>
3426extern struct __res_state _res;
3427int main() { return 0; }
3428 ],
3429 [AC_MSG_RESULT(yes)
3430 AC_DEFINE(HAVE__RES_EXTERN, 1,
3431 [Define if you have struct __res_state _res as an extern])
3432 ],
3433 [ AC_MSG_RESULT(no) ]
3434)
3435
30460aeb 3436# Check whether user wants SELinux support
3437SELINUX_MSG="no"
3438LIBSELINUX=""
3439AC_ARG_WITH(selinux,
e74dc197 3440 [ --with-selinux Enable SELinux support],
30460aeb 3441 [ if test "x$withval" != "xno" ; then
fa0f0f45 3442 save_LIBS="$LIBS"
30460aeb 3443 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3444 SELINUX_MSG="yes"
3445 AC_CHECK_HEADER([selinux/selinux.h], ,
3446 AC_MSG_ERROR(SELinux support requires selinux.h header))
3447 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3448 AC_MSG_ERROR(SELinux support requires libselinux library))
fa0f0f45 3449 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
30460aeb 3450 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
240debe0 3451 LIBS="$save_LIBS"
30460aeb 3452 fi ]
3453)
30460aeb 3454
9fb46e52 3455# Finish configuring Globus GSSAPI
3456if test "x$gsi_path" != "xno" ; then
3457 if test ! -z "$need_dash_r" ; then
3458 LDFLAGS="$LDFLAGS -R${gsi_path}/lib"
3459 fi
3460 if test ! -z "$blibpath" ; then
3461 blibpath="$blibpath:${gsi_path}/lib"
3462 fi
3463fi
3464
282f473f 3465# Check whether the user wants GSSAPI mechglue support
3466AC_ARG_WITH(mechglue,
3467 [ --with-mechglue=PATH Build with GSSAPI mechglue library],
3468 [
3469 AC_MSG_CHECKING(for mechglue library)
3470
3471 if test -e ${withval}/libgssapi.a ; then
3472 mechglue_lib=${withval}/libgssapi.a
3473 elif test -e ${withval}/lib/libgssapi.a ; then
3474 mechglue_lib=${withval}/lib/libgssapi.a
3475 else
3476 AC_MSG_ERROR("Can't find libgssapi in ${withval}");
3477 fi
3478 LIBS="${mechglue_lib} $LIBS"
3479 AC_MSG_RESULT(${mechglue_lib})
3480
3481 AC_CHECK_LIB(dl, dlopen, , )
3482 if test $ac_cv_lib_dl_dlopen = yes; then
3483 LDFLAGS="$LDFLAGS -ldl -Wl,-Bsymbolic"
3484 fi
3485
3486 AC_DEFINE(GSSAPI)
3487 AC_DEFINE(MECHGLUE, 1, [Define this if you're building with GSSAPI MechGlue.])
3488 GSSAPI="mechglue"
3489 ]
3490)
3491
3492
63119dd9 3493# Check whether user wants Kerberos 5 support
540d72c3 3494KRB5_MSG="no"
63119dd9 3495AC_ARG_WITH(kerberos5,
540d72c3 3496 [ --with-kerberos5=PATH Enable Kerberos 5 support],
3497 [ if test "x$withval" != "xno" ; then
3498 if test "x$withval" = "xyes" ; then
3499 KRB5ROOT="/usr/local"
3500 else
3501 KRB5ROOT=${withval}
3502 fi
3503
08822d99 3504 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
540d72c3 3505 KRB5_MSG="yes"
3506
3507 AC_MSG_CHECKING(for krb5-config)
3508 if test -x $KRB5ROOT/bin/krb5-config ; then
3509 KRB5CONF=$KRB5ROOT/bin/krb5-config
3510 AC_MSG_RESULT($KRB5CONF)
3511
3512 AC_MSG_CHECKING(for gssapi support)
3513 if $KRB5CONF | grep gssapi >/dev/null ; then
3514 AC_MSG_RESULT(yes)
08822d99 3515 AC_DEFINE(GSSAPI, 1,
3516 [Define this if you want GSSAPI
3517 support in the version 2 protocol])
540d72c3 3518 k5confopts=gssapi
3519 else
3520 AC_MSG_RESULT(no)
3521 k5confopts=""
3522 fi
3523 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3524 K5LIBS="`$KRB5CONF --libs $k5confopts`"
3525 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
3526 AC_MSG_CHECKING(whether we are using Heimdal)
3527 AC_TRY_COMPILE([ #include <krb5.h> ],
3528 [ char *tmp = heimdal_version; ],
3529 [ AC_MSG_RESULT(yes)
08822d99 3530 AC_DEFINE(HEIMDAL, 1,
3531 [Define this if you are using the
3532 Heimdal version of Kerberos V5]) ],
540d72c3 3533 AC_MSG_RESULT(no)
3534 )
3535 else
3536 AC_MSG_RESULT(no)
63119dd9 3537 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
540d72c3 3538 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
3539 AC_MSG_CHECKING(whether we are using Heimdal)
3540 AC_TRY_COMPILE([ #include <krb5.h> ],
3541 [ char *tmp = heimdal_version; ],
3542 [ AC_MSG_RESULT(yes)
3543 AC_DEFINE(HEIMDAL)
7e82606e 3544 K5LIBS="-lkrb5 -ldes"
3545 K5LIBS="$K5LIBS -lcom_err -lasn1"
8b32eddc 3546 AC_CHECK_LIB(roken, net_write,
7e82606e 3547 [K5LIBS="$K5LIBS -lroken"])
540d72c3 3548 ],
3549 [ AC_MSG_RESULT(no)
3550 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3551 ]
3552 )
7cac2b65 3553 AC_SEARCH_LIBS(dn_expand, resolv)
3554
5156b1a1 3555 AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,
7cac2b65 3556 [ AC_DEFINE(GSSAPI)
5156b1a1 3557 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3558 [ AC_CHECK_LIB(gssapi, gss_init_sec_context,
7cac2b65 3559 [ AC_DEFINE(GSSAPI)
5156b1a1 3560 K5LIBS="-lgssapi $K5LIBS" ],
7cac2b65 3561 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3562 $K5LIBS)
3563 ],
3564 $K5LIBS)
8b32eddc 3565
7cac2b65 3566 AC_CHECK_HEADER(gssapi.h, ,
3567 [ unset ac_cv_header_gssapi_h
540d72c3 3568 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
7cac2b65 3569 AC_CHECK_HEADERS(gssapi.h, ,
3570 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
540d72c3 3571 )
7cac2b65 3572 ]
3573 )
3574
3575 oldCPP="$CPPFLAGS"
3576 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3577 AC_CHECK_HEADER(gssapi_krb5.h, ,
3578 [ CPPFLAGS="$oldCPP" ])
63119dd9 3579
1c89237d 3580 # If we're using some other GSSAPI
3581 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
3582 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
3583 fi
5598e598 3584
540d72c3 3585 if test -z "$GSSAPI"; then
3586 GSSAPI="KRB5";
3587 fi
1c89237d 3588
5598e598 3589 oldCPP="$CPPFLAGS"
3590 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3591 AC_CHECK_HEADER(gssapi_krb5.h, ,
3592 [ CPPFLAGS="$oldCPP" ])
3593
63119dd9 3594 fi
540d72c3 3595 if test ! -z "$need_dash_r" ; then
3596 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3597 fi
3598 if test ! -z "$blibpath" ; then
3599 blibpath="$blibpath:${KRB5ROOT}/lib"
3600 fi
540d72c3 3601
08822d99 3602 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3603 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3604 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
540d72c3 3605
08822d99 3606 LIBS="$LIBS $K5LIBS"
3607 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3608 [Define this if you want to use libkafs' AFS support]))
3609 fi
540d72c3 3610 ]
63119dd9 3611)
3c0ef626 3612
62eb343a 3613# Check whether user wants AFS_KRB5 support
3614AFS_KRB5_MSG="no"
3615AC_ARG_WITH(afs-krb5,
3616 [ --with-afs-krb5[[=AKLOG_PATH]] Enable aklog to get token (default=/usr/bin/aklog).],
3617 [
3618 if test "x$withval" != "xno" ; then
3619
3620 if test "x$withval" != "xyes" ; then
08822d99 3621 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval",
3622 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
62eb343a 3623 else
08822d99 3624 AC_DEFINE_UNQUOTED(AKLOG_PATH,
3625 "/usr/bin/aklog",
3626 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
62eb343a 3627 fi
3628
540d72c3 3629 if test -z "$KRB5ROOT" ; then
62eb343a 3630 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
3631 fi
3632
0a00e8f9 3633 LIBS="-lkrbafs -lkrb4 $LIBS"
62eb343a 3634 if test ! -z "$AFS_LIBS" ; then
3635 LIBS="$LIBS $AFS_LIBS"
3636 fi
08822d99 3637 AC_DEFINE(AFS_KRB5, 1,
3638 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
62eb343a 3639 AFS_KRB5_MSG="yes"
3640 fi
3641 ]
3642)
3c0ef626 3643
75be3237 3644AC_ARG_WITH(session-hooks,
3645 [ --with-session-hooks Enable hooks for executing external commands before/after a session],
08822d99 3646 [ AC_DEFINE(SESSION_HOOKS, 1, [Define this if you want support for startup/shutdown hooks]) ]
75be3237 3647)
3648
3c0ef626 3649# Looking for programs, paths and files
3c0ef626 3650
350391c5 3651PRIVSEP_PATH=/var/empty
3652AC_ARG_WITH(privsep-path,
d03f4262 3653 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
350391c5 3654 [
8b32eddc 3655 if test -n "$withval" && test "x$withval" != "xno" && \
3656 test "x${withval}" != "xyes"; then
350391c5 3657 PRIVSEP_PATH=$withval
3658 fi
3659 ]
3660)
3661AC_SUBST(PRIVSEP_PATH)
3662
3c0ef626 3663AC_ARG_WITH(xauth,
3664 [ --with-xauth=PATH Specify path to xauth program ],
3665 [
8b32eddc 3666 if test -n "$withval" && test "x$withval" != "xno" && \
3667 test "x${withval}" != "xyes"; then
3c0ef626 3668 xauth_path=$withval
3669 fi
3670 ],
3671 [
d03f4262 3672 TestPath="$PATH"
3673 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3674 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3675 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3676 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3677 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3c0ef626 3678 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3679 xauth_path="/usr/openwin/bin/xauth"
3680 fi
3681 ]
3682)
3683
5156b1a1 3684# strip causes problems with GSI libraries...
3685if test -z "$GLOBUS_LDFLAGS" ; then
bfe49944 3686STRIP_OPT=-s
5156b1a1 3687fi
bfe49944 3688AC_ARG_ENABLE(strip,
3689 [ --disable-strip Disable calling strip(1) on install],
3690 [
3691 if test "x$enableval" = "xno" ; then
3692 STRIP_OPT=
3693 fi
3694 ]
3695)
3696AC_SUBST(STRIP_OPT)
3697
3c0ef626 3698if test -z "$xauth_path" ; then
3699 XAUTH_PATH="undefined"
3700 AC_SUBST(XAUTH_PATH)
3701else
08822d99 3702 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3703 [Define if xauth is found in your path])
3c0ef626 3704 XAUTH_PATH=$xauth_path
3705 AC_SUBST(XAUTH_PATH)
3706fi
3c0ef626 3707
3708# Check for mail directory (last resort if we cannot get it from headers)
3709if test ! -z "$MAIL" ; then
3710 maildir=`dirname $MAIL`
08822d99 3711 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3712 [Set this to your mail directory if you don't have maillock.h])
3c0ef626 3713fi
3714
dfddba3d 3715if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3716 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3717 disable_ptmx_check=yes
3718fi
3c0ef626 3719if test -z "$no_dev_ptmx" ; then
350391c5 3720 if test "x$disable_ptmx_check" != "xyes" ; then
540d72c3 3721 AC_CHECK_FILE("/dev/ptmx",
350391c5 3722 [
08822d99 3723 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3724 [Define if you have /dev/ptmx])
350391c5 3725 have_dev_ptmx=1
3726 ]
3727 )
3728 fi
3c0ef626 3729fi
dfddba3d 3730
3731if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3732 AC_CHECK_FILE("/dev/ptc",
3733 [
08822d99 3734 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3735 [Define if you have /dev/ptc])
dfddba3d 3736 have_dev_ptc=1
3737 ]
3738 )
3739else
3740 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3741fi
3c0ef626 3742
3743# Options from here on. Some of these are preset by platform above
3c0ef626 3744AC_ARG_WITH(mantype,
3745 [ --with-mantype=man|cat|doc Set man page type],
3746 [
3747 case "$withval" in
3748 man|cat|doc)
3749 MANTYPE=$withval
3750 ;;
3751 *)
3752 AC_MSG_ERROR(invalid man type: $withval)
3753 ;;
3754 esac
3755 ]
3756)
3757if test -z "$MANTYPE"; then
d03f4262 3758 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3759 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3c0ef626 3760 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3761 MANTYPE=doc
3762 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3763 MANTYPE=man
3764 else
3765 MANTYPE=cat
3766 fi
3767fi
3768AC_SUBST(MANTYPE)
3769if test "$MANTYPE" = "doc"; then
3770 mansubdir=man;
3771else
3772 mansubdir=$MANTYPE;
3773fi
3774AC_SUBST(mansubdir)
3775
3776# Check whether to enable MD5 passwords
540d72c3 3777MD5_MSG="no"
3c0ef626 3778AC_ARG_WITH(md5-passwords,
3779 [ --with-md5-passwords Enable use of MD5 passwords],
3780 [
3781 if test "x$withval" != "xno" ; then
08822d99 3782 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3783 [Define if you want to allow MD5 passwords])
540d72c3 3784 MD5_MSG="yes"
3c0ef626 3785 fi
3786 ]
3787)
3788
3789# Whether to disable shadow password support
3790AC_ARG_WITH(shadow,
3791 [ --without-shadow Disable shadow password support],
3792 [
8b32eddc 3793 if test "x$withval" = "xno" ; then
3c0ef626 3794 AC_DEFINE(DISABLE_SHADOW)
3795 disable_shadow=yes
3796 fi
3797 ]
3798)
3799
3800if test -z "$disable_shadow" ; then
3801 AC_MSG_CHECKING([if the systems has expire shadow information])
3802 AC_TRY_COMPILE(
3803 [
3804#include <sys/types.h>
3805#include <shadow.h>
3806 struct spwd sp;
3807 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3808 [ sp_expire_available=yes ], []
3809 )
3810
3811 if test "x$sp_expire_available" = "xyes" ; then
3812 AC_MSG_RESULT(yes)
08822d99 3813 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3814 [Define if you want to use shadow password expire field])
3c0ef626 3815 else
3816 AC_MSG_RESULT(no)
3817 fi
3818fi
3819
3820# Use ip address instead of hostname in $DISPLAY
3821if test ! -z "$IPADDR_IN_DISPLAY" ; then
3822 DISPLAY_HACK_MSG="yes"
08822d99 3823 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3824 [Define if you need to use IP address
3825 instead of hostname in $DISPLAY])
3c0ef626 3826else
540d72c3 3827 DISPLAY_HACK_MSG="no"
3c0ef626 3828 AC_ARG_WITH(ipaddr-display,
3829 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3830 [
8b32eddc 3831 if test "x$withval" != "xno" ; then
3c0ef626 3832 AC_DEFINE(IPADDR_IN_DISPLAY)
540d72c3 3833 DISPLAY_HACK_MSG="yes"
3c0ef626 3834 fi
3835 ]
3836 )
3837fi
3838
7cac2b65 3839# check for /etc/default/login and use it if present.
29d88157 3840AC_ARG_ENABLE(etc-default-login,
dfddba3d 3841 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3842 [ if test "x$enableval" = "xno"; then
3843 AC_MSG_NOTICE([/etc/default/login handling disabled])
3844 etc_default_login=no
3845 else
3846 etc_default_login=yes
3847 fi ],
08822d99 3848 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3849 then
3850 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3851 etc_default_login=no
3852 else
3853 etc_default_login=yes
3854 fi ]
dfddba3d 3855)
3856
3857if test "x$etc_default_login" != "xno"; then
3858 AC_CHECK_FILE("/etc/default/login",
3859 [ external_path_file=/etc/default/login ])
08822d99 3860 if test "x$external_path_file" = "x/etc/default/login"; then
3861 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3862 [Define if your system has /etc/default/login])
dfddba3d 3863 fi
7cac2b65 3864fi
3865
350391c5 3866dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
8b32eddc 3867if test $ac_cv_func_login_getcapbool = "yes" && \
3868 test $ac_cv_header_login_cap_h = "yes" ; then
7cac2b65 3869 external_path_file=/etc/login.conf
350391c5 3870fi
7cac2b65 3871
3c0ef626 3872# Whether to mess with the default path
540d72c3 3873SERVER_PATH_MSG="(default)"
3c0ef626 3874AC_ARG_WITH(default-path,
350391c5 3875 [ --with-default-path= Specify default \$PATH environment for server],
3c0ef626 3876 [
7cac2b65 3877 if test "x$external_path_file" = "x/etc/login.conf" ; then
350391c5 3878 AC_MSG_WARN([
3879--with-default-path=PATH has no effect on this system.
3880Edit /etc/login.conf instead.])
8b32eddc 3881 elif test "x$withval" != "xno" ; then
7cac2b65 3882 if test ! -z "$external_path_file" ; then
3883 AC_MSG_WARN([
3884--with-default-path=PATH will only be used if PATH is not defined in
3885$external_path_file .])
3886 fi
3c0ef626 3887 user_path="$withval"
540d72c3 3888 SERVER_PATH_MSG="$withval"
3c0ef626 3889 fi
3890 ],
7cac2b65 3891 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3892 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
350391c5 3893 else
7cac2b65 3894 if test ! -z "$external_path_file" ; then
3895 AC_MSG_WARN([
3896If PATH is defined in $external_path_file, ensure the path to scp is included,
3897otherwise scp will not work.])
3898 fi
08822d99 3899 AC_RUN_IFELSE(
3900 [AC_LANG_SOURCE([[
3c0ef626 3901/* find out what STDPATH is */
3902#include <stdio.h>
3903#ifdef HAVE_PATHS_H
3904# include <paths.h>
3905#endif
3906#ifndef _PATH_STDPATH
bfe49944 3907# ifdef _PATH_USERPATH /* Irix */
3908# define _PATH_STDPATH _PATH_USERPATH
3909# else
3910# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3911# endif
3c0ef626 3912#endif
3913#include <sys/types.h>
3914#include <sys/stat.h>
3915#include <fcntl.h>
3916#define DATA "conftest.stdpath"
3917
3918main()
3919{
3920 FILE *fd;
3921 int rc;
8b32eddc 3922
3c0ef626 3923 fd = fopen(DATA,"w");
3924 if(fd == NULL)
3925 exit(1);
8b32eddc 3926
3c0ef626 3927 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3928 exit(1);
3929
3930 exit(0);
3931}
08822d99 3932 ]])],
3933 [ user_path=`cat conftest.stdpath` ],
3c0ef626 3934 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3935 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3936 )
3937# make sure $bindir is in USER_PATH so scp will work
3938 t_bindir=`eval echo ${bindir}`
3939 case $t_bindir in
3940 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3941 esac
3942 case $t_bindir in
3943 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3944 esac
3945 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3946 if test $? -ne 0 ; then
3947 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3948 if test $? -ne 0 ; then
3949 user_path=$user_path:$t_bindir
3950 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3951 fi
3952 fi
350391c5 3953 fi ]
3954)
7cac2b65 3955if test "x$external_path_file" != "x/etc/login.conf" ; then
08822d99 3956 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
350391c5 3957 AC_SUBST(user_path)
3958fi
3959
3960# Set superuser path separately to user path
350391c5 3961AC_ARG_WITH(superuser-path,
3962 [ --with-superuser-path= Specify different path for super-user],
3963 [
8b32eddc 3964 if test -n "$withval" && test "x$withval" != "xno" && \
3965 test "x${withval}" != "xyes"; then
08822d99 3966 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3967 [Define if you want a different $PATH
3968 for the superuser])
350391c5 3969 superuser_path=$withval
3970 fi
3c0ef626 3971 ]
3972)
350391c5 3973
3c0ef626 3974
3c0ef626 3975AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
540d72c3 3976IPV4_IN6_HACK_MSG="no"
3c0ef626 3977AC_ARG_WITH(4in6,
3978 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3979 [
3980 if test "x$withval" != "xno" ; then
3981 AC_MSG_RESULT(yes)
08822d99 3982 AC_DEFINE(IPV4_IN_IPV6, 1,
3983 [Detect IPv4 in IPv6 mapped addresses
3984 and treat as IPv4])
540d72c3 3985 IPV4_IN6_HACK_MSG="yes"
3c0ef626 3986 else
3987 AC_MSG_RESULT(no)
3988 fi
3989 ],[
3990 if test "x$inet6_default_4in6" = "xyes"; then
3991 AC_MSG_RESULT([yes (default)])
3992 AC_DEFINE(IPV4_IN_IPV6)
540d72c3 3993 IPV4_IN6_HACK_MSG="yes"
3c0ef626 3994 else
3995 AC_MSG_RESULT([no (default)])
3996 fi
3997 ]
3998)
3999
4000# Whether to enable BSD auth support
e9702f7d 4001BSD_AUTH_MSG=no
3c0ef626 4002AC_ARG_WITH(bsd-auth,
4003 [ --with-bsd-auth Enable BSD auth support],
4004 [
8b32eddc 4005 if test "x$withval" != "xno" ; then
08822d99 4006 AC_DEFINE(BSD_AUTH, 1,
4007 [Define if you have BSD auth support])
e9702f7d 4008 BSD_AUTH_MSG=yes
3c0ef626 4009 fi
4010 ]
4011)
4012
3c0ef626 4013# Where to place sshd.pid
4014piddir=/var/run
350391c5 4015# make sure the directory exists
8b32eddc 4016if test ! -d $piddir ; then
350391c5 4017 piddir=`eval echo ${sysconfdir}`
4018 case $piddir in
540d72c3 4019 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
350391c5 4020 esac
4021fi
4022
3c0ef626 4023AC_ARG_WITH(pid-dir,
4024 [ --with-pid-dir=PATH Specify location of ssh.pid file],
4025 [
8b32eddc 4026 if test -n "$withval" && test "x$withval" != "xno" && \
4027 test "x${withval}" != "xyes"; then
3c0ef626 4028 piddir=$withval
8b32eddc 4029 if test ! -d $piddir ; then
350391c5 4030 AC_MSG_WARN([** no $piddir directory on this system **])
4031 fi
3c0ef626 4032 fi
4033 ]
4034)
4035
08822d99 4036AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3c0ef626 4037AC_SUBST(piddir)
4038
4039dnl allow user to disable some login recording features
4040AC_ARG_ENABLE(lastlog,
4041 [ --disable-lastlog disable use of lastlog even if detected [no]],
7cac2b65 4042 [
4043 if test "x$enableval" = "xno" ; then
4044 AC_DEFINE(DISABLE_LASTLOG)
4045 fi
4046 ]
3c0ef626 4047)
4048AC_ARG_ENABLE(utmp,
4049 [ --disable-utmp disable use of utmp even if detected [no]],
7cac2b65 4050 [
4051 if test "x$enableval" = "xno" ; then
4052 AC_DEFINE(DISABLE_UTMP)
4053 fi
4054 ]
3c0ef626 4055)
4056AC_ARG_ENABLE(utmpx,
4057 [ --disable-utmpx disable use of utmpx even if detected [no]],
7cac2b65 4058 [
4059 if test "x$enableval" = "xno" ; then
08822d99 4060 AC_DEFINE(DISABLE_UTMPX, 1,
4061 [Define if you don't want to use utmpx])
7cac2b65 4062 fi
4063 ]
3c0ef626 4064)
4065AC_ARG_ENABLE(wtmp,
4066 [ --disable-wtmp disable use of wtmp even if detected [no]],
7cac2b65 4067 [
4068 if test "x$enableval" = "xno" ; then
4069 AC_DEFINE(DISABLE_WTMP)
4070 fi
4071 ]
3c0ef626 4072)
4073AC_ARG_ENABLE(wtmpx,
4074 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
7cac2b65 4075 [
4076 if test "x$enableval" = "xno" ; then
08822d99 4077 AC_DEFINE(DISABLE_WTMPX, 1,
4078 [Define if you don't want to use wtmpx])
7cac2b65 4079 fi
4080 ]
3c0ef626 4081)
4082AC_ARG_ENABLE(libutil,
4083 [ --disable-libutil disable use of libutil (login() etc.) [no]],
7cac2b65 4084 [
4085 if test "x$enableval" = "xno" ; then
4086 AC_DEFINE(DISABLE_LOGIN)
4087 fi
4088 ]
3c0ef626 4089)
4090AC_ARG_ENABLE(pututline,
4091 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
7cac2b65 4092 [
4093 if test "x$enableval" = "xno" ; then
08822d99 4094 AC_DEFINE(DISABLE_PUTUTLINE, 1,
4095 [Define if you don't want to use pututline()
4096 etc. to write [uw]tmp])
7cac2b65 4097 fi
4098 ]
3c0ef626 4099)
4100AC_ARG_ENABLE(pututxline,
4101 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
7cac2b65 4102 [
4103 if test "x$enableval" = "xno" ; then
08822d99 4104 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
4105 [Define if you don't want to use pututxline()
4106 etc. to write [uw]tmpx])
7cac2b65 4107 fi
4108 ]
3c0ef626 4109)
4110AC_ARG_WITH(lastlog,
4111 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
4112 [
8b32eddc 4113 if test "x$withval" = "xno" ; then
3c0ef626 4114 AC_DEFINE(DISABLE_LASTLOG)
8b32eddc 4115 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3c0ef626 4116 conf_lastlog_location=$withval
4117 fi
4118 ]
4119)
4120
4121dnl lastlog, [uw]tmpx? detection
4122dnl NOTE: set the paths in the platform section to avoid the
4123dnl need for command-line parameters
4124dnl lastlog and [uw]tmp are subject to a file search if all else fails
4125
4126dnl lastlog detection
4127dnl NOTE: the code itself will detect if lastlog is a directory
4128AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
4129AC_TRY_COMPILE([
4130#include <sys/types.h>
4131#include <utmp.h>
4132#ifdef HAVE_LASTLOG_H
4133# include <lastlog.h>
4134#endif
4135#ifdef HAVE_PATHS_H
4136# include <paths.h>
4137#endif
4138#ifdef HAVE_LOGIN_H
4139# include <login.h>
4140#endif
4141 ],
4142 [ char *lastlog = LASTLOG_FILE; ],
4143 [ AC_MSG_RESULT(yes) ],
4144 [
4145 AC_MSG_RESULT(no)
4146 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
4147 AC_TRY_COMPILE([
4148#include <sys/types.h>
4149#include <utmp.h>
4150#ifdef HAVE_LASTLOG_H
4151# include <lastlog.h>
4152#endif
4153#ifdef HAVE_PATHS_H
4154# include <paths.h>
4155#endif
4156 ],
4157 [ char *lastlog = _PATH_LASTLOG; ],
4158 [ AC_MSG_RESULT(yes) ],
4159 [
4160 AC_MSG_RESULT(no)
4161 system_lastlog_path=no
4162 ])
4163 ]
4164)
4165
4166if test -z "$conf_lastlog_location"; then
4167 if test x"$system_lastlog_path" = x"no" ; then
4168 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
4169 if (test -d "$f" || test -f "$f") ; then
4170 conf_lastlog_location=$f
4171 fi
4172 done
4173 if test -z "$conf_lastlog_location"; then
4174 AC_MSG_WARN([** Cannot find lastlog **])
4175 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
4176 fi
4177 fi
4178fi
4179
4180if test -n "$conf_lastlog_location"; then
08822d99 4181 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
4182 [Define if you want to specify the path to your lastlog file])
8b32eddc 4183fi
3c0ef626 4184
4185dnl utmp detection
4186AC_MSG_CHECKING([if your system defines UTMP_FILE])
4187AC_TRY_COMPILE([
4188#include <sys/types.h>
4189#include <utmp.h>
4190#ifdef HAVE_PATHS_H
4191# include <paths.h>
4192#endif
4193 ],
4194 [ char *utmp = UTMP_FILE; ],
4195 [ AC_MSG_RESULT(yes) ],
4196 [ AC_MSG_RESULT(no)
4197 system_utmp_path=no ]
4198)
4199if test -z "$conf_utmp_location"; then
4200 if test x"$system_utmp_path" = x"no" ; then
4201 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4202 if test -f $f ; then
4203 conf_utmp_location=$f
4204 fi
4205 done
4206 if test -z "$conf_utmp_location"; then
4207 AC_DEFINE(DISABLE_UTMP)
4208 fi
4209 fi
4210fi
4211if test -n "$conf_utmp_location"; then
08822d99 4212 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
4213 [Define if you want to specify the path to your utmp file])
8b32eddc 4214fi
3c0ef626 4215
4216dnl wtmp detection
4217AC_MSG_CHECKING([if your system defines WTMP_FILE])
4218AC_TRY_COMPILE([
4219#include <sys/types.h>
4220#include <utmp.h>
4221#ifdef HAVE_PATHS_H
4222# include <paths.h>
4223#endif
4224 ],
4225 [ char *wtmp = WTMP_FILE; ],
4226 [ AC_MSG_RESULT(yes) ],
4227 [ AC_MSG_RESULT(no)
4228 system_wtmp_path=no ]
4229)
4230if test -z "$conf_wtmp_location"; then
4231 if test x"$system_wtmp_path" = x"no" ; then
4232 for f in /usr/adm/wtmp /var/log/wtmp; do
4233 if test -f $f ; then
4234 conf_wtmp_location=$f
4235 fi
4236 done
4237 if test -z "$conf_wtmp_location"; then
4238 AC_DEFINE(DISABLE_WTMP)
4239 fi
4240 fi
4241fi
4242if test -n "$conf_wtmp_location"; then
08822d99 4243 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
4244 [Define if you want to specify the path to your wtmp file])
8b32eddc 4245fi
3c0ef626 4246
4247
4248dnl utmpx detection - I don't know any system so perverse as to require
4249dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
4250dnl there, though.
4251AC_MSG_CHECKING([if your system defines UTMPX_FILE])
4252AC_TRY_COMPILE([
4253#include <sys/types.h>
4254#include <utmp.h>
4255#ifdef HAVE_UTMPX_H
4256#include <utmpx.h>
4257#endif
4258#ifdef HAVE_PATHS_H
4259# include <paths.h>
4260#endif
4261 ],
4262 [ char *utmpx = UTMPX_FILE; ],
4263 [ AC_MSG_RESULT(yes) ],
4264 [ AC_MSG_RESULT(no)
4265 system_utmpx_path=no ]
4266)
4267if test -z "$conf_utmpx_location"; then
4268 if test x"$system_utmpx_path" = x"no" ; then
4269 AC_DEFINE(DISABLE_UTMPX)
4270 fi
4271else
08822d99 4272 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
4273 [Define if you want to specify the path to your utmpx file])
8b32eddc 4274fi
3c0ef626 4275
4276dnl wtmpx detection
4277AC_MSG_CHECKING([if your system defines WTMPX_FILE])
4278AC_TRY_COMPILE([
4279#include <sys/types.h>
4280#include <utmp.h>
4281#ifdef HAVE_UTMPX_H
4282#include <utmpx.h>
4283#endif
4284#ifdef HAVE_PATHS_H
4285# include <paths.h>
4286#endif
4287 ],
4288 [ char *wtmpx = WTMPX_FILE; ],
4289 [ AC_MSG_RESULT(yes) ],
4290 [ AC_MSG_RESULT(no)
4291 system_wtmpx_path=no ]
4292)
4293if test -z "$conf_wtmpx_location"; then
4294 if test x"$system_wtmpx_path" = x"no" ; then
4295 AC_DEFINE(DISABLE_WTMPX)
4296 fi
4297else
08822d99 4298 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
4299 [Define if you want to specify the path to your wtmpx file])
8b32eddc 4300fi
3c0ef626 4301
4302
3c0ef626 4303if test ! -z "$blibpath" ; then
256cb466 4304 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4305 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3c0ef626 4306fi
4307
2ce0bfe4 4308dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4309dnl Add now.
4310CFLAGS="$CFLAGS $werror_flags"
4311
5156b1a1 4312if grep "#define BROKEN_GETADDRINFO 1" confdefs.h >/dev/null || \
4313 test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4314 AC_SUBST(TEST_SSH_IPV6, no)
4315else
4316 AC_SUBST(TEST_SSH_IPV6, yes)
4317fi
4318
e9702f7d 4319AC_EXEEXT
30460aeb 4320AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4321 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
dfddba3d 4322 scard/Makefile ssh_prng_cmds survey.sh])
3c0ef626 4323AC_OUTPUT
4324
4325# Print summary of options
4326
3c0ef626 4327# Someone please show me a better way :)
4328A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4329B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4330C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4331D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
4332E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
4333F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
4334G=`eval echo ${piddir}` ; G=`eval echo ${G}`
350391c5 4335H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4336I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4337J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3c0ef626 4338
4339echo ""
4340echo "OpenSSH has been configured with the following options:"
350391c5 4341echo " User binaries: $B"
4342echo " System binaries: $C"
4343echo " Configuration files: $D"
4344echo " Askpass program: $E"
4345echo " Manual pages: $F"
4346echo " PID file: $G"
4347echo " Privilege separation chroot path: $H"
7cac2b65 4348if test "x$external_path_file" = "x/etc/login.conf" ; then
4349echo " At runtime, sshd will use the path defined in $external_path_file"
4350echo " Make sure the path to scp is present, otherwise scp will not work"
350391c5 4351else
4352echo " sshd default user PATH: $I"
7cac2b65 4353 if test ! -z "$external_path_file"; then
4354echo " (If PATH is set in $external_path_file it will be used instead. If"
4355echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4356 fi
350391c5 4357fi
4358if test ! -z "$superuser_path" ; then
4359echo " sshd superuser user PATH: $J"
4360fi
4361echo " Manpage format: $MANTYPE"
7cac2b65 4362echo " PAM support: $PAM_MSG"
30460aeb 4363echo " OSF SIA support: $SIA_MSG"
350391c5 4364echo " KerberosV support: $KRB5_MSG"
30460aeb 4365echo " SELinux support: $SELINUX_MSG"
350391c5 4366echo " Smartcard support: $SCARD_MSG"
350391c5 4367echo " S/KEY support: $SKEY_MSG"
4368echo " TCP Wrappers support: $TCPW_MSG"
4369echo " MD5 password support: $MD5_MSG"
dfddba3d 4370echo " libedit support: $LIBEDIT_MSG"
30460aeb 4371echo " Solaris process contract support: $SPC_MSG"
350391c5 4372echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
350391c5 4373echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4374echo " BSD Auth support: $BSD_AUTH_MSG"
4375echo " Random number source: $RAND_MSG"
e9702f7d 4376if test ! -z "$USE_RAND_HELPER" ; then
350391c5 4377echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3c0ef626 4378fi
4379
4380echo ""
4381
4382echo " Host: ${host}"
4383echo " Compiler: ${CC}"
4384echo " Compiler flags: ${CFLAGS}"
4385echo "Preprocessor flags: ${CPPFLAGS}"
4386echo " Linker flags: ${LDFLAGS}"
fa0f0f45 4387echo " Libraries: ${LIBS}"
4388if test ! -z "${SSHDLIBS}"; then
4389echo " +for sshd: ${SSHDLIBS}"
4390fi
3c0ef626 4391
4392echo ""
4393
7e82606e 4394if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
dfddba3d 4395 echo "SVR4 style packages are supported with \"make package\""
4396 echo ""
7e82606e 4397fi
4398
3c0ef626 4399if test "x$PAM_MSG" = "xyes" ; then
e9702f7d 4400 echo "PAM is enabled. You may need to install a PAM control file "
4401 echo "for sshd, otherwise password authentication may fail. "
540d72c3 4402 echo "Example PAM control files can be found in the contrib/ "
e9702f7d 4403 echo "subdirectory"
3c0ef626 4404 echo ""
4405fi
4406
e9702f7d 4407if test ! -z "$RAND_HELPER_CMDHASH" ; then
4408 echo "WARNING: you are using the builtin random number collection "
4409 echo "service. Please read WARNING.RNG and request that your OS "
4410 echo "vendor includes kernel-based random number collection in "
4411 echo "future versions of your OS."
3c0ef626 4412 echo ""
4413fi
4414
7e82606e 4415if test ! -z "$NO_PEERCHECK" ; then
fa0f0f45 4416 echo "WARNING: the operating system that you are using does not"
4417 echo "appear to support getpeereid(), getpeerucred() or the"
4418 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4419 echo "enforce security checks to prevent unauthorised connections to"
4420 echo "ssh-agent. Their absence increases the risk that a malicious"
4421 echo "user can connect to your agent."
7e82606e 4422 echo ""
4423fi
4424
dfddba3d 4425if test "$AUDIT_MODULE" = "bsm" ; then
4426 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4427 echo "See the Solaris section in README.platform for details."
4428fi
This page took 1.151453 seconds and 5 git commands to generate.