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$)
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" ;;
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 \
310 # lastlog.h requires sys/time.h to be included first on Solaris
311 AC_CHECK_HEADERS(lastlog.h, [], [], [
312 #ifdef HAVE_SYS_TIME_H
313 # include <sys/time.h>
317 # sys/ptms.h requires sys/stream.h to be included first on Solaris
318 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
319 #ifdef HAVE_SYS_STREAM_H
320 # include <sys/stream.h>
324 # login_cap.h requires sys/types.h on NetBSD
325 AC_CHECK_HEADERS(login_cap.h, [], [], [
326 #include <sys/types.h>
329 # Messages for features tested for in target-specific section
333 # Check for some target-specific stuff
336 # Some versions of VAC won't allow macro redefinitions at
337 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
338 # particularly with older versions of vac or xlc.
339 # It also throws errors about null macro argments, but these are
341 AC_MSG_CHECKING(if compiler allows macro redefinitions)
344 #define testmacro foo
345 #define testmacro bar
346 int main(void) { exit(0); }
348 [ AC_MSG_RESULT(yes) ],
350 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
351 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
352 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
353 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
357 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
358 if (test -z "$blibpath"); then
359 blibpath="/usr/lib:/lib"
361 saved_LDFLAGS="$LDFLAGS"
362 if test "$GCC" = "yes"; then
363 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
365 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
367 for tryflags in $flags ;do
368 if (test -z "$blibflags"); then
369 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
370 AC_TRY_LINK([], [], [blibflags=$tryflags])
373 if (test -z "$blibflags"); then
374 AC_MSG_RESULT(not found)
375 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
377 AC_MSG_RESULT($blibflags)
379 LDFLAGS="$saved_LDFLAGS"
380 dnl Check for authenticate. Might be in libs.a on older AIXes
381 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
382 [Define if you want to enable AIX4's authenticate function])],
383 [AC_CHECK_LIB(s,authenticate,
384 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
388 dnl Check for various auth function declarations in headers.
389 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
390 passwdexpired, setauthdb], , , [#include <usersec.h>])
391 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
392 AC_CHECK_DECLS(loginfailed,
393 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
395 [#include <usersec.h>],
396 [(void)loginfailed("user","host","tty",0);],
398 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
399 [Define if your AIX loginfailed() function
400 takes 4 arguments (AIX >= 5.2)])],
404 [#include <usersec.h>]
406 AC_CHECK_FUNCS(getgrset setauthdb)
407 AC_CHECK_DECL(F_CLOSEM,
408 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
410 [ #include <limits.h>
413 check_for_aix_broken_getaddrinfo=1
414 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
415 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
416 [Define if your platform breaks doing a seteuid before a setuid])
417 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
418 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
419 dnl AIX handles lastlog as part of its login message
420 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
421 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
422 [Some systems need a utmpx entry for /bin/login to work])
423 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
424 [Define to a Set Process Title type if your system is
425 supported by bsd-setproctitle.c])
426 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
427 [AIX 5.2 and 5.3 (and presumably newer) require this])
428 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
431 check_for_libcrypt_later=1
432 LIBS="$LIBS /usr/lib/textreadmode.o"
433 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
434 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
435 AC_DEFINE(DISABLE_SHADOW, 1,
436 [Define if you want to disable shadow passwords])
437 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
438 [Define if your system choked on IP TOS setting])
439 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
440 [Define if X11 doesn't support AF_UNIX sockets on that system])
441 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
442 [Define if the concept of ports only accessible to
443 superusers isn't known])
444 AC_DEFINE(DISABLE_FD_PASSING, 1,
445 [Define if your platform needs to skip post auth
446 file descriptor passing])
449 AC_DEFINE(IP_TOS_IS_BROKEN)
450 AC_DEFINE(SETEUID_BREAKS_SETUID)
451 AC_DEFINE(BROKEN_SETREUID)
452 AC_DEFINE(BROKEN_SETREGID)
455 AC_MSG_CHECKING(if we have working getaddrinfo)
456 AC_TRY_RUN([#include <mach-o/dyld.h>
457 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
461 }], [AC_MSG_RESULT(working)],
462 [AC_MSG_RESULT(buggy)
463 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
464 [AC_MSG_RESULT(assume it is working)])
465 AC_DEFINE(SETEUID_BREAKS_SETUID)
466 AC_DEFINE(BROKEN_SETREUID)
467 AC_DEFINE(BROKEN_SETREGID)
468 AC_DEFINE(BROKEN_GLOB, 1, [OS X glob does not do what we expect])
469 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
470 [Define if your resolver libs need this for getrrsetbyname])
471 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
472 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
473 [Use tunnel device compatibility to OpenBSD])
474 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
475 [Prepend the address family to IP tunnel traffic])
476 AC_MSG_CHECKING(if we have the Security Authorization Session API)
477 AC_TRY_COMPILE([#include <Security/AuthSession.h>],
478 [SessionCreate(0, 0);],
479 [ac_cv_use_security_session_api="yes"
480 AC_DEFINE(USE_SECURITY_SESSION_API, 1,
481 [platform has the Security Authorization Session API])
482 LIBS="$LIBS -framework Security"
484 [ac_cv_use_security_session_api="no"
486 AC_MSG_CHECKING(if we have an in-memory credentials cache)
488 [#include <Kerberos/Kerberos.h>],
490 (void) cc_initialize (&c, 0, NULL, NULL);],
491 [AC_DEFINE(USE_CCAPI, 1,
492 [platform uses an in-memory credentials cache])
493 LIBS="$LIBS -framework Security"
495 if test "x$ac_cv_use_security_session_api" = "xno"; then
496 AC_MSG_ERROR(*** Need a security framework to use the credentials cache API ***)
500 m4_pattern_allow(AU_IPv)
501 AC_CHECK_DECL(AU_IPv4, [],
502 AC_DEFINE(AU_IPv4, 0, [System only supports IPv4 audit records])
503 [#include <bsm/audit.h>]
504 AC_DEFINE(LASTLOG_WRITE_PUTUTXLINE, 1,
505 [Define if pututxline updates lastlog too])
509 SSHDLIBS="$SSHDLIBS -lcrypt"
512 # first we define all of the options common to all HP-UX releases
513 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
514 IPADDR_IN_DISPLAY=yes
516 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
517 [Define if your login program cannot handle end of options ("--")])
518 AC_DEFINE(LOGIN_NEEDS_UTMPX)
519 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
520 [String used in /etc/passwd to denote locked account])
521 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
522 MAIL="/var/mail/username"
524 AC_CHECK_LIB(xnet, t_error, ,
525 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
527 # next, we define all of the options specific to major releases
530 if test -z "$GCC"; then
535 AC_DEFINE(PAM_SUN_CODEBASE, 1,
536 [Define if you are using Solaris-derived PAM which
537 passes pam_messages to the conversation function
538 with an extra level of indirection])
539 AC_DEFINE(DISABLE_UTMP, 1,
540 [Define if you don't want to use utmp])
541 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
542 check_for_hpux_broken_getaddrinfo=1
543 check_for_conflicting_getspnam=1
547 # lastly, we define options specific to minor releases
550 AC_DEFINE(HAVE_SECUREWARE, 1,
551 [Define if you have SecureWare-based
552 protected password database])
553 disable_ptmx_check=yes
559 PATH="$PATH:/usr/etc"
560 AC_DEFINE(BROKEN_INET_NTOA, 1,
561 [Define if you system's inet_ntoa is busted
562 (e.g. Irix gcc issue)])
563 AC_DEFINE(SETEUID_BREAKS_SETUID)
564 AC_DEFINE(BROKEN_SETREUID)
565 AC_DEFINE(BROKEN_SETREGID)
566 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
567 [Define if you shouldn't strip 'tty' from your
569 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
572 PATH="$PATH:/usr/etc"
573 AC_DEFINE(WITH_IRIX_ARRAY, 1,
574 [Define if you have/want arrays
575 (cluster-wide session managment, not C arrays)])
576 AC_DEFINE(WITH_IRIX_PROJECT, 1,
577 [Define if you want IRIX project management])
578 AC_DEFINE(WITH_IRIX_AUDIT, 1,
579 [Define if you want IRIX audit trails])
580 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
581 [Define if you want IRIX kernel jobs])])
582 AC_DEFINE(BROKEN_INET_NTOA)
583 AC_DEFINE(SETEUID_BREAKS_SETUID)
584 AC_DEFINE(BROKEN_SETREUID)
585 AC_DEFINE(BROKEN_SETREGID)
586 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
587 AC_DEFINE(WITH_ABBREV_NO_TTY)
588 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
590 *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
591 check_for_libcrypt_later=1
592 AC_DEFINE(PAM_TTY_KLUDGE)
593 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
594 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
595 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
596 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
600 check_for_libcrypt_later=1
601 check_for_openpty_ctty_bug=1
602 AC_DEFINE(PAM_TTY_KLUDGE, 1,
603 [Work around problematic Linux PAM modules handling of PAM_TTY])
604 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
605 [String used in /etc/passwd to denote locked account])
606 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
607 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
608 [Define to whatever link() returns for "not supported"
609 if it doesn't return EOPNOTSUPP.])
610 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
612 inet6_default_4in6=yes
615 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
616 [Define if cmsg_type is not passed correctly])
619 # tun(4) forwarding compat code
620 AC_CHECK_HEADERS(linux/if_tun.h)
621 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
622 AC_DEFINE(SSH_TUN_LINUX, 1,
623 [Open tunnel devices the Linux tun/tap way])
624 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
625 [Use tunnel device compatibility to OpenBSD])
626 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
627 [Prepend the address family to IP tunnel traffic])
630 mips-sony-bsd|mips-sony-newsos4)
631 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
635 check_for_libcrypt_before=1
636 if test "x$withval" != "xno" ; then
639 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
640 AC_CHECK_HEADER([net/if_tap.h], ,
641 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
642 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
643 [Prepend the address family to IP tunnel traffic])
646 check_for_libcrypt_later=1
647 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
648 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
649 AC_CHECK_HEADER([net/if_tap.h], ,
650 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
651 AC_DEFINE(BROKEN_GLOB, 1, [FreeBSD glob does not do what we need])
654 AC_DEFINE(SETEUID_BREAKS_SETUID)
655 AC_DEFINE(BROKEN_SETREUID)
656 AC_DEFINE(BROKEN_SETREGID)
659 conf_lastlog_location="/usr/adm/lastlog"
660 conf_utmp_location=/etc/utmp
661 conf_wtmp_location=/usr/adm/wtmp
663 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
664 AC_DEFINE(BROKEN_REALPATH)
666 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
669 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
670 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
671 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
672 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
673 [syslog_r function is safe to use in in a signal handler])
676 if test "x$withval" != "xno" ; then
679 AC_DEFINE(PAM_SUN_CODEBASE)
680 AC_DEFINE(LOGIN_NEEDS_UTMPX)
681 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
682 [Some versions of /bin/login need the TERM supplied
684 AC_DEFINE(PAM_TTY_KLUDGE)
685 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
686 [Define if pam_chauthtok wants real uid set
687 to the unpriv'ed user])
688 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
689 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
690 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
691 [Define if sshd somehow reacquires a controlling TTY
693 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
694 in case the name is longer than 8 chars])
695 external_path_file=/etc/default/login
696 # hardwire lastlog location (can't detect it on some versions)
697 conf_lastlog_location="/var/adm/lastlog"
698 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
699 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
700 if test "$sol2ver" -ge 8; then
702 AC_DEFINE(DISABLE_UTMP)
703 AC_DEFINE(DISABLE_WTMP, 1,
704 [Define if you don't want to use wtmp])
708 AC_ARG_WITH(solaris-contracts,
709 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
711 AC_CHECK_LIB(contract, ct_tmpl_activate,
712 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
713 [Define if you have Solaris process contracts])
714 SSHDLIBS="$SSHDLIBS -lcontract"
721 CPPFLAGS="$CPPFLAGS -DSUNOS4"
722 AC_CHECK_FUNCS(getpwanam)
723 AC_DEFINE(PAM_SUN_CODEBASE)
724 conf_utmp_location=/etc/utmp
725 conf_wtmp_location=/var/adm/wtmp
726 conf_lastlog_location=/var/adm/lastlog
732 AC_DEFINE(SSHD_ACQUIRES_CTTY)
733 AC_DEFINE(SETEUID_BREAKS_SETUID)
734 AC_DEFINE(BROKEN_SETREUID)
735 AC_DEFINE(BROKEN_SETREGID)
738 # /usr/ucblib MUST NOT be searched on ReliantUNIX
739 AC_CHECK_LIB(dl, dlsym, ,)
740 # -lresolv needs to be at the end of LIBS or DNS lookups break
741 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
742 IPADDR_IN_DISPLAY=yes
744 AC_DEFINE(IP_TOS_IS_BROKEN)
745 AC_DEFINE(SETEUID_BREAKS_SETUID)
746 AC_DEFINE(BROKEN_SETREUID)
747 AC_DEFINE(BROKEN_SETREGID)
748 AC_DEFINE(SSHD_ACQUIRES_CTTY)
749 external_path_file=/etc/default/login
750 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
751 # Attention: always take care to bind libsocket and libnsl before libc,
752 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
754 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
757 AC_DEFINE(SETEUID_BREAKS_SETUID)
758 AC_DEFINE(BROKEN_SETREUID)
759 AC_DEFINE(BROKEN_SETREGID)
760 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
761 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
763 # UnixWare 7.x, OpenUNIX 8
765 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
767 AC_DEFINE(SETEUID_BREAKS_SETUID)
768 AC_DEFINE(BROKEN_SETREUID)
769 AC_DEFINE(BROKEN_SETREGID)
770 AC_DEFINE(PASSWD_NEEDS_USERNAME)
772 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
773 TEST_SHELL=/u95/bin/sh
774 AC_DEFINE(BROKEN_LIBIAF, 1,
775 [ia_uinfo routines not supported by OS yet])
776 AC_DEFINE(BROKEN_UPDWTMPX)
777 AC_CHECK_LIB(prot, getluid,[ LIBS="$LIBS -lprot"
778 AC_CHECK_FUNCS(getluid setluid,,,-lprot)
779 AC_DEFINE(HAVE_SECUREWARE)
780 AC_DEFINE(DISABLE_SHADOW)
783 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
784 check_for_libcrypt_later=1
790 # SCO UNIX and OEM versions of SCO UNIX
792 AC_MSG_ERROR("This Platform is no longer supported.")
796 if test -z "$GCC"; then
797 CFLAGS="$CFLAGS -belf"
799 LIBS="$LIBS -lprot -lx -ltinfo -lm"
802 AC_DEFINE(HAVE_SECUREWARE)
803 AC_DEFINE(DISABLE_SHADOW)
804 AC_DEFINE(DISABLE_FD_PASSING)
805 AC_DEFINE(SETEUID_BREAKS_SETUID)
806 AC_DEFINE(BROKEN_SETREUID)
807 AC_DEFINE(BROKEN_SETREGID)
808 AC_DEFINE(WITH_ABBREV_NO_TTY)
809 AC_DEFINE(BROKEN_UPDWTMPX)
810 AC_DEFINE(PASSWD_NEEDS_USERNAME)
811 AC_CHECK_FUNCS(getluid setluid)
816 AC_DEFINE(NO_SSH_LASTLOG, 1,
817 [Define if you don't want to use lastlog in session.c])
818 AC_DEFINE(SETEUID_BREAKS_SETUID)
819 AC_DEFINE(BROKEN_SETREUID)
820 AC_DEFINE(BROKEN_SETREGID)
822 AC_DEFINE(DISABLE_FD_PASSING)
824 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
828 AC_DEFINE(SETEUID_BREAKS_SETUID)
829 AC_DEFINE(BROKEN_SETREUID)
830 AC_DEFINE(BROKEN_SETREGID)
831 AC_DEFINE(WITH_ABBREV_NO_TTY)
833 AC_DEFINE(DISABLE_FD_PASSING)
835 LIBS="$LIBS -lgen -lacid -ldb"
839 AC_DEFINE(SETEUID_BREAKS_SETUID)
840 AC_DEFINE(BROKEN_SETREUID)
841 AC_DEFINE(BROKEN_SETREGID)
843 AC_DEFINE(DISABLE_FD_PASSING)
844 AC_DEFINE(NO_SSH_LASTLOG)
845 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
846 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
850 AC_MSG_CHECKING(for Digital Unix SIA)
853 [ --with-osfsia Enable Digital Unix SIA],
855 if test "x$withval" = "xno" ; then
856 AC_MSG_RESULT(disabled)
861 if test -z "$no_osfsia" ; then
862 if test -f /etc/sia/matrix.conf; then
864 AC_DEFINE(HAVE_OSF_SIA, 1,
865 [Define if you have Digital Unix Security
866 Integration Architecture])
867 AC_DEFINE(DISABLE_LOGIN, 1,
868 [Define if you don't want to use your
869 system's login() call])
870 AC_DEFINE(DISABLE_FD_PASSING)
871 LIBS="$LIBS -lsecurity -ldb -lm -laud"
875 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
876 [String used in /etc/passwd to denote locked account])
879 AC_DEFINE(BROKEN_GETADDRINFO)
880 AC_DEFINE(SETEUID_BREAKS_SETUID)
881 AC_DEFINE(BROKEN_SETREUID)
882 AC_DEFINE(BROKEN_SETREGID)
883 AC_DEFINE(BROKEN_READV_COMPARISON, 1, [Can't do comparisons on readv])
888 AC_DEFINE(NO_X11_UNIX_SOCKETS)
889 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
890 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
891 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
892 AC_DEFINE(DISABLE_LASTLOG)
893 AC_DEFINE(SSHD_ACQUIRES_CTTY)
894 AC_DEFINE(BROKEN_SHADOW_EXPIRE, 1, [QNX shadow support is broken])
895 enable_etc_default_login=no # has incompatible /etc/default/login
898 AC_DEFINE(DISABLE_FD_PASSING)
904 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
905 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
906 AC_DEFINE(NEED_SETPGRP)
907 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
911 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
912 AC_DEFINE(MISSING_HOWMANY)
913 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
917 AC_MSG_CHECKING(compiler and flags for sanity)
923 [ AC_MSG_RESULT(yes) ],
926 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
928 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
931 dnl Checks for header files.
932 # Checks for libraries.
933 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
934 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
936 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
937 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
938 AC_CHECK_LIB(gen, dirname,[
939 AC_CACHE_CHECK([for broken dirname],
940 ac_cv_have_broken_dirname, [
948 int main(int argc, char **argv) {
951 strncpy(buf,"/etc", 32);
953 if (!s || strncmp(s, "/", 32) != 0) {
960 [ ac_cv_have_broken_dirname="no" ],
961 [ ac_cv_have_broken_dirname="yes" ],
962 [ ac_cv_have_broken_dirname="no" ],
966 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
968 AC_DEFINE(HAVE_DIRNAME)
969 AC_CHECK_HEADERS(libgen.h)
974 AC_CHECK_FUNC(getspnam, ,
975 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
976 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
977 [Define if you have the basename function.]))
981 [ --with-zlib=PATH Use zlib in PATH],
982 [ if test "x$withval" = "xno" ; then
983 AC_MSG_ERROR([*** zlib is required ***])
984 elif test "x$withval" != "xyes"; then
985 if test -d "$withval/lib"; then
986 if test -n "${need_dash_r}"; then
987 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
989 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
992 if test -n "${need_dash_r}"; then
993 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
995 LDFLAGS="-L${withval} ${LDFLAGS}"
998 if test -d "$withval/include"; then
999 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1001 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1006 AC_CHECK_LIB(z, deflate, ,
1008 saved_CPPFLAGS="$CPPFLAGS"
1009 saved_LDFLAGS="$LDFLAGS"
1011 dnl Check default zlib install dir
1012 if test -n "${need_dash_r}"; then
1013 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1015 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1017 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1019 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
1021 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1026 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
1028 AC_ARG_WITH(zlib-version-check,
1029 [ --without-zlib-version-check Disable zlib version check],
1030 [ if test "x$withval" = "xno" ; then
1031 zlib_check_nonfatal=1
1036 AC_MSG_CHECKING(for possibly buggy zlib)
1037 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1042 int a=0, b=0, c=0, d=0, n, v;
1043 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1044 if (n != 3 && n != 4)
1046 v = a*1000000 + b*10000 + c*100 + d;
1047 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1050 if (a == 1 && b == 1 && c >= 4)
1053 /* 1.2.3 and up are OK */
1061 [ AC_MSG_RESULT(yes)
1062 if test -z "$zlib_check_nonfatal" ; then
1063 AC_MSG_ERROR([*** zlib too old - check config.log ***
1064 Your reported zlib version has known security problems. It's possible your
1065 vendor has fixed these problems without changing the version number. If you
1066 are sure this is the case, you can disable the check by running
1067 "./configure --without-zlib-version-check".
1068 If you are in doubt, upgrade zlib to version 1.2.3 or greater.
1069 See http://www.gzip.org/zlib/ for details.])
1071 AC_MSG_WARN([zlib version may have security problems])
1074 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
1078 AC_CHECK_FUNC(strcasecmp,
1079 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
1081 AC_CHECK_FUNCS(utimes,
1082 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
1083 LIBS="$LIBS -lc89"]) ]
1086 dnl Checks for libutil functions
1087 AC_CHECK_HEADERS(libutil.h)
1088 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
1089 [Define if your libraries define login()])])
1090 AC_CHECK_FUNCS(fmt_scaled logout updwtmp logwtmp)
1094 # Check for ALTDIRFUNC glob() extension
1095 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
1096 AC_EGREP_CPP(FOUNDIT,
1099 #ifdef GLOB_ALTDIRFUNC
1104 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
1105 [Define if your system glob() function has
1106 the GLOB_ALTDIRFUNC extension])
1114 # Check for g.gl_matchc glob() extension
1115 AC_MSG_CHECKING(for gl_matchc field in glob_t)
1117 [ #include <glob.h> ],
1118 [glob_t g; g.gl_matchc = 1;],
1120 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1121 [Define if your system glob() function has
1122 gl_matchc options in glob_t])
1130 AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1132 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
1135 #include <sys/types.h>
1137 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
1139 [AC_MSG_RESULT(yes)],
1142 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
1143 [Define if your struct dirent expects you to
1144 allocate extra space for d_name])
1147 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1148 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
1152 AC_MSG_CHECKING([for /proc/pid/fd directory])
1153 if test -d "/proc/$$/fd" ; then
1154 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
1160 # Check whether user wants S/Key support
1163 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
1165 if test "x$withval" != "xno" ; then
1167 if test "x$withval" != "xyes" ; then
1168 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1169 LDFLAGS="$LDFLAGS -L${withval}/lib"
1172 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
1176 AC_MSG_CHECKING([for s/key support])
1181 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
1183 [AC_MSG_RESULT(yes)],
1186 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1188 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1192 [(void)skeychallenge(NULL,"name","",0);],
1194 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1195 [Define if your skeychallenge()
1196 function takes 4 arguments (NetBSD)])],
1203 # Check whether user wants TCP wrappers support
1205 AC_ARG_WITH(tcp-wrappers,
1206 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1208 if test "x$withval" != "xno" ; then
1210 saved_LDFLAGS="$LDFLAGS"
1211 saved_CPPFLAGS="$CPPFLAGS"
1212 if test -n "${withval}" && \
1213 test "x${withval}" != "xyes"; then
1214 if test -d "${withval}/lib"; then
1215 if test -n "${need_dash_r}"; then
1216 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1218 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1221 if test -n "${need_dash_r}"; then
1222 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1224 LDFLAGS="-L${withval} ${LDFLAGS}"
1227 if test -d "${withval}/include"; then
1228 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1230 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1234 AC_MSG_CHECKING(for libwrap)
1237 #include <sys/types.h>
1238 #include <sys/socket.h>
1239 #include <netinet/in.h>
1241 int deny_severity = 0, allow_severity = 0;
1246 AC_DEFINE(LIBWRAP, 1,
1248 TCP Wrappers support])
1249 SSHDLIBS="$SSHDLIBS -lwrap"
1253 AC_MSG_ERROR([*** libwrap missing])
1261 # Check whether user wants libedit support
1263 AC_ARG_WITH(libedit,
1264 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1265 [ if test "x$withval" != "xno" ; then
1266 if test "x$withval" != "xyes"; then
1267 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1268 if test -n "${need_dash_r}"; then
1269 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1271 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1274 AC_CHECK_LIB(edit, el_init,
1275 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1276 LIBEDIT="-ledit -lcurses"
1280 [ AC_MSG_ERROR(libedit not found) ],
1283 AC_MSG_CHECKING(if libedit version is compatible)
1286 #include <histedit.h>
1290 el_init("", NULL, NULL, NULL);
1294 [ AC_MSG_RESULT(yes) ],
1296 AC_MSG_ERROR(libedit version is not compatible) ]
1303 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1305 AC_MSG_CHECKING(for supported audit module)
1310 dnl Checks for headers, libs and functions
1311 AC_CHECK_HEADERS(bsm/audit.h, [],
1312 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1319 AC_CHECK_LIB(bsm, getaudit, [],
1320 [AC_MSG_ERROR(BSM enabled and required library not found)])
1321 AC_CHECK_FUNCS(getaudit, [],
1322 [AC_MSG_ERROR(BSM enabled and required function not found)])
1323 # These are optional
1324 AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
1325 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1329 AC_MSG_RESULT(debug)
1330 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1336 AC_MSG_ERROR([Unknown audit module $withval])
1341 dnl Checks for library functions. Please keep in alphabetical order
1345 arc4random_uniform \
1434 # IRIX has a const char return value for gai_strerror()
1435 AC_CHECK_FUNCS(gai_strerror,[
1436 AC_DEFINE(HAVE_GAI_STRERROR)
1438 #include <sys/types.h>
1439 #include <sys/socket.h>
1442 const char *gai_strerror(int);],[
1445 str = gai_strerror(0);],[
1446 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1447 [Define if gai_strerror() returns const char *])])])
1449 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1450 [Some systems put nanosleep outside of libc]))
1452 dnl Make sure prototypes are defined for these before using them.
1453 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1454 AC_CHECK_DECL(strsep,
1455 [AC_CHECK_FUNCS(strsep)],
1458 #ifdef HAVE_STRING_H
1459 # include <string.h>
1463 dnl tcsendbreak might be a macro
1464 AC_CHECK_DECL(tcsendbreak,
1465 [AC_DEFINE(HAVE_TCSENDBREAK)],
1466 [AC_CHECK_FUNCS(tcsendbreak)],
1467 [#include <termios.h>]
1470 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1472 AC_CHECK_DECLS(SHUT_RD, , ,
1474 #include <sys/types.h>
1475 #include <sys/socket.h>
1478 AC_CHECK_DECLS(O_NONBLOCK, , ,
1480 #include <sys/types.h>
1481 #ifdef HAVE_SYS_STAT_H
1482 # include <sys/stat.h>
1489 AC_CHECK_DECLS(writev, , , [
1490 #include <sys/types.h>
1491 #include <sys/uio.h>
1495 AC_CHECK_DECLS(MAXSYMLINKS, , , [
1496 #include <sys/param.h>
1499 AC_CHECK_DECLS(offsetof, , , [
1503 AC_CHECK_FUNCS(setresuid, [
1504 dnl Some platorms have setresuid that isn't implemented, test for this
1505 AC_MSG_CHECKING(if setresuid seems to work)
1510 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1512 [AC_MSG_RESULT(yes)],
1513 [AC_DEFINE(BROKEN_SETRESUID, 1,
1514 [Define if your setresuid() is broken])
1515 AC_MSG_RESULT(not implemented)],
1516 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1520 AC_CHECK_FUNCS(setresgid, [
1521 dnl Some platorms have setresgid that isn't implemented, test for this
1522 AC_MSG_CHECKING(if setresgid seems to work)
1527 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1529 [AC_MSG_RESULT(yes)],
1530 [AC_DEFINE(BROKEN_SETRESGID, 1,
1531 [Define if your setresgid() is broken])
1532 AC_MSG_RESULT(not implemented)],
1533 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1537 dnl Checks for time functions
1538 AC_CHECK_FUNCS(gettimeofday time)
1539 dnl Checks for utmp functions
1540 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1541 AC_CHECK_FUNCS(utmpname)
1542 dnl Checks for utmpx functions
1543 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1544 AC_CHECK_FUNCS(setutxent utmpxname)
1545 dnl Checks for lastlog functions
1546 AC_CHECK_FUNCS(getlastlogxbyname)
1548 AC_CHECK_FUNC(daemon,
1549 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1550 [AC_CHECK_LIB(bsd, daemon,
1551 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1554 AC_CHECK_FUNC(getpagesize,
1555 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1556 [Define if your libraries define getpagesize()])],
1557 [AC_CHECK_LIB(ucb, getpagesize,
1558 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1561 # Check for broken snprintf
1562 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1563 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1567 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1569 [AC_MSG_RESULT(yes)],
1572 AC_DEFINE(BROKEN_SNPRINTF, 1,
1573 [Define if your snprintf is busted])
1574 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1576 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1580 # If we don't have a working asprintf, then we strongly depend on vsnprintf
1581 # returning the right thing on overflow: the number of characters it tried to
1582 # create (as per SUSv3)
1583 if test "x$ac_cv_func_asprintf" != "xyes" && \
1584 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1585 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1588 #include <sys/types.h>
1592 int x_snprintf(char *str,size_t count,const char *fmt,...)
1594 size_t ret; va_list ap;
1595 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1601 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1603 [AC_MSG_RESULT(yes)],
1606 AC_DEFINE(BROKEN_SNPRINTF, 1,
1607 [Define if your snprintf is busted])
1608 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1610 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1614 # On systems where [v]snprintf is broken, but is declared in stdio,
1615 # check that the fmt argument is const char * or just char *.
1616 # This is only useful for when BROKEN_SNPRINTF
1617 AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1618 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1619 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1620 int main(void) { snprintf(0, 0, 0); }
1623 AC_DEFINE(SNPRINTF_CONST, [const],
1624 [Define as const if snprintf() can declare const char *fmt])],
1626 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1628 # Check for missing getpeereid (or equiv) support
1630 if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
1631 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1633 [#include <sys/types.h>
1634 #include <sys/socket.h>],
1635 [int i = SO_PEERCRED;],
1636 [ AC_MSG_RESULT(yes)
1637 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1644 dnl see whether mkstemp() requires XXXXXX
1645 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1646 AC_MSG_CHECKING([for (overly) strict mkstemp])
1650 main() { char template[]="conftest.mkstemp-test";
1651 if (mkstemp(template) == -1)
1653 unlink(template); exit(0);
1661 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1665 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1670 dnl make sure that openpty does not reacquire controlling terminal
1671 if test ! -z "$check_for_openpty_ctty_bug"; then
1672 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1676 #include <sys/fcntl.h>
1677 #include <sys/types.h>
1678 #include <sys/wait.h>
1684 int fd, ptyfd, ttyfd, status;
1687 if (pid < 0) { /* failed */
1689 } else if (pid > 0) { /* parent */
1690 waitpid(pid, &status, 0);
1691 if (WIFEXITED(status))
1692 exit(WEXITSTATUS(status));
1695 } else { /* child */
1696 close(0); close(1); close(2);
1698 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1699 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1701 exit(3); /* Acquired ctty: broken */
1703 exit(0); /* Did not acquire ctty: OK */
1712 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1715 AC_MSG_RESULT(cross-compiling, assuming yes)
1720 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1721 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1722 AC_MSG_CHECKING(if getaddrinfo seems to work)
1726 #include <sys/socket.h>
1729 #include <netinet/in.h>
1731 #define TEST_PORT "2222"
1737 struct addrinfo *gai_ai, *ai, hints;
1738 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1740 memset(&hints, 0, sizeof(hints));
1741 hints.ai_family = PF_UNSPEC;
1742 hints.ai_socktype = SOCK_STREAM;
1743 hints.ai_flags = AI_PASSIVE;
1745 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1747 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1751 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1752 if (ai->ai_family != AF_INET6)
1755 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1756 sizeof(ntop), strport, sizeof(strport),
1757 NI_NUMERICHOST|NI_NUMERICSERV);
1760 if (err == EAI_SYSTEM)
1761 perror("getnameinfo EAI_SYSTEM");
1763 fprintf(stderr, "getnameinfo failed: %s\n",
1768 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1771 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1784 AC_DEFINE(BROKEN_GETADDRINFO)
1787 AC_MSG_RESULT(cross-compiling, assuming yes)
1792 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1793 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1794 AC_MSG_CHECKING(if getaddrinfo seems to work)
1798 #include <sys/socket.h>
1801 #include <netinet/in.h>
1803 #define TEST_PORT "2222"
1809 struct addrinfo *gai_ai, *ai, hints;
1810 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1812 memset(&hints, 0, sizeof(hints));
1813 hints.ai_family = PF_UNSPEC;
1814 hints.ai_socktype = SOCK_STREAM;
1815 hints.ai_flags = AI_PASSIVE;
1817 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1819 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1823 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1824 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1827 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1828 sizeof(ntop), strport, sizeof(strport),
1829 NI_NUMERICHOST|NI_NUMERICSERV);
1831 if (ai->ai_family == AF_INET && err != 0) {
1832 perror("getnameinfo");
1841 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1842 [Define if you have a getaddrinfo that fails
1843 for the all-zeros IPv6 address])
1847 AC_DEFINE(BROKEN_GETADDRINFO)
1850 AC_MSG_RESULT(cross-compiling, assuming no)
1855 if test "x$check_for_conflicting_getspnam" = "x1"; then
1856 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1860 int main(void) {exit(0);}
1867 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1868 [Conflicting defs for getspnam])
1875 # Search for OpenSSL
1876 saved_CPPFLAGS="$CPPFLAGS"
1877 saved_LDFLAGS="$LDFLAGS"
1878 AC_ARG_WITH(ssl-dir,
1879 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1881 if test "x$withval" != "xno" ; then
1884 ./*|../*) withval="`pwd`/$withval"
1886 if test -d "$withval/lib"; then
1887 if test -n "${need_dash_r}"; then
1888 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1890 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1893 if test -n "${need_dash_r}"; then
1894 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1896 LDFLAGS="-L${withval} ${LDFLAGS}"
1899 if test -d "$withval/include"; then
1900 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1902 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1907 LIBS="-lcrypto $LIBS"
1908 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1909 [Define if your ssl headers are included
1910 with #include <openssl/header.h>]),
1912 dnl Check default openssl install dir
1913 if test -n "${need_dash_r}"; then
1914 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1916 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1918 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1919 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1921 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1927 # Determine OpenSSL header version
1928 AC_MSG_CHECKING([OpenSSL header version])
1933 #include <openssl/opensslv.h>
1934 #define DATA "conftest.sslincver"
1939 fd = fopen(DATA,"w");
1943 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1950 ssl_header_ver=`cat conftest.sslincver`
1951 AC_MSG_RESULT($ssl_header_ver)
1954 AC_MSG_RESULT(not found)
1955 AC_MSG_ERROR(OpenSSL version header not found.)
1958 AC_MSG_WARN([cross compiling: not checking])
1962 # Determine OpenSSL library version
1963 AC_MSG_CHECKING([OpenSSL library version])
1968 #include <openssl/opensslv.h>
1969 #include <openssl/crypto.h>
1970 #define DATA "conftest.ssllibver"
1975 fd = fopen(DATA,"w");
1979 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1986 ssl_library_ver=`cat conftest.ssllibver`
1987 AC_MSG_RESULT($ssl_library_ver)
1990 AC_MSG_RESULT(not found)
1991 AC_MSG_ERROR(OpenSSL library not found.)
1994 AC_MSG_WARN([cross compiling: not checking])
1998 AC_ARG_WITH(openssl-header-check,
1999 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2000 [ if test "x$withval" = "xno" ; then
2001 openssl_check_nonfatal=1
2006 # Sanity check OpenSSL headers
2007 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2011 #include <openssl/opensslv.h>
2012 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
2019 if test "x$openssl_check_nonfatal" = "x"; then
2020 AC_MSG_ERROR([Your OpenSSL headers do not match your
2021 library. Check config.log for details.
2022 If you are sure your installation is consistent, you can disable the check
2023 by running "./configure --without-openssl-header-check".
2024 Also see contrib/findssl.sh for help identifying header/library mismatches.
2027 AC_MSG_WARN([Your OpenSSL headers do not match your
2028 library. Check config.log for details.
2029 Also see contrib/findssl.sh for help identifying header/library mismatches.])
2033 AC_MSG_WARN([cross compiling: not checking])
2037 AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2040 #include <openssl/evp.h>
2041 int main(void) { SSLeay_add_all_algorithms(); }
2050 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2053 #include <openssl/evp.h>
2054 int main(void) { SSLeay_add_all_algorithms(); }
2067 AC_ARG_WITH(ssl-engine,
2068 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2069 [ if test "x$withval" != "xno" ; then
2070 AC_MSG_CHECKING(for OpenSSL ENGINE support)
2072 [ #include <openssl/engine.h>],
2074 ENGINE_load_builtin_engines();ENGINE_register_all_complete();
2076 [ AC_MSG_RESULT(yes)
2077 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
2078 [Enable OpenSSL engine support])
2080 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
2085 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2086 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2090 #include <openssl/evp.h>
2091 int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
2098 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2099 [libcrypto is missing AES 192 and 256 bit functions])
2103 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2104 # because the system crypt() is more featureful.
2105 if test "x$check_for_libcrypt_before" = "x1"; then
2106 AC_CHECK_LIB(crypt, crypt)
2109 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2110 # version in OpenSSL.
2111 if test "x$check_for_libcrypt_later" = "x1"; then
2112 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
2115 # Search for SHA256 support in libc and/or OpenSSL
2116 AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2119 AC_CHECK_LIB(iaf, ia_openinfo, [
2121 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2122 AC_DEFINE(HAVE_LIBIAF, 1,
2123 [Define if system has libiaf that supports set_id])
2128 ### Configure cryptographic random number support
2130 # Check wheter OpenSSL seeds itself
2131 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2135 #include <openssl/rand.h>
2136 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
2139 OPENSSL_SEEDS_ITSELF=yes
2144 # Default to use of the rand helper if OpenSSL doesn't
2149 AC_MSG_WARN([cross compiling: assuming yes])
2150 # This is safe, since all recent OpenSSL versions will
2151 # complain at runtime if not seeded correctly.
2152 OPENSSL_SEEDS_ITSELF=yes
2156 # Check for PAM libs
2159 [ --with-pam Enable PAM support ],
2161 if test "x$withval" != "xno" ; then
2162 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2163 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2164 AC_MSG_ERROR([PAM headers not found])
2168 AC_CHECK_LIB(dl, dlopen, , )
2169 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2170 AC_CHECK_FUNCS(pam_getenvlist)
2171 AC_CHECK_FUNCS(pam_putenv)
2176 SSHDLIBS="$SSHDLIBS -lpam"
2177 AC_DEFINE(USE_PAM, 1,
2178 [Define if you want to enable PAM support])
2180 if test $ac_cv_lib_dl_dlopen = yes; then
2183 # libdl already in LIBS
2186 SSHDLIBS="$SSHDLIBS -ldl"
2194 # Check for older PAM
2195 if test "x$PAM_MSG" = "xyes" ; then
2196 # Check PAM strerror arguments (old PAM)
2197 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2201 #if defined(HAVE_SECURITY_PAM_APPL_H)
2202 #include <security/pam_appl.h>
2203 #elif defined (HAVE_PAM_PAM_APPL_H)
2204 #include <pam/pam_appl.h>
2207 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2208 [AC_MSG_RESULT(no)],
2210 AC_DEFINE(HAVE_OLD_PAM, 1,
2211 [Define if you have an old version of PAM
2212 which takes only one argument to pam_strerror])
2214 PAM_MSG="yes (old library)"
2219 # Do we want to force the use of the rand helper?
2220 AC_ARG_WITH(rand-helper,
2221 [ --with-rand-helper Use subprocess to gather strong randomness ],
2223 if test "x$withval" = "xno" ; then
2224 # Force use of OpenSSL's internal RNG, even if
2225 # the previous test showed it to be unseeded.
2226 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2227 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2228 OPENSSL_SEEDS_ITSELF=yes
2237 # Which randomness source do we use?
2238 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
2240 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2241 [Define if you want OpenSSL's internally seeded PRNG only])
2242 RAND_MSG="OpenSSL internal ONLY"
2243 INSTALL_SSH_RAND_HELPER=""
2244 elif test ! -z "$USE_RAND_HELPER" ; then
2245 # install rand helper
2246 RAND_MSG="ssh-rand-helper"
2247 INSTALL_SSH_RAND_HELPER="yes"
2249 AC_SUBST(INSTALL_SSH_RAND_HELPER)
2251 ### Configuration of ssh-rand-helper
2254 AC_ARG_WITH(prngd-port,
2255 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2264 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2267 if test ! -z "$withval" ; then
2268 PRNGD_PORT="$withval"
2269 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2270 [Port number of PRNGD/EGD random number socket])
2275 # PRNGD Unix domain socket
2276 AC_ARG_WITH(prngd-socket,
2277 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2281 withval="/var/run/egd-pool"
2289 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2293 if test ! -z "$withval" ; then
2294 if test ! -z "$PRNGD_PORT" ; then
2295 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2297 if test ! -r "$withval" ; then
2298 AC_MSG_WARN(Entropy socket is not readable)
2300 PRNGD_SOCKET="$withval"
2301 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2302 [Location of PRNGD/EGD random number socket])
2306 # Check for existing socket only if we don't have a random device already
2307 if test "$USE_RAND_HELPER" = yes ; then
2308 AC_MSG_CHECKING(for PRNGD/EGD socket)
2309 # Insert other locations here
2310 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2311 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2312 PRNGD_SOCKET="$sock"
2313 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2317 if test ! -z "$PRNGD_SOCKET" ; then
2318 AC_MSG_RESULT($PRNGD_SOCKET)
2320 AC_MSG_RESULT(not found)
2326 # Change default command timeout for hashing entropy source
2328 AC_ARG_WITH(entropy-timeout,
2329 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2331 if test -n "$withval" && test "x$withval" != "xno" && \
2332 test "x${withval}" != "xyes"; then
2333 entropy_timeout=$withval
2337 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2338 [Builtin PRNG command timeout])
2340 SSH_PRIVSEP_USER=sshd
2341 AC_ARG_WITH(privsep-user,
2342 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
2344 if test -n "$withval" && test "x$withval" != "xno" && \
2345 test "x${withval}" != "xyes"; then
2346 SSH_PRIVSEP_USER=$withval
2350 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2351 [non-privileged user for privilege separation])
2352 AC_SUBST(SSH_PRIVSEP_USER)
2354 # We do this little dance with the search path to insure
2355 # that programs that we select for use by installed programs
2356 # (which may be run by the super-user) come from trusted
2357 # locations before they come from the user's private area.
2358 # This should help avoid accidentally configuring some
2359 # random version of a program in someone's personal bin.
2363 test -h /bin 2> /dev/null && PATH=/usr/bin
2364 test -d /sbin && PATH=$PATH:/sbin
2365 test -d /usr/sbin && PATH=$PATH:/usr/sbin
2366 PATH=$PATH:/etc:$OPATH
2368 # These programs are used by the command hashing source to gather entropy
2369 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2370 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2371 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2372 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2373 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2374 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2375 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2376 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2377 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2378 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2379 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2380 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2381 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2382 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2383 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2384 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2388 # Where does ssh-rand-helper get its randomness from?
2389 INSTALL_SSH_PRNG_CMDS=""
2390 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2391 if test ! -z "$PRNGD_PORT" ; then
2392 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2393 elif test ! -z "$PRNGD_SOCKET" ; then
2394 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2396 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2397 RAND_HELPER_CMDHASH=yes
2398 INSTALL_SSH_PRNG_CMDS="yes"
2401 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2404 # Cheap hack to ensure NEWS-OS libraries are arranged right.
2405 if test ! -z "$SONY" ; then
2406 LIBS="$LIBS -liberty";
2409 # Check for long long datatypes
2410 AC_CHECK_TYPES([long long, unsigned long long, long double])
2412 # Check datatype sizes
2413 AC_CHECK_SIZEOF(char, 1)
2414 AC_CHECK_SIZEOF(short int, 2)
2415 AC_CHECK_SIZEOF(int, 4)
2416 AC_CHECK_SIZEOF(long int, 4)
2417 AC_CHECK_SIZEOF(long long int, 8)
2419 # Sanity check long long for some platforms (AIX)
2420 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2421 ac_cv_sizeof_long_long_int=0
2424 # compute LLONG_MIN and LLONG_MAX if we don't know them.
2425 if test -z "$have_llong_max"; then
2426 AC_MSG_CHECKING([for max value of long long])
2430 /* Why is this so damn hard? */
2434 #define __USE_ISOC99
2436 #define DATA "conftest.llminmax"
2437 #define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2440 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2441 * we do this the hard way.
2444 fprint_ll(FILE *f, long long n)
2447 int l[sizeof(long long) * 8];
2450 if (fprintf(f, "-") < 0)
2452 for (i = 0; n != 0; i++) {
2453 l[i] = my_abs(n % 10);
2457 if (fprintf(f, "%d", l[--i]) < 0)
2460 if (fprintf(f, " ") < 0)
2467 long long i, llmin, llmax = 0;
2469 if((f = fopen(DATA,"w")) == NULL)
2472 #if defined(LLONG_MIN) && defined(LLONG_MAX)
2473 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2477 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2478 /* This will work on one's complement and two's complement */
2479 for (i = 1; i > llmax; i <<= 1, i++)
2481 llmin = llmax + 1LL; /* wrap */
2485 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2486 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2487 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
2488 fprintf(f, "unknown unknown\n");
2492 if (fprint_ll(f, llmin) < 0)
2494 if (fprint_ll(f, llmax) < 0)
2502 llong_min=`$AWK '{print $1}' conftest.llminmax`
2503 llong_max=`$AWK '{print $2}' conftest.llminmax`
2505 AC_MSG_RESULT($llong_max)
2506 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2507 [max value of long long calculated by configure])
2508 AC_MSG_CHECKING([for min value of long long])
2509 AC_MSG_RESULT($llong_min)
2510 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2511 [min value of long long calculated by configure])
2514 AC_MSG_RESULT(not found)
2517 AC_MSG_WARN([cross compiling: not checking])
2523 # More checks for data types
2524 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2526 [ #include <sys/types.h> ],
2528 [ ac_cv_have_u_int="yes" ],
2529 [ ac_cv_have_u_int="no" ]
2532 if test "x$ac_cv_have_u_int" = "xyes" ; then
2533 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2537 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2539 [ #include <sys/types.h> ],
2540 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2541 [ ac_cv_have_intxx_t="yes" ],
2542 [ ac_cv_have_intxx_t="no" ]
2545 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2546 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2550 if (test -z "$have_intxx_t" && \
2551 test "x$ac_cv_header_stdint_h" = "xyes")
2553 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2555 [ #include <stdint.h> ],
2556 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2558 AC_DEFINE(HAVE_INTXX_T)
2561 [ AC_MSG_RESULT(no) ]
2565 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2568 #include <sys/types.h>
2569 #ifdef HAVE_STDINT_H
2570 # include <stdint.h>
2572 #include <sys/socket.h>
2573 #ifdef HAVE_SYS_BITYPES_H
2574 # include <sys/bitypes.h>
2577 [ int64_t a; a = 1;],
2578 [ ac_cv_have_int64_t="yes" ],
2579 [ ac_cv_have_int64_t="no" ]
2582 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2583 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2586 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2588 [ #include <sys/types.h> ],
2589 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2590 [ ac_cv_have_u_intxx_t="yes" ],
2591 [ ac_cv_have_u_intxx_t="no" ]
2594 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2595 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2599 if test -z "$have_u_intxx_t" ; then
2600 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2602 [ #include <sys/socket.h> ],
2603 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2605 AC_DEFINE(HAVE_U_INTXX_T)
2608 [ AC_MSG_RESULT(no) ]
2612 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2614 [ #include <sys/types.h> ],
2615 [ u_int64_t a; a = 1;],
2616 [ ac_cv_have_u_int64_t="yes" ],
2617 [ ac_cv_have_u_int64_t="no" ]
2620 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2621 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2625 if test -z "$have_u_int64_t" ; then
2626 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2628 [ #include <sys/bitypes.h> ],
2629 [ u_int64_t a; a = 1],
2631 AC_DEFINE(HAVE_U_INT64_T)
2634 [ AC_MSG_RESULT(no) ]
2638 if test -z "$have_u_intxx_t" ; then
2639 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2642 #include <sys/types.h>
2644 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2645 [ ac_cv_have_uintxx_t="yes" ],
2646 [ ac_cv_have_uintxx_t="no" ]
2649 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2650 AC_DEFINE(HAVE_UINTXX_T, 1,
2651 [define if you have uintxx_t data type])
2655 if test -z "$have_uintxx_t" ; then
2656 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2658 [ #include <stdint.h> ],
2659 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2661 AC_DEFINE(HAVE_UINTXX_T)
2664 [ AC_MSG_RESULT(no) ]
2668 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2669 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2671 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2674 #include <sys/bitypes.h>
2677 int8_t a; int16_t b; int32_t c;
2678 u_int8_t e; u_int16_t f; u_int32_t g;
2679 a = b = c = e = f = g = 1;
2682 AC_DEFINE(HAVE_U_INTXX_T)
2683 AC_DEFINE(HAVE_INTXX_T)
2691 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2694 #include <sys/types.h>
2696 [ u_char foo; foo = 125; ],
2697 [ ac_cv_have_u_char="yes" ],
2698 [ ac_cv_have_u_char="no" ]
2701 if test "x$ac_cv_have_u_char" = "xyes" ; then
2702 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2707 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2708 AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t],,,[
2709 #include <sys/types.h>
2710 #ifdef HAVE_SYS_BITYPES_H
2711 #include <sys/bitypes.h>
2713 #ifdef HAVE_SYS_STATFS_H
2714 #include <sys/statfs.h>
2716 #ifdef HAVE_SYS_STATVFS_H
2717 #include <sys/statvfs.h>
2721 AC_CHECK_TYPES(in_addr_t,,,
2722 [#include <sys/types.h>
2723 #include <netinet/in.h>])
2725 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2728 #include <sys/types.h>
2730 [ size_t foo; foo = 1235; ],
2731 [ ac_cv_have_size_t="yes" ],
2732 [ ac_cv_have_size_t="no" ]
2735 if test "x$ac_cv_have_size_t" = "xyes" ; then
2736 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2739 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2742 #include <sys/types.h>
2744 [ ssize_t foo; foo = 1235; ],
2745 [ ac_cv_have_ssize_t="yes" ],
2746 [ ac_cv_have_ssize_t="no" ]
2749 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2750 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2753 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2758 [ clock_t foo; foo = 1235; ],
2759 [ ac_cv_have_clock_t="yes" ],
2760 [ ac_cv_have_clock_t="no" ]
2763 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2764 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2767 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2770 #include <sys/types.h>
2771 #include <sys/socket.h>
2773 [ sa_family_t foo; foo = 1235; ],
2774 [ ac_cv_have_sa_family_t="yes" ],
2777 #include <sys/types.h>
2778 #include <sys/socket.h>
2779 #include <netinet/in.h>
2781 [ sa_family_t foo; foo = 1235; ],
2782 [ ac_cv_have_sa_family_t="yes" ],
2784 [ ac_cv_have_sa_family_t="no" ]
2788 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2789 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2790 [define if you have sa_family_t data type])
2793 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2796 #include <sys/types.h>
2798 [ pid_t foo; foo = 1235; ],
2799 [ ac_cv_have_pid_t="yes" ],
2800 [ ac_cv_have_pid_t="no" ]
2803 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2804 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2807 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2810 #include <sys/types.h>
2812 [ mode_t foo; foo = 1235; ],
2813 [ ac_cv_have_mode_t="yes" ],
2814 [ ac_cv_have_mode_t="no" ]
2817 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2818 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2822 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2825 #include <sys/types.h>
2826 #include <sys/socket.h>
2828 [ struct sockaddr_storage s; ],
2829 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2830 [ ac_cv_have_struct_sockaddr_storage="no" ]
2833 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2834 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2835 [define if you have struct sockaddr_storage data type])
2838 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2841 #include <sys/types.h>
2842 #include <netinet/in.h>
2844 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2845 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2846 [ ac_cv_have_struct_sockaddr_in6="no" ]
2849 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2850 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2851 [define if you have struct sockaddr_in6 data type])
2854 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2857 #include <sys/types.h>
2858 #include <netinet/in.h>
2860 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2861 [ ac_cv_have_struct_in6_addr="yes" ],
2862 [ ac_cv_have_struct_in6_addr="no" ]
2865 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2866 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2867 [define if you have struct in6_addr data type])
2869 dnl Now check for sin6_scope_id
2870 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
2872 #ifdef HAVE_SYS_TYPES_H
2873 #include <sys/types.h>
2875 #include <netinet/in.h>
2879 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2882 #include <sys/types.h>
2883 #include <sys/socket.h>
2886 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2887 [ ac_cv_have_struct_addrinfo="yes" ],
2888 [ ac_cv_have_struct_addrinfo="no" ]
2891 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2892 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2893 [define if you have struct addrinfo data type])
2896 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2898 [ #include <sys/time.h> ],
2899 [ struct timeval tv; tv.tv_sec = 1;],
2900 [ ac_cv_have_struct_timeval="yes" ],
2901 [ ac_cv_have_struct_timeval="no" ]
2904 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2905 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
2906 have_struct_timeval=1
2909 AC_CHECK_TYPES(struct timespec)
2911 # We need int64_t or else certian parts of the compile will fail.
2912 if test "x$ac_cv_have_int64_t" = "xno" && \
2913 test "x$ac_cv_sizeof_long_int" != "x8" && \
2914 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2915 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2916 echo "an alternative compiler (I.E., GCC) before continuing."
2920 dnl test snprintf (broken on SCO w/gcc)
2925 #ifdef HAVE_SNPRINTF
2929 char expected_out[50];
2931 #if (SIZEOF_LONG_INT == 8)
2932 long int num = 0x7fffffffffffffff;
2934 long long num = 0x7fffffffffffffffll;
2936 strcpy(expected_out, "9223372036854775807");
2937 snprintf(buf, mazsize, "%lld", num);
2938 if(strcmp(buf, expected_out) != 0)
2945 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2946 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2950 dnl Checks for structure members
2951 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2952 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2953 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2954 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2955 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2956 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2957 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2958 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2959 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2960 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2961 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2962 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2963 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2964 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2965 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2966 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2967 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2969 AC_CHECK_MEMBERS([struct stat.st_blksize])
2970 AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2971 [Define if we don't have struct __res_state in resolv.h])],
2974 #if HAVE_SYS_TYPES_H
2975 # include <sys/types.h>
2977 #include <netinet/in.h>
2978 #include <arpa/nameser.h>
2982 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2983 ac_cv_have_ss_family_in_struct_ss, [
2986 #include <sys/types.h>
2987 #include <sys/socket.h>
2989 [ struct sockaddr_storage s; s.ss_family = 1; ],
2990 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2991 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2994 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2995 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
2998 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2999 ac_cv_have___ss_family_in_struct_ss, [
3002 #include <sys/types.h>
3003 #include <sys/socket.h>
3005 [ struct sockaddr_storage s; s.__ss_family = 1; ],
3006 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3007 [ ac_cv_have___ss_family_in_struct_ss="no" ]
3010 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
3011 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
3012 [Fields in struct sockaddr_storage])
3015 AC_CACHE_CHECK([for pw_class field in struct passwd],
3016 ac_cv_have_pw_class_in_struct_passwd, [
3021 [ struct passwd p; p.pw_class = 0; ],
3022 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3023 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
3026 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
3027 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
3028 [Define if your password has a pw_class field])
3031 AC_CACHE_CHECK([for pw_expire field in struct passwd],
3032 ac_cv_have_pw_expire_in_struct_passwd, [
3037 [ struct passwd p; p.pw_expire = 0; ],
3038 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3039 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
3042 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
3043 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
3044 [Define if your password has a pw_expire field])
3047 AC_CACHE_CHECK([for pw_change field in struct passwd],
3048 ac_cv_have_pw_change_in_struct_passwd, [
3053 [ struct passwd p; p.pw_change = 0; ],
3054 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3055 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
3058 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
3059 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
3060 [Define if your password has a pw_change field])
3063 dnl make sure we're using the real structure members and not defines
3064 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3065 ac_cv_have_accrights_in_msghdr, [
3068 #include <sys/types.h>
3069 #include <sys/socket.h>
3070 #include <sys/uio.h>
3072 #ifdef msg_accrights
3073 #error "msg_accrights is a macro"
3077 m.msg_accrights = 0;
3081 [ ac_cv_have_accrights_in_msghdr="yes" ],
3082 [ ac_cv_have_accrights_in_msghdr="no" ]
3085 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
3086 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
3087 [Define if your system uses access rights style
3088 file descriptor passing])
3091 AC_MSG_CHECKING(if f_fsid has val members)
3093 #include <sys/types.h>
3094 #include <sys/statvfs.h>],
3095 [struct fsid_t t; t.val[0] = 0;],
3096 [ AC_MSG_RESULT(yes)
3097 AC_DEFINE(FSID_HAS_VAL, 1, f_fsid has members) ],
3098 [ AC_MSG_RESULT(no) ]
3101 AC_CACHE_CHECK([for msg_control field in struct msghdr],
3102 ac_cv_have_control_in_msghdr, [
3105 #include <sys/types.h>
3106 #include <sys/socket.h>
3107 #include <sys/uio.h>
3110 #error "msg_control is a macro"
3118 [ ac_cv_have_control_in_msghdr="yes" ],
3119 [ ac_cv_have_control_in_msghdr="no" ]
3122 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
3123 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
3124 [Define if your system uses ancillary data style
3125 file descriptor passing])
3128 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
3130 [ extern char *__progname; printf("%s", __progname); ],
3131 [ ac_cv_libc_defines___progname="yes" ],
3132 [ ac_cv_libc_defines___progname="no" ]
3135 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
3136 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
3139 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3143 [ printf("%s", __FUNCTION__); ],
3144 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3145 [ ac_cv_cc_implements___FUNCTION__="no" ]
3148 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
3149 AC_DEFINE(HAVE___FUNCTION__, 1,
3150 [Define if compiler implements __FUNCTION__])
3153 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3157 [ printf("%s", __func__); ],
3158 [ ac_cv_cc_implements___func__="yes" ],
3159 [ ac_cv_cc_implements___func__="no" ]
3162 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
3163 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
3166 AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3168 [#include <stdarg.h>
3171 [ ac_cv_have_va_copy="yes" ],
3172 [ ac_cv_have_va_copy="no" ]
3175 if test "x$ac_cv_have_va_copy" = "xyes" ; then
3176 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3179 AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3181 [#include <stdarg.h>
3184 [ ac_cv_have___va_copy="yes" ],
3185 [ ac_cv_have___va_copy="no" ]
3188 if test "x$ac_cv_have___va_copy" = "xyes" ; then
3189 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3192 AC_CACHE_CHECK([whether getopt has optreset support],
3193 ac_cv_have_getopt_optreset, [
3198 [ extern int optreset; optreset = 0; ],
3199 [ ac_cv_have_getopt_optreset="yes" ],
3200 [ ac_cv_have_getopt_optreset="no" ]
3203 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
3204 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3205 [Define if your getopt(3) defines and uses optreset])
3208 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
3210 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
3211 [ ac_cv_libc_defines_sys_errlist="yes" ],
3212 [ ac_cv_libc_defines_sys_errlist="no" ]
3215 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
3216 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3217 [Define if your system defines sys_errlist[]])
3221 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
3223 [ extern int sys_nerr; printf("%i", sys_nerr);],
3224 [ ac_cv_libc_defines_sys_nerr="yes" ],
3225 [ ac_cv_libc_defines_sys_nerr="no" ]
3228 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
3229 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
3233 # Check whether user wants sectok support
3235 [ --with-sectok Enable smartcard support using libsectok],
3237 if test "x$withval" != "xno" ; then
3238 if test "x$withval" != "xyes" ; then
3239 CPPFLAGS="$CPPFLAGS -I${withval}"
3240 LDFLAGS="$LDFLAGS -L${withval}"
3241 if test ! -z "$need_dash_r" ; then
3242 LDFLAGS="$LDFLAGS -R${withval}"
3244 if test ! -z "$blibpath" ; then
3245 blibpath="$blibpath:${withval}"
3248 AC_CHECK_HEADERS(sectok.h)
3249 if test "$ac_cv_header_sectok_h" != yes; then
3250 AC_MSG_ERROR(Can't find sectok.h)
3252 AC_CHECK_LIB(sectok, sectok_open)
3253 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3254 AC_MSG_ERROR(Can't find libsectok)
3256 AC_DEFINE(SMARTCARD, 1,
3257 [Define if you want smartcard support])
3258 AC_DEFINE(USE_SECTOK, 1,
3259 [Define if you want smartcard support
3261 SCARD_MSG="yes, using sectok"
3266 # Check whether user wants OpenSC support
3269 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
3271 if test "x$withval" != "xno" ; then
3272 if test "x$withval" != "xyes" ; then
3273 OPENSC_CONFIG=$withval/bin/opensc-config
3275 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3277 if test "$OPENSC_CONFIG" != "no"; then
3278 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3279 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3280 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
3281 LIBS="$LIBS $LIBOPENSC_LIBS"
3282 AC_DEFINE(SMARTCARD)
3283 AC_DEFINE(USE_OPENSC, 1,
3284 [Define if you want smartcard support
3286 SCARD_MSG="yes, using OpenSC"
3292 # Check libraries needed by DNS fingerprint support
3293 AC_SEARCH_LIBS(getrrsetbyname, resolv,
3294 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3295 [Define if getrrsetbyname() exists])],
3297 # Needed by our getrrsetbyname()
3298 AC_SEARCH_LIBS(res_query, resolv)
3299 AC_SEARCH_LIBS(dn_expand, resolv)
3300 AC_MSG_CHECKING(if res_query will link)
3301 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3304 LIBS="$LIBS -lresolv"
3305 AC_MSG_CHECKING(for res_query in -lresolv)
3310 res_query (0, 0, 0, 0, 0);
3314 [LIBS="$LIBS -lresolv"
3315 AC_MSG_RESULT(yes)],
3319 AC_CHECK_FUNCS(_getshort _getlong)
3320 AC_CHECK_DECLS([_getshort, _getlong], , ,
3321 [#include <sys/types.h>
3322 #include <arpa/nameser.h>])
3323 AC_CHECK_MEMBER(HEADER.ad,
3324 [AC_DEFINE(HAVE_HEADER_AD, 1,
3325 [Define if HEADER.ad exists in arpa/nameser.h])],,
3326 [#include <arpa/nameser.h>])
3329 AC_MSG_CHECKING(if struct __res_state _res is an extern)
3332 #if HAVE_SYS_TYPES_H
3333 # include <sys/types.h>
3335 #include <netinet/in.h>
3336 #include <arpa/nameser.h>
3338 extern struct __res_state _res;
3339 int main() { return 0; }
3342 AC_DEFINE(HAVE__RES_EXTERN, 1,
3343 [Define if you have struct __res_state _res as an extern])
3345 [ AC_MSG_RESULT(no) ]
3348 # Check whether user wants SELinux support
3351 AC_ARG_WITH(selinux,
3352 [ --with-selinux Enable SELinux support],
3353 [ if test "x$withval" != "xno" ; then
3355 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3357 AC_CHECK_HEADER([selinux/selinux.h], ,
3358 AC_MSG_ERROR(SELinux support requires selinux.h header))
3359 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3360 AC_MSG_ERROR(SELinux support requires libselinux library))
3361 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
3362 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
3367 # Check whether user wants Kerberos 5 support
3369 AC_ARG_WITH(kerberos5,
3370 [ --with-kerberos5=PATH Enable Kerberos 5 support],
3371 [ if test "x$withval" != "xno" ; then
3372 if test "x$withval" = "xyes" ; then
3373 KRB5ROOT="/usr/local"
3378 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
3381 AC_MSG_CHECKING(for krb5-config)
3382 if test -x $KRB5ROOT/bin/krb5-config ; then
3383 KRB5CONF=$KRB5ROOT/bin/krb5-config
3384 AC_MSG_RESULT($KRB5CONF)
3386 AC_MSG_CHECKING(for gssapi support)
3387 if $KRB5CONF | grep gssapi >/dev/null ; then
3389 AC_DEFINE(GSSAPI, 1,
3390 [Define this if you want GSSAPI
3391 support in the version 2 protocol])
3397 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3398 K5LIBS="`$KRB5CONF --libs $k5confopts`"
3399 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
3400 AC_MSG_CHECKING(whether we are using Heimdal)
3401 AC_TRY_COMPILE([ #include <krb5.h> ],
3402 [ char *tmp = heimdal_version; ],
3403 [ AC_MSG_RESULT(yes)
3404 AC_DEFINE(HEIMDAL, 1,
3405 [Define this if you are using the
3406 Heimdal version of Kerberos V5]) ],
3411 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
3412 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
3413 AC_MSG_CHECKING(whether we are using Heimdal)
3414 AC_TRY_COMPILE([ #include <krb5.h> ],
3415 [ char *tmp = heimdal_version; ],
3416 [ AC_MSG_RESULT(yes)
3418 K5LIBS="-lkrb5 -ldes"
3419 K5LIBS="$K5LIBS -lcom_err -lasn1"
3420 AC_CHECK_LIB(roken, net_write,
3421 [K5LIBS="$K5LIBS -lroken"])
3424 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3427 AC_SEARCH_LIBS(dn_expand, resolv)
3429 AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,
3431 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3432 [ AC_CHECK_LIB(gssapi, gss_init_sec_context,
3434 K5LIBS="-lgssapi $K5LIBS" ],
3435 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3440 AC_CHECK_HEADER(gssapi.h, ,
3441 [ unset ac_cv_header_gssapi_h
3442 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3443 AC_CHECK_HEADERS(gssapi.h, ,
3444 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
3450 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3451 AC_CHECK_HEADER(gssapi_krb5.h, ,
3452 [ CPPFLAGS="$oldCPP" ])
3455 if test ! -z "$need_dash_r" ; then
3456 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3458 if test ! -z "$blibpath" ; then
3459 blibpath="$blibpath:${KRB5ROOT}/lib"
3462 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3463 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3464 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3466 LIBS="$LIBS $K5LIBS"
3467 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3468 [Define this if you want to use libkafs' AFS support]))
3473 # Looking for programs, paths and files
3475 PRIVSEP_PATH=/var/empty
3476 AC_ARG_WITH(privsep-path,
3477 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
3479 if test -n "$withval" && test "x$withval" != "xno" && \
3480 test "x${withval}" != "xyes"; then
3481 PRIVSEP_PATH=$withval
3485 AC_SUBST(PRIVSEP_PATH)
3488 [ --with-xauth=PATH Specify path to xauth program ],
3490 if test -n "$withval" && test "x$withval" != "xno" && \
3491 test "x${withval}" != "xyes"; then
3497 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3498 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3499 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3500 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3501 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3502 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3503 xauth_path="/usr/openwin/bin/xauth"
3509 AC_ARG_ENABLE(strip,
3510 [ --disable-strip Disable calling strip(1) on install],
3512 if test "x$enableval" = "xno" ; then
3519 if test -z "$xauth_path" ; then
3520 XAUTH_PATH="undefined"
3521 AC_SUBST(XAUTH_PATH)
3523 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3524 [Define if xauth is found in your path])
3525 XAUTH_PATH=$xauth_path
3526 AC_SUBST(XAUTH_PATH)
3529 # Check for mail directory (last resort if we cannot get it from headers)
3530 if test ! -z "$MAIL" ; then
3531 maildir=`dirname $MAIL`
3532 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3533 [Set this to your mail directory if you don't have maillock.h])
3536 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3537 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3538 disable_ptmx_check=yes
3540 if test -z "$no_dev_ptmx" ; then
3541 if test "x$disable_ptmx_check" != "xyes" ; then
3542 AC_CHECK_FILE("/dev/ptmx",
3544 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3545 [Define if you have /dev/ptmx])
3552 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3553 AC_CHECK_FILE("/dev/ptc",
3555 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3556 [Define if you have /dev/ptc])
3561 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3564 # Options from here on. Some of these are preset by platform above
3565 AC_ARG_WITH(mantype,
3566 [ --with-mantype=man|cat|doc Set man page type],
3573 AC_MSG_ERROR(invalid man type: $withval)
3578 if test -z "$MANTYPE"; then
3579 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3580 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3581 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3583 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3590 if test "$MANTYPE" = "doc"; then
3597 # Check whether to enable MD5 passwords
3599 AC_ARG_WITH(md5-passwords,
3600 [ --with-md5-passwords Enable use of MD5 passwords],
3602 if test "x$withval" != "xno" ; then
3603 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3604 [Define if you want to allow MD5 passwords])
3610 # Whether to disable shadow password support
3612 [ --without-shadow Disable shadow password support],
3614 if test "x$withval" = "xno" ; then
3615 AC_DEFINE(DISABLE_SHADOW)
3621 if test -z "$disable_shadow" ; then
3622 AC_MSG_CHECKING([if the systems has expire shadow information])
3625 #include <sys/types.h>
3628 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3629 [ sp_expire_available=yes ], []
3632 if test "x$sp_expire_available" = "xyes" ; then
3634 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3635 [Define if you want to use shadow password expire field])
3641 # Use ip address instead of hostname in $DISPLAY
3642 if test ! -z "$IPADDR_IN_DISPLAY" ; then
3643 DISPLAY_HACK_MSG="yes"
3644 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3645 [Define if you need to use IP address
3646 instead of hostname in $DISPLAY])
3648 DISPLAY_HACK_MSG="no"
3649 AC_ARG_WITH(ipaddr-display,
3650 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3652 if test "x$withval" != "xno" ; then
3653 AC_DEFINE(IPADDR_IN_DISPLAY)
3654 DISPLAY_HACK_MSG="yes"
3660 # check for /etc/default/login and use it if present.
3661 AC_ARG_ENABLE(etc-default-login,
3662 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3663 [ if test "x$enableval" = "xno"; then
3664 AC_MSG_NOTICE([/etc/default/login handling disabled])
3665 etc_default_login=no
3667 etc_default_login=yes
3669 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3671 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3672 etc_default_login=no
3674 etc_default_login=yes
3678 if test "x$etc_default_login" != "xno"; then
3679 AC_CHECK_FILE("/etc/default/login",
3680 [ external_path_file=/etc/default/login ])
3681 if test "x$external_path_file" = "x/etc/default/login"; then
3682 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3683 [Define if your system has /etc/default/login])
3687 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3688 if test $ac_cv_func_login_getcapbool = "yes" && \
3689 test $ac_cv_header_login_cap_h = "yes" ; then
3690 external_path_file=/etc/login.conf
3693 # Whether to mess with the default path
3694 SERVER_PATH_MSG="(default)"
3695 AC_ARG_WITH(default-path,
3696 [ --with-default-path= Specify default \$PATH environment for server],
3698 if test "x$external_path_file" = "x/etc/login.conf" ; then
3700 --with-default-path=PATH has no effect on this system.
3701 Edit /etc/login.conf instead.])
3702 elif test "x$withval" != "xno" ; then
3703 if test ! -z "$external_path_file" ; then
3705 --with-default-path=PATH will only be used if PATH is not defined in
3706 $external_path_file .])
3708 user_path="$withval"
3709 SERVER_PATH_MSG="$withval"
3712 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3713 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3715 if test ! -z "$external_path_file" ; then
3717 If PATH is defined in $external_path_file, ensure the path to scp is included,
3718 otherwise scp will not work.])
3722 /* find out what STDPATH is */
3727 #ifndef _PATH_STDPATH
3728 # ifdef _PATH_USERPATH /* Irix */
3729 # define _PATH_STDPATH _PATH_USERPATH
3731 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3734 #include <sys/types.h>
3735 #include <sys/stat.h>
3737 #define DATA "conftest.stdpath"
3744 fd = fopen(DATA,"w");
3748 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3754 [ user_path=`cat conftest.stdpath` ],
3755 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3756 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3758 # make sure $bindir is in USER_PATH so scp will work
3759 t_bindir=`eval echo ${bindir}`
3761 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3764 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3766 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3767 if test $? -ne 0 ; then
3768 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3769 if test $? -ne 0 ; then
3770 user_path=$user_path:$t_bindir
3771 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3776 if test "x$external_path_file" != "x/etc/login.conf" ; then
3777 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
3781 # Set superuser path separately to user path
3782 AC_ARG_WITH(superuser-path,
3783 [ --with-superuser-path= Specify different path for super-user],
3785 if test -n "$withval" && test "x$withval" != "xno" && \
3786 test "x${withval}" != "xyes"; then
3787 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3788 [Define if you want a different $PATH
3790 superuser_path=$withval
3796 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3797 IPV4_IN6_HACK_MSG="no"
3799 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3801 if test "x$withval" != "xno" ; then
3803 AC_DEFINE(IPV4_IN_IPV6, 1,
3804 [Detect IPv4 in IPv6 mapped addresses
3806 IPV4_IN6_HACK_MSG="yes"
3811 if test "x$inet6_default_4in6" = "xyes"; then
3812 AC_MSG_RESULT([yes (default)])
3813 AC_DEFINE(IPV4_IN_IPV6)
3814 IPV4_IN6_HACK_MSG="yes"
3816 AC_MSG_RESULT([no (default)])
3821 # Whether to enable BSD auth support
3823 AC_ARG_WITH(bsd-auth,
3824 [ --with-bsd-auth Enable BSD auth support],
3826 if test "x$withval" != "xno" ; then
3827 AC_DEFINE(BSD_AUTH, 1,
3828 [Define if you have BSD auth support])
3834 # Where to place sshd.pid
3836 # make sure the directory exists
3837 if test ! -d $piddir ; then
3838 piddir=`eval echo ${sysconfdir}`
3840 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3844 AC_ARG_WITH(pid-dir,
3845 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3847 if test -n "$withval" && test "x$withval" != "xno" && \
3848 test "x${withval}" != "xyes"; then
3850 if test ! -d $piddir ; then
3851 AC_MSG_WARN([** no $piddir directory on this system **])
3857 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3860 dnl allow user to disable some login recording features
3861 AC_ARG_ENABLE(lastlog,
3862 [ --disable-lastlog disable use of lastlog even if detected [no]],
3864 if test "x$enableval" = "xno" ; then
3865 AC_DEFINE(DISABLE_LASTLOG)
3870 [ --disable-utmp disable use of utmp even if detected [no]],
3872 if test "x$enableval" = "xno" ; then
3873 AC_DEFINE(DISABLE_UTMP)
3877 AC_ARG_ENABLE(utmpx,
3878 [ --disable-utmpx disable use of utmpx even if detected [no]],
3880 if test "x$enableval" = "xno" ; then
3881 AC_DEFINE(DISABLE_UTMPX, 1,
3882 [Define if you don't want to use utmpx])
3887 [ --disable-wtmp disable use of wtmp even if detected [no]],
3889 if test "x$enableval" = "xno" ; then
3890 AC_DEFINE(DISABLE_WTMP)
3894 AC_ARG_ENABLE(wtmpx,
3895 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3897 if test "x$enableval" = "xno" ; then
3898 AC_DEFINE(DISABLE_WTMPX, 1,
3899 [Define if you don't want to use wtmpx])
3903 AC_ARG_ENABLE(libutil,
3904 [ --disable-libutil disable use of libutil (login() etc.) [no]],
3906 if test "x$enableval" = "xno" ; then
3907 AC_DEFINE(DISABLE_LOGIN)
3911 AC_ARG_ENABLE(pututline,
3912 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
3914 if test "x$enableval" = "xno" ; then
3915 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3916 [Define if you don't want to use pututline()
3917 etc. to write [uw]tmp])
3921 AC_ARG_ENABLE(pututxline,
3922 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
3924 if test "x$enableval" = "xno" ; then
3925 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3926 [Define if you don't want to use pututxline()
3927 etc. to write [uw]tmpx])
3931 AC_ARG_WITH(lastlog,
3932 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3934 if test "x$withval" = "xno" ; then
3935 AC_DEFINE(DISABLE_LASTLOG)
3936 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3937 conf_lastlog_location=$withval
3942 dnl lastlog, [uw]tmpx? detection
3943 dnl NOTE: set the paths in the platform section to avoid the
3944 dnl need for command-line parameters
3945 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3947 dnl lastlog detection
3948 dnl NOTE: the code itself will detect if lastlog is a directory
3949 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3951 #include <sys/types.h>
3953 #ifdef HAVE_LASTLOG_H
3954 # include <lastlog.h>
3963 [ char *lastlog = LASTLOG_FILE; ],
3964 [ AC_MSG_RESULT(yes) ],
3967 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3969 #include <sys/types.h>
3971 #ifdef HAVE_LASTLOG_H
3972 # include <lastlog.h>
3978 [ char *lastlog = _PATH_LASTLOG; ],
3979 [ AC_MSG_RESULT(yes) ],
3982 system_lastlog_path=no
3987 if test -z "$conf_lastlog_location"; then
3988 if test x"$system_lastlog_path" = x"no" ; then
3989 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3990 if (test -d "$f" || test -f "$f") ; then
3991 conf_lastlog_location=$f
3994 if test -z "$conf_lastlog_location"; then
3995 AC_MSG_WARN([** Cannot find lastlog **])
3996 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
4001 if test -n "$conf_lastlog_location"; then
4002 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
4003 [Define if you want to specify the path to your lastlog file])
4007 AC_MSG_CHECKING([if your system defines UTMP_FILE])
4009 #include <sys/types.h>
4015 [ char *utmp = UTMP_FILE; ],
4016 [ AC_MSG_RESULT(yes) ],
4018 system_utmp_path=no ]
4020 if test -z "$conf_utmp_location"; then
4021 if test x"$system_utmp_path" = x"no" ; then
4022 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4023 if test -f $f ; then
4024 conf_utmp_location=$f
4027 if test -z "$conf_utmp_location"; then
4028 AC_DEFINE(DISABLE_UTMP)
4032 if test -n "$conf_utmp_location"; then
4033 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
4034 [Define if you want to specify the path to your utmp file])
4038 AC_MSG_CHECKING([if your system defines WTMP_FILE])
4040 #include <sys/types.h>
4046 [ char *wtmp = WTMP_FILE; ],
4047 [ AC_MSG_RESULT(yes) ],
4049 system_wtmp_path=no ]
4051 if test -z "$conf_wtmp_location"; then
4052 if test x"$system_wtmp_path" = x"no" ; then
4053 for f in /usr/adm/wtmp /var/log/wtmp; do
4054 if test -f $f ; then
4055 conf_wtmp_location=$f
4058 if test -z "$conf_wtmp_location"; then
4059 AC_DEFINE(DISABLE_WTMP)
4063 if test -n "$conf_wtmp_location"; then
4064 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
4065 [Define if you want to specify the path to your wtmp file])
4069 dnl utmpx detection - I don't know any system so perverse as to require
4070 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
4072 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
4074 #include <sys/types.h>
4083 [ char *utmpx = UTMPX_FILE; ],
4084 [ AC_MSG_RESULT(yes) ],
4086 system_utmpx_path=no ]
4088 if test -z "$conf_utmpx_location"; then
4089 if test x"$system_utmpx_path" = x"no" ; then
4090 AC_DEFINE(DISABLE_UTMPX)
4093 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
4094 [Define if you want to specify the path to your utmpx file])
4098 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
4100 #include <sys/types.h>
4109 [ char *wtmpx = WTMPX_FILE; ],
4110 [ AC_MSG_RESULT(yes) ],
4112 system_wtmpx_path=no ]
4114 if test -z "$conf_wtmpx_location"; then
4115 if test x"$system_wtmpx_path" = x"no" ; then
4116 AC_DEFINE(DISABLE_WTMPX)
4119 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
4120 [Define if you want to specify the path to your wtmpx file])
4124 if test ! -z "$blibpath" ; then
4125 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4126 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
4129 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4131 CFLAGS="$CFLAGS $werror_flags"
4133 if grep "#define BROKEN_GETADDRINFO 1" confdefs.h >/dev/null || \
4134 test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4135 AC_SUBST(TEST_SSH_IPV6, no)
4137 AC_SUBST(TEST_SSH_IPV6, yes)
4141 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4142 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
4143 scard/Makefile ssh_prng_cmds survey.sh])
4146 # Print summary of options
4148 # Someone please show me a better way :)
4149 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4150 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4151 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4152 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
4153 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
4154 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
4155 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
4156 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4157 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4158 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
4161 echo "OpenSSH has been configured with the following options:"
4162 echo " User binaries: $B"
4163 echo " System binaries: $C"
4164 echo " Configuration files: $D"
4165 echo " Askpass program: $E"
4166 echo " Manual pages: $F"
4167 echo " PID file: $G"
4168 echo " Privilege separation chroot path: $H"
4169 if test "x$external_path_file" = "x/etc/login.conf" ; then
4170 echo " At runtime, sshd will use the path defined in $external_path_file"
4171 echo " Make sure the path to scp is present, otherwise scp will not work"
4173 echo " sshd default user PATH: $I"
4174 if test ! -z "$external_path_file"; then
4175 echo " (If PATH is set in $external_path_file it will be used instead. If"
4176 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4179 if test ! -z "$superuser_path" ; then
4180 echo " sshd superuser user PATH: $J"
4182 echo " Manpage format: $MANTYPE"
4183 echo " PAM support: $PAM_MSG"
4184 echo " OSF SIA support: $SIA_MSG"
4185 echo " KerberosV support: $KRB5_MSG"
4186 echo " SELinux support: $SELINUX_MSG"
4187 echo " Smartcard support: $SCARD_MSG"
4188 echo " S/KEY support: $SKEY_MSG"
4189 echo " TCP Wrappers support: $TCPW_MSG"
4190 echo " MD5 password support: $MD5_MSG"
4191 echo " libedit support: $LIBEDIT_MSG"
4192 echo " Solaris process contract support: $SPC_MSG"
4193 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
4194 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4195 echo " BSD Auth support: $BSD_AUTH_MSG"
4196 echo " Random number source: $RAND_MSG"
4197 if test ! -z "$USE_RAND_HELPER" ; then
4198 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
4203 echo " Host: ${host}"
4204 echo " Compiler: ${CC}"
4205 echo " Compiler flags: ${CFLAGS}"
4206 echo "Preprocessor flags: ${CPPFLAGS}"
4207 echo " Linker flags: ${LDFLAGS}"
4208 echo " Libraries: ${LIBS}"
4209 if test ! -z "${SSHDLIBS}"; then
4210 echo " +for sshd: ${SSHDLIBS}"
4215 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
4216 echo "SVR4 style packages are supported with \"make package\""
4220 if test "x$PAM_MSG" = "xyes" ; then
4221 echo "PAM is enabled. You may need to install a PAM control file "
4222 echo "for sshd, otherwise password authentication may fail. "
4223 echo "Example PAM control files can be found in the contrib/ "
4228 if test ! -z "$RAND_HELPER_CMDHASH" ; then
4229 echo "WARNING: you are using the builtin random number collection "
4230 echo "service. Please read WARNING.RNG and request that your OS "
4231 echo "vendor includes kernel-based random number collection in "
4232 echo "future versions of your OS."
4236 if test ! -z "$NO_PEERCHECK" ; then
4237 echo "WARNING: the operating system that you are using does not"
4238 echo "appear to support getpeereid(), getpeerucred() or the"
4239 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4240 echo "enforce security checks to prevent unauthorised connections to"
4241 echo "ssh-agent. Their absence increases the risk that a malicious"
4242 echo "user can connect to your agent."
4246 if test "$AUDIT_MODULE" = "bsm" ; then
4247 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4248 echo "See the Solaris section in README.platform for details."