1 # $Id: configure.ac,v 1.459 2010/12/04 12:20:50 dtucker Exp $
3 # Copyright (c) 1999-2004 Damien Miller
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
18 AC_REVISION($Revision: 1.459 $)
19 AC_CONFIG_SRCDIR([ssh.c])
21 AC_CONFIG_HEADER(config.h)
26 # Checks for programs.
33 AC_PATH_PROG(CAT, cat)
34 AC_PATH_PROG(KILL, kill)
35 AC_PATH_PROGS(PERL, perl5 perl)
36 AC_PATH_PROG(SED, sed)
38 AC_PATH_PROG(ENT, ent)
40 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
41 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
42 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
44 AC_SUBST(TEST_SHELL,sh)
47 AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49 AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
50 [/usr/sbin${PATH_SEPARATOR}/etc])
51 AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
52 if test -x /sbin/sh; then
53 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
55 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
61 if test -z "$AR" ; then
62 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
65 # Use LOGIN_PROGRAM from environment if possible
66 if test ! -z "$LOGIN_PROGRAM" ; then
67 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
68 [If your header files don't define LOGIN_PROGRAM,
69 then use this (detected) from environment and PATH])
72 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
73 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
74 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
78 AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
79 if test ! -z "$PATH_PASSWD_PROG" ; then
80 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
81 [Full path of your "passwd" program])
84 if test -z "$LD" ; then
91 AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
94 AC_ARG_WITH(stackprotect,
95 [ --without-stackprotect Don't use compiler's stack protection], [
96 if test "x$withval" = "xno"; then
100 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
101 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
102 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
104 1.*) no_attrib_nonnull=1 ;;
106 CFLAGS="$CFLAGS -Wsign-compare"
109 2.*) no_attrib_nonnull=1 ;;
110 3.*) CFLAGS="$CFLAGS -Wsign-compare -Wformat-security" ;;
111 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign -Wformat-security -fno-strict-aliasing" ;;
115 AC_MSG_CHECKING(if $CC accepts -fno-builtin-memset)
116 saved_CFLAGS="$CFLAGS"
117 CFLAGS="$CFLAGS -fno-builtin-memset"
118 AC_LINK_IFELSE( [AC_LANG_SOURCE([[
120 int main(void){char b[10]; memset(b, 0, sizeof(b));}
122 [ AC_MSG_RESULT(yes) ],
124 CFLAGS="$saved_CFLAGS" ]
127 # -fstack-protector-all doesn't always work for some GCC versions
128 # and/or platforms, so we test if we can. If it's not supported
129 # on a given platform gcc will emit a warning so we use -Werror.
130 if test "x$use_stack_protector" = "x1"; then
131 for t in -fstack-protector-all -fstack-protector; do
132 AC_MSG_CHECKING(if $CC supports $t)
133 saved_CFLAGS="$CFLAGS"
134 saved_LDFLAGS="$LDFLAGS"
135 CFLAGS="$CFLAGS $t -Werror"
136 LDFLAGS="$LDFLAGS $t -Werror"
140 int main(void){char x[[256]]; snprintf(x, sizeof(x), "XXX"); return 0;}
143 CFLAGS="$saved_CFLAGS $t"
144 LDFLAGS="$saved_LDFLAGS $t"
145 AC_MSG_CHECKING(if $t works)
149 int main(void){char x[[256]]; snprintf(x, sizeof(x), "XXX"); return 0;}
153 [ AC_MSG_RESULT(no) ],
154 [ AC_MSG_WARN([cross compiling: cannot test])
158 [ AC_MSG_RESULT(no) ]
160 CFLAGS="$saved_CFLAGS"
161 LDFLAGS="$saved_LDFLAGS"
165 if test -z "$have_llong_max"; then
166 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
167 unset ac_cv_have_decl_LLONG_MAX
168 saved_CFLAGS="$CFLAGS"
169 CFLAGS="$CFLAGS -std=gnu99"
170 AC_CHECK_DECL(LLONG_MAX,
172 [CFLAGS="$saved_CFLAGS"],
173 [#include <limits.h>]
178 if test "x$no_attrib_nonnull" != "x1" ; then
179 AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
183 [ --without-rpath Disable auto-added -R linker paths],
185 if test "x$withval" = "xno" ; then
188 if test "x$withval" = "xyes" ; then
194 # Allow user to specify flags
196 [ --with-cflags Specify additional flags to pass to compiler],
198 if test -n "$withval" && test "x$withval" != "xno" && \
199 test "x${withval}" != "xyes"; then
200 CFLAGS="$CFLAGS $withval"
204 AC_ARG_WITH(cppflags,
205 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
207 if test -n "$withval" && test "x$withval" != "xno" && \
208 test "x${withval}" != "xyes"; then
209 CPPFLAGS="$CPPFLAGS $withval"
214 [ --with-ldflags Specify additional flags to pass to linker],
216 if test -n "$withval" && test "x$withval" != "xno" && \
217 test "x${withval}" != "xyes"; then
218 LDFLAGS="$LDFLAGS $withval"
223 [ --with-libs Specify additional libraries to link with],
225 if test -n "$withval" && test "x$withval" != "xno" && \
226 test "x${withval}" != "xyes"; then
227 LIBS="$LIBS $withval"
232 [ --with-Werror Build main code with -Werror],
234 if test -n "$withval" && test "x$withval" != "xno"; then
235 werror_flags="-Werror"
236 if test "x${withval}" != "xyes"; then
237 werror_flags="$withval"
269 security/pam_appl.h \
309 # lastlog.h requires sys/time.h to be included first on Solaris
310 AC_CHECK_HEADERS(lastlog.h, [], [], [
311 #ifdef HAVE_SYS_TIME_H
312 # include <sys/time.h>
316 # sys/ptms.h requires sys/stream.h to be included first on Solaris
317 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
318 #ifdef HAVE_SYS_STREAM_H
319 # include <sys/stream.h>
323 # login_cap.h requires sys/types.h on NetBSD
324 AC_CHECK_HEADERS(login_cap.h, [], [], [
325 #include <sys/types.h>
328 # older BSDs need sys/param.h before sys/mount.h
329 AC_CHECK_HEADERS(sys/mount.h, [], [], [
330 #include <sys/param.h>
333 # Messages for features tested for in target-specific section
338 # Check for some target-specific stuff
341 # Some versions of VAC won't allow macro redefinitions at
342 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
343 # particularly with older versions of vac or xlc.
344 # It also throws errors about null macro argments, but these are
346 AC_MSG_CHECKING(if compiler allows macro redefinitions)
349 #define testmacro foo
350 #define testmacro bar
351 int main(void) { exit(0); }
353 [ AC_MSG_RESULT(yes) ],
355 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
356 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
357 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
358 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
362 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
363 if (test -z "$blibpath"); then
364 blibpath="/usr/lib:/lib"
366 saved_LDFLAGS="$LDFLAGS"
367 if test "$GCC" = "yes"; then
368 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
370 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
372 for tryflags in $flags ;do
373 if (test -z "$blibflags"); then
374 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
375 AC_TRY_LINK([], [], [blibflags=$tryflags])
378 if (test -z "$blibflags"); then
379 AC_MSG_RESULT(not found)
380 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
382 AC_MSG_RESULT($blibflags)
384 LDFLAGS="$saved_LDFLAGS"
385 dnl Check for authenticate. Might be in libs.a on older AIXes
386 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
387 [Define if you want to enable AIX4's authenticate function])],
388 [AC_CHECK_LIB(s,authenticate,
389 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
393 dnl Check for various auth function declarations in headers.
394 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
395 passwdexpired, setauthdb], , , [#include <usersec.h>])
396 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
397 AC_CHECK_DECLS(loginfailed,
398 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
400 [#include <usersec.h>],
401 [(void)loginfailed("user","host","tty",0);],
403 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
404 [Define if your AIX loginfailed() function
405 takes 4 arguments (AIX >= 5.2)])],
409 [#include <usersec.h>]
411 AC_CHECK_FUNCS(getgrset setauthdb)
412 AC_CHECK_DECL(F_CLOSEM,
413 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
415 [ #include <limits.h>
418 check_for_aix_broken_getaddrinfo=1
419 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
420 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
421 [Define if your platform breaks doing a seteuid before a setuid])
422 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
423 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
424 dnl AIX handles lastlog as part of its login message
425 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
426 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
427 [Some systems need a utmpx entry for /bin/login to work])
428 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
429 [Define to a Set Process Title type if your system is
430 supported by bsd-setproctitle.c])
431 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
432 [AIX 5.2 and 5.3 (and presumably newer) require this])
433 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
436 check_for_libcrypt_later=1
437 LIBS="$LIBS /usr/lib/textreadmode.o"
438 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
439 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
440 AC_DEFINE(DISABLE_SHADOW, 1,
441 [Define if you want to disable shadow passwords])
442 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
443 [Define if X11 doesn't support AF_UNIX sockets on that system])
444 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
445 [Define if the concept of ports only accessible to
446 superusers isn't known])
447 AC_DEFINE(DISABLE_FD_PASSING, 1,
448 [Define if your platform needs to skip post auth
449 file descriptor passing])
450 AC_DEFINE(SSH_IOBUFSZ, 65535, [Windows is sensitive to read buffer size])
453 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
454 [Define if your system choked on IP TOS setting])
455 AC_DEFINE(SETEUID_BREAKS_SETUID)
456 AC_DEFINE(BROKEN_SETREUID)
457 AC_DEFINE(BROKEN_SETREGID)
460 AC_MSG_CHECKING(if we have working getaddrinfo)
461 AC_TRY_RUN([#include <mach-o/dyld.h>
462 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
466 }], [AC_MSG_RESULT(working)],
467 [AC_MSG_RESULT(buggy)
468 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
469 [AC_MSG_RESULT(assume it is working)])
470 AC_DEFINE(SETEUID_BREAKS_SETUID)
471 AC_DEFINE(BROKEN_SETREUID)
472 AC_DEFINE(BROKEN_SETREGID)
473 AC_DEFINE(BROKEN_GLOB, 1, [OS X glob does not do what we expect])
474 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
475 [Define if your resolver libs need this for getrrsetbyname])
476 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
477 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
478 [Use tunnel device compatibility to OpenBSD])
479 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
480 [Prepend the address family to IP tunnel traffic])
481 m4_pattern_allow(AU_IPv)
482 AC_CHECK_DECL(AU_IPv4, [],
483 AC_DEFINE(AU_IPv4, 0, [System only supports IPv4 audit records])
484 [#include <bsm/audit.h>]
485 AC_DEFINE(LASTLOG_WRITE_PUTUTXLINE, 1,
486 [Define if pututxline updates lastlog too])
490 SSHDLIBS="$SSHDLIBS -lcrypt"
494 AC_CHECK_LIB(network, socket)
495 AC_DEFINE(HAVE_U_INT64_T)
499 # first we define all of the options common to all HP-UX releases
500 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
501 IPADDR_IN_DISPLAY=yes
503 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
504 [Define if your login program cannot handle end of options ("--")])
505 AC_DEFINE(LOGIN_NEEDS_UTMPX)
506 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
507 [String used in /etc/passwd to denote locked account])
508 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
509 MAIL="/var/mail/username"
511 AC_CHECK_LIB(xnet, t_error, ,
512 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
514 # next, we define all of the options specific to major releases
517 if test -z "$GCC"; then
522 AC_DEFINE(PAM_SUN_CODEBASE, 1,
523 [Define if you are using Solaris-derived PAM which
524 passes pam_messages to the conversation function
525 with an extra level of indirection])
526 AC_DEFINE(DISABLE_UTMP, 1,
527 [Define if you don't want to use utmp])
528 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
529 check_for_hpux_broken_getaddrinfo=1
530 check_for_conflicting_getspnam=1
534 # lastly, we define options specific to minor releases
537 AC_DEFINE(HAVE_SECUREWARE, 1,
538 [Define if you have SecureWare-based
539 protected password database])
540 disable_ptmx_check=yes
546 PATH="$PATH:/usr/etc"
547 AC_DEFINE(BROKEN_INET_NTOA, 1,
548 [Define if you system's inet_ntoa is busted
549 (e.g. Irix gcc issue)])
550 AC_DEFINE(SETEUID_BREAKS_SETUID)
551 AC_DEFINE(BROKEN_SETREUID)
552 AC_DEFINE(BROKEN_SETREGID)
553 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
554 [Define if you shouldn't strip 'tty' from your
556 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
559 PATH="$PATH:/usr/etc"
560 AC_DEFINE(WITH_IRIX_ARRAY, 1,
561 [Define if you have/want arrays
562 (cluster-wide session managment, not C arrays)])
563 AC_DEFINE(WITH_IRIX_PROJECT, 1,
564 [Define if you want IRIX project management])
565 AC_DEFINE(WITH_IRIX_AUDIT, 1,
566 [Define if you want IRIX audit trails])
567 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
568 [Define if you want IRIX kernel jobs])])
569 AC_DEFINE(BROKEN_INET_NTOA)
570 AC_DEFINE(SETEUID_BREAKS_SETUID)
571 AC_DEFINE(BROKEN_SETREUID)
572 AC_DEFINE(BROKEN_SETREGID)
573 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
574 AC_DEFINE(WITH_ABBREV_NO_TTY)
575 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
577 *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
578 check_for_libcrypt_later=1
579 AC_DEFINE(PAM_TTY_KLUDGE)
580 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
581 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
582 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
583 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
587 check_for_libcrypt_later=1
588 check_for_openpty_ctty_bug=1
589 AC_DEFINE(PAM_TTY_KLUDGE, 1,
590 [Work around problematic Linux PAM modules handling of PAM_TTY])
591 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
592 [String used in /etc/passwd to denote locked account])
593 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
594 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
595 [Define to whatever link() returns for "not supported"
596 if it doesn't return EOPNOTSUPP.])
597 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
599 AC_DEFINE(LINUX_OOM_ADJUST, 1, [Adjust Linux out-of-memory killer])
600 inet6_default_4in6=yes
603 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
604 [Define if cmsg_type is not passed correctly])
607 # tun(4) forwarding compat code
608 AC_CHECK_HEADERS(linux/if_tun.h)
609 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
610 AC_DEFINE(SSH_TUN_LINUX, 1,
611 [Open tunnel devices the Linux tun/tap way])
612 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
613 [Use tunnel device compatibility to OpenBSD])
614 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
615 [Prepend the address family to IP tunnel traffic])
618 mips-sony-bsd|mips-sony-newsos4)
619 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
623 check_for_libcrypt_before=1
624 if test "x$withval" != "xno" ; then
627 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
628 AC_CHECK_HEADER([net/if_tap.h], ,
629 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
630 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
631 [Prepend the address family to IP tunnel traffic])
634 check_for_libcrypt_later=1
635 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
636 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
637 AC_CHECK_HEADER([net/if_tap.h], ,
638 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
639 AC_DEFINE(BROKEN_GLOB, 1, [FreeBSD glob does not do what we need])
642 AC_DEFINE(SETEUID_BREAKS_SETUID)
643 AC_DEFINE(BROKEN_SETREUID)
644 AC_DEFINE(BROKEN_SETREGID)
647 conf_lastlog_location="/usr/adm/lastlog"
648 conf_utmp_location=/etc/utmp
649 conf_wtmp_location=/usr/adm/wtmp
651 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
652 AC_DEFINE(BROKEN_REALPATH)
654 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
657 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
658 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
659 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
660 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
661 [syslog_r function is safe to use in in a signal handler])
664 if test "x$withval" != "xno" ; then
667 AC_DEFINE(PAM_SUN_CODEBASE)
668 AC_DEFINE(LOGIN_NEEDS_UTMPX)
669 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
670 [Some versions of /bin/login need the TERM supplied
672 AC_DEFINE(PAM_TTY_KLUDGE)
673 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
674 [Define if pam_chauthtok wants real uid set
675 to the unpriv'ed user])
676 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
677 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
678 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
679 [Define if sshd somehow reacquires a controlling TTY
681 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
682 in case the name is longer than 8 chars])
683 AC_DEFINE(BROKEN_TCGETATTR_ICANON, 1, [tcgetattr with ICANON may hang])
684 external_path_file=/etc/default/login
685 # hardwire lastlog location (can't detect it on some versions)
686 conf_lastlog_location="/var/adm/lastlog"
687 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
688 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
689 if test "$sol2ver" -ge 8; then
691 AC_DEFINE(DISABLE_UTMP)
692 AC_DEFINE(DISABLE_WTMP, 1,
693 [Define if you don't want to use wtmp])
697 AC_ARG_WITH(solaris-contracts,
698 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
700 AC_CHECK_LIB(contract, ct_tmpl_activate,
701 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
702 [Define if you have Solaris process contracts])
703 SSHDLIBS="$SSHDLIBS -lcontract"
708 AC_ARG_WITH(solaris-projects,
709 [ --with-solaris-projects Enable Solaris projects (experimental)],
711 AC_CHECK_LIB(project, setproject,
712 [ AC_DEFINE(USE_SOLARIS_PROJECTS, 1,
713 [Define if you have Solaris projects])
714 SSHDLIBS="$SSHDLIBS -lproject"
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 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
766 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
768 AC_DEFINE(SETEUID_BREAKS_SETUID)
769 AC_DEFINE(BROKEN_GETADDRINFO)
770 AC_DEFINE(BROKEN_SETREUID)
771 AC_DEFINE(BROKEN_SETREGID)
772 AC_DEFINE(PASSWD_NEEDS_USERNAME)
774 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
775 TEST_SHELL=/u95/bin/sh
776 AC_DEFINE(BROKEN_LIBIAF, 1,
777 [ia_uinfo routines not supported by OS yet])
778 AC_DEFINE(BROKEN_UPDWTMPX)
779 AC_CHECK_LIB(prot, getluid,[ LIBS="$LIBS -lprot"
780 AC_CHECK_FUNCS(getluid setluid,,,-lprot)
781 AC_DEFINE(HAVE_SECUREWARE)
782 AC_DEFINE(DISABLE_SHADOW)
785 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
786 check_for_libcrypt_later=1
792 # SCO UNIX and OEM versions of SCO UNIX
794 AC_MSG_ERROR("This Platform is no longer supported.")
798 if test -z "$GCC"; then
799 CFLAGS="$CFLAGS -belf"
801 LIBS="$LIBS -lprot -lx -ltinfo -lm"
804 AC_DEFINE(HAVE_SECUREWARE)
805 AC_DEFINE(DISABLE_SHADOW)
806 AC_DEFINE(DISABLE_FD_PASSING)
807 AC_DEFINE(SETEUID_BREAKS_SETUID)
808 AC_DEFINE(BROKEN_GETADDRINFO)
809 AC_DEFINE(BROKEN_SETREUID)
810 AC_DEFINE(BROKEN_SETREGID)
811 AC_DEFINE(WITH_ABBREV_NO_TTY)
812 AC_DEFINE(BROKEN_UPDWTMPX)
813 AC_DEFINE(PASSWD_NEEDS_USERNAME)
814 AC_CHECK_FUNCS(getluid setluid)
819 AC_DEFINE(NO_SSH_LASTLOG, 1,
820 [Define if you don't want to use lastlog in session.c])
821 AC_DEFINE(SETEUID_BREAKS_SETUID)
822 AC_DEFINE(BROKEN_SETREUID)
823 AC_DEFINE(BROKEN_SETREGID)
825 AC_DEFINE(DISABLE_FD_PASSING)
827 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
831 AC_DEFINE(SETEUID_BREAKS_SETUID)
832 AC_DEFINE(BROKEN_SETREUID)
833 AC_DEFINE(BROKEN_SETREGID)
834 AC_DEFINE(WITH_ABBREV_NO_TTY)
836 AC_DEFINE(DISABLE_FD_PASSING)
838 LIBS="$LIBS -lgen -lacid -ldb"
842 AC_DEFINE(SETEUID_BREAKS_SETUID)
843 AC_DEFINE(BROKEN_SETREUID)
844 AC_DEFINE(BROKEN_SETREGID)
846 AC_DEFINE(DISABLE_FD_PASSING)
847 AC_DEFINE(NO_SSH_LASTLOG)
848 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
849 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
853 AC_MSG_CHECKING(for Digital Unix SIA)
856 [ --with-osfsia Enable Digital Unix SIA],
858 if test "x$withval" = "xno" ; then
859 AC_MSG_RESULT(disabled)
864 if test -z "$no_osfsia" ; then
865 if test -f /etc/sia/matrix.conf; then
867 AC_DEFINE(HAVE_OSF_SIA, 1,
868 [Define if you have Digital Unix Security
869 Integration Architecture])
870 AC_DEFINE(DISABLE_LOGIN, 1,
871 [Define if you don't want to use your
872 system's login() call])
873 AC_DEFINE(DISABLE_FD_PASSING)
874 LIBS="$LIBS -lsecurity -ldb -lm -laud"
878 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
879 [String used in /etc/passwd to denote locked account])
882 AC_DEFINE(BROKEN_GETADDRINFO)
883 AC_DEFINE(SETEUID_BREAKS_SETUID)
884 AC_DEFINE(BROKEN_SETREUID)
885 AC_DEFINE(BROKEN_SETREGID)
886 AC_DEFINE(BROKEN_READV_COMPARISON, 1, [Can't do comparisons on readv])
891 AC_DEFINE(NO_X11_UNIX_SOCKETS)
892 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
893 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
894 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
895 AC_DEFINE(DISABLE_LASTLOG)
896 AC_DEFINE(SSHD_ACQUIRES_CTTY)
897 AC_DEFINE(BROKEN_SHADOW_EXPIRE, 1, [QNX shadow support is broken])
898 enable_etc_default_login=no # has incompatible /etc/default/login
901 AC_DEFINE(DISABLE_FD_PASSING)
907 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
908 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
909 AC_DEFINE(NEED_SETPGRP)
910 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
914 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
915 AC_DEFINE(MISSING_HOWMANY)
916 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
920 AC_MSG_CHECKING(compiler and flags for sanity)
926 [ AC_MSG_RESULT(yes) ],
929 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
931 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
934 dnl Checks for header files.
935 # Checks for libraries.
936 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
937 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
939 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
940 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
941 AC_CHECK_LIB(gen, dirname,[
942 AC_CACHE_CHECK([for broken dirname],
943 ac_cv_have_broken_dirname, [
951 int main(int argc, char **argv) {
954 strncpy(buf,"/etc", 32);
956 if (!s || strncmp(s, "/", 32) != 0) {
963 [ ac_cv_have_broken_dirname="no" ],
964 [ ac_cv_have_broken_dirname="yes" ],
965 [ ac_cv_have_broken_dirname="no" ],
969 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
971 AC_DEFINE(HAVE_DIRNAME)
972 AC_CHECK_HEADERS(libgen.h)
977 AC_CHECK_FUNC(getspnam, ,
978 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
979 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
980 [Define if you have the basename function.]))
984 [ --with-zlib=PATH Use zlib in PATH],
985 [ if test "x$withval" = "xno" ; then
986 AC_MSG_ERROR([*** zlib is required ***])
987 elif test "x$withval" != "xyes"; then
988 if test -d "$withval/lib"; then
989 if test -n "${need_dash_r}"; then
990 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
992 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
995 if test -n "${need_dash_r}"; then
996 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
998 LDFLAGS="-L${withval} ${LDFLAGS}"
1001 if test -d "$withval/include"; then
1002 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1004 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1009 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
1010 AC_CHECK_LIB(z, deflate, ,
1012 saved_CPPFLAGS="$CPPFLAGS"
1013 saved_LDFLAGS="$LDFLAGS"
1015 dnl Check default zlib install dir
1016 if test -n "${need_dash_r}"; then
1017 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1019 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1021 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1023 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
1025 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1031 AC_ARG_WITH(zlib-version-check,
1032 [ --without-zlib-version-check Disable zlib version check],
1033 [ if test "x$withval" = "xno" ; then
1034 zlib_check_nonfatal=1
1039 AC_MSG_CHECKING(for possibly buggy zlib)
1040 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1045 int a=0, b=0, c=0, d=0, n, v;
1046 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1047 if (n != 3 && n != 4)
1049 v = a*1000000 + b*10000 + c*100 + d;
1050 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1053 if (a == 1 && b == 1 && c >= 4)
1056 /* 1.2.3 and up are OK */
1064 [ AC_MSG_RESULT(yes)
1065 if test -z "$zlib_check_nonfatal" ; then
1066 AC_MSG_ERROR([*** zlib too old - check config.log ***
1067 Your reported zlib version has known security problems. It's possible your
1068 vendor has fixed these problems without changing the version number. If you
1069 are sure this is the case, you can disable the check by running
1070 "./configure --without-zlib-version-check".
1071 If you are in doubt, upgrade zlib to version 1.2.3 or greater.
1072 See http://www.gzip.org/zlib/ for details.])
1074 AC_MSG_WARN([zlib version may have security problems])
1077 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
1081 AC_CHECK_FUNC(strcasecmp,
1082 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
1084 AC_CHECK_FUNCS(utimes,
1085 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
1086 LIBS="$LIBS -lc89"]) ]
1089 dnl Checks for libutil functions
1090 AC_CHECK_HEADERS(libutil.h)
1091 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
1092 [Define if your libraries define login()])])
1093 AC_CHECK_FUNCS(fmt_scaled logout updwtmp logwtmp)
1097 # Check for ALTDIRFUNC glob() extension
1098 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
1099 AC_EGREP_CPP(FOUNDIT,
1102 #ifdef GLOB_ALTDIRFUNC
1107 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
1108 [Define if your system glob() function has
1109 the GLOB_ALTDIRFUNC extension])
1117 # Check for g.gl_matchc glob() extension
1118 AC_MSG_CHECKING(for gl_matchc field in glob_t)
1120 [ #include <glob.h> ],
1121 [glob_t g; g.gl_matchc = 1;],
1123 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1124 [Define if your system glob() function has
1125 gl_matchc options in glob_t])
1133 # Check for g.gl_statv glob() extension
1134 AC_MSG_CHECKING(for gl_statv and GLOB_KEEPSTAT extensions for glob)
1136 [ #include <glob.h> ],
1138 #ifndef GLOB_KEEPSTAT
1139 #error "glob does not support GLOB_KEEPSTAT extension"
1145 AC_DEFINE(GLOB_HAS_GL_STATV, 1,
1146 [Define if your system glob() function has
1147 gl_statv options in glob_t])
1155 AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1157 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
1160 #include <sys/types.h>
1162 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
1164 [AC_MSG_RESULT(yes)],
1167 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
1168 [Define if your struct dirent expects you to
1169 allocate extra space for d_name])
1172 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1173 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
1177 AC_MSG_CHECKING([for /proc/pid/fd directory])
1178 if test -d "/proc/$$/fd" ; then
1179 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
1185 # Check whether user wants S/Key support
1188 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
1190 if test "x$withval" != "xno" ; then
1192 if test "x$withval" != "xyes" ; then
1193 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1194 LDFLAGS="$LDFLAGS -L${withval}/lib"
1197 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
1201 AC_MSG_CHECKING([for s/key support])
1206 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
1208 [AC_MSG_RESULT(yes)],
1211 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1213 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1217 [(void)skeychallenge(NULL,"name","",0);],
1219 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1220 [Define if your skeychallenge()
1221 function takes 4 arguments (NetBSD)])],
1228 # Check whether user wants TCP wrappers support
1230 AC_ARG_WITH(tcp-wrappers,
1231 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1233 if test "x$withval" != "xno" ; then
1235 saved_LDFLAGS="$LDFLAGS"
1236 saved_CPPFLAGS="$CPPFLAGS"
1237 if test -n "${withval}" && \
1238 test "x${withval}" != "xyes"; then
1239 if test -d "${withval}/lib"; then
1240 if test -n "${need_dash_r}"; then
1241 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1243 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1246 if test -n "${need_dash_r}"; then
1247 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1249 LDFLAGS="-L${withval} ${LDFLAGS}"
1252 if test -d "${withval}/include"; then
1253 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1255 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1259 AC_MSG_CHECKING(for libwrap)
1262 #include <sys/types.h>
1263 #include <sys/socket.h>
1264 #include <netinet/in.h>
1266 int deny_severity = 0, allow_severity = 0;
1271 AC_DEFINE(LIBWRAP, 1,
1273 TCP Wrappers support])
1274 SSHDLIBS="$SSHDLIBS -lwrap"
1278 AC_MSG_ERROR([*** libwrap missing])
1286 # Check whether user wants libedit support
1288 AC_ARG_WITH(libedit,
1289 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1290 [ if test "x$withval" != "xno" ; then
1291 if test "x$withval" = "xyes" ; then
1292 AC_PATH_PROG(PKGCONFIG, pkg-config, no)
1293 if test "x$PKGCONFIG" != "xno"; then
1294 AC_MSG_CHECKING(if $PKGCONFIG knows about libedit)
1295 if "$PKGCONFIG" libedit; then
1297 use_pkgconfig_for_libedit=yes
1303 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1304 if test -n "${need_dash_r}"; then
1305 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1307 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1310 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
1311 LIBEDIT=`$PKGCONFIG --libs-only-l libedit`
1312 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1314 LIBEDIT="-ledit -lcurses"
1316 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
1317 AC_CHECK_LIB(edit, el_init,
1318 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1322 [ AC_MSG_ERROR(libedit not found) ],
1325 AC_MSG_CHECKING(if libedit version is compatible)
1328 #include <histedit.h>
1332 el_init("", NULL, NULL, NULL);
1336 [ AC_MSG_RESULT(yes) ],
1338 AC_MSG_ERROR(libedit version is not compatible) ]
1345 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1347 AC_MSG_CHECKING(for supported audit module)
1352 dnl Checks for headers, libs and functions
1353 AC_CHECK_HEADERS(bsm/audit.h, [],
1354 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1361 AC_CHECK_LIB(bsm, getaudit, [],
1362 [AC_MSG_ERROR(BSM enabled and required library not found)])
1363 AC_CHECK_FUNCS(getaudit, [],
1364 [AC_MSG_ERROR(BSM enabled and required function not found)])
1365 # These are optional
1366 AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
1367 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1371 AC_MSG_RESULT(debug)
1372 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1378 AC_MSG_ERROR([Unknown audit module $withval])
1383 dnl Checks for library functions. Please keep in alphabetical order
1387 arc4random_uniform \
1487 return (isblank('a'));
1490 [AC_DEFINE(HAVE_ISBLANK, 1, [Define if you have isblank(3C).])
1493 # PKCS#11 support requires dlopen() and co
1494 AC_SEARCH_LIBS(dlopen, dl,
1495 AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])
1498 # IRIX has a const char return value for gai_strerror()
1499 AC_CHECK_FUNCS(gai_strerror,[
1500 AC_DEFINE(HAVE_GAI_STRERROR)
1502 #include <sys/types.h>
1503 #include <sys/socket.h>
1506 const char *gai_strerror(int);],[
1509 str = gai_strerror(0);],[
1510 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1511 [Define if gai_strerror() returns const char *])])])
1513 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1514 [Some systems put nanosleep outside of libc]))
1516 dnl Make sure prototypes are defined for these before using them.
1517 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1518 AC_CHECK_DECL(strsep,
1519 [AC_CHECK_FUNCS(strsep)],
1522 #ifdef HAVE_STRING_H
1523 # include <string.h>
1527 dnl tcsendbreak might be a macro
1528 AC_CHECK_DECL(tcsendbreak,
1529 [AC_DEFINE(HAVE_TCSENDBREAK)],
1530 [AC_CHECK_FUNCS(tcsendbreak)],
1531 [#include <termios.h>]
1534 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1536 AC_CHECK_DECLS(SHUT_RD, , ,
1538 #include <sys/types.h>
1539 #include <sys/socket.h>
1542 AC_CHECK_DECLS(O_NONBLOCK, , ,
1544 #include <sys/types.h>
1545 #ifdef HAVE_SYS_STAT_H
1546 # include <sys/stat.h>
1553 AC_CHECK_DECLS(writev, , , [
1554 #include <sys/types.h>
1555 #include <sys/uio.h>
1559 AC_CHECK_DECLS(MAXSYMLINKS, , , [
1560 #include <sys/param.h>
1563 AC_CHECK_DECLS(offsetof, , , [
1567 AC_CHECK_FUNCS(setresuid, [
1568 dnl Some platorms have setresuid that isn't implemented, test for this
1569 AC_MSG_CHECKING(if setresuid seems to work)
1574 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1576 [AC_MSG_RESULT(yes)],
1577 [AC_DEFINE(BROKEN_SETRESUID, 1,
1578 [Define if your setresuid() is broken])
1579 AC_MSG_RESULT(not implemented)],
1580 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1584 AC_CHECK_FUNCS(setresgid, [
1585 dnl Some platorms have setresgid that isn't implemented, test for this
1586 AC_MSG_CHECKING(if setresgid seems to work)
1591 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1593 [AC_MSG_RESULT(yes)],
1594 [AC_DEFINE(BROKEN_SETRESGID, 1,
1595 [Define if your setresgid() is broken])
1596 AC_MSG_RESULT(not implemented)],
1597 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1601 dnl Checks for time functions
1602 AC_CHECK_FUNCS(gettimeofday time)
1603 dnl Checks for utmp functions
1604 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1605 AC_CHECK_FUNCS(utmpname)
1606 dnl Checks for utmpx functions
1607 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline getutxuser pututxline)
1608 AC_CHECK_FUNCS(setutxdb setutxent utmpxname)
1609 dnl Checks for lastlog functions
1610 AC_CHECK_FUNCS(getlastlogxbyname)
1612 AC_CHECK_FUNC(daemon,
1613 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1614 [AC_CHECK_LIB(bsd, daemon,
1615 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1618 AC_CHECK_FUNC(getpagesize,
1619 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1620 [Define if your libraries define getpagesize()])],
1621 [AC_CHECK_LIB(ucb, getpagesize,
1622 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1625 # Check for broken snprintf
1626 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1627 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1631 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1633 [AC_MSG_RESULT(yes)],
1636 AC_DEFINE(BROKEN_SNPRINTF, 1,
1637 [Define if your snprintf is busted])
1638 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1640 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1644 # If we don't have a working asprintf, then we strongly depend on vsnprintf
1645 # returning the right thing on overflow: the number of characters it tried to
1646 # create (as per SUSv3)
1647 if test "x$ac_cv_func_asprintf" != "xyes" && \
1648 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1649 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1652 #include <sys/types.h>
1656 int x_snprintf(char *str,size_t count,const char *fmt,...)
1658 size_t ret; va_list ap;
1659 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1665 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1667 [AC_MSG_RESULT(yes)],
1670 AC_DEFINE(BROKEN_SNPRINTF, 1,
1671 [Define if your snprintf is busted])
1672 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1674 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1678 # On systems where [v]snprintf is broken, but is declared in stdio,
1679 # check that the fmt argument is const char * or just char *.
1680 # This is only useful for when BROKEN_SNPRINTF
1681 AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1682 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1683 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1684 int main(void) { snprintf(0, 0, 0); }
1687 AC_DEFINE(SNPRINTF_CONST, [const],
1688 [Define as const if snprintf() can declare const char *fmt])],
1690 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1692 # Check for missing getpeereid (or equiv) support
1694 if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
1695 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1697 [#include <sys/types.h>
1698 #include <sys/socket.h>],
1699 [int i = SO_PEERCRED;],
1700 [ AC_MSG_RESULT(yes)
1701 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1708 dnl see whether mkstemp() requires XXXXXX
1709 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1710 AC_MSG_CHECKING([for (overly) strict mkstemp])
1714 main() { char template[]="conftest.mkstemp-test";
1715 if (mkstemp(template) == -1)
1717 unlink(template); exit(0);
1725 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1729 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1734 dnl make sure that openpty does not reacquire controlling terminal
1735 if test ! -z "$check_for_openpty_ctty_bug"; then
1736 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1740 #include <sys/fcntl.h>
1741 #include <sys/types.h>
1742 #include <sys/wait.h>
1748 int fd, ptyfd, ttyfd, status;
1751 if (pid < 0) { /* failed */
1753 } else if (pid > 0) { /* parent */
1754 waitpid(pid, &status, 0);
1755 if (WIFEXITED(status))
1756 exit(WEXITSTATUS(status));
1759 } else { /* child */
1760 close(0); close(1); close(2);
1762 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1763 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1765 exit(3); /* Acquired ctty: broken */
1767 exit(0); /* Did not acquire ctty: OK */
1776 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1779 AC_MSG_RESULT(cross-compiling, assuming yes)
1784 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1785 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1786 AC_MSG_CHECKING(if getaddrinfo seems to work)
1790 #include <sys/socket.h>
1793 #include <netinet/in.h>
1795 #define TEST_PORT "2222"
1801 struct addrinfo *gai_ai, *ai, hints;
1802 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1804 memset(&hints, 0, sizeof(hints));
1805 hints.ai_family = PF_UNSPEC;
1806 hints.ai_socktype = SOCK_STREAM;
1807 hints.ai_flags = AI_PASSIVE;
1809 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1811 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1815 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1816 if (ai->ai_family != AF_INET6)
1819 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1820 sizeof(ntop), strport, sizeof(strport),
1821 NI_NUMERICHOST|NI_NUMERICSERV);
1824 if (err == EAI_SYSTEM)
1825 perror("getnameinfo EAI_SYSTEM");
1827 fprintf(stderr, "getnameinfo failed: %s\n",
1832 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1835 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1848 AC_DEFINE(BROKEN_GETADDRINFO)
1851 AC_MSG_RESULT(cross-compiling, assuming yes)
1856 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1857 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1858 AC_MSG_CHECKING(if getaddrinfo seems to work)
1862 #include <sys/socket.h>
1865 #include <netinet/in.h>
1867 #define TEST_PORT "2222"
1873 struct addrinfo *gai_ai, *ai, hints;
1874 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1876 memset(&hints, 0, sizeof(hints));
1877 hints.ai_family = PF_UNSPEC;
1878 hints.ai_socktype = SOCK_STREAM;
1879 hints.ai_flags = AI_PASSIVE;
1881 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1883 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1887 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1888 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1891 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1892 sizeof(ntop), strport, sizeof(strport),
1893 NI_NUMERICHOST|NI_NUMERICSERV);
1895 if (ai->ai_family == AF_INET && err != 0) {
1896 perror("getnameinfo");
1905 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1906 [Define if you have a getaddrinfo that fails
1907 for the all-zeros IPv6 address])
1911 AC_DEFINE(BROKEN_GETADDRINFO)
1914 AC_MSG_RESULT(cross-compiling, assuming no)
1919 if test "x$check_for_conflicting_getspnam" = "x1"; then
1920 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1924 int main(void) {exit(0);}
1931 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1932 [Conflicting defs for getspnam])
1939 # Search for OpenSSL
1940 saved_CPPFLAGS="$CPPFLAGS"
1941 saved_LDFLAGS="$LDFLAGS"
1942 AC_ARG_WITH(ssl-dir,
1943 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1945 if test "x$withval" != "xno" ; then
1948 ./*|../*) withval="`pwd`/$withval"
1950 if test -d "$withval/lib"; then
1951 if test -n "${need_dash_r}"; then
1952 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1954 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1956 elif test -d "$withval/lib64"; then
1957 if test -n "${need_dash_r}"; then
1958 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
1960 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
1963 if test -n "${need_dash_r}"; then
1964 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1966 LDFLAGS="-L${withval} ${LDFLAGS}"
1969 if test -d "$withval/include"; then
1970 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1972 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1977 LIBS="-lcrypto $LIBS"
1978 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1979 [Define if your ssl headers are included
1980 with #include <openssl/header.h>]),
1982 dnl Check default openssl install dir
1983 if test -n "${need_dash_r}"; then
1984 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1986 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1988 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1989 AC_CHECK_HEADER([openssl/opensslv.h], ,
1990 AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***]))
1991 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1993 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1999 # Determine OpenSSL header version
2000 AC_MSG_CHECKING([OpenSSL header version])
2005 #include <openssl/opensslv.h>
2006 #define DATA "conftest.sslincver"
2011 fd = fopen(DATA,"w");
2015 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2022 ssl_header_ver=`cat conftest.sslincver`
2023 AC_MSG_RESULT($ssl_header_ver)
2026 AC_MSG_RESULT(not found)
2027 AC_MSG_ERROR(OpenSSL version header not found.)
2030 AC_MSG_WARN([cross compiling: not checking])
2034 # Determine OpenSSL library version
2035 AC_MSG_CHECKING([OpenSSL library version])
2040 #include <openssl/opensslv.h>
2041 #include <openssl/crypto.h>
2042 #define DATA "conftest.ssllibver"
2047 fd = fopen(DATA,"w");
2051 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2058 ssl_library_ver=`cat conftest.ssllibver`
2059 AC_MSG_RESULT($ssl_library_ver)
2062 AC_MSG_RESULT(not found)
2063 AC_MSG_ERROR(OpenSSL library not found.)
2066 AC_MSG_WARN([cross compiling: not checking])
2070 AC_ARG_WITH(openssl-header-check,
2071 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2072 [ if test "x$withval" = "xno" ; then
2073 openssl_check_nonfatal=1
2078 # Sanity check OpenSSL headers
2079 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2083 #include <openssl/opensslv.h>
2084 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
2091 if test "x$openssl_check_nonfatal" = "x"; then
2092 AC_MSG_ERROR([Your OpenSSL headers do not match your
2093 library. Check config.log for details.
2094 If you are sure your installation is consistent, you can disable the check
2095 by running "./configure --without-openssl-header-check".
2096 Also see contrib/findssl.sh for help identifying header/library mismatches.
2099 AC_MSG_WARN([Your OpenSSL headers do not match your
2100 library. Check config.log for details.
2101 Also see contrib/findssl.sh for help identifying header/library mismatches.])
2105 AC_MSG_WARN([cross compiling: not checking])
2109 AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2112 #include <openssl/evp.h>
2113 int main(void) { SSLeay_add_all_algorithms(); }
2122 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2125 #include <openssl/evp.h>
2126 int main(void) { SSLeay_add_all_algorithms(); }
2139 AC_CHECK_FUNCS(RSA_generate_key_ex DSA_generate_parameters_ex BN_is_prime_ex)
2141 AC_ARG_WITH(ssl-engine,
2142 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2143 [ if test "x$withval" != "xno" ; then
2144 AC_MSG_CHECKING(for OpenSSL ENGINE support)
2146 [ #include <openssl/engine.h>],
2148 ENGINE_load_builtin_engines();ENGINE_register_all_complete();
2150 [ AC_MSG_RESULT(yes)
2151 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
2152 [Enable OpenSSL engine support])
2154 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
2159 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2160 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2164 #include <openssl/evp.h>
2165 int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
2172 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2173 [libcrypto is missing AES 192 and 256 bit functions])
2177 AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2181 #include <openssl/evp.h>
2182 int main(void) { if(EVP_DigestUpdate(NULL, NULL,0)) exit(0); }
2189 AC_DEFINE(OPENSSL_EVP_DIGESTUPDATE_VOID, 1,
2190 [Define if EVP_DigestUpdate returns void])
2194 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2195 # because the system crypt() is more featureful.
2196 if test "x$check_for_libcrypt_before" = "x1"; then
2197 AC_CHECK_LIB(crypt, crypt)
2200 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2201 # version in OpenSSL.
2202 if test "x$check_for_libcrypt_later" = "x1"; then
2203 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
2206 # Search for SHA256 support in libc and/or OpenSSL
2207 AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2209 # Check complete ECC support in OpenSSL
2210 AC_MSG_CHECKING([whether OpenSSL has complete ECC support])
2213 #include <openssl/ec.h>
2214 #include <openssl/evp.h>
2215 #include <openssl/objects.h>
2217 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2218 const EVP_MD *m = EVP_sha512(); /* We need this too */
2223 AC_DEFINE(OPENSSL_HAS_ECC, 1,
2224 [libcrypto includes complete ECC support])
2232 AC_SUBST(TEST_SSH_ECC)
2235 AC_CHECK_LIB(iaf, ia_openinfo, [
2237 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2238 AC_DEFINE(HAVE_LIBIAF, 1,
2239 [Define if system has libiaf that supports set_id])
2244 ### Configure cryptographic random number support
2246 # Check wheter OpenSSL seeds itself
2247 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2251 #include <openssl/rand.h>
2252 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
2255 OPENSSL_SEEDS_ITSELF=yes
2260 # Default to use of the rand helper if OpenSSL doesn't
2265 AC_MSG_WARN([cross compiling: assuming yes])
2266 # This is safe, since all recent OpenSSL versions will
2267 # complain at runtime if not seeded correctly.
2268 OPENSSL_SEEDS_ITSELF=yes
2272 # Check for PAM libs
2275 [ --with-pam Enable PAM support ],
2277 if test "x$withval" != "xno" ; then
2278 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2279 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2280 AC_MSG_ERROR([PAM headers not found])
2284 AC_CHECK_LIB(dl, dlopen, , )
2285 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2286 AC_CHECK_FUNCS(pam_getenvlist)
2287 AC_CHECK_FUNCS(pam_putenv)
2292 SSHDLIBS="$SSHDLIBS -lpam"
2293 AC_DEFINE(USE_PAM, 1,
2294 [Define if you want to enable PAM support])
2296 if test $ac_cv_lib_dl_dlopen = yes; then
2299 # libdl already in LIBS
2302 SSHDLIBS="$SSHDLIBS -ldl"
2310 # Check for older PAM
2311 if test "x$PAM_MSG" = "xyes" ; then
2312 # Check PAM strerror arguments (old PAM)
2313 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2317 #if defined(HAVE_SECURITY_PAM_APPL_H)
2318 #include <security/pam_appl.h>
2319 #elif defined (HAVE_PAM_PAM_APPL_H)
2320 #include <pam/pam_appl.h>
2323 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2324 [AC_MSG_RESULT(no)],
2326 AC_DEFINE(HAVE_OLD_PAM, 1,
2327 [Define if you have an old version of PAM
2328 which takes only one argument to pam_strerror])
2330 PAM_MSG="yes (old library)"
2335 # Do we want to force the use of the rand helper?
2336 AC_ARG_WITH(rand-helper,
2337 [ --with-rand-helper Use subprocess to gather strong randomness ],
2339 if test "x$withval" = "xno" ; then
2340 # Force use of OpenSSL's internal RNG, even if
2341 # the previous test showed it to be unseeded.
2342 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2343 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2344 OPENSSL_SEEDS_ITSELF=yes
2353 # Which randomness source do we use?
2354 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
2356 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2357 [Define if you want OpenSSL's internally seeded PRNG only])
2358 RAND_MSG="OpenSSL internal ONLY"
2359 INSTALL_SSH_RAND_HELPER=""
2360 elif test ! -z "$USE_RAND_HELPER" ; then
2361 # install rand helper
2362 RAND_MSG="ssh-rand-helper"
2363 INSTALL_SSH_RAND_HELPER="yes"
2365 AC_SUBST(INSTALL_SSH_RAND_HELPER)
2367 ### Configuration of ssh-rand-helper
2370 AC_ARG_WITH(prngd-port,
2371 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2380 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2383 if test ! -z "$withval" ; then
2384 PRNGD_PORT="$withval"
2385 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2386 [Port number of PRNGD/EGD random number socket])
2391 # PRNGD Unix domain socket
2392 AC_ARG_WITH(prngd-socket,
2393 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2397 withval="/var/run/egd-pool"
2405 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2409 if test ! -z "$withval" ; then
2410 if test ! -z "$PRNGD_PORT" ; then
2411 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2413 if test ! -r "$withval" ; then
2414 AC_MSG_WARN(Entropy socket is not readable)
2416 PRNGD_SOCKET="$withval"
2417 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2418 [Location of PRNGD/EGD random number socket])
2422 # Check for existing socket only if we don't have a random device already
2423 if test "$USE_RAND_HELPER" = yes ; then
2424 AC_MSG_CHECKING(for PRNGD/EGD socket)
2425 # Insert other locations here
2426 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2427 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2428 PRNGD_SOCKET="$sock"
2429 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2433 if test ! -z "$PRNGD_SOCKET" ; then
2434 AC_MSG_RESULT($PRNGD_SOCKET)
2436 AC_MSG_RESULT(not found)
2442 # Change default command timeout for hashing entropy source
2444 AC_ARG_WITH(entropy-timeout,
2445 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2447 if test -n "$withval" && test "x$withval" != "xno" && \
2448 test "x${withval}" != "xyes"; then
2449 entropy_timeout=$withval
2453 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2454 [Builtin PRNG command timeout])
2456 SSH_PRIVSEP_USER=sshd
2457 AC_ARG_WITH(privsep-user,
2458 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
2460 if test -n "$withval" && test "x$withval" != "xno" && \
2461 test "x${withval}" != "xyes"; then
2462 SSH_PRIVSEP_USER=$withval
2466 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2467 [non-privileged user for privilege separation])
2468 AC_SUBST(SSH_PRIVSEP_USER)
2470 # We do this little dance with the search path to insure
2471 # that programs that we select for use by installed programs
2472 # (which may be run by the super-user) come from trusted
2473 # locations before they come from the user's private area.
2474 # This should help avoid accidentally configuring some
2475 # random version of a program in someone's personal bin.
2479 test -h /bin 2> /dev/null && PATH=/usr/bin
2480 test -d /sbin && PATH=$PATH:/sbin
2481 test -d /usr/sbin && PATH=$PATH:/usr/sbin
2482 PATH=$PATH:/etc:$OPATH
2484 # These programs are used by the command hashing source to gather entropy
2485 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2486 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2487 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2488 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2489 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2490 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2491 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2492 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2493 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2494 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2495 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2496 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2497 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2498 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2499 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2500 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2504 # Where does ssh-rand-helper get its randomness from?
2505 INSTALL_SSH_PRNG_CMDS=""
2506 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2507 if test ! -z "$PRNGD_PORT" ; then
2508 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2509 elif test ! -z "$PRNGD_SOCKET" ; then
2510 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2512 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2513 RAND_HELPER_CMDHASH=yes
2514 INSTALL_SSH_PRNG_CMDS="yes"
2517 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2520 # Cheap hack to ensure NEWS-OS libraries are arranged right.
2521 if test ! -z "$SONY" ; then
2522 LIBS="$LIBS -liberty";
2525 # Check for long long datatypes
2526 AC_CHECK_TYPES([long long, unsigned long long, long double])
2528 # Check datatype sizes
2529 AC_CHECK_SIZEOF(char, 1)
2530 AC_CHECK_SIZEOF(short int, 2)
2531 AC_CHECK_SIZEOF(int, 4)
2532 AC_CHECK_SIZEOF(long int, 4)
2533 AC_CHECK_SIZEOF(long long int, 8)
2535 # Sanity check long long for some platforms (AIX)
2536 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2537 ac_cv_sizeof_long_long_int=0
2540 # compute LLONG_MIN and LLONG_MAX if we don't know them.
2541 if test -z "$have_llong_max"; then
2542 AC_MSG_CHECKING([for max value of long long])
2546 /* Why is this so damn hard? */
2550 #define __USE_ISOC99
2552 #define DATA "conftest.llminmax"
2553 #define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2556 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2557 * we do this the hard way.
2560 fprint_ll(FILE *f, long long n)
2563 int l[sizeof(long long) * 8];
2566 if (fprintf(f, "-") < 0)
2568 for (i = 0; n != 0; i++) {
2569 l[i] = my_abs(n % 10);
2573 if (fprintf(f, "%d", l[--i]) < 0)
2576 if (fprintf(f, " ") < 0)
2583 long long i, llmin, llmax = 0;
2585 if((f = fopen(DATA,"w")) == NULL)
2588 #if defined(LLONG_MIN) && defined(LLONG_MAX)
2589 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2593 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2594 /* This will work on one's complement and two's complement */
2595 for (i = 1; i > llmax; i <<= 1, i++)
2597 llmin = llmax + 1LL; /* wrap */
2601 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2602 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2603 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
2604 fprintf(f, "unknown unknown\n");
2608 if (fprint_ll(f, llmin) < 0)
2610 if (fprint_ll(f, llmax) < 0)
2618 llong_min=`$AWK '{print $1}' conftest.llminmax`
2619 llong_max=`$AWK '{print $2}' conftest.llminmax`
2621 AC_MSG_RESULT($llong_max)
2622 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2623 [max value of long long calculated by configure])
2624 AC_MSG_CHECKING([for min value of long long])
2625 AC_MSG_RESULT($llong_min)
2626 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2627 [min value of long long calculated by configure])
2630 AC_MSG_RESULT(not found)
2633 AC_MSG_WARN([cross compiling: not checking])
2639 # More checks for data types
2640 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2642 [ #include <sys/types.h> ],
2644 [ ac_cv_have_u_int="yes" ],
2645 [ ac_cv_have_u_int="no" ]
2648 if test "x$ac_cv_have_u_int" = "xyes" ; then
2649 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2653 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2655 [ #include <sys/types.h> ],
2656 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2657 [ ac_cv_have_intxx_t="yes" ],
2658 [ ac_cv_have_intxx_t="no" ]
2661 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2662 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2666 if (test -z "$have_intxx_t" && \
2667 test "x$ac_cv_header_stdint_h" = "xyes")
2669 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2671 [ #include <stdint.h> ],
2672 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2674 AC_DEFINE(HAVE_INTXX_T)
2677 [ AC_MSG_RESULT(no) ]
2681 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2684 #include <sys/types.h>
2685 #ifdef HAVE_STDINT_H
2686 # include <stdint.h>
2688 #include <sys/socket.h>
2689 #ifdef HAVE_SYS_BITYPES_H
2690 # include <sys/bitypes.h>
2693 [ int64_t a; a = 1;],
2694 [ ac_cv_have_int64_t="yes" ],
2695 [ ac_cv_have_int64_t="no" ]
2698 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2699 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2702 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2704 [ #include <sys/types.h> ],
2705 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2706 [ ac_cv_have_u_intxx_t="yes" ],
2707 [ ac_cv_have_u_intxx_t="no" ]
2710 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2711 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2715 if test -z "$have_u_intxx_t" ; then
2716 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2718 [ #include <sys/socket.h> ],
2719 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2721 AC_DEFINE(HAVE_U_INTXX_T)
2724 [ AC_MSG_RESULT(no) ]
2728 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2730 [ #include <sys/types.h> ],
2731 [ u_int64_t a; a = 1;],
2732 [ ac_cv_have_u_int64_t="yes" ],
2733 [ ac_cv_have_u_int64_t="no" ]
2736 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2737 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2741 if test -z "$have_u_int64_t" ; then
2742 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2744 [ #include <sys/bitypes.h> ],
2745 [ u_int64_t a; a = 1],
2747 AC_DEFINE(HAVE_U_INT64_T)
2750 [ AC_MSG_RESULT(no) ]
2754 if test -z "$have_u_intxx_t" ; then
2755 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2758 #include <sys/types.h>
2760 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2761 [ ac_cv_have_uintxx_t="yes" ],
2762 [ ac_cv_have_uintxx_t="no" ]
2765 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2766 AC_DEFINE(HAVE_UINTXX_T, 1,
2767 [define if you have uintxx_t data type])
2771 if test -z "$have_uintxx_t" ; then
2772 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2774 [ #include <stdint.h> ],
2775 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2777 AC_DEFINE(HAVE_UINTXX_T)
2780 [ AC_MSG_RESULT(no) ]
2784 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2785 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2787 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2790 #include <sys/bitypes.h>
2793 int8_t a; int16_t b; int32_t c;
2794 u_int8_t e; u_int16_t f; u_int32_t g;
2795 a = b = c = e = f = g = 1;
2798 AC_DEFINE(HAVE_U_INTXX_T)
2799 AC_DEFINE(HAVE_INTXX_T)
2807 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2810 #include <sys/types.h>
2812 [ u_char foo; foo = 125; ],
2813 [ ac_cv_have_u_char="yes" ],
2814 [ ac_cv_have_u_char="no" ]
2817 if test "x$ac_cv_have_u_char" = "xyes" ; then
2818 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2823 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2824 AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t],,,[
2825 #include <sys/types.h>
2826 #ifdef HAVE_SYS_BITYPES_H
2827 #include <sys/bitypes.h>
2829 #ifdef HAVE_SYS_STATFS_H
2830 #include <sys/statfs.h>
2832 #ifdef HAVE_SYS_STATVFS_H
2833 #include <sys/statvfs.h>
2837 AC_CHECK_TYPES([in_addr_t, in_port_t],,,
2838 [#include <sys/types.h>
2839 #include <netinet/in.h>])
2841 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2844 #include <sys/types.h>
2846 [ size_t foo; foo = 1235; ],
2847 [ ac_cv_have_size_t="yes" ],
2848 [ ac_cv_have_size_t="no" ]
2851 if test "x$ac_cv_have_size_t" = "xyes" ; then
2852 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2855 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2858 #include <sys/types.h>
2860 [ ssize_t foo; foo = 1235; ],
2861 [ ac_cv_have_ssize_t="yes" ],
2862 [ ac_cv_have_ssize_t="no" ]
2865 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2866 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2869 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2874 [ clock_t foo; foo = 1235; ],
2875 [ ac_cv_have_clock_t="yes" ],
2876 [ ac_cv_have_clock_t="no" ]
2879 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2880 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2883 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2886 #include <sys/types.h>
2887 #include <sys/socket.h>
2889 [ sa_family_t foo; foo = 1235; ],
2890 [ ac_cv_have_sa_family_t="yes" ],
2893 #include <sys/types.h>
2894 #include <sys/socket.h>
2895 #include <netinet/in.h>
2897 [ sa_family_t foo; foo = 1235; ],
2898 [ ac_cv_have_sa_family_t="yes" ],
2900 [ ac_cv_have_sa_family_t="no" ]
2904 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2905 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2906 [define if you have sa_family_t data type])
2909 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2912 #include <sys/types.h>
2914 [ pid_t foo; foo = 1235; ],
2915 [ ac_cv_have_pid_t="yes" ],
2916 [ ac_cv_have_pid_t="no" ]
2919 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2920 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2923 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2926 #include <sys/types.h>
2928 [ mode_t foo; foo = 1235; ],
2929 [ ac_cv_have_mode_t="yes" ],
2930 [ ac_cv_have_mode_t="no" ]
2933 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2934 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2938 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2941 #include <sys/types.h>
2942 #include <sys/socket.h>
2944 [ struct sockaddr_storage s; ],
2945 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2946 [ ac_cv_have_struct_sockaddr_storage="no" ]
2949 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2950 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2951 [define if you have struct sockaddr_storage data type])
2954 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2957 #include <sys/types.h>
2958 #include <netinet/in.h>
2960 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2961 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2962 [ ac_cv_have_struct_sockaddr_in6="no" ]
2965 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2966 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2967 [define if you have struct sockaddr_in6 data type])
2970 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2973 #include <sys/types.h>
2974 #include <netinet/in.h>
2976 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2977 [ ac_cv_have_struct_in6_addr="yes" ],
2978 [ ac_cv_have_struct_in6_addr="no" ]
2981 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2982 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2983 [define if you have struct in6_addr data type])
2985 dnl Now check for sin6_scope_id
2986 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
2988 #ifdef HAVE_SYS_TYPES_H
2989 #include <sys/types.h>
2991 #include <netinet/in.h>
2995 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2998 #include <sys/types.h>
2999 #include <sys/socket.h>
3002 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
3003 [ ac_cv_have_struct_addrinfo="yes" ],
3004 [ ac_cv_have_struct_addrinfo="no" ]
3007 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
3008 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
3009 [define if you have struct addrinfo data type])
3012 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
3014 [ #include <sys/time.h> ],
3015 [ struct timeval tv; tv.tv_sec = 1;],
3016 [ ac_cv_have_struct_timeval="yes" ],
3017 [ ac_cv_have_struct_timeval="no" ]
3020 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
3021 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
3022 have_struct_timeval=1
3025 AC_CHECK_TYPES(struct timespec)
3027 # We need int64_t or else certian parts of the compile will fail.
3028 if test "x$ac_cv_have_int64_t" = "xno" && \
3029 test "x$ac_cv_sizeof_long_int" != "x8" && \
3030 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
3031 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3032 echo "an alternative compiler (I.E., GCC) before continuing."
3036 dnl test snprintf (broken on SCO w/gcc)
3041 #ifdef HAVE_SNPRINTF
3045 char expected_out[50];
3047 #if (SIZEOF_LONG_INT == 8)
3048 long int num = 0x7fffffffffffffff;
3050 long long num = 0x7fffffffffffffffll;
3052 strcpy(expected_out, "9223372036854775807");
3053 snprintf(buf, mazsize, "%lld", num);
3054 if(strcmp(buf, expected_out) != 0)
3061 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
3062 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
3066 dnl Checks for structure members
3067 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
3068 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
3069 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
3070 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
3071 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
3072 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
3073 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
3074 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
3075 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
3076 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
3077 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
3078 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
3079 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
3080 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
3081 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
3082 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
3083 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
3085 AC_CHECK_MEMBERS([struct stat.st_blksize])
3086 AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
3087 [Define if we don't have struct __res_state in resolv.h])],
3090 #if HAVE_SYS_TYPES_H
3091 # include <sys/types.h>
3093 #include <netinet/in.h>
3094 #include <arpa/nameser.h>
3098 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3099 ac_cv_have_ss_family_in_struct_ss, [
3102 #include <sys/types.h>
3103 #include <sys/socket.h>
3105 [ struct sockaddr_storage s; s.ss_family = 1; ],
3106 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3107 [ ac_cv_have_ss_family_in_struct_ss="no" ],
3110 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
3111 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
3114 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3115 ac_cv_have___ss_family_in_struct_ss, [
3118 #include <sys/types.h>
3119 #include <sys/socket.h>
3121 [ struct sockaddr_storage s; s.__ss_family = 1; ],
3122 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3123 [ ac_cv_have___ss_family_in_struct_ss="no" ]
3126 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
3127 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
3128 [Fields in struct sockaddr_storage])
3131 AC_CACHE_CHECK([for pw_class field in struct passwd],
3132 ac_cv_have_pw_class_in_struct_passwd, [
3137 [ struct passwd p; p.pw_class = 0; ],
3138 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3139 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
3142 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
3143 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
3144 [Define if your password has a pw_class field])
3147 AC_CACHE_CHECK([for pw_expire field in struct passwd],
3148 ac_cv_have_pw_expire_in_struct_passwd, [
3153 [ struct passwd p; p.pw_expire = 0; ],
3154 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3155 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
3158 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
3159 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
3160 [Define if your password has a pw_expire field])
3163 AC_CACHE_CHECK([for pw_change field in struct passwd],
3164 ac_cv_have_pw_change_in_struct_passwd, [
3169 [ struct passwd p; p.pw_change = 0; ],
3170 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3171 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
3174 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
3175 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
3176 [Define if your password has a pw_change field])
3179 dnl make sure we're using the real structure members and not defines
3180 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3181 ac_cv_have_accrights_in_msghdr, [
3184 #include <sys/types.h>
3185 #include <sys/socket.h>
3186 #include <sys/uio.h>
3188 #ifdef msg_accrights
3189 #error "msg_accrights is a macro"
3193 m.msg_accrights = 0;
3197 [ ac_cv_have_accrights_in_msghdr="yes" ],
3198 [ ac_cv_have_accrights_in_msghdr="no" ]
3201 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
3202 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
3203 [Define if your system uses access rights style
3204 file descriptor passing])
3207 AC_MSG_CHECKING(if struct statvfs.f_fsid is integral type)
3209 #include <sys/types.h>
3210 #include <sys/stat.h>
3211 #ifdef HAVE_SYS_TIME_H
3212 # include <sys/time.h>
3214 #ifdef HAVE_SYS_MOUNT_H
3215 #include <sys/mount.h>
3217 #ifdef HAVE_SYS_STATVFS_H
3218 #include <sys/statvfs.h>
3220 ], [struct statvfs s; s.f_fsid = 0;],
3221 [ AC_MSG_RESULT(yes) ],
3224 AC_MSG_CHECKING(if fsid_t has member val)
3226 #include <sys/types.h>
3227 #include <sys/statvfs.h>],
3228 [fsid_t t; t.val[0] = 0;],
3229 [ AC_MSG_RESULT(yes)
3230 AC_DEFINE(FSID_HAS_VAL, 1, fsid_t has member val) ],
3231 [ AC_MSG_RESULT(no) ])
3233 AC_MSG_CHECKING(if f_fsid has member __val)
3235 #include <sys/types.h>
3236 #include <sys/statvfs.h>],
3237 [fsid_t t; t.__val[0] = 0;],
3238 [ AC_MSG_RESULT(yes)
3239 AC_DEFINE(FSID_HAS___VAL, 1, fsid_t has member __val) ],
3240 [ AC_MSG_RESULT(no) ])
3243 AC_CACHE_CHECK([for msg_control field in struct msghdr],
3244 ac_cv_have_control_in_msghdr, [
3247 #include <sys/types.h>
3248 #include <sys/socket.h>
3249 #include <sys/uio.h>
3252 #error "msg_control is a macro"
3260 [ ac_cv_have_control_in_msghdr="yes" ],
3261 [ ac_cv_have_control_in_msghdr="no" ]
3264 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
3265 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
3266 [Define if your system uses ancillary data style
3267 file descriptor passing])
3270 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
3272 [ extern char *__progname; printf("%s", __progname); ],
3273 [ ac_cv_libc_defines___progname="yes" ],
3274 [ ac_cv_libc_defines___progname="no" ]
3277 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
3278 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
3281 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3285 [ printf("%s", __FUNCTION__); ],
3286 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3287 [ ac_cv_cc_implements___FUNCTION__="no" ]
3290 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
3291 AC_DEFINE(HAVE___FUNCTION__, 1,
3292 [Define if compiler implements __FUNCTION__])
3295 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3299 [ printf("%s", __func__); ],
3300 [ ac_cv_cc_implements___func__="yes" ],
3301 [ ac_cv_cc_implements___func__="no" ]
3304 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
3305 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
3308 AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3310 [#include <stdarg.h>
3313 [ ac_cv_have_va_copy="yes" ],
3314 [ ac_cv_have_va_copy="no" ]
3317 if test "x$ac_cv_have_va_copy" = "xyes" ; then
3318 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3321 AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3323 [#include <stdarg.h>
3326 [ ac_cv_have___va_copy="yes" ],
3327 [ ac_cv_have___va_copy="no" ]
3330 if test "x$ac_cv_have___va_copy" = "xyes" ; then
3331 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3334 AC_CACHE_CHECK([whether getopt has optreset support],
3335 ac_cv_have_getopt_optreset, [
3340 [ extern int optreset; optreset = 0; ],
3341 [ ac_cv_have_getopt_optreset="yes" ],
3342 [ ac_cv_have_getopt_optreset="no" ]
3345 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
3346 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3347 [Define if your getopt(3) defines and uses optreset])
3350 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
3352 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
3353 [ ac_cv_libc_defines_sys_errlist="yes" ],
3354 [ ac_cv_libc_defines_sys_errlist="no" ]
3357 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
3358 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3359 [Define if your system defines sys_errlist[]])
3363 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
3365 [ extern int sys_nerr; printf("%i", sys_nerr);],
3366 [ ac_cv_libc_defines_sys_nerr="yes" ],
3367 [ ac_cv_libc_defines_sys_nerr="no" ]
3370 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
3371 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
3374 # Check libraries needed by DNS fingerprint support
3375 AC_SEARCH_LIBS(getrrsetbyname, resolv,
3376 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3377 [Define if getrrsetbyname() exists])],
3379 # Needed by our getrrsetbyname()
3380 AC_SEARCH_LIBS(res_query, resolv)
3381 AC_SEARCH_LIBS(dn_expand, resolv)
3382 AC_MSG_CHECKING(if res_query will link)
3384 #include "confdefs.h"
3385 #include <sys/types.h>
3386 #include <netinet/in.h>
3387 #include <arpa/nameser.h>
3392 res_query (0, 0, 0, 0, 0);
3399 LIBS="$LIBS -lresolv"
3400 AC_MSG_CHECKING(for res_query in -lresolv)
3402 #include "confdefs.h"
3403 #include <sys/types.h>
3404 #include <netinet/in.h>
3405 #include <arpa/nameser.h>
3410 res_query (0, 0, 0, 0, 0);
3414 [AC_MSG_RESULT(yes)],
3418 AC_CHECK_FUNCS(_getshort _getlong)
3419 AC_CHECK_DECLS([_getshort, _getlong], , ,
3420 [#include <sys/types.h>
3421 #include <arpa/nameser.h>])
3422 AC_CHECK_MEMBER(HEADER.ad,
3423 [AC_DEFINE(HAVE_HEADER_AD, 1,
3424 [Define if HEADER.ad exists in arpa/nameser.h])],,
3425 [#include <arpa/nameser.h>])
3428 AC_MSG_CHECKING(if struct __res_state _res is an extern)
3431 #if HAVE_SYS_TYPES_H
3432 # include <sys/types.h>
3434 #include <netinet/in.h>
3435 #include <arpa/nameser.h>
3437 extern struct __res_state _res;
3438 int main() { return 0; }
3441 AC_DEFINE(HAVE__RES_EXTERN, 1,
3442 [Define if you have struct __res_state _res as an extern])
3444 [ AC_MSG_RESULT(no) ]
3447 # Check whether user wants SELinux support
3450 AC_ARG_WITH(selinux,
3451 [ --with-selinux Enable SELinux support],
3452 [ if test "x$withval" != "xno" ; then
3454 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3456 AC_CHECK_HEADER([selinux/selinux.h], ,
3457 AC_MSG_ERROR(SELinux support requires selinux.h header))
3458 AC_CHECK_LIB(selinux, setexeccon,
3459 [ LIBSELINUX="-lselinux"
3460 LIBS="$LIBS -lselinux"
3462 AC_MSG_ERROR(SELinux support requires libselinux library))
3463 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
3464 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
3469 # Check whether user wants Kerberos 5 support
3471 AC_ARG_WITH(kerberos5,
3472 [ --with-kerberos5=PATH Enable Kerberos 5 support],
3473 [ if test "x$withval" != "xno" ; then
3474 if test "x$withval" = "xyes" ; then
3475 KRB5ROOT="/usr/local"
3480 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
3483 AC_PATH_PROG([KRB5CONF],[krb5-config],
3484 [$KRB5ROOT/bin/krb5-config],
3485 [$KRB5ROOT/bin:$PATH])
3486 if test -x $KRB5CONF ; then
3488 AC_MSG_CHECKING(for gssapi support)
3489 if $KRB5CONF | grep gssapi >/dev/null ; then
3491 AC_DEFINE(GSSAPI, 1,
3492 [Define this if you want GSSAPI
3493 support in the version 2 protocol])
3499 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3500 K5LIBS="`$KRB5CONF --libs $k5confopts`"
3501 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
3502 AC_MSG_CHECKING(whether we are using Heimdal)
3503 AC_TRY_COMPILE([ #include <krb5.h> ],
3504 [ char *tmp = heimdal_version; ],
3505 [ AC_MSG_RESULT(yes)
3506 AC_DEFINE(HEIMDAL, 1,
3507 [Define this if you are using the
3508 Heimdal version of Kerberos V5]) ],
3512 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
3513 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
3514 AC_MSG_CHECKING(whether we are using Heimdal)
3515 AC_TRY_COMPILE([ #include <krb5.h> ],
3516 [ char *tmp = heimdal_version; ],
3517 [ AC_MSG_RESULT(yes)
3519 K5LIBS="-lkrb5 -ldes"
3520 K5LIBS="$K5LIBS -lcom_err -lasn1"
3521 AC_CHECK_LIB(roken, net_write,
3522 [K5LIBS="$K5LIBS -lroken"])
3525 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3528 AC_SEARCH_LIBS(dn_expand, resolv)
3530 AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,
3532 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3533 [ AC_CHECK_LIB(gssapi, gss_init_sec_context,
3535 K5LIBS="-lgssapi $K5LIBS" ],
3536 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3541 AC_CHECK_HEADER(gssapi.h, ,
3542 [ unset ac_cv_header_gssapi_h
3543 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3544 AC_CHECK_HEADERS(gssapi.h, ,
3545 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
3551 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3552 AC_CHECK_HEADER(gssapi_krb5.h, ,
3553 [ CPPFLAGS="$oldCPP" ])
3556 if test ! -z "$need_dash_r" ; then
3557 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3559 if test ! -z "$blibpath" ; then
3560 blibpath="$blibpath:${KRB5ROOT}/lib"
3563 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3564 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3565 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3567 LIBS="$LIBS $K5LIBS"
3568 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3569 [Define this if you want to use libkafs' AFS support]))
3574 # Looking for programs, paths and files
3576 PRIVSEP_PATH=/var/empty
3577 AC_ARG_WITH(privsep-path,
3578 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
3580 if test -n "$withval" && test "x$withval" != "xno" && \
3581 test "x${withval}" != "xyes"; then
3582 PRIVSEP_PATH=$withval
3586 AC_SUBST(PRIVSEP_PATH)
3589 [ --with-xauth=PATH Specify path to xauth program ],
3591 if test -n "$withval" && test "x$withval" != "xno" && \
3592 test "x${withval}" != "xyes"; then
3598 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3599 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3600 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3601 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3602 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3603 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3604 xauth_path="/usr/openwin/bin/xauth"
3610 AC_ARG_ENABLE(strip,
3611 [ --disable-strip Disable calling strip(1) on install],
3613 if test "x$enableval" = "xno" ; then
3620 if test -z "$xauth_path" ; then
3621 XAUTH_PATH="undefined"
3622 AC_SUBST(XAUTH_PATH)
3624 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3625 [Define if xauth is found in your path])
3626 XAUTH_PATH=$xauth_path
3627 AC_SUBST(XAUTH_PATH)
3630 # Check for mail directory (last resort if we cannot get it from headers)
3631 if test ! -z "$MAIL" ; then
3632 maildir=`dirname $MAIL`
3633 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3634 [Set this to your mail directory if you don't have maillock.h])
3637 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3638 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3639 disable_ptmx_check=yes
3641 if test -z "$no_dev_ptmx" ; then
3642 if test "x$disable_ptmx_check" != "xyes" ; then
3643 AC_CHECK_FILE("/dev/ptmx",
3645 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3646 [Define if you have /dev/ptmx])
3653 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3654 AC_CHECK_FILE("/dev/ptc",
3656 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3657 [Define if you have /dev/ptc])
3662 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3665 # Options from here on. Some of these are preset by platform above
3666 AC_ARG_WITH(mantype,
3667 [ --with-mantype=man|cat|doc Set man page type],
3674 AC_MSG_ERROR(invalid man type: $withval)
3679 if test -z "$MANTYPE"; then
3680 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3681 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3682 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3684 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3691 if test "$MANTYPE" = "doc"; then
3698 # Check whether to enable MD5 passwords
3700 AC_ARG_WITH(md5-passwords,
3701 [ --with-md5-passwords Enable use of MD5 passwords],
3703 if test "x$withval" != "xno" ; then
3704 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3705 [Define if you want to allow MD5 passwords])
3711 # Whether to disable shadow password support
3713 [ --without-shadow Disable shadow password support],
3715 if test "x$withval" = "xno" ; then
3716 AC_DEFINE(DISABLE_SHADOW)
3722 if test -z "$disable_shadow" ; then
3723 AC_MSG_CHECKING([if the systems has expire shadow information])
3726 #include <sys/types.h>
3729 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3730 [ sp_expire_available=yes ], []
3733 if test "x$sp_expire_available" = "xyes" ; then
3735 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3736 [Define if you want to use shadow password expire field])
3742 # Use ip address instead of hostname in $DISPLAY
3743 if test ! -z "$IPADDR_IN_DISPLAY" ; then
3744 DISPLAY_HACK_MSG="yes"
3745 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3746 [Define if you need to use IP address
3747 instead of hostname in $DISPLAY])
3749 DISPLAY_HACK_MSG="no"
3750 AC_ARG_WITH(ipaddr-display,
3751 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3753 if test "x$withval" != "xno" ; then
3754 AC_DEFINE(IPADDR_IN_DISPLAY)
3755 DISPLAY_HACK_MSG="yes"
3761 # check for /etc/default/login and use it if present.
3762 AC_ARG_ENABLE(etc-default-login,
3763 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3764 [ if test "x$enableval" = "xno"; then
3765 AC_MSG_NOTICE([/etc/default/login handling disabled])
3766 etc_default_login=no
3768 etc_default_login=yes
3770 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3772 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3773 etc_default_login=no
3775 etc_default_login=yes
3779 if test "x$etc_default_login" != "xno"; then
3780 AC_CHECK_FILE("/etc/default/login",
3781 [ external_path_file=/etc/default/login ])
3782 if test "x$external_path_file" = "x/etc/default/login"; then
3783 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3784 [Define if your system has /etc/default/login])
3788 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3789 if test $ac_cv_func_login_getcapbool = "yes" && \
3790 test $ac_cv_header_login_cap_h = "yes" ; then
3791 external_path_file=/etc/login.conf
3794 # Whether to mess with the default path
3795 SERVER_PATH_MSG="(default)"
3796 AC_ARG_WITH(default-path,
3797 [ --with-default-path= Specify default \$PATH environment for server],
3799 if test "x$external_path_file" = "x/etc/login.conf" ; then
3801 --with-default-path=PATH has no effect on this system.
3802 Edit /etc/login.conf instead.])
3803 elif test "x$withval" != "xno" ; then
3804 if test ! -z "$external_path_file" ; then
3806 --with-default-path=PATH will only be used if PATH is not defined in
3807 $external_path_file .])
3809 user_path="$withval"
3810 SERVER_PATH_MSG="$withval"
3813 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3814 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3816 if test ! -z "$external_path_file" ; then
3818 If PATH is defined in $external_path_file, ensure the path to scp is included,
3819 otherwise scp will not work.])
3823 /* find out what STDPATH is */
3828 #ifndef _PATH_STDPATH
3829 # ifdef _PATH_USERPATH /* Irix */
3830 # define _PATH_STDPATH _PATH_USERPATH
3832 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3835 #include <sys/types.h>
3836 #include <sys/stat.h>
3838 #define DATA "conftest.stdpath"
3845 fd = fopen(DATA,"w");
3849 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3855 [ user_path=`cat conftest.stdpath` ],
3856 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3857 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3859 # make sure $bindir is in USER_PATH so scp will work
3860 t_bindir=`eval echo ${bindir}`
3862 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3865 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3867 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3868 if test $? -ne 0 ; then
3869 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3870 if test $? -ne 0 ; then
3871 user_path=$user_path:$t_bindir
3872 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3877 if test "x$external_path_file" != "x/etc/login.conf" ; then
3878 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
3882 # Set superuser path separately to user path
3883 AC_ARG_WITH(superuser-path,
3884 [ --with-superuser-path= Specify different path for super-user],
3886 if test -n "$withval" && test "x$withval" != "xno" && \
3887 test "x${withval}" != "xyes"; then
3888 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3889 [Define if you want a different $PATH
3891 superuser_path=$withval
3897 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3898 IPV4_IN6_HACK_MSG="no"
3900 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3902 if test "x$withval" != "xno" ; then
3904 AC_DEFINE(IPV4_IN_IPV6, 1,
3905 [Detect IPv4 in IPv6 mapped addresses
3907 IPV4_IN6_HACK_MSG="yes"
3912 if test "x$inet6_default_4in6" = "xyes"; then
3913 AC_MSG_RESULT([yes (default)])
3914 AC_DEFINE(IPV4_IN_IPV6)
3915 IPV4_IN6_HACK_MSG="yes"
3917 AC_MSG_RESULT([no (default)])
3922 # Whether to enable BSD auth support
3924 AC_ARG_WITH(bsd-auth,
3925 [ --with-bsd-auth Enable BSD auth support],
3927 if test "x$withval" != "xno" ; then
3928 AC_DEFINE(BSD_AUTH, 1,
3929 [Define if you have BSD auth support])
3935 # Where to place sshd.pid
3937 # make sure the directory exists
3938 if test ! -d $piddir ; then
3939 piddir=`eval echo ${sysconfdir}`
3941 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3945 AC_ARG_WITH(pid-dir,
3946 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3948 if test -n "$withval" && test "x$withval" != "xno" && \
3949 test "x${withval}" != "xyes"; then
3951 if test ! -d $piddir ; then
3952 AC_MSG_WARN([** no $piddir directory on this system **])
3958 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3961 dnl allow user to disable some login recording features
3962 AC_ARG_ENABLE(lastlog,
3963 [ --disable-lastlog disable use of lastlog even if detected [no]],
3965 if test "x$enableval" = "xno" ; then
3966 AC_DEFINE(DISABLE_LASTLOG)
3971 [ --disable-utmp disable use of utmp even if detected [no]],
3973 if test "x$enableval" = "xno" ; then
3974 AC_DEFINE(DISABLE_UTMP)
3978 AC_ARG_ENABLE(utmpx,
3979 [ --disable-utmpx disable use of utmpx even if detected [no]],
3981 if test "x$enableval" = "xno" ; then
3982 AC_DEFINE(DISABLE_UTMPX, 1,
3983 [Define if you don't want to use utmpx])
3988 [ --disable-wtmp disable use of wtmp even if detected [no]],
3990 if test "x$enableval" = "xno" ; then
3991 AC_DEFINE(DISABLE_WTMP)
3995 AC_ARG_ENABLE(wtmpx,
3996 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3998 if test "x$enableval" = "xno" ; then
3999 AC_DEFINE(DISABLE_WTMPX, 1,
4000 [Define if you don't want to use wtmpx])
4004 AC_ARG_ENABLE(libutil,
4005 [ --disable-libutil disable use of libutil (login() etc.) [no]],
4007 if test "x$enableval" = "xno" ; then
4008 AC_DEFINE(DISABLE_LOGIN)
4012 AC_ARG_ENABLE(pututline,
4013 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
4015 if test "x$enableval" = "xno" ; then
4016 AC_DEFINE(DISABLE_PUTUTLINE, 1,
4017 [Define if you don't want to use pututline()
4018 etc. to write [uw]tmp])
4022 AC_ARG_ENABLE(pututxline,
4023 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
4025 if test "x$enableval" = "xno" ; then
4026 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
4027 [Define if you don't want to use pututxline()
4028 etc. to write [uw]tmpx])
4032 AC_ARG_WITH(lastlog,
4033 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
4035 if test "x$withval" = "xno" ; then
4036 AC_DEFINE(DISABLE_LASTLOG)
4037 elif test -n "$withval" && test "x${withval}" != "xyes"; then
4038 conf_lastlog_location=$withval
4043 dnl lastlog, [uw]tmpx? detection
4044 dnl NOTE: set the paths in the platform section to avoid the
4045 dnl need for command-line parameters
4046 dnl lastlog and [uw]tmp are subject to a file search if all else fails
4048 dnl lastlog detection
4049 dnl NOTE: the code itself will detect if lastlog is a directory
4050 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
4052 #include <sys/types.h>
4054 #ifdef HAVE_LASTLOG_H
4055 # include <lastlog.h>
4064 [ char *lastlog = LASTLOG_FILE; ],
4065 [ AC_MSG_RESULT(yes) ],
4068 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
4070 #include <sys/types.h>
4072 #ifdef HAVE_LASTLOG_H
4073 # include <lastlog.h>
4079 [ char *lastlog = _PATH_LASTLOG; ],
4080 [ AC_MSG_RESULT(yes) ],
4083 system_lastlog_path=no
4088 if test -z "$conf_lastlog_location"; then
4089 if test x"$system_lastlog_path" = x"no" ; then
4090 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
4091 if (test -d "$f" || test -f "$f") ; then
4092 conf_lastlog_location=$f
4095 if test -z "$conf_lastlog_location"; then
4096 AC_MSG_WARN([** Cannot find lastlog **])
4097 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
4102 if test -n "$conf_lastlog_location"; then
4103 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
4104 [Define if you want to specify the path to your lastlog file])
4108 AC_MSG_CHECKING([if your system defines UTMP_FILE])
4110 #include <sys/types.h>
4116 [ char *utmp = UTMP_FILE; ],
4117 [ AC_MSG_RESULT(yes) ],
4119 system_utmp_path=no ]
4121 if test -z "$conf_utmp_location"; then
4122 if test x"$system_utmp_path" = x"no" ; then
4123 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4124 if test -f $f ; then
4125 conf_utmp_location=$f
4128 if test -z "$conf_utmp_location"; then
4129 AC_DEFINE(DISABLE_UTMP)
4133 if test -n "$conf_utmp_location"; then
4134 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
4135 [Define if you want to specify the path to your utmp file])
4139 AC_MSG_CHECKING([if your system defines WTMP_FILE])
4141 #include <sys/types.h>
4147 [ char *wtmp = WTMP_FILE; ],
4148 [ AC_MSG_RESULT(yes) ],
4150 system_wtmp_path=no ]
4152 if test -z "$conf_wtmp_location"; then
4153 if test x"$system_wtmp_path" = x"no" ; then
4154 for f in /usr/adm/wtmp /var/log/wtmp; do
4155 if test -f $f ; then
4156 conf_wtmp_location=$f
4159 if test -z "$conf_wtmp_location"; then
4160 AC_DEFINE(DISABLE_WTMP)
4164 if test -n "$conf_wtmp_location"; then
4165 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
4166 [Define if you want to specify the path to your wtmp file])
4171 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
4173 #include <sys/types.h>
4182 [ char *wtmpx = WTMPX_FILE; ],
4183 [ AC_MSG_RESULT(yes) ],
4185 system_wtmpx_path=no ]
4187 if test -z "$conf_wtmpx_location"; then
4188 if test x"$system_wtmpx_path" = x"no" ; then
4189 AC_DEFINE(DISABLE_WTMPX)
4192 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
4193 [Define if you want to specify the path to your wtmpx file])
4197 if test ! -z "$blibpath" ; then
4198 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4199 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
4202 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4204 CFLAGS="$CFLAGS $werror_flags"
4206 if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4211 AC_CHECK_DECL(BROKEN_GETADDRINFO, TEST_SSH_IPV6=no)
4212 AC_SUBST(TEST_SSH_IPV6, $TEST_SSH_IPV6)
4215 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4216 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
4217 ssh_prng_cmds survey.sh])
4220 # Print summary of options
4222 # Someone please show me a better way :)
4223 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4224 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4225 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4226 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
4227 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
4228 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
4229 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
4230 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4231 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4232 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
4235 echo "OpenSSH has been configured with the following options:"
4236 echo " User binaries: $B"
4237 echo " System binaries: $C"
4238 echo " Configuration files: $D"
4239 echo " Askpass program: $E"
4240 echo " Manual pages: $F"
4241 echo " PID file: $G"
4242 echo " Privilege separation chroot path: $H"
4243 if test "x$external_path_file" = "x/etc/login.conf" ; then
4244 echo " At runtime, sshd will use the path defined in $external_path_file"
4245 echo " Make sure the path to scp is present, otherwise scp will not work"
4247 echo " sshd default user PATH: $I"
4248 if test ! -z "$external_path_file"; then
4249 echo " (If PATH is set in $external_path_file it will be used instead. If"
4250 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4253 if test ! -z "$superuser_path" ; then
4254 echo " sshd superuser user PATH: $J"
4256 echo " Manpage format: $MANTYPE"
4257 echo " PAM support: $PAM_MSG"
4258 echo " OSF SIA support: $SIA_MSG"
4259 echo " KerberosV support: $KRB5_MSG"
4260 echo " SELinux support: $SELINUX_MSG"
4261 echo " Smartcard support: $SCARD_MSG"
4262 echo " S/KEY support: $SKEY_MSG"
4263 echo " TCP Wrappers support: $TCPW_MSG"
4264 echo " MD5 password support: $MD5_MSG"
4265 echo " libedit support: $LIBEDIT_MSG"
4266 echo " Solaris process contract support: $SPC_MSG"
4267 echo " Solaris project support: $SP_MSG"
4268 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
4269 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4270 echo " BSD Auth support: $BSD_AUTH_MSG"
4271 echo " Random number source: $RAND_MSG"
4272 if test ! -z "$USE_RAND_HELPER" ; then
4273 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
4278 echo " Host: ${host}"
4279 echo " Compiler: ${CC}"
4280 echo " Compiler flags: ${CFLAGS}"
4281 echo "Preprocessor flags: ${CPPFLAGS}"
4282 echo " Linker flags: ${LDFLAGS}"
4283 echo " Libraries: ${LIBS}"
4284 if test ! -z "${SSHDLIBS}"; then
4285 echo " +for sshd: ${SSHDLIBS}"
4290 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
4291 echo "SVR4 style packages are supported with \"make package\""
4295 if test "x$PAM_MSG" = "xyes" ; then
4296 echo "PAM is enabled. You may need to install a PAM control file "
4297 echo "for sshd, otherwise password authentication may fail. "
4298 echo "Example PAM control files can be found in the contrib/ "
4303 if test ! -z "$RAND_HELPER_CMDHASH" ; then
4304 echo "WARNING: you are using the builtin random number collection "
4305 echo "service. Please read WARNING.RNG and request that your OS "
4306 echo "vendor includes kernel-based random number collection in "
4307 echo "future versions of your OS."
4311 if test ! -z "$NO_PEERCHECK" ; then
4312 echo "WARNING: the operating system that you are using does not"
4313 echo "appear to support getpeereid(), getpeerucred() or the"
4314 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4315 echo "enforce security checks to prevent unauthorised connections to"
4316 echo "ssh-agent. Their absence increases the risk that a malicious"
4317 echo "user can connect to your agent."
4321 if test "$AUDIT_MODULE" = "bsm" ; then
4322 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4323 echo "See the Solaris section in README.platform for details."