1 # $Id: configure.ac,v 1.449 2010/04/10 12:58:01 dtucker Exp $
3 # Copyright (c) 1999-2004 Damien Miller
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.
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.
17 AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
18 AC_REVISION($Revision: 1.449 $)
19 AC_CONFIG_SRCDIR([ssh.c])
21 AC_CONFIG_HEADER(config.h)
26 # Checks for programs.
33 AC_PATH_PROG(CAT, cat)
34 AC_PATH_PROG(KILL, kill)
35 AC_PATH_PROGS(PERL, perl5 perl)
36 AC_PATH_PROG(SED, sed)
38 AC_PATH_PROG(ENT, ent)
40 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
41 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
42 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
44 AC_SUBST(TEST_SHELL,sh)
47 AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49 AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
50 [/usr/sbin${PATH_SEPARATOR}/etc])
51 AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
52 if test -x /sbin/sh; then
53 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
55 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
61 if test -z "$AR" ; then
62 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
65 # Use LOGIN_PROGRAM from environment if possible
66 if test ! -z "$LOGIN_PROGRAM" ; then
67 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
68 [If your header files don't define LOGIN_PROGRAM,
69 then use this (detected) from environment and PATH])
72 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
73 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
74 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
78 AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
79 if test ! -z "$PATH_PASSWD_PROG" ; then
80 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
81 [Full path of your "passwd" program])
84 if test -z "$LD" ; then
91 AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
94 AC_ARG_WITH(stackprotect,
95 [ --without-stackprotect Don't use compiler's stack protection], [
96 if test "x$withval" = "xno"; then
100 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
101 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
102 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
104 1.*) no_attrib_nonnull=1 ;;
106 CFLAGS="$CFLAGS -Wsign-compare"
109 2.*) no_attrib_nonnull=1 ;;
110 3.*) CFLAGS="$CFLAGS -Wsign-compare -Wformat-security" ;;
111 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign -Wformat-security -fno-strict-aliasing" ;;
115 AC_MSG_CHECKING(if $CC accepts -fno-builtin-memset)
116 saved_CFLAGS="$CFLAGS"
117 CFLAGS="$CFLAGS -fno-builtin-memset"
118 AC_LINK_IFELSE( [AC_LANG_SOURCE([[
120 int main(void){char b[10]; memset(b, 0, sizeof(b));}
122 [ AC_MSG_RESULT(yes) ],
124 CFLAGS="$saved_CFLAGS" ]
127 # -fstack-protector-all doesn't always work for some GCC versions
128 # and/or platforms, so we test if we can. If it's not supported
129 # on a given platform gcc will emit a warning so we use -Werror.
130 if test "x$use_stack_protector" = "x1"; then
131 for t in -fstack-protector-all -fstack-protector; do
132 AC_MSG_CHECKING(if $CC supports $t)
133 saved_CFLAGS="$CFLAGS"
134 saved_LDFLAGS="$LDFLAGS"
135 CFLAGS="$CFLAGS $t -Werror"
136 LDFLAGS="$LDFLAGS $t -Werror"
140 int main(void){char x[[256]]; snprintf(x, sizeof(x), "XXX"); return 0;}
143 CFLAGS="$saved_CFLAGS $t"
144 LDFLAGS="$saved_LDFLAGS $t"
145 AC_MSG_CHECKING(if $t works)
149 int main(void){char x[[256]]; snprintf(x, sizeof(x), "XXX"); return 0;}
153 [ AC_MSG_RESULT(no) ],
154 [ AC_MSG_WARN([cross compiling: cannot test])
158 [ AC_MSG_RESULT(no) ]
160 CFLAGS="$saved_CFLAGS"
161 LDFLAGS="$saved_LDFLAGS"
165 if test -z "$have_llong_max"; then
166 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
167 unset ac_cv_have_decl_LLONG_MAX
168 saved_CFLAGS="$CFLAGS"
169 CFLAGS="$CFLAGS -std=gnu99"
170 AC_CHECK_DECL(LLONG_MAX,
172 [CFLAGS="$saved_CFLAGS"],
173 [#include <limits.h>]
178 if test "x$no_attrib_nonnull" != "x1" ; then
179 AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
183 [ --without-rpath Disable auto-added -R linker paths],
185 if test "x$withval" = "xno" ; then
188 if test "x$withval" = "xyes" ; then
194 # Allow user to specify flags
196 [ --with-cflags Specify additional flags to pass to compiler],
198 if test -n "$withval" && test "x$withval" != "xno" && \
199 test "x${withval}" != "xyes"; then
200 CFLAGS="$CFLAGS $withval"
204 AC_ARG_WITH(cppflags,
205 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
207 if test -n "$withval" && test "x$withval" != "xno" && \
208 test "x${withval}" != "xyes"; then
209 CPPFLAGS="$CPPFLAGS $withval"
214 [ --with-ldflags Specify additional flags to pass to linker],
216 if test -n "$withval" && test "x$withval" != "xno" && \
217 test "x${withval}" != "xyes"; then
218 LDFLAGS="$LDFLAGS $withval"
223 [ --with-libs Specify additional libraries to link with],
225 if test -n "$withval" && test "x$withval" != "xno" && \
226 test "x${withval}" != "xyes"; then
227 LIBS="$LIBS $withval"
232 [ --with-Werror Build main code with -Werror],
234 if test -n "$withval" && test "x$withval" != "xno"; then
235 werror_flags="-Werror"
236 if test "x${withval}" != "xyes"; then
237 werror_flags="$withval"
269 security/pam_appl.h \
309 # lastlog.h requires sys/time.h to be included first on Solaris
310 AC_CHECK_HEADERS(lastlog.h, [], [], [
311 #ifdef HAVE_SYS_TIME_H
312 # include <sys/time.h>
316 # sys/ptms.h requires sys/stream.h to be included first on Solaris
317 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
318 #ifdef HAVE_SYS_STREAM_H
319 # include <sys/stream.h>
323 # login_cap.h requires sys/types.h on NetBSD
324 AC_CHECK_HEADERS(login_cap.h, [], [], [
325 #include <sys/types.h>
328 # older BSDs need sys/param.h before sys/mount.h
329 AC_CHECK_HEADERS(sys/mount.h, [], [], [
330 #include <sys/param.h>
333 # Messages for features tested for in target-specific section
337 # Check for some target-specific stuff
340 # Some versions of VAC won't allow macro redefinitions at
341 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
342 # particularly with older versions of vac or xlc.
343 # It also throws errors about null macro argments, but these are
345 AC_MSG_CHECKING(if compiler allows macro redefinitions)
348 #define testmacro foo
349 #define testmacro bar
350 int main(void) { exit(0); }
352 [ AC_MSG_RESULT(yes) ],
354 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
355 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
356 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
357 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
361 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
362 if (test -z "$blibpath"); then
363 blibpath="/usr/lib:/lib"
365 saved_LDFLAGS="$LDFLAGS"
366 if test "$GCC" = "yes"; then
367 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
369 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
371 for tryflags in $flags ;do
372 if (test -z "$blibflags"); then
373 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
374 AC_TRY_LINK([], [], [blibflags=$tryflags])
377 if (test -z "$blibflags"); then
378 AC_MSG_RESULT(not found)
379 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
381 AC_MSG_RESULT($blibflags)
383 LDFLAGS="$saved_LDFLAGS"
384 dnl Check for authenticate. Might be in libs.a on older AIXes
385 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
386 [Define if you want to enable AIX4's authenticate function])],
387 [AC_CHECK_LIB(s,authenticate,
388 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
392 dnl Check for various auth function declarations in headers.
393 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
394 passwdexpired, setauthdb], , , [#include <usersec.h>])
395 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
396 AC_CHECK_DECLS(loginfailed,
397 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
399 [#include <usersec.h>],
400 [(void)loginfailed("user","host","tty",0);],
402 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
403 [Define if your AIX loginfailed() function
404 takes 4 arguments (AIX >= 5.2)])],
408 [#include <usersec.h>]
410 AC_CHECK_FUNCS(getgrset setauthdb)
411 AC_CHECK_DECL(F_CLOSEM,
412 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
414 [ #include <limits.h>
417 check_for_aix_broken_getaddrinfo=1
418 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
419 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
420 [Define if your platform breaks doing a seteuid before a setuid])
421 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
422 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
423 dnl AIX handles lastlog as part of its login message
424 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
425 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
426 [Some systems need a utmpx entry for /bin/login to work])
427 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
428 [Define to a Set Process Title type if your system is
429 supported by bsd-setproctitle.c])
430 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
431 [AIX 5.2 and 5.3 (and presumably newer) require this])
432 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
435 check_for_libcrypt_later=1
436 LIBS="$LIBS /usr/lib/textreadmode.o"
437 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
438 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
439 AC_DEFINE(DISABLE_SHADOW, 1,
440 [Define if you want to disable shadow passwords])
441 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
442 [Define if X11 doesn't support AF_UNIX sockets on that system])
443 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
444 [Define if the concept of ports only accessible to
445 superusers isn't known])
446 AC_DEFINE(DISABLE_FD_PASSING, 1,
447 [Define if your platform needs to skip post auth
448 file descriptor passing])
449 AC_DEFINE(SSH_IOBUFSZ, 65535, [Windows is sensitive to read buffer size])
452 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
453 [Define if your system choked on IP TOS setting])
454 AC_DEFINE(SETEUID_BREAKS_SETUID)
455 AC_DEFINE(BROKEN_SETREUID)
456 AC_DEFINE(BROKEN_SETREGID)
459 AC_MSG_CHECKING(if we have working getaddrinfo)
460 AC_TRY_RUN([#include <mach-o/dyld.h>
461 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
465 }], [AC_MSG_RESULT(working)],
466 [AC_MSG_RESULT(buggy)
467 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
468 [AC_MSG_RESULT(assume it is working)])
469 AC_DEFINE(SETEUID_BREAKS_SETUID)
470 AC_DEFINE(BROKEN_SETREUID)
471 AC_DEFINE(BROKEN_SETREGID)
472 AC_DEFINE(BROKEN_GLOB, 1, [OS X glob does not do what we expect])
473 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
474 [Define if your resolver libs need this for getrrsetbyname])
475 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
476 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
477 [Use tunnel device compatibility to OpenBSD])
478 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
479 [Prepend the address family to IP tunnel traffic])
480 m4_pattern_allow(AU_IPv)
481 AC_CHECK_DECL(AU_IPv4, [],
482 AC_DEFINE(AU_IPv4, 0, [System only supports IPv4 audit records])
483 [#include <bsm/audit.h>]
484 AC_DEFINE(LASTLOG_WRITE_PUTUTXLINE, 1,
485 [Define if pututxline updates lastlog too])
489 SSHDLIBS="$SSHDLIBS -lcrypt"
493 AC_CHECK_LIB(network, socket)
494 AC_DEFINE(HAVE_U_INT64_T)
498 # first we define all of the options common to all HP-UX releases
499 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
500 IPADDR_IN_DISPLAY=yes
502 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
503 [Define if your login program cannot handle end of options ("--")])
504 AC_DEFINE(LOGIN_NEEDS_UTMPX)
505 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
506 [String used in /etc/passwd to denote locked account])
507 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
508 MAIL="/var/mail/username"
510 AC_CHECK_LIB(xnet, t_error, ,
511 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
513 # next, we define all of the options specific to major releases
516 if test -z "$GCC"; then
521 AC_DEFINE(PAM_SUN_CODEBASE, 1,
522 [Define if you are using Solaris-derived PAM which
523 passes pam_messages to the conversation function
524 with an extra level of indirection])
525 AC_DEFINE(DISABLE_UTMP, 1,
526 [Define if you don't want to use utmp])
527 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
528 check_for_hpux_broken_getaddrinfo=1
529 check_for_conflicting_getspnam=1
533 # lastly, we define options specific to minor releases
536 AC_DEFINE(HAVE_SECUREWARE, 1,
537 [Define if you have SecureWare-based
538 protected password database])
539 disable_ptmx_check=yes
545 PATH="$PATH:/usr/etc"
546 AC_DEFINE(BROKEN_INET_NTOA, 1,
547 [Define if you system's inet_ntoa is busted
548 (e.g. Irix gcc issue)])
549 AC_DEFINE(SETEUID_BREAKS_SETUID)
550 AC_DEFINE(BROKEN_SETREUID)
551 AC_DEFINE(BROKEN_SETREGID)
552 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
553 [Define if you shouldn't strip 'tty' from your
555 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
558 PATH="$PATH:/usr/etc"
559 AC_DEFINE(WITH_IRIX_ARRAY, 1,
560 [Define if you have/want arrays
561 (cluster-wide session managment, not C arrays)])
562 AC_DEFINE(WITH_IRIX_PROJECT, 1,
563 [Define if you want IRIX project management])
564 AC_DEFINE(WITH_IRIX_AUDIT, 1,
565 [Define if you want IRIX audit trails])
566 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
567 [Define if you want IRIX kernel jobs])])
568 AC_DEFINE(BROKEN_INET_NTOA)
569 AC_DEFINE(SETEUID_BREAKS_SETUID)
570 AC_DEFINE(BROKEN_SETREUID)
571 AC_DEFINE(BROKEN_SETREGID)
572 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
573 AC_DEFINE(WITH_ABBREV_NO_TTY)
574 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
576 *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
577 check_for_libcrypt_later=1
578 AC_DEFINE(PAM_TTY_KLUDGE)
579 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
580 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
581 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
582 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
586 check_for_libcrypt_later=1
587 check_for_openpty_ctty_bug=1
588 AC_DEFINE(PAM_TTY_KLUDGE, 1,
589 [Work around problematic Linux PAM modules handling of PAM_TTY])
590 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
591 [String used in /etc/passwd to denote locked account])
592 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
593 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
594 [Define to whatever link() returns for "not supported"
595 if it doesn't return EOPNOTSUPP.])
596 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
598 AC_DEFINE(LINUX_OOM_ADJUST, 1, [Adjust Linux out-of-memory killer])
599 inet6_default_4in6=yes
602 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
603 [Define if cmsg_type is not passed correctly])
606 # tun(4) forwarding compat code
607 AC_CHECK_HEADERS(linux/if_tun.h)
608 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
609 AC_DEFINE(SSH_TUN_LINUX, 1,
610 [Open tunnel devices the Linux tun/tap way])
611 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
612 [Use tunnel device compatibility to OpenBSD])
613 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
614 [Prepend the address family to IP tunnel traffic])
617 mips-sony-bsd|mips-sony-newsos4)
618 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
622 check_for_libcrypt_before=1
623 if test "x$withval" != "xno" ; then
626 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
627 AC_CHECK_HEADER([net/if_tap.h], ,
628 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
629 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
630 [Prepend the address family to IP tunnel traffic])
633 check_for_libcrypt_later=1
634 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
635 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
636 AC_CHECK_HEADER([net/if_tap.h], ,
637 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
638 AC_DEFINE(BROKEN_GLOB, 1, [FreeBSD glob does not do what we need])
641 AC_DEFINE(SETEUID_BREAKS_SETUID)
642 AC_DEFINE(BROKEN_SETREUID)
643 AC_DEFINE(BROKEN_SETREGID)
646 conf_lastlog_location="/usr/adm/lastlog"
647 conf_utmp_location=/etc/utmp
648 conf_wtmp_location=/usr/adm/wtmp
650 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
651 AC_DEFINE(BROKEN_REALPATH)
653 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
656 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
657 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
658 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
659 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
660 [syslog_r function is safe to use in in a signal handler])
663 if test "x$withval" != "xno" ; then
666 AC_DEFINE(PAM_SUN_CODEBASE)
667 AC_DEFINE(LOGIN_NEEDS_UTMPX)
668 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
669 [Some versions of /bin/login need the TERM supplied
671 AC_DEFINE(PAM_TTY_KLUDGE)
672 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
673 [Define if pam_chauthtok wants real uid set
674 to the unpriv'ed user])
675 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
676 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
677 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
678 [Define if sshd somehow reacquires a controlling TTY
680 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
681 in case the name is longer than 8 chars])
682 AC_DEFINE(BROKEN_TCGETATTR_ICANON, 1, [tcgetattr with ICANON may hang])
683 external_path_file=/etc/default/login
684 # hardwire lastlog location (can't detect it on some versions)
685 conf_lastlog_location="/var/adm/lastlog"
686 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
687 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
688 if test "$sol2ver" -ge 8; then
690 AC_DEFINE(DISABLE_UTMP)
691 AC_DEFINE(DISABLE_WTMP, 1,
692 [Define if you don't want to use wtmp])
696 AC_ARG_WITH(solaris-contracts,
697 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
699 AC_CHECK_LIB(contract, ct_tmpl_activate,
700 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
701 [Define if you have Solaris process contracts])
702 SSHDLIBS="$SSHDLIBS -lcontract"
709 CPPFLAGS="$CPPFLAGS -DSUNOS4"
710 AC_CHECK_FUNCS(getpwanam)
711 AC_DEFINE(PAM_SUN_CODEBASE)
712 conf_utmp_location=/etc/utmp
713 conf_wtmp_location=/var/adm/wtmp
714 conf_lastlog_location=/var/adm/lastlog
720 AC_DEFINE(SSHD_ACQUIRES_CTTY)
721 AC_DEFINE(SETEUID_BREAKS_SETUID)
722 AC_DEFINE(BROKEN_SETREUID)
723 AC_DEFINE(BROKEN_SETREGID)
726 # /usr/ucblib MUST NOT be searched on ReliantUNIX
727 AC_CHECK_LIB(dl, dlsym, ,)
728 # -lresolv needs to be at the end of LIBS or DNS lookups break
729 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
730 IPADDR_IN_DISPLAY=yes
732 AC_DEFINE(IP_TOS_IS_BROKEN)
733 AC_DEFINE(SETEUID_BREAKS_SETUID)
734 AC_DEFINE(BROKEN_SETREUID)
735 AC_DEFINE(BROKEN_SETREGID)
736 AC_DEFINE(SSHD_ACQUIRES_CTTY)
737 external_path_file=/etc/default/login
738 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
739 # Attention: always take care to bind libsocket and libnsl before libc,
740 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
742 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
745 AC_DEFINE(SETEUID_BREAKS_SETUID)
746 AC_DEFINE(BROKEN_SETREUID)
747 AC_DEFINE(BROKEN_SETREGID)
748 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
749 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
751 # UnixWare 7.x, OpenUNIX 8
753 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
754 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
756 AC_DEFINE(SETEUID_BREAKS_SETUID)
757 AC_DEFINE(BROKEN_GETADDRINFO)
758 AC_DEFINE(BROKEN_SETREUID)
759 AC_DEFINE(BROKEN_SETREGID)
760 AC_DEFINE(PASSWD_NEEDS_USERNAME)
762 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
763 TEST_SHELL=/u95/bin/sh
764 AC_DEFINE(BROKEN_LIBIAF, 1,
765 [ia_uinfo routines not supported by OS yet])
766 AC_DEFINE(BROKEN_UPDWTMPX)
767 AC_CHECK_LIB(prot, getluid,[ LIBS="$LIBS -lprot"
768 AC_CHECK_FUNCS(getluid setluid,,,-lprot)
769 AC_DEFINE(HAVE_SECUREWARE)
770 AC_DEFINE(DISABLE_SHADOW)
773 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
774 check_for_libcrypt_later=1
780 # SCO UNIX and OEM versions of SCO UNIX
782 AC_MSG_ERROR("This Platform is no longer supported.")
786 if test -z "$GCC"; then
787 CFLAGS="$CFLAGS -belf"
789 LIBS="$LIBS -lprot -lx -ltinfo -lm"
792 AC_DEFINE(HAVE_SECUREWARE)
793 AC_DEFINE(DISABLE_SHADOW)
794 AC_DEFINE(DISABLE_FD_PASSING)
795 AC_DEFINE(SETEUID_BREAKS_SETUID)
796 AC_DEFINE(BROKEN_GETADDRINFO)
797 AC_DEFINE(BROKEN_SETREUID)
798 AC_DEFINE(BROKEN_SETREGID)
799 AC_DEFINE(WITH_ABBREV_NO_TTY)
800 AC_DEFINE(BROKEN_UPDWTMPX)
801 AC_DEFINE(PASSWD_NEEDS_USERNAME)
802 AC_CHECK_FUNCS(getluid setluid)
807 AC_DEFINE(NO_SSH_LASTLOG, 1,
808 [Define if you don't want to use lastlog in session.c])
809 AC_DEFINE(SETEUID_BREAKS_SETUID)
810 AC_DEFINE(BROKEN_SETREUID)
811 AC_DEFINE(BROKEN_SETREGID)
813 AC_DEFINE(DISABLE_FD_PASSING)
815 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
819 AC_DEFINE(SETEUID_BREAKS_SETUID)
820 AC_DEFINE(BROKEN_SETREUID)
821 AC_DEFINE(BROKEN_SETREGID)
822 AC_DEFINE(WITH_ABBREV_NO_TTY)
824 AC_DEFINE(DISABLE_FD_PASSING)
826 LIBS="$LIBS -lgen -lacid -ldb"
830 AC_DEFINE(SETEUID_BREAKS_SETUID)
831 AC_DEFINE(BROKEN_SETREUID)
832 AC_DEFINE(BROKEN_SETREGID)
834 AC_DEFINE(DISABLE_FD_PASSING)
835 AC_DEFINE(NO_SSH_LASTLOG)
836 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
837 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
841 AC_MSG_CHECKING(for Digital Unix SIA)
844 [ --with-osfsia Enable Digital Unix SIA],
846 if test "x$withval" = "xno" ; then
847 AC_MSG_RESULT(disabled)
852 if test -z "$no_osfsia" ; then
853 if test -f /etc/sia/matrix.conf; then
855 AC_DEFINE(HAVE_OSF_SIA, 1,
856 [Define if you have Digital Unix Security
857 Integration Architecture])
858 AC_DEFINE(DISABLE_LOGIN, 1,
859 [Define if you don't want to use your
860 system's login() call])
861 AC_DEFINE(DISABLE_FD_PASSING)
862 LIBS="$LIBS -lsecurity -ldb -lm -laud"
866 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
867 [String used in /etc/passwd to denote locked account])
870 AC_DEFINE(BROKEN_GETADDRINFO)
871 AC_DEFINE(SETEUID_BREAKS_SETUID)
872 AC_DEFINE(BROKEN_SETREUID)
873 AC_DEFINE(BROKEN_SETREGID)
874 AC_DEFINE(BROKEN_READV_COMPARISON, 1, [Can't do comparisons on readv])
879 AC_DEFINE(NO_X11_UNIX_SOCKETS)
880 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
881 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
882 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
883 AC_DEFINE(DISABLE_LASTLOG)
884 AC_DEFINE(SSHD_ACQUIRES_CTTY)
885 AC_DEFINE(BROKEN_SHADOW_EXPIRE, 1, [QNX shadow support is broken])
886 enable_etc_default_login=no # has incompatible /etc/default/login
889 AC_DEFINE(DISABLE_FD_PASSING)
895 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
896 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
897 AC_DEFINE(NEED_SETPGRP)
898 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
902 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
903 AC_DEFINE(MISSING_HOWMANY)
904 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
908 AC_MSG_CHECKING(compiler and flags for sanity)
914 [ AC_MSG_RESULT(yes) ],
917 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
919 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
922 dnl Checks for header files.
923 # Checks for libraries.
924 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
925 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
927 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
928 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
929 AC_CHECK_LIB(gen, dirname,[
930 AC_CACHE_CHECK([for broken dirname],
931 ac_cv_have_broken_dirname, [
939 int main(int argc, char **argv) {
942 strncpy(buf,"/etc", 32);
944 if (!s || strncmp(s, "/", 32) != 0) {
951 [ ac_cv_have_broken_dirname="no" ],
952 [ ac_cv_have_broken_dirname="yes" ],
953 [ ac_cv_have_broken_dirname="no" ],
957 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
959 AC_DEFINE(HAVE_DIRNAME)
960 AC_CHECK_HEADERS(libgen.h)
965 AC_CHECK_FUNC(getspnam, ,
966 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
967 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
968 [Define if you have the basename function.]))
972 [ --with-zlib=PATH Use zlib in PATH],
973 [ if test "x$withval" = "xno" ; then
974 AC_MSG_ERROR([*** zlib is required ***])
975 elif test "x$withval" != "xyes"; then
976 if test -d "$withval/lib"; then
977 if test -n "${need_dash_r}"; then
978 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
980 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
983 if test -n "${need_dash_r}"; then
984 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
986 LDFLAGS="-L${withval} ${LDFLAGS}"
989 if test -d "$withval/include"; then
990 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
992 CPPFLAGS="-I${withval} ${CPPFLAGS}"
997 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
998 AC_CHECK_LIB(z, deflate, ,
1000 saved_CPPFLAGS="$CPPFLAGS"
1001 saved_LDFLAGS="$LDFLAGS"
1003 dnl Check default zlib install dir
1004 if test -n "${need_dash_r}"; then
1005 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1007 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1009 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1011 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
1013 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1019 AC_ARG_WITH(zlib-version-check,
1020 [ --without-zlib-version-check Disable zlib version check],
1021 [ if test "x$withval" = "xno" ; then
1022 zlib_check_nonfatal=1
1027 AC_MSG_CHECKING(for possibly buggy zlib)
1028 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1033 int a=0, b=0, c=0, d=0, n, v;
1034 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1035 if (n != 3 && n != 4)
1037 v = a*1000000 + b*10000 + c*100 + d;
1038 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1041 if (a == 1 && b == 1 && c >= 4)
1044 /* 1.2.3 and up are OK */
1052 [ AC_MSG_RESULT(yes)
1053 if test -z "$zlib_check_nonfatal" ; then
1054 AC_MSG_ERROR([*** zlib too old - check config.log ***
1055 Your reported zlib version has known security problems. It's possible your
1056 vendor has fixed these problems without changing the version number. If you
1057 are sure this is the case, you can disable the check by running
1058 "./configure --without-zlib-version-check".
1059 If you are in doubt, upgrade zlib to version 1.2.3 or greater.
1060 See http://www.gzip.org/zlib/ for details.])
1062 AC_MSG_WARN([zlib version may have security problems])
1065 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
1069 AC_CHECK_FUNC(strcasecmp,
1070 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
1072 AC_CHECK_FUNCS(utimes,
1073 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
1074 LIBS="$LIBS -lc89"]) ]
1077 dnl Checks for libutil functions
1078 AC_CHECK_HEADERS(libutil.h)
1079 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
1080 [Define if your libraries define login()])])
1081 AC_CHECK_FUNCS(fmt_scaled logout updwtmp logwtmp)
1085 # Check for ALTDIRFUNC glob() extension
1086 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
1087 AC_EGREP_CPP(FOUNDIT,
1090 #ifdef GLOB_ALTDIRFUNC
1095 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
1096 [Define if your system glob() function has
1097 the GLOB_ALTDIRFUNC extension])
1105 # Check for g.gl_matchc glob() extension
1106 AC_MSG_CHECKING(for gl_matchc field in glob_t)
1108 [ #include <glob.h> ],
1109 [glob_t g; g.gl_matchc = 1;],
1111 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1112 [Define if your system glob() function has
1113 gl_matchc options in glob_t])
1121 AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1123 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
1126 #include <sys/types.h>
1128 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
1130 [AC_MSG_RESULT(yes)],
1133 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
1134 [Define if your struct dirent expects you to
1135 allocate extra space for d_name])
1138 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1139 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
1143 AC_MSG_CHECKING([for /proc/pid/fd directory])
1144 if test -d "/proc/$$/fd" ; then
1145 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
1151 # Check whether user wants S/Key support
1154 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
1156 if test "x$withval" != "xno" ; then
1158 if test "x$withval" != "xyes" ; then
1159 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1160 LDFLAGS="$LDFLAGS -L${withval}/lib"
1163 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
1167 AC_MSG_CHECKING([for s/key support])
1172 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
1174 [AC_MSG_RESULT(yes)],
1177 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1179 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1183 [(void)skeychallenge(NULL,"name","",0);],
1185 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1186 [Define if your skeychallenge()
1187 function takes 4 arguments (NetBSD)])],
1194 # Check whether user wants TCP wrappers support
1196 AC_ARG_WITH(tcp-wrappers,
1197 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1199 if test "x$withval" != "xno" ; then
1201 saved_LDFLAGS="$LDFLAGS"
1202 saved_CPPFLAGS="$CPPFLAGS"
1203 if test -n "${withval}" && \
1204 test "x${withval}" != "xyes"; then
1205 if test -d "${withval}/lib"; then
1206 if test -n "${need_dash_r}"; then
1207 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1209 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1212 if test -n "${need_dash_r}"; then
1213 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1215 LDFLAGS="-L${withval} ${LDFLAGS}"
1218 if test -d "${withval}/include"; then
1219 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1221 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1225 AC_MSG_CHECKING(for libwrap)
1228 #include <sys/types.h>
1229 #include <sys/socket.h>
1230 #include <netinet/in.h>
1232 int deny_severity = 0, allow_severity = 0;
1237 AC_DEFINE(LIBWRAP, 1,
1239 TCP Wrappers support])
1240 SSHDLIBS="$SSHDLIBS -lwrap"
1244 AC_MSG_ERROR([*** libwrap missing])
1252 # Check whether user wants libedit support
1254 AC_ARG_WITH(libedit,
1255 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1256 [ if test "x$withval" != "xno" ; then
1257 if test "x$withval" = "xyes" ; then
1258 AC_PATH_PROG(PKGCONFIG, pkg-config, no)
1259 if test "x$PKGCONFIG" != "xno"; then
1260 AC_MSG_CHECKING(if $PKGCONFIG knows about libedit)
1261 if "$PKGCONFIG" libedit; then
1263 use_pkgconfig_for_libedit=yes
1269 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1270 if test -n "${need_dash_r}"; then
1271 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1273 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1276 if test "x$use_pkgconfig_for_libedit" == "xyes"; then
1277 LIBEDIT=`$PKGCONFIG --libs-only-l libedit`
1278 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1280 LIBEDIT="-ledit -lcurses"
1282 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
1283 AC_CHECK_LIB(edit, el_init,
1284 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1288 [ AC_MSG_ERROR(libedit not found) ],
1291 AC_MSG_CHECKING(if libedit version is compatible)
1294 #include <histedit.h>
1298 el_init("", NULL, NULL, NULL);
1302 [ AC_MSG_RESULT(yes) ],
1304 AC_MSG_ERROR(libedit version is not compatible) ]
1311 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1313 AC_MSG_CHECKING(for supported audit module)
1318 dnl Checks for headers, libs and functions
1319 AC_CHECK_HEADERS(bsm/audit.h, [],
1320 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1327 AC_CHECK_LIB(bsm, getaudit, [],
1328 [AC_MSG_ERROR(BSM enabled and required library not found)])
1329 AC_CHECK_FUNCS(getaudit, [],
1330 [AC_MSG_ERROR(BSM enabled and required function not found)])
1331 # These are optional
1332 AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
1333 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1337 AC_MSG_RESULT(debug)
1338 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1344 AC_MSG_ERROR([Unknown audit module $withval])
1349 dnl Checks for library functions. Please keep in alphabetical order
1353 arc4random_uniform \
1446 # PKCS#11 support requires dlopen() and co
1447 AC_SEARCH_LIBS(dlopen, dl,
1448 AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])
1451 # IRIX has a const char return value for gai_strerror()
1452 AC_CHECK_FUNCS(gai_strerror,[
1453 AC_DEFINE(HAVE_GAI_STRERROR)
1455 #include <sys/types.h>
1456 #include <sys/socket.h>
1459 const char *gai_strerror(int);],[
1462 str = gai_strerror(0);],[
1463 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1464 [Define if gai_strerror() returns const char *])])])
1466 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1467 [Some systems put nanosleep outside of libc]))
1469 dnl Make sure prototypes are defined for these before using them.
1470 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1471 AC_CHECK_DECL(strsep,
1472 [AC_CHECK_FUNCS(strsep)],
1475 #ifdef HAVE_STRING_H
1476 # include <string.h>
1480 dnl tcsendbreak might be a macro
1481 AC_CHECK_DECL(tcsendbreak,
1482 [AC_DEFINE(HAVE_TCSENDBREAK)],
1483 [AC_CHECK_FUNCS(tcsendbreak)],
1484 [#include <termios.h>]
1487 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1489 AC_CHECK_DECLS(SHUT_RD, , ,
1491 #include <sys/types.h>
1492 #include <sys/socket.h>
1495 AC_CHECK_DECLS(O_NONBLOCK, , ,
1497 #include <sys/types.h>
1498 #ifdef HAVE_SYS_STAT_H
1499 # include <sys/stat.h>
1506 AC_CHECK_DECLS(writev, , , [
1507 #include <sys/types.h>
1508 #include <sys/uio.h>
1512 AC_CHECK_DECLS(MAXSYMLINKS, , , [
1513 #include <sys/param.h>
1516 AC_CHECK_DECLS(offsetof, , , [
1520 AC_CHECK_FUNCS(setresuid, [
1521 dnl Some platorms have setresuid that isn't implemented, test for this
1522 AC_MSG_CHECKING(if setresuid seems to work)
1527 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1529 [AC_MSG_RESULT(yes)],
1530 [AC_DEFINE(BROKEN_SETRESUID, 1,
1531 [Define if your setresuid() is broken])
1532 AC_MSG_RESULT(not implemented)],
1533 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1537 AC_CHECK_FUNCS(setresgid, [
1538 dnl Some platorms have setresgid that isn't implemented, test for this
1539 AC_MSG_CHECKING(if setresgid seems to work)
1544 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1546 [AC_MSG_RESULT(yes)],
1547 [AC_DEFINE(BROKEN_SETRESGID, 1,
1548 [Define if your setresgid() is broken])
1549 AC_MSG_RESULT(not implemented)],
1550 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1554 dnl Checks for time functions
1555 AC_CHECK_FUNCS(gettimeofday time)
1556 dnl Checks for utmp functions
1557 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1558 AC_CHECK_FUNCS(utmpname)
1559 dnl Checks for utmpx functions
1560 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline getutxuser pututxline)
1561 AC_CHECK_FUNCS(setutxdb setutxent utmpxname)
1562 dnl Checks for lastlog functions
1563 AC_CHECK_FUNCS(getlastlogxbyname)
1565 AC_CHECK_FUNC(daemon,
1566 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1567 [AC_CHECK_LIB(bsd, daemon,
1568 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1571 AC_CHECK_FUNC(getpagesize,
1572 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1573 [Define if your libraries define getpagesize()])],
1574 [AC_CHECK_LIB(ucb, getpagesize,
1575 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1578 # Check for broken snprintf
1579 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1580 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1584 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1586 [AC_MSG_RESULT(yes)],
1589 AC_DEFINE(BROKEN_SNPRINTF, 1,
1590 [Define if your snprintf is busted])
1591 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1593 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1597 # If we don't have a working asprintf, then we strongly depend on vsnprintf
1598 # returning the right thing on overflow: the number of characters it tried to
1599 # create (as per SUSv3)
1600 if test "x$ac_cv_func_asprintf" != "xyes" && \
1601 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1602 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1605 #include <sys/types.h>
1609 int x_snprintf(char *str,size_t count,const char *fmt,...)
1611 size_t ret; va_list ap;
1612 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1618 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1620 [AC_MSG_RESULT(yes)],
1623 AC_DEFINE(BROKEN_SNPRINTF, 1,
1624 [Define if your snprintf is busted])
1625 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1627 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1631 # On systems where [v]snprintf is broken, but is declared in stdio,
1632 # check that the fmt argument is const char * or just char *.
1633 # This is only useful for when BROKEN_SNPRINTF
1634 AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1635 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1636 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1637 int main(void) { snprintf(0, 0, 0); }
1640 AC_DEFINE(SNPRINTF_CONST, [const],
1641 [Define as const if snprintf() can declare const char *fmt])],
1643 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1645 # Check for missing getpeereid (or equiv) support
1647 if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
1648 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1650 [#include <sys/types.h>
1651 #include <sys/socket.h>],
1652 [int i = SO_PEERCRED;],
1653 [ AC_MSG_RESULT(yes)
1654 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1661 dnl see whether mkstemp() requires XXXXXX
1662 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1663 AC_MSG_CHECKING([for (overly) strict mkstemp])
1667 main() { char template[]="conftest.mkstemp-test";
1668 if (mkstemp(template) == -1)
1670 unlink(template); exit(0);
1678 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1682 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1687 dnl make sure that openpty does not reacquire controlling terminal
1688 if test ! -z "$check_for_openpty_ctty_bug"; then
1689 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1693 #include <sys/fcntl.h>
1694 #include <sys/types.h>
1695 #include <sys/wait.h>
1701 int fd, ptyfd, ttyfd, status;
1704 if (pid < 0) { /* failed */
1706 } else if (pid > 0) { /* parent */
1707 waitpid(pid, &status, 0);
1708 if (WIFEXITED(status))
1709 exit(WEXITSTATUS(status));
1712 } else { /* child */
1713 close(0); close(1); close(2);
1715 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1716 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1718 exit(3); /* Acquired ctty: broken */
1720 exit(0); /* Did not acquire ctty: OK */
1729 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1732 AC_MSG_RESULT(cross-compiling, assuming yes)
1737 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1738 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1739 AC_MSG_CHECKING(if getaddrinfo seems to work)
1743 #include <sys/socket.h>
1746 #include <netinet/in.h>
1748 #define TEST_PORT "2222"
1754 struct addrinfo *gai_ai, *ai, hints;
1755 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1757 memset(&hints, 0, sizeof(hints));
1758 hints.ai_family = PF_UNSPEC;
1759 hints.ai_socktype = SOCK_STREAM;
1760 hints.ai_flags = AI_PASSIVE;
1762 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1764 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1768 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1769 if (ai->ai_family != AF_INET6)
1772 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1773 sizeof(ntop), strport, sizeof(strport),
1774 NI_NUMERICHOST|NI_NUMERICSERV);
1777 if (err == EAI_SYSTEM)
1778 perror("getnameinfo EAI_SYSTEM");
1780 fprintf(stderr, "getnameinfo failed: %s\n",
1785 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1788 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1801 AC_DEFINE(BROKEN_GETADDRINFO)
1804 AC_MSG_RESULT(cross-compiling, assuming yes)
1809 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1810 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1811 AC_MSG_CHECKING(if getaddrinfo seems to work)
1815 #include <sys/socket.h>
1818 #include <netinet/in.h>
1820 #define TEST_PORT "2222"
1826 struct addrinfo *gai_ai, *ai, hints;
1827 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1829 memset(&hints, 0, sizeof(hints));
1830 hints.ai_family = PF_UNSPEC;
1831 hints.ai_socktype = SOCK_STREAM;
1832 hints.ai_flags = AI_PASSIVE;
1834 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1836 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1840 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1841 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1844 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1845 sizeof(ntop), strport, sizeof(strport),
1846 NI_NUMERICHOST|NI_NUMERICSERV);
1848 if (ai->ai_family == AF_INET && err != 0) {
1849 perror("getnameinfo");
1858 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1859 [Define if you have a getaddrinfo that fails
1860 for the all-zeros IPv6 address])
1864 AC_DEFINE(BROKEN_GETADDRINFO)
1867 AC_MSG_RESULT(cross-compiling, assuming no)
1872 if test "x$check_for_conflicting_getspnam" = "x1"; then
1873 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1877 int main(void) {exit(0);}
1884 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1885 [Conflicting defs for getspnam])
1892 # Search for OpenSSL
1893 saved_CPPFLAGS="$CPPFLAGS"
1894 saved_LDFLAGS="$LDFLAGS"
1895 AC_ARG_WITH(ssl-dir,
1896 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1898 if test "x$withval" != "xno" ; then
1901 ./*|../*) withval="`pwd`/$withval"
1903 if test -d "$withval/lib"; then
1904 if test -n "${need_dash_r}"; then
1905 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1907 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1910 if test -n "${need_dash_r}"; then
1911 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1913 LDFLAGS="-L${withval} ${LDFLAGS}"
1916 if test -d "$withval/include"; then
1917 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1919 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1924 LIBS="-lcrypto $LIBS"
1925 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1926 [Define if your ssl headers are included
1927 with #include <openssl/header.h>]),
1929 dnl Check default openssl install dir
1930 if test -n "${need_dash_r}"; then
1931 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1933 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1935 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1936 AC_CHECK_HEADER([openssl/opensslv.h], ,
1937 AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***]))
1938 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1940 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1946 # Determine OpenSSL header version
1947 AC_MSG_CHECKING([OpenSSL header version])
1952 #include <openssl/opensslv.h>
1953 #define DATA "conftest.sslincver"
1958 fd = fopen(DATA,"w");
1962 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1969 ssl_header_ver=`cat conftest.sslincver`
1970 AC_MSG_RESULT($ssl_header_ver)
1973 AC_MSG_RESULT(not found)
1974 AC_MSG_ERROR(OpenSSL version header not found.)
1977 AC_MSG_WARN([cross compiling: not checking])
1981 # Determine OpenSSL library version
1982 AC_MSG_CHECKING([OpenSSL library version])
1987 #include <openssl/opensslv.h>
1988 #include <openssl/crypto.h>
1989 #define DATA "conftest.ssllibver"
1994 fd = fopen(DATA,"w");
1998 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2005 ssl_library_ver=`cat conftest.ssllibver`
2006 AC_MSG_RESULT($ssl_library_ver)
2009 AC_MSG_RESULT(not found)
2010 AC_MSG_ERROR(OpenSSL library not found.)
2013 AC_MSG_WARN([cross compiling: not checking])
2017 AC_ARG_WITH(openssl-header-check,
2018 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2019 [ if test "x$withval" = "xno" ; then
2020 openssl_check_nonfatal=1
2025 # Sanity check OpenSSL headers
2026 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2030 #include <openssl/opensslv.h>
2031 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
2038 if test "x$openssl_check_nonfatal" = "x"; then
2039 AC_MSG_ERROR([Your OpenSSL headers do not match your
2040 library. Check config.log for details.
2041 If you are sure your installation is consistent, you can disable the check
2042 by running "./configure --without-openssl-header-check".
2043 Also see contrib/findssl.sh for help identifying header/library mismatches.
2046 AC_MSG_WARN([Your OpenSSL headers do not match your
2047 library. Check config.log for details.
2048 Also see contrib/findssl.sh for help identifying header/library mismatches.])
2052 AC_MSG_WARN([cross compiling: not checking])
2056 AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2059 #include <openssl/evp.h>
2060 int main(void) { SSLeay_add_all_algorithms(); }
2069 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2072 #include <openssl/evp.h>
2073 int main(void) { SSLeay_add_all_algorithms(); }
2086 AC_ARG_WITH(ssl-engine,
2087 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2088 [ if test "x$withval" != "xno" ; then
2089 AC_MSG_CHECKING(for OpenSSL ENGINE support)
2091 [ #include <openssl/engine.h>],
2093 ENGINE_load_builtin_engines();ENGINE_register_all_complete();
2095 [ AC_MSG_RESULT(yes)
2096 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
2097 [Enable OpenSSL engine support])
2099 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
2104 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2105 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2109 #include <openssl/evp.h>
2110 int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
2117 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2118 [libcrypto is missing AES 192 and 256 bit functions])
2122 AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2126 #include <openssl/evp.h>
2127 int main(void) { if(EVP_DigestUpdate(NULL, NULL,0)) exit(0); }
2134 AC_DEFINE(OPENSSL_EVP_DIGESTUPDATE_VOID, 1,
2135 [Define if EVP_DigestUpdate returns void])
2139 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2140 # because the system crypt() is more featureful.
2141 if test "x$check_for_libcrypt_before" = "x1"; then
2142 AC_CHECK_LIB(crypt, crypt)
2145 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2146 # version in OpenSSL.
2147 if test "x$check_for_libcrypt_later" = "x1"; then
2148 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
2151 # Search for SHA256 support in libc and/or OpenSSL
2152 AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2155 AC_CHECK_LIB(iaf, ia_openinfo, [
2157 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2158 AC_DEFINE(HAVE_LIBIAF, 1,
2159 [Define if system has libiaf that supports set_id])
2164 ### Configure cryptographic random number support
2166 # Check wheter OpenSSL seeds itself
2167 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2171 #include <openssl/rand.h>
2172 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
2175 OPENSSL_SEEDS_ITSELF=yes
2180 # Default to use of the rand helper if OpenSSL doesn't
2185 AC_MSG_WARN([cross compiling: assuming yes])
2186 # This is safe, since all recent OpenSSL versions will
2187 # complain at runtime if not seeded correctly.
2188 OPENSSL_SEEDS_ITSELF=yes
2192 # Check for PAM libs
2195 [ --with-pam Enable PAM support ],
2197 if test "x$withval" != "xno" ; then
2198 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2199 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2200 AC_MSG_ERROR([PAM headers not found])
2204 AC_CHECK_LIB(dl, dlopen, , )
2205 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2206 AC_CHECK_FUNCS(pam_getenvlist)
2207 AC_CHECK_FUNCS(pam_putenv)
2212 SSHDLIBS="$SSHDLIBS -lpam"
2213 AC_DEFINE(USE_PAM, 1,
2214 [Define if you want to enable PAM support])
2216 if test $ac_cv_lib_dl_dlopen = yes; then
2219 # libdl already in LIBS
2222 SSHDLIBS="$SSHDLIBS -ldl"
2230 # Check for older PAM
2231 if test "x$PAM_MSG" = "xyes" ; then
2232 # Check PAM strerror arguments (old PAM)
2233 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2237 #if defined(HAVE_SECURITY_PAM_APPL_H)
2238 #include <security/pam_appl.h>
2239 #elif defined (HAVE_PAM_PAM_APPL_H)
2240 #include <pam/pam_appl.h>
2243 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2244 [AC_MSG_RESULT(no)],
2246 AC_DEFINE(HAVE_OLD_PAM, 1,
2247 [Define if you have an old version of PAM
2248 which takes only one argument to pam_strerror])
2250 PAM_MSG="yes (old library)"
2255 # Do we want to force the use of the rand helper?
2256 AC_ARG_WITH(rand-helper,
2257 [ --with-rand-helper Use subprocess to gather strong randomness ],
2259 if test "x$withval" = "xno" ; then
2260 # Force use of OpenSSL's internal RNG, even if
2261 # the previous test showed it to be unseeded.
2262 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2263 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2264 OPENSSL_SEEDS_ITSELF=yes
2273 # Which randomness source do we use?
2274 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
2276 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2277 [Define if you want OpenSSL's internally seeded PRNG only])
2278 RAND_MSG="OpenSSL internal ONLY"
2279 INSTALL_SSH_RAND_HELPER=""
2280 elif test ! -z "$USE_RAND_HELPER" ; then
2281 # install rand helper
2282 RAND_MSG="ssh-rand-helper"
2283 INSTALL_SSH_RAND_HELPER="yes"
2285 AC_SUBST(INSTALL_SSH_RAND_HELPER)
2287 ### Configuration of ssh-rand-helper
2290 AC_ARG_WITH(prngd-port,
2291 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2300 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2303 if test ! -z "$withval" ; then
2304 PRNGD_PORT="$withval"
2305 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2306 [Port number of PRNGD/EGD random number socket])
2311 # PRNGD Unix domain socket
2312 AC_ARG_WITH(prngd-socket,
2313 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2317 withval="/var/run/egd-pool"
2325 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2329 if test ! -z "$withval" ; then
2330 if test ! -z "$PRNGD_PORT" ; then
2331 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2333 if test ! -r "$withval" ; then
2334 AC_MSG_WARN(Entropy socket is not readable)
2336 PRNGD_SOCKET="$withval"
2337 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2338 [Location of PRNGD/EGD random number socket])
2342 # Check for existing socket only if we don't have a random device already
2343 if test "$USE_RAND_HELPER" = yes ; then
2344 AC_MSG_CHECKING(for PRNGD/EGD socket)
2345 # Insert other locations here
2346 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2347 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2348 PRNGD_SOCKET="$sock"
2349 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2353 if test ! -z "$PRNGD_SOCKET" ; then
2354 AC_MSG_RESULT($PRNGD_SOCKET)
2356 AC_MSG_RESULT(not found)
2362 # Change default command timeout for hashing entropy source
2364 AC_ARG_WITH(entropy-timeout,
2365 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2367 if test -n "$withval" && test "x$withval" != "xno" && \
2368 test "x${withval}" != "xyes"; then
2369 entropy_timeout=$withval
2373 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2374 [Builtin PRNG command timeout])
2376 SSH_PRIVSEP_USER=sshd
2377 AC_ARG_WITH(privsep-user,
2378 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
2380 if test -n "$withval" && test "x$withval" != "xno" && \
2381 test "x${withval}" != "xyes"; then
2382 SSH_PRIVSEP_USER=$withval
2386 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2387 [non-privileged user for privilege separation])
2388 AC_SUBST(SSH_PRIVSEP_USER)
2390 # We do this little dance with the search path to insure
2391 # that programs that we select for use by installed programs
2392 # (which may be run by the super-user) come from trusted
2393 # locations before they come from the user's private area.
2394 # This should help avoid accidentally configuring some
2395 # random version of a program in someone's personal bin.
2399 test -h /bin 2> /dev/null && PATH=/usr/bin
2400 test -d /sbin && PATH=$PATH:/sbin
2401 test -d /usr/sbin && PATH=$PATH:/usr/sbin
2402 PATH=$PATH:/etc:$OPATH
2404 # These programs are used by the command hashing source to gather entropy
2405 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2406 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2407 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2408 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2409 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2410 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2411 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2412 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2413 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2414 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2415 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2416 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2417 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2418 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2419 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2420 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2424 # Where does ssh-rand-helper get its randomness from?
2425 INSTALL_SSH_PRNG_CMDS=""
2426 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2427 if test ! -z "$PRNGD_PORT" ; then
2428 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2429 elif test ! -z "$PRNGD_SOCKET" ; then
2430 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2432 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2433 RAND_HELPER_CMDHASH=yes
2434 INSTALL_SSH_PRNG_CMDS="yes"
2437 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2440 # Cheap hack to ensure NEWS-OS libraries are arranged right.
2441 if test ! -z "$SONY" ; then
2442 LIBS="$LIBS -liberty";
2445 # Check for long long datatypes
2446 AC_CHECK_TYPES([long long, unsigned long long, long double])
2448 # Check datatype sizes
2449 AC_CHECK_SIZEOF(char, 1)
2450 AC_CHECK_SIZEOF(short int, 2)
2451 AC_CHECK_SIZEOF(int, 4)
2452 AC_CHECK_SIZEOF(long int, 4)
2453 AC_CHECK_SIZEOF(long long int, 8)
2455 # Sanity check long long for some platforms (AIX)
2456 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2457 ac_cv_sizeof_long_long_int=0
2460 # compute LLONG_MIN and LLONG_MAX if we don't know them.
2461 if test -z "$have_llong_max"; then
2462 AC_MSG_CHECKING([for max value of long long])
2466 /* Why is this so damn hard? */
2470 #define __USE_ISOC99
2472 #define DATA "conftest.llminmax"
2473 #define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2476 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2477 * we do this the hard way.
2480 fprint_ll(FILE *f, long long n)
2483 int l[sizeof(long long) * 8];
2486 if (fprintf(f, "-") < 0)
2488 for (i = 0; n != 0; i++) {
2489 l[i] = my_abs(n % 10);
2493 if (fprintf(f, "%d", l[--i]) < 0)
2496 if (fprintf(f, " ") < 0)
2503 long long i, llmin, llmax = 0;
2505 if((f = fopen(DATA,"w")) == NULL)
2508 #if defined(LLONG_MIN) && defined(LLONG_MAX)
2509 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2513 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2514 /* This will work on one's complement and two's complement */
2515 for (i = 1; i > llmax; i <<= 1, i++)
2517 llmin = llmax + 1LL; /* wrap */
2521 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2522 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2523 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
2524 fprintf(f, "unknown unknown\n");
2528 if (fprint_ll(f, llmin) < 0)
2530 if (fprint_ll(f, llmax) < 0)
2538 llong_min=`$AWK '{print $1}' conftest.llminmax`
2539 llong_max=`$AWK '{print $2}' conftest.llminmax`
2541 AC_MSG_RESULT($llong_max)
2542 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2543 [max value of long long calculated by configure])
2544 AC_MSG_CHECKING([for min value of long long])
2545 AC_MSG_RESULT($llong_min)
2546 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2547 [min value of long long calculated by configure])
2550 AC_MSG_RESULT(not found)
2553 AC_MSG_WARN([cross compiling: not checking])
2559 # More checks for data types
2560 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2562 [ #include <sys/types.h> ],
2564 [ ac_cv_have_u_int="yes" ],
2565 [ ac_cv_have_u_int="no" ]
2568 if test "x$ac_cv_have_u_int" = "xyes" ; then
2569 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2573 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2575 [ #include <sys/types.h> ],
2576 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2577 [ ac_cv_have_intxx_t="yes" ],
2578 [ ac_cv_have_intxx_t="no" ]
2581 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2582 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2586 if (test -z "$have_intxx_t" && \
2587 test "x$ac_cv_header_stdint_h" = "xyes")
2589 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2591 [ #include <stdint.h> ],
2592 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2594 AC_DEFINE(HAVE_INTXX_T)
2597 [ AC_MSG_RESULT(no) ]
2601 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2604 #include <sys/types.h>
2605 #ifdef HAVE_STDINT_H
2606 # include <stdint.h>
2608 #include <sys/socket.h>
2609 #ifdef HAVE_SYS_BITYPES_H
2610 # include <sys/bitypes.h>
2613 [ int64_t a; a = 1;],
2614 [ ac_cv_have_int64_t="yes" ],
2615 [ ac_cv_have_int64_t="no" ]
2618 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2619 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2622 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2624 [ #include <sys/types.h> ],
2625 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2626 [ ac_cv_have_u_intxx_t="yes" ],
2627 [ ac_cv_have_u_intxx_t="no" ]
2630 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2631 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2635 if test -z "$have_u_intxx_t" ; then
2636 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2638 [ #include <sys/socket.h> ],
2639 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2641 AC_DEFINE(HAVE_U_INTXX_T)
2644 [ AC_MSG_RESULT(no) ]
2648 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2650 [ #include <sys/types.h> ],
2651 [ u_int64_t a; a = 1;],
2652 [ ac_cv_have_u_int64_t="yes" ],
2653 [ ac_cv_have_u_int64_t="no" ]
2656 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2657 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2661 if test -z "$have_u_int64_t" ; then
2662 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2664 [ #include <sys/bitypes.h> ],
2665 [ u_int64_t a; a = 1],
2667 AC_DEFINE(HAVE_U_INT64_T)
2670 [ AC_MSG_RESULT(no) ]
2674 if test -z "$have_u_intxx_t" ; then
2675 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2678 #include <sys/types.h>
2680 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2681 [ ac_cv_have_uintxx_t="yes" ],
2682 [ ac_cv_have_uintxx_t="no" ]
2685 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2686 AC_DEFINE(HAVE_UINTXX_T, 1,
2687 [define if you have uintxx_t data type])
2691 if test -z "$have_uintxx_t" ; then
2692 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2694 [ #include <stdint.h> ],
2695 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2697 AC_DEFINE(HAVE_UINTXX_T)
2700 [ AC_MSG_RESULT(no) ]
2704 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2705 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2707 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2710 #include <sys/bitypes.h>
2713 int8_t a; int16_t b; int32_t c;
2714 u_int8_t e; u_int16_t f; u_int32_t g;
2715 a = b = c = e = f = g = 1;
2718 AC_DEFINE(HAVE_U_INTXX_T)
2719 AC_DEFINE(HAVE_INTXX_T)
2727 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2730 #include <sys/types.h>
2732 [ u_char foo; foo = 125; ],
2733 [ ac_cv_have_u_char="yes" ],
2734 [ ac_cv_have_u_char="no" ]
2737 if test "x$ac_cv_have_u_char" = "xyes" ; then
2738 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2743 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2744 AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t],,,[
2745 #include <sys/types.h>
2746 #ifdef HAVE_SYS_BITYPES_H
2747 #include <sys/bitypes.h>
2749 #ifdef HAVE_SYS_STATFS_H
2750 #include <sys/statfs.h>
2752 #ifdef HAVE_SYS_STATVFS_H
2753 #include <sys/statvfs.h>
2757 AC_CHECK_TYPES([in_addr_t, in_port_t],,,
2758 [#include <sys/types.h>
2759 #include <netinet/in.h>])
2761 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2764 #include <sys/types.h>
2766 [ size_t foo; foo = 1235; ],
2767 [ ac_cv_have_size_t="yes" ],
2768 [ ac_cv_have_size_t="no" ]
2771 if test "x$ac_cv_have_size_t" = "xyes" ; then
2772 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2775 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2778 #include <sys/types.h>
2780 [ ssize_t foo; foo = 1235; ],
2781 [ ac_cv_have_ssize_t="yes" ],
2782 [ ac_cv_have_ssize_t="no" ]
2785 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2786 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2789 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2794 [ clock_t foo; foo = 1235; ],
2795 [ ac_cv_have_clock_t="yes" ],
2796 [ ac_cv_have_clock_t="no" ]
2799 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2800 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2803 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2806 #include <sys/types.h>
2807 #include <sys/socket.h>
2809 [ sa_family_t foo; foo = 1235; ],
2810 [ ac_cv_have_sa_family_t="yes" ],
2813 #include <sys/types.h>
2814 #include <sys/socket.h>
2815 #include <netinet/in.h>
2817 [ sa_family_t foo; foo = 1235; ],
2818 [ ac_cv_have_sa_family_t="yes" ],
2820 [ ac_cv_have_sa_family_t="no" ]
2824 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2825 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2826 [define if you have sa_family_t data type])
2829 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2832 #include <sys/types.h>
2834 [ pid_t foo; foo = 1235; ],
2835 [ ac_cv_have_pid_t="yes" ],
2836 [ ac_cv_have_pid_t="no" ]
2839 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2840 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2843 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2846 #include <sys/types.h>
2848 [ mode_t foo; foo = 1235; ],
2849 [ ac_cv_have_mode_t="yes" ],
2850 [ ac_cv_have_mode_t="no" ]
2853 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2854 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2858 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2861 #include <sys/types.h>
2862 #include <sys/socket.h>
2864 [ struct sockaddr_storage s; ],
2865 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2866 [ ac_cv_have_struct_sockaddr_storage="no" ]
2869 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2870 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2871 [define if you have struct sockaddr_storage data type])
2874 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2877 #include <sys/types.h>
2878 #include <netinet/in.h>
2880 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2881 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2882 [ ac_cv_have_struct_sockaddr_in6="no" ]
2885 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2886 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2887 [define if you have struct sockaddr_in6 data type])
2890 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2893 #include <sys/types.h>
2894 #include <netinet/in.h>
2896 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2897 [ ac_cv_have_struct_in6_addr="yes" ],
2898 [ ac_cv_have_struct_in6_addr="no" ]
2901 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2902 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2903 [define if you have struct in6_addr data type])
2905 dnl Now check for sin6_scope_id
2906 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
2908 #ifdef HAVE_SYS_TYPES_H
2909 #include <sys/types.h>
2911 #include <netinet/in.h>
2915 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2918 #include <sys/types.h>
2919 #include <sys/socket.h>
2922 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2923 [ ac_cv_have_struct_addrinfo="yes" ],
2924 [ ac_cv_have_struct_addrinfo="no" ]
2927 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2928 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2929 [define if you have struct addrinfo data type])
2932 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2934 [ #include <sys/time.h> ],
2935 [ struct timeval tv; tv.tv_sec = 1;],
2936 [ ac_cv_have_struct_timeval="yes" ],
2937 [ ac_cv_have_struct_timeval="no" ]
2940 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2941 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
2942 have_struct_timeval=1
2945 AC_CHECK_TYPES(struct timespec)
2947 # We need int64_t or else certian parts of the compile will fail.
2948 if test "x$ac_cv_have_int64_t" = "xno" && \
2949 test "x$ac_cv_sizeof_long_int" != "x8" && \
2950 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2951 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2952 echo "an alternative compiler (I.E., GCC) before continuing."
2956 dnl test snprintf (broken on SCO w/gcc)
2961 #ifdef HAVE_SNPRINTF
2965 char expected_out[50];
2967 #if (SIZEOF_LONG_INT == 8)
2968 long int num = 0x7fffffffffffffff;
2970 long long num = 0x7fffffffffffffffll;
2972 strcpy(expected_out, "9223372036854775807");
2973 snprintf(buf, mazsize, "%lld", num);
2974 if(strcmp(buf, expected_out) != 0)
2981 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2982 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2986 dnl Checks for structure members
2987 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2988 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2989 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2990 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2991 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2992 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2993 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2994 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2995 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2996 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2997 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2998 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2999 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
3000 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
3001 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
3002 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
3003 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
3005 AC_CHECK_MEMBERS([struct stat.st_blksize])
3006 AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
3007 [Define if we don't have struct __res_state in resolv.h])],
3010 #if HAVE_SYS_TYPES_H
3011 # include <sys/types.h>
3013 #include <netinet/in.h>
3014 #include <arpa/nameser.h>
3018 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3019 ac_cv_have_ss_family_in_struct_ss, [
3022 #include <sys/types.h>
3023 #include <sys/socket.h>
3025 [ struct sockaddr_storage s; s.ss_family = 1; ],
3026 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3027 [ ac_cv_have_ss_family_in_struct_ss="no" ],
3030 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
3031 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
3034 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3035 ac_cv_have___ss_family_in_struct_ss, [
3038 #include <sys/types.h>
3039 #include <sys/socket.h>
3041 [ struct sockaddr_storage s; s.__ss_family = 1; ],
3042 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3043 [ ac_cv_have___ss_family_in_struct_ss="no" ]
3046 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
3047 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
3048 [Fields in struct sockaddr_storage])
3051 AC_CACHE_CHECK([for pw_class field in struct passwd],
3052 ac_cv_have_pw_class_in_struct_passwd, [
3057 [ struct passwd p; p.pw_class = 0; ],
3058 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3059 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
3062 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
3063 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
3064 [Define if your password has a pw_class field])
3067 AC_CACHE_CHECK([for pw_expire field in struct passwd],
3068 ac_cv_have_pw_expire_in_struct_passwd, [
3073 [ struct passwd p; p.pw_expire = 0; ],
3074 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3075 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
3078 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
3079 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
3080 [Define if your password has a pw_expire field])
3083 AC_CACHE_CHECK([for pw_change field in struct passwd],
3084 ac_cv_have_pw_change_in_struct_passwd, [
3089 [ struct passwd p; p.pw_change = 0; ],
3090 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3091 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
3094 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
3095 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
3096 [Define if your password has a pw_change field])
3099 dnl make sure we're using the real structure members and not defines
3100 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3101 ac_cv_have_accrights_in_msghdr, [
3104 #include <sys/types.h>
3105 #include <sys/socket.h>
3106 #include <sys/uio.h>
3108 #ifdef msg_accrights
3109 #error "msg_accrights is a macro"
3113 m.msg_accrights = 0;
3117 [ ac_cv_have_accrights_in_msghdr="yes" ],
3118 [ ac_cv_have_accrights_in_msghdr="no" ]
3121 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
3122 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
3123 [Define if your system uses access rights style
3124 file descriptor passing])
3127 AC_MSG_CHECKING(if struct statvfs.f_fsid is integral type)
3129 #include <sys/types.h>
3130 #include <sys/stat.h>
3131 #ifdef HAVE_SYS_TIME_H
3132 # include <sys/time.h>
3134 #ifdef HAVE_SYS_MOUNT_H
3135 #include <sys/mount.h>
3137 #ifdef HAVE_SYS_STATVFS_H
3138 #include <sys/statvfs.h>
3140 ], [struct statvfs s; s.f_fsid = 0;],
3141 [ AC_MSG_RESULT(yes) ],
3144 AC_MSG_CHECKING(if fsid_t has member val)
3146 #include <sys/types.h>
3147 #include <sys/statvfs.h>],
3148 [fsid_t t; t.val[0] = 0;],
3149 [ AC_MSG_RESULT(yes)
3150 AC_DEFINE(FSID_HAS_VAL, 1, fsid_t has member val) ],
3151 [ AC_MSG_RESULT(no) ])
3153 AC_MSG_CHECKING(if f_fsid has member __val)
3155 #include <sys/types.h>
3156 #include <sys/statvfs.h>],
3157 [fsid_t t; t.__val[0] = 0;],
3158 [ AC_MSG_RESULT(yes)
3159 AC_DEFINE(FSID_HAS___VAL, 1, fsid_t has member __val) ],
3160 [ AC_MSG_RESULT(no) ])
3163 AC_CACHE_CHECK([for msg_control field in struct msghdr],
3164 ac_cv_have_control_in_msghdr, [
3167 #include <sys/types.h>
3168 #include <sys/socket.h>
3169 #include <sys/uio.h>
3172 #error "msg_control is a macro"
3180 [ ac_cv_have_control_in_msghdr="yes" ],
3181 [ ac_cv_have_control_in_msghdr="no" ]
3184 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
3185 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
3186 [Define if your system uses ancillary data style
3187 file descriptor passing])
3190 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
3192 [ extern char *__progname; printf("%s", __progname); ],
3193 [ ac_cv_libc_defines___progname="yes" ],
3194 [ ac_cv_libc_defines___progname="no" ]
3197 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
3198 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
3201 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3205 [ printf("%s", __FUNCTION__); ],
3206 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3207 [ ac_cv_cc_implements___FUNCTION__="no" ]
3210 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
3211 AC_DEFINE(HAVE___FUNCTION__, 1,
3212 [Define if compiler implements __FUNCTION__])
3215 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3219 [ printf("%s", __func__); ],
3220 [ ac_cv_cc_implements___func__="yes" ],
3221 [ ac_cv_cc_implements___func__="no" ]
3224 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
3225 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
3228 AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3230 [#include <stdarg.h>
3233 [ ac_cv_have_va_copy="yes" ],
3234 [ ac_cv_have_va_copy="no" ]
3237 if test "x$ac_cv_have_va_copy" = "xyes" ; then
3238 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3241 AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3243 [#include <stdarg.h>
3246 [ ac_cv_have___va_copy="yes" ],
3247 [ ac_cv_have___va_copy="no" ]
3250 if test "x$ac_cv_have___va_copy" = "xyes" ; then
3251 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3254 AC_CACHE_CHECK([whether getopt has optreset support],
3255 ac_cv_have_getopt_optreset, [
3260 [ extern int optreset; optreset = 0; ],
3261 [ ac_cv_have_getopt_optreset="yes" ],
3262 [ ac_cv_have_getopt_optreset="no" ]
3265 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
3266 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3267 [Define if your getopt(3) defines and uses optreset])
3270 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
3272 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
3273 [ ac_cv_libc_defines_sys_errlist="yes" ],
3274 [ ac_cv_libc_defines_sys_errlist="no" ]
3277 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
3278 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3279 [Define if your system defines sys_errlist[]])
3283 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
3285 [ extern int sys_nerr; printf("%i", sys_nerr);],
3286 [ ac_cv_libc_defines_sys_nerr="yes" ],
3287 [ ac_cv_libc_defines_sys_nerr="no" ]
3290 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
3291 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
3294 # Check libraries needed by DNS fingerprint support
3295 AC_SEARCH_LIBS(getrrsetbyname, resolv,
3296 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3297 [Define if getrrsetbyname() exists])],
3299 # Needed by our getrrsetbyname()
3300 AC_SEARCH_LIBS(res_query, resolv)
3301 AC_SEARCH_LIBS(dn_expand, resolv)
3302 AC_MSG_CHECKING(if res_query will link)
3304 #include "confdefs.h"
3305 #include <sys/types.h>
3306 #include <netinet/in.h>
3307 #include <arpa/nameser.h>
3312 res_query (0, 0, 0, 0, 0);
3319 LIBS="$LIBS -lresolv"
3320 AC_MSG_CHECKING(for res_query in -lresolv)
3322 #include "confdefs.h"
3323 #include <sys/types.h>
3324 #include <netinet/in.h>
3325 #include <arpa/nameser.h>
3330 res_query (0, 0, 0, 0, 0);
3334 [AC_MSG_RESULT(yes)],
3338 AC_CHECK_FUNCS(_getshort _getlong)
3339 AC_CHECK_DECLS([_getshort, _getlong], , ,
3340 [#include <sys/types.h>
3341 #include <arpa/nameser.h>])
3342 AC_CHECK_MEMBER(HEADER.ad,
3343 [AC_DEFINE(HAVE_HEADER_AD, 1,
3344 [Define if HEADER.ad exists in arpa/nameser.h])],,
3345 [#include <arpa/nameser.h>])
3348 AC_MSG_CHECKING(if struct __res_state _res is an extern)
3351 #if HAVE_SYS_TYPES_H
3352 # include <sys/types.h>
3354 #include <netinet/in.h>
3355 #include <arpa/nameser.h>
3357 extern struct __res_state _res;
3358 int main() { return 0; }
3361 AC_DEFINE(HAVE__RES_EXTERN, 1,
3362 [Define if you have struct __res_state _res as an extern])
3364 [ AC_MSG_RESULT(no) ]
3367 # Check whether user wants SELinux support
3370 AC_ARG_WITH(selinux,
3371 [ --with-selinux Enable SELinux support],
3372 [ if test "x$withval" != "xno" ; then
3374 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3376 AC_CHECK_HEADER([selinux/selinux.h], ,
3377 AC_MSG_ERROR(SELinux support requires selinux.h header))
3378 AC_CHECK_LIB(selinux, setexeccon,
3379 [ LIBSELINUX="-lselinux"
3380 LIBS="$LIBS -lselinux"
3382 AC_MSG_ERROR(SELinux support requires libselinux library))
3383 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
3384 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
3389 # Check whether user wants Kerberos 5 support
3391 AC_ARG_WITH(kerberos5,
3392 [ --with-kerberos5=PATH Enable Kerberos 5 support],
3393 [ if test "x$withval" != "xno" ; then
3394 if test "x$withval" = "xyes" ; then
3395 KRB5ROOT="/usr/local"
3400 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
3403 AC_PATH_PROG([KRB5CONF],[krb5-config],
3404 [$KRB5ROOT/bin/krb5-config],
3405 [$KRB5ROOT/bin:$PATH])
3406 if test -x $KRB5CONF ; then
3408 AC_MSG_CHECKING(for gssapi support)
3409 if $KRB5CONF | grep gssapi >/dev/null ; then
3411 AC_DEFINE(GSSAPI, 1,
3412 [Define this if you want GSSAPI
3413 support in the version 2 protocol])
3419 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3420 K5LIBS="`$KRB5CONF --libs $k5confopts`"
3421 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
3422 AC_MSG_CHECKING(whether we are using Heimdal)
3423 AC_TRY_COMPILE([ #include <krb5.h> ],
3424 [ char *tmp = heimdal_version; ],
3425 [ AC_MSG_RESULT(yes)
3426 AC_DEFINE(HEIMDAL, 1,
3427 [Define this if you are using the
3428 Heimdal version of Kerberos V5]) ],
3432 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
3433 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
3434 AC_MSG_CHECKING(whether we are using Heimdal)
3435 AC_TRY_COMPILE([ #include <krb5.h> ],
3436 [ char *tmp = heimdal_version; ],
3437 [ AC_MSG_RESULT(yes)
3439 K5LIBS="-lkrb5 -ldes"
3440 K5LIBS="$K5LIBS -lcom_err -lasn1"
3441 AC_CHECK_LIB(roken, net_write,
3442 [K5LIBS="$K5LIBS -lroken"])
3445 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3448 AC_SEARCH_LIBS(dn_expand, resolv)
3450 AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,
3452 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3453 [ AC_CHECK_LIB(gssapi, gss_init_sec_context,
3455 K5LIBS="-lgssapi $K5LIBS" ],
3456 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3461 AC_CHECK_HEADER(gssapi.h, ,
3462 [ unset ac_cv_header_gssapi_h
3463 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3464 AC_CHECK_HEADERS(gssapi.h, ,
3465 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
3471 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3472 AC_CHECK_HEADER(gssapi_krb5.h, ,
3473 [ CPPFLAGS="$oldCPP" ])
3476 if test ! -z "$need_dash_r" ; then
3477 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3479 if test ! -z "$blibpath" ; then
3480 blibpath="$blibpath:${KRB5ROOT}/lib"
3483 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3484 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3485 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3487 LIBS="$LIBS $K5LIBS"
3488 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3489 [Define this if you want to use libkafs' AFS support]))
3494 # Looking for programs, paths and files
3496 PRIVSEP_PATH=/var/empty
3497 AC_ARG_WITH(privsep-path,
3498 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
3500 if test -n "$withval" && test "x$withval" != "xno" && \
3501 test "x${withval}" != "xyes"; then
3502 PRIVSEP_PATH=$withval
3506 AC_SUBST(PRIVSEP_PATH)
3509 [ --with-xauth=PATH Specify path to xauth program ],
3511 if test -n "$withval" && test "x$withval" != "xno" && \
3512 test "x${withval}" != "xyes"; then
3518 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3519 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3520 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3521 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3522 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3523 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3524 xauth_path="/usr/openwin/bin/xauth"
3530 AC_ARG_ENABLE(strip,
3531 [ --disable-strip Disable calling strip(1) on install],
3533 if test "x$enableval" = "xno" ; then
3540 if test -z "$xauth_path" ; then
3541 XAUTH_PATH="undefined"
3542 AC_SUBST(XAUTH_PATH)
3544 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3545 [Define if xauth is found in your path])
3546 XAUTH_PATH=$xauth_path
3547 AC_SUBST(XAUTH_PATH)
3550 # Check for mail directory (last resort if we cannot get it from headers)
3551 if test ! -z "$MAIL" ; then
3552 maildir=`dirname $MAIL`
3553 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3554 [Set this to your mail directory if you don't have maillock.h])
3557 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3558 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3559 disable_ptmx_check=yes
3561 if test -z "$no_dev_ptmx" ; then
3562 if test "x$disable_ptmx_check" != "xyes" ; then
3563 AC_CHECK_FILE("/dev/ptmx",
3565 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3566 [Define if you have /dev/ptmx])
3573 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3574 AC_CHECK_FILE("/dev/ptc",
3576 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3577 [Define if you have /dev/ptc])
3582 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3585 # Options from here on. Some of these are preset by platform above
3586 AC_ARG_WITH(mantype,
3587 [ --with-mantype=man|cat|doc Set man page type],
3594 AC_MSG_ERROR(invalid man type: $withval)
3599 if test -z "$MANTYPE"; then
3600 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3601 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3602 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3604 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3611 if test "$MANTYPE" = "doc"; then
3618 # Check whether to enable MD5 passwords
3620 AC_ARG_WITH(md5-passwords,
3621 [ --with-md5-passwords Enable use of MD5 passwords],
3623 if test "x$withval" != "xno" ; then
3624 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3625 [Define if you want to allow MD5 passwords])
3631 # Whether to disable shadow password support
3633 [ --without-shadow Disable shadow password support],
3635 if test "x$withval" = "xno" ; then
3636 AC_DEFINE(DISABLE_SHADOW)
3642 if test -z "$disable_shadow" ; then
3643 AC_MSG_CHECKING([if the systems has expire shadow information])
3646 #include <sys/types.h>
3649 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3650 [ sp_expire_available=yes ], []
3653 if test "x$sp_expire_available" = "xyes" ; then
3655 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3656 [Define if you want to use shadow password expire field])
3662 # Use ip address instead of hostname in $DISPLAY
3663 if test ! -z "$IPADDR_IN_DISPLAY" ; then
3664 DISPLAY_HACK_MSG="yes"
3665 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3666 [Define if you need to use IP address
3667 instead of hostname in $DISPLAY])
3669 DISPLAY_HACK_MSG="no"
3670 AC_ARG_WITH(ipaddr-display,
3671 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3673 if test "x$withval" != "xno" ; then
3674 AC_DEFINE(IPADDR_IN_DISPLAY)
3675 DISPLAY_HACK_MSG="yes"
3681 # check for /etc/default/login and use it if present.
3682 AC_ARG_ENABLE(etc-default-login,
3683 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3684 [ if test "x$enableval" = "xno"; then
3685 AC_MSG_NOTICE([/etc/default/login handling disabled])
3686 etc_default_login=no
3688 etc_default_login=yes
3690 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3692 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3693 etc_default_login=no
3695 etc_default_login=yes
3699 if test "x$etc_default_login" != "xno"; then
3700 AC_CHECK_FILE("/etc/default/login",
3701 [ external_path_file=/etc/default/login ])
3702 if test "x$external_path_file" = "x/etc/default/login"; then
3703 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3704 [Define if your system has /etc/default/login])
3708 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3709 if test $ac_cv_func_login_getcapbool = "yes" && \
3710 test $ac_cv_header_login_cap_h = "yes" ; then
3711 external_path_file=/etc/login.conf
3714 # Whether to mess with the default path
3715 SERVER_PATH_MSG="(default)"
3716 AC_ARG_WITH(default-path,
3717 [ --with-default-path= Specify default \$PATH environment for server],
3719 if test "x$external_path_file" = "x/etc/login.conf" ; then
3721 --with-default-path=PATH has no effect on this system.
3722 Edit /etc/login.conf instead.])
3723 elif test "x$withval" != "xno" ; then
3724 if test ! -z "$external_path_file" ; then
3726 --with-default-path=PATH will only be used if PATH is not defined in
3727 $external_path_file .])
3729 user_path="$withval"
3730 SERVER_PATH_MSG="$withval"
3733 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3734 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3736 if test ! -z "$external_path_file" ; then
3738 If PATH is defined in $external_path_file, ensure the path to scp is included,
3739 otherwise scp will not work.])
3743 /* find out what STDPATH is */
3748 #ifndef _PATH_STDPATH
3749 # ifdef _PATH_USERPATH /* Irix */
3750 # define _PATH_STDPATH _PATH_USERPATH
3752 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3755 #include <sys/types.h>
3756 #include <sys/stat.h>
3758 #define DATA "conftest.stdpath"
3765 fd = fopen(DATA,"w");
3769 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3775 [ user_path=`cat conftest.stdpath` ],
3776 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3777 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3779 # make sure $bindir is in USER_PATH so scp will work
3780 t_bindir=`eval echo ${bindir}`
3782 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3785 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3787 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3788 if test $? -ne 0 ; then
3789 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3790 if test $? -ne 0 ; then
3791 user_path=$user_path:$t_bindir
3792 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3797 if test "x$external_path_file" != "x/etc/login.conf" ; then
3798 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
3802 # Set superuser path separately to user path
3803 AC_ARG_WITH(superuser-path,
3804 [ --with-superuser-path= Specify different path for super-user],
3806 if test -n "$withval" && test "x$withval" != "xno" && \
3807 test "x${withval}" != "xyes"; then
3808 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3809 [Define if you want a different $PATH
3811 superuser_path=$withval
3817 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3818 IPV4_IN6_HACK_MSG="no"
3820 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3822 if test "x$withval" != "xno" ; then
3824 AC_DEFINE(IPV4_IN_IPV6, 1,
3825 [Detect IPv4 in IPv6 mapped addresses
3827 IPV4_IN6_HACK_MSG="yes"
3832 if test "x$inet6_default_4in6" = "xyes"; then
3833 AC_MSG_RESULT([yes (default)])
3834 AC_DEFINE(IPV4_IN_IPV6)
3835 IPV4_IN6_HACK_MSG="yes"
3837 AC_MSG_RESULT([no (default)])
3842 # Whether to enable BSD auth support
3844 AC_ARG_WITH(bsd-auth,
3845 [ --with-bsd-auth Enable BSD auth support],
3847 if test "x$withval" != "xno" ; then
3848 AC_DEFINE(BSD_AUTH, 1,
3849 [Define if you have BSD auth support])
3855 # Where to place sshd.pid
3857 # make sure the directory exists
3858 if test ! -d $piddir ; then
3859 piddir=`eval echo ${sysconfdir}`
3861 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3865 AC_ARG_WITH(pid-dir,
3866 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3868 if test -n "$withval" && test "x$withval" != "xno" && \
3869 test "x${withval}" != "xyes"; then
3871 if test ! -d $piddir ; then
3872 AC_MSG_WARN([** no $piddir directory on this system **])
3878 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3881 dnl allow user to disable some login recording features
3882 AC_ARG_ENABLE(lastlog,
3883 [ --disable-lastlog disable use of lastlog even if detected [no]],
3885 if test "x$enableval" = "xno" ; then
3886 AC_DEFINE(DISABLE_LASTLOG)
3891 [ --disable-utmp disable use of utmp even if detected [no]],
3893 if test "x$enableval" = "xno" ; then
3894 AC_DEFINE(DISABLE_UTMP)
3898 AC_ARG_ENABLE(utmpx,
3899 [ --disable-utmpx disable use of utmpx even if detected [no]],
3901 if test "x$enableval" = "xno" ; then
3902 AC_DEFINE(DISABLE_UTMPX, 1,
3903 [Define if you don't want to use utmpx])
3908 [ --disable-wtmp disable use of wtmp even if detected [no]],
3910 if test "x$enableval" = "xno" ; then
3911 AC_DEFINE(DISABLE_WTMP)
3915 AC_ARG_ENABLE(wtmpx,
3916 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3918 if test "x$enableval" = "xno" ; then
3919 AC_DEFINE(DISABLE_WTMPX, 1,
3920 [Define if you don't want to use wtmpx])
3924 AC_ARG_ENABLE(libutil,
3925 [ --disable-libutil disable use of libutil (login() etc.) [no]],
3927 if test "x$enableval" = "xno" ; then
3928 AC_DEFINE(DISABLE_LOGIN)
3932 AC_ARG_ENABLE(pututline,
3933 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
3935 if test "x$enableval" = "xno" ; then
3936 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3937 [Define if you don't want to use pututline()
3938 etc. to write [uw]tmp])
3942 AC_ARG_ENABLE(pututxline,
3943 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
3945 if test "x$enableval" = "xno" ; then
3946 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3947 [Define if you don't want to use pututxline()
3948 etc. to write [uw]tmpx])
3952 AC_ARG_WITH(lastlog,
3953 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3955 if test "x$withval" = "xno" ; then
3956 AC_DEFINE(DISABLE_LASTLOG)
3957 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3958 conf_lastlog_location=$withval
3963 dnl lastlog, [uw]tmpx? detection
3964 dnl NOTE: set the paths in the platform section to avoid the
3965 dnl need for command-line parameters
3966 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3968 dnl lastlog detection
3969 dnl NOTE: the code itself will detect if lastlog is a directory
3970 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3972 #include <sys/types.h>
3974 #ifdef HAVE_LASTLOG_H
3975 # include <lastlog.h>
3984 [ char *lastlog = LASTLOG_FILE; ],
3985 [ AC_MSG_RESULT(yes) ],
3988 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3990 #include <sys/types.h>
3992 #ifdef HAVE_LASTLOG_H
3993 # include <lastlog.h>
3999 [ char *lastlog = _PATH_LASTLOG; ],
4000 [ AC_MSG_RESULT(yes) ],
4003 system_lastlog_path=no
4008 if test -z "$conf_lastlog_location"; then
4009 if test x"$system_lastlog_path" = x"no" ; then
4010 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
4011 if (test -d "$f" || test -f "$f") ; then
4012 conf_lastlog_location=$f
4015 if test -z "$conf_lastlog_location"; then
4016 AC_MSG_WARN([** Cannot find lastlog **])
4017 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
4022 if test -n "$conf_lastlog_location"; then
4023 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
4024 [Define if you want to specify the path to your lastlog file])
4028 AC_MSG_CHECKING([if your system defines UTMP_FILE])
4030 #include <sys/types.h>
4036 [ char *utmp = UTMP_FILE; ],
4037 [ AC_MSG_RESULT(yes) ],
4039 system_utmp_path=no ]
4041 if test -z "$conf_utmp_location"; then
4042 if test x"$system_utmp_path" = x"no" ; then
4043 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4044 if test -f $f ; then
4045 conf_utmp_location=$f
4048 if test -z "$conf_utmp_location"; then
4049 AC_DEFINE(DISABLE_UTMP)
4053 if test -n "$conf_utmp_location"; then
4054 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
4055 [Define if you want to specify the path to your utmp file])
4059 AC_MSG_CHECKING([if your system defines WTMP_FILE])
4061 #include <sys/types.h>
4067 [ char *wtmp = WTMP_FILE; ],
4068 [ AC_MSG_RESULT(yes) ],
4070 system_wtmp_path=no ]
4072 if test -z "$conf_wtmp_location"; then
4073 if test x"$system_wtmp_path" = x"no" ; then
4074 for f in /usr/adm/wtmp /var/log/wtmp; do
4075 if test -f $f ; then
4076 conf_wtmp_location=$f
4079 if test -z "$conf_wtmp_location"; then
4080 AC_DEFINE(DISABLE_WTMP)
4084 if test -n "$conf_wtmp_location"; then
4085 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
4086 [Define if you want to specify the path to your wtmp file])
4091 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
4093 #include <sys/types.h>
4102 [ char *wtmpx = WTMPX_FILE; ],
4103 [ AC_MSG_RESULT(yes) ],
4105 system_wtmpx_path=no ]
4107 if test -z "$conf_wtmpx_location"; then
4108 if test x"$system_wtmpx_path" = x"no" ; then
4109 AC_DEFINE(DISABLE_WTMPX)
4112 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
4113 [Define if you want to specify the path to your wtmpx file])
4117 if test ! -z "$blibpath" ; then
4118 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4119 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
4122 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4124 CFLAGS="$CFLAGS $werror_flags"
4126 if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4131 AC_CHECK_DECL(BROKEN_GETADDRINFO, TEST_SSH_IPV6=no)
4132 AC_SUBST(TEST_SSH_IPV6, $TEST_SSH_IPV6)
4135 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4136 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
4137 ssh_prng_cmds survey.sh])
4140 # Print summary of options
4142 # Someone please show me a better way :)
4143 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4144 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4145 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4146 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
4147 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
4148 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
4149 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
4150 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4151 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4152 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
4155 echo "OpenSSH has been configured with the following options:"
4156 echo " User binaries: $B"
4157 echo " System binaries: $C"
4158 echo " Configuration files: $D"
4159 echo " Askpass program: $E"
4160 echo " Manual pages: $F"
4161 echo " PID file: $G"
4162 echo " Privilege separation chroot path: $H"
4163 if test "x$external_path_file" = "x/etc/login.conf" ; then
4164 echo " At runtime, sshd will use the path defined in $external_path_file"
4165 echo " Make sure the path to scp is present, otherwise scp will not work"
4167 echo " sshd default user PATH: $I"
4168 if test ! -z "$external_path_file"; then
4169 echo " (If PATH is set in $external_path_file it will be used instead. If"
4170 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4173 if test ! -z "$superuser_path" ; then
4174 echo " sshd superuser user PATH: $J"
4176 echo " Manpage format: $MANTYPE"
4177 echo " PAM support: $PAM_MSG"
4178 echo " OSF SIA support: $SIA_MSG"
4179 echo " KerberosV support: $KRB5_MSG"
4180 echo " SELinux support: $SELINUX_MSG"
4181 echo " Smartcard support: $SCARD_MSG"
4182 echo " S/KEY support: $SKEY_MSG"
4183 echo " TCP Wrappers support: $TCPW_MSG"
4184 echo " MD5 password support: $MD5_MSG"
4185 echo " libedit support: $LIBEDIT_MSG"
4186 echo " Solaris process contract support: $SPC_MSG"
4187 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
4188 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4189 echo " BSD Auth support: $BSD_AUTH_MSG"
4190 echo " Random number source: $RAND_MSG"
4191 if test ! -z "$USE_RAND_HELPER" ; then
4192 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
4197 echo " Host: ${host}"
4198 echo " Compiler: ${CC}"
4199 echo " Compiler flags: ${CFLAGS}"
4200 echo "Preprocessor flags: ${CPPFLAGS}"
4201 echo " Linker flags: ${LDFLAGS}"
4202 echo " Libraries: ${LIBS}"
4203 if test ! -z "${SSHDLIBS}"; then
4204 echo " +for sshd: ${SSHDLIBS}"
4209 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
4210 echo "SVR4 style packages are supported with \"make package\""
4214 if test "x$PAM_MSG" = "xyes" ; then
4215 echo "PAM is enabled. You may need to install a PAM control file "
4216 echo "for sshd, otherwise password authentication may fail. "
4217 echo "Example PAM control files can be found in the contrib/ "
4222 if test ! -z "$RAND_HELPER_CMDHASH" ; then
4223 echo "WARNING: you are using the builtin random number collection "
4224 echo "service. Please read WARNING.RNG and request that your OS "
4225 echo "vendor includes kernel-based random number collection in "
4226 echo "future versions of your OS."
4230 if test ! -z "$NO_PEERCHECK" ; then
4231 echo "WARNING: the operating system that you are using does not"
4232 echo "appear to support getpeereid(), getpeerucred() or the"
4233 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4234 echo "enforce security checks to prevent unauthorised connections to"
4235 echo "ssh-agent. Their absence increases the risk that a malicious"
4236 echo "user can connect to your agent."
4240 if test "$AUDIT_MODULE" = "bsm" ; then
4241 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4242 echo "See the Solaris section in README.platform for details."