1 # $Id: configure.ac,v 1.458 2010/11/08 22:26:23 tim 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.458 $)
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_ARG_WITH(ssl-engine,
2140 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2141 [ if test "x$withval" != "xno" ; then
2142 AC_MSG_CHECKING(for OpenSSL ENGINE support)
2144 [ #include <openssl/engine.h>],
2146 ENGINE_load_builtin_engines();ENGINE_register_all_complete();
2148 [ AC_MSG_RESULT(yes)
2149 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
2150 [Enable OpenSSL engine support])
2152 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
2157 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2158 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2162 #include <openssl/evp.h>
2163 int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
2170 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2171 [libcrypto is missing AES 192 and 256 bit functions])
2175 AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2179 #include <openssl/evp.h>
2180 int main(void) { if(EVP_DigestUpdate(NULL, NULL,0)) exit(0); }
2187 AC_DEFINE(OPENSSL_EVP_DIGESTUPDATE_VOID, 1,
2188 [Define if EVP_DigestUpdate returns void])
2192 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2193 # because the system crypt() is more featureful.
2194 if test "x$check_for_libcrypt_before" = "x1"; then
2195 AC_CHECK_LIB(crypt, crypt)
2198 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2199 # version in OpenSSL.
2200 if test "x$check_for_libcrypt_later" = "x1"; then
2201 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
2204 # Search for SHA256 support in libc and/or OpenSSL
2205 AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2207 # Check complete ECC support in OpenSSL
2208 AC_MSG_CHECKING([whether OpenSSL has complete ECC support])
2211 #include <openssl/ec.h>
2212 #include <openssl/evp.h>
2213 #include <openssl/objects.h>
2215 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2216 const EVP_MD *m = EVP_sha512(); /* We need this too */
2221 AC_DEFINE(OPENSSL_HAS_ECC, 1,
2222 [libcrypto includes complete ECC support])
2230 AC_SUBST(TEST_SSH_ECC)
2233 AC_CHECK_LIB(iaf, ia_openinfo, [
2235 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2236 AC_DEFINE(HAVE_LIBIAF, 1,
2237 [Define if system has libiaf that supports set_id])
2242 ### Configure cryptographic random number support
2244 # Check wheter OpenSSL seeds itself
2245 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2249 #include <openssl/rand.h>
2250 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
2253 OPENSSL_SEEDS_ITSELF=yes
2258 # Default to use of the rand helper if OpenSSL doesn't
2263 AC_MSG_WARN([cross compiling: assuming yes])
2264 # This is safe, since all recent OpenSSL versions will
2265 # complain at runtime if not seeded correctly.
2266 OPENSSL_SEEDS_ITSELF=yes
2270 # Check for PAM libs
2273 [ --with-pam Enable PAM support ],
2275 if test "x$withval" != "xno" ; then
2276 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2277 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2278 AC_MSG_ERROR([PAM headers not found])
2282 AC_CHECK_LIB(dl, dlopen, , )
2283 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2284 AC_CHECK_FUNCS(pam_getenvlist)
2285 AC_CHECK_FUNCS(pam_putenv)
2290 SSHDLIBS="$SSHDLIBS -lpam"
2291 AC_DEFINE(USE_PAM, 1,
2292 [Define if you want to enable PAM support])
2294 if test $ac_cv_lib_dl_dlopen = yes; then
2297 # libdl already in LIBS
2300 SSHDLIBS="$SSHDLIBS -ldl"
2308 # Check for older PAM
2309 if test "x$PAM_MSG" = "xyes" ; then
2310 # Check PAM strerror arguments (old PAM)
2311 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2315 #if defined(HAVE_SECURITY_PAM_APPL_H)
2316 #include <security/pam_appl.h>
2317 #elif defined (HAVE_PAM_PAM_APPL_H)
2318 #include <pam/pam_appl.h>
2321 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2322 [AC_MSG_RESULT(no)],
2324 AC_DEFINE(HAVE_OLD_PAM, 1,
2325 [Define if you have an old version of PAM
2326 which takes only one argument to pam_strerror])
2328 PAM_MSG="yes (old library)"
2333 # Do we want to force the use of the rand helper?
2334 AC_ARG_WITH(rand-helper,
2335 [ --with-rand-helper Use subprocess to gather strong randomness ],
2337 if test "x$withval" = "xno" ; then
2338 # Force use of OpenSSL's internal RNG, even if
2339 # the previous test showed it to be unseeded.
2340 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2341 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2342 OPENSSL_SEEDS_ITSELF=yes
2351 # Which randomness source do we use?
2352 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
2354 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2355 [Define if you want OpenSSL's internally seeded PRNG only])
2356 RAND_MSG="OpenSSL internal ONLY"
2357 INSTALL_SSH_RAND_HELPER=""
2358 elif test ! -z "$USE_RAND_HELPER" ; then
2359 # install rand helper
2360 RAND_MSG="ssh-rand-helper"
2361 INSTALL_SSH_RAND_HELPER="yes"
2363 AC_SUBST(INSTALL_SSH_RAND_HELPER)
2365 ### Configuration of ssh-rand-helper
2368 AC_ARG_WITH(prngd-port,
2369 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2378 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2381 if test ! -z "$withval" ; then
2382 PRNGD_PORT="$withval"
2383 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2384 [Port number of PRNGD/EGD random number socket])
2389 # PRNGD Unix domain socket
2390 AC_ARG_WITH(prngd-socket,
2391 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2395 withval="/var/run/egd-pool"
2403 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2407 if test ! -z "$withval" ; then
2408 if test ! -z "$PRNGD_PORT" ; then
2409 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2411 if test ! -r "$withval" ; then
2412 AC_MSG_WARN(Entropy socket is not readable)
2414 PRNGD_SOCKET="$withval"
2415 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2416 [Location of PRNGD/EGD random number socket])
2420 # Check for existing socket only if we don't have a random device already
2421 if test "$USE_RAND_HELPER" = yes ; then
2422 AC_MSG_CHECKING(for PRNGD/EGD socket)
2423 # Insert other locations here
2424 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2425 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2426 PRNGD_SOCKET="$sock"
2427 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2431 if test ! -z "$PRNGD_SOCKET" ; then
2432 AC_MSG_RESULT($PRNGD_SOCKET)
2434 AC_MSG_RESULT(not found)
2440 # Change default command timeout for hashing entropy source
2442 AC_ARG_WITH(entropy-timeout,
2443 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2445 if test -n "$withval" && test "x$withval" != "xno" && \
2446 test "x${withval}" != "xyes"; then
2447 entropy_timeout=$withval
2451 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2452 [Builtin PRNG command timeout])
2454 SSH_PRIVSEP_USER=sshd
2455 AC_ARG_WITH(privsep-user,
2456 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
2458 if test -n "$withval" && test "x$withval" != "xno" && \
2459 test "x${withval}" != "xyes"; then
2460 SSH_PRIVSEP_USER=$withval
2464 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2465 [non-privileged user for privilege separation])
2466 AC_SUBST(SSH_PRIVSEP_USER)
2468 # We do this little dance with the search path to insure
2469 # that programs that we select for use by installed programs
2470 # (which may be run by the super-user) come from trusted
2471 # locations before they come from the user's private area.
2472 # This should help avoid accidentally configuring some
2473 # random version of a program in someone's personal bin.
2477 test -h /bin 2> /dev/null && PATH=/usr/bin
2478 test -d /sbin && PATH=$PATH:/sbin
2479 test -d /usr/sbin && PATH=$PATH:/usr/sbin
2480 PATH=$PATH:/etc:$OPATH
2482 # These programs are used by the command hashing source to gather entropy
2483 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2484 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2485 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2486 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2487 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2488 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2489 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2490 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2491 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2492 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2493 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2494 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2495 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2496 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2497 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2498 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2502 # Where does ssh-rand-helper get its randomness from?
2503 INSTALL_SSH_PRNG_CMDS=""
2504 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2505 if test ! -z "$PRNGD_PORT" ; then
2506 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2507 elif test ! -z "$PRNGD_SOCKET" ; then
2508 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2510 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2511 RAND_HELPER_CMDHASH=yes
2512 INSTALL_SSH_PRNG_CMDS="yes"
2515 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2518 # Cheap hack to ensure NEWS-OS libraries are arranged right.
2519 if test ! -z "$SONY" ; then
2520 LIBS="$LIBS -liberty";
2523 # Check for long long datatypes
2524 AC_CHECK_TYPES([long long, unsigned long long, long double])
2526 # Check datatype sizes
2527 AC_CHECK_SIZEOF(char, 1)
2528 AC_CHECK_SIZEOF(short int, 2)
2529 AC_CHECK_SIZEOF(int, 4)
2530 AC_CHECK_SIZEOF(long int, 4)
2531 AC_CHECK_SIZEOF(long long int, 8)
2533 # Sanity check long long for some platforms (AIX)
2534 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2535 ac_cv_sizeof_long_long_int=0
2538 # compute LLONG_MIN and LLONG_MAX if we don't know them.
2539 if test -z "$have_llong_max"; then
2540 AC_MSG_CHECKING([for max value of long long])
2544 /* Why is this so damn hard? */
2548 #define __USE_ISOC99
2550 #define DATA "conftest.llminmax"
2551 #define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2554 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2555 * we do this the hard way.
2558 fprint_ll(FILE *f, long long n)
2561 int l[sizeof(long long) * 8];
2564 if (fprintf(f, "-") < 0)
2566 for (i = 0; n != 0; i++) {
2567 l[i] = my_abs(n % 10);
2571 if (fprintf(f, "%d", l[--i]) < 0)
2574 if (fprintf(f, " ") < 0)
2581 long long i, llmin, llmax = 0;
2583 if((f = fopen(DATA,"w")) == NULL)
2586 #if defined(LLONG_MIN) && defined(LLONG_MAX)
2587 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2591 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2592 /* This will work on one's complement and two's complement */
2593 for (i = 1; i > llmax; i <<= 1, i++)
2595 llmin = llmax + 1LL; /* wrap */
2599 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2600 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2601 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
2602 fprintf(f, "unknown unknown\n");
2606 if (fprint_ll(f, llmin) < 0)
2608 if (fprint_ll(f, llmax) < 0)
2616 llong_min=`$AWK '{print $1}' conftest.llminmax`
2617 llong_max=`$AWK '{print $2}' conftest.llminmax`
2619 AC_MSG_RESULT($llong_max)
2620 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2621 [max value of long long calculated by configure])
2622 AC_MSG_CHECKING([for min value of long long])
2623 AC_MSG_RESULT($llong_min)
2624 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2625 [min value of long long calculated by configure])
2628 AC_MSG_RESULT(not found)
2631 AC_MSG_WARN([cross compiling: not checking])
2637 # More checks for data types
2638 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2640 [ #include <sys/types.h> ],
2642 [ ac_cv_have_u_int="yes" ],
2643 [ ac_cv_have_u_int="no" ]
2646 if test "x$ac_cv_have_u_int" = "xyes" ; then
2647 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2651 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2653 [ #include <sys/types.h> ],
2654 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2655 [ ac_cv_have_intxx_t="yes" ],
2656 [ ac_cv_have_intxx_t="no" ]
2659 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2660 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2664 if (test -z "$have_intxx_t" && \
2665 test "x$ac_cv_header_stdint_h" = "xyes")
2667 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2669 [ #include <stdint.h> ],
2670 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2672 AC_DEFINE(HAVE_INTXX_T)
2675 [ AC_MSG_RESULT(no) ]
2679 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2682 #include <sys/types.h>
2683 #ifdef HAVE_STDINT_H
2684 # include <stdint.h>
2686 #include <sys/socket.h>
2687 #ifdef HAVE_SYS_BITYPES_H
2688 # include <sys/bitypes.h>
2691 [ int64_t a; a = 1;],
2692 [ ac_cv_have_int64_t="yes" ],
2693 [ ac_cv_have_int64_t="no" ]
2696 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2697 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2700 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2702 [ #include <sys/types.h> ],
2703 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2704 [ ac_cv_have_u_intxx_t="yes" ],
2705 [ ac_cv_have_u_intxx_t="no" ]
2708 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2709 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2713 if test -z "$have_u_intxx_t" ; then
2714 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2716 [ #include <sys/socket.h> ],
2717 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2719 AC_DEFINE(HAVE_U_INTXX_T)
2722 [ AC_MSG_RESULT(no) ]
2726 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2728 [ #include <sys/types.h> ],
2729 [ u_int64_t a; a = 1;],
2730 [ ac_cv_have_u_int64_t="yes" ],
2731 [ ac_cv_have_u_int64_t="no" ]
2734 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2735 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2739 if test -z "$have_u_int64_t" ; then
2740 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2742 [ #include <sys/bitypes.h> ],
2743 [ u_int64_t a; a = 1],
2745 AC_DEFINE(HAVE_U_INT64_T)
2748 [ AC_MSG_RESULT(no) ]
2752 if test -z "$have_u_intxx_t" ; then
2753 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2756 #include <sys/types.h>
2758 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2759 [ ac_cv_have_uintxx_t="yes" ],
2760 [ ac_cv_have_uintxx_t="no" ]
2763 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2764 AC_DEFINE(HAVE_UINTXX_T, 1,
2765 [define if you have uintxx_t data type])
2769 if test -z "$have_uintxx_t" ; then
2770 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2772 [ #include <stdint.h> ],
2773 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2775 AC_DEFINE(HAVE_UINTXX_T)
2778 [ AC_MSG_RESULT(no) ]
2782 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2783 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2785 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2788 #include <sys/bitypes.h>
2791 int8_t a; int16_t b; int32_t c;
2792 u_int8_t e; u_int16_t f; u_int32_t g;
2793 a = b = c = e = f = g = 1;
2796 AC_DEFINE(HAVE_U_INTXX_T)
2797 AC_DEFINE(HAVE_INTXX_T)
2805 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2808 #include <sys/types.h>
2810 [ u_char foo; foo = 125; ],
2811 [ ac_cv_have_u_char="yes" ],
2812 [ ac_cv_have_u_char="no" ]
2815 if test "x$ac_cv_have_u_char" = "xyes" ; then
2816 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2821 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2822 AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t],,,[
2823 #include <sys/types.h>
2824 #ifdef HAVE_SYS_BITYPES_H
2825 #include <sys/bitypes.h>
2827 #ifdef HAVE_SYS_STATFS_H
2828 #include <sys/statfs.h>
2830 #ifdef HAVE_SYS_STATVFS_H
2831 #include <sys/statvfs.h>
2835 AC_CHECK_TYPES([in_addr_t, in_port_t],,,
2836 [#include <sys/types.h>
2837 #include <netinet/in.h>])
2839 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2842 #include <sys/types.h>
2844 [ size_t foo; foo = 1235; ],
2845 [ ac_cv_have_size_t="yes" ],
2846 [ ac_cv_have_size_t="no" ]
2849 if test "x$ac_cv_have_size_t" = "xyes" ; then
2850 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2853 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2856 #include <sys/types.h>
2858 [ ssize_t foo; foo = 1235; ],
2859 [ ac_cv_have_ssize_t="yes" ],
2860 [ ac_cv_have_ssize_t="no" ]
2863 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2864 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2867 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2872 [ clock_t foo; foo = 1235; ],
2873 [ ac_cv_have_clock_t="yes" ],
2874 [ ac_cv_have_clock_t="no" ]
2877 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2878 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2881 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2884 #include <sys/types.h>
2885 #include <sys/socket.h>
2887 [ sa_family_t foo; foo = 1235; ],
2888 [ ac_cv_have_sa_family_t="yes" ],
2891 #include <sys/types.h>
2892 #include <sys/socket.h>
2893 #include <netinet/in.h>
2895 [ sa_family_t foo; foo = 1235; ],
2896 [ ac_cv_have_sa_family_t="yes" ],
2898 [ ac_cv_have_sa_family_t="no" ]
2902 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2903 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2904 [define if you have sa_family_t data type])
2907 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2910 #include <sys/types.h>
2912 [ pid_t foo; foo = 1235; ],
2913 [ ac_cv_have_pid_t="yes" ],
2914 [ ac_cv_have_pid_t="no" ]
2917 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2918 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2921 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2924 #include <sys/types.h>
2926 [ mode_t foo; foo = 1235; ],
2927 [ ac_cv_have_mode_t="yes" ],
2928 [ ac_cv_have_mode_t="no" ]
2931 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2932 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2936 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2939 #include <sys/types.h>
2940 #include <sys/socket.h>
2942 [ struct sockaddr_storage s; ],
2943 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2944 [ ac_cv_have_struct_sockaddr_storage="no" ]
2947 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2948 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2949 [define if you have struct sockaddr_storage data type])
2952 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2955 #include <sys/types.h>
2956 #include <netinet/in.h>
2958 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2959 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2960 [ ac_cv_have_struct_sockaddr_in6="no" ]
2963 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2964 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2965 [define if you have struct sockaddr_in6 data type])
2968 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2971 #include <sys/types.h>
2972 #include <netinet/in.h>
2974 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2975 [ ac_cv_have_struct_in6_addr="yes" ],
2976 [ ac_cv_have_struct_in6_addr="no" ]
2979 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2980 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2981 [define if you have struct in6_addr data type])
2983 dnl Now check for sin6_scope_id
2984 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
2986 #ifdef HAVE_SYS_TYPES_H
2987 #include <sys/types.h>
2989 #include <netinet/in.h>
2993 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2996 #include <sys/types.h>
2997 #include <sys/socket.h>
3000 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
3001 [ ac_cv_have_struct_addrinfo="yes" ],
3002 [ ac_cv_have_struct_addrinfo="no" ]
3005 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
3006 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
3007 [define if you have struct addrinfo data type])
3010 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
3012 [ #include <sys/time.h> ],
3013 [ struct timeval tv; tv.tv_sec = 1;],
3014 [ ac_cv_have_struct_timeval="yes" ],
3015 [ ac_cv_have_struct_timeval="no" ]
3018 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
3019 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
3020 have_struct_timeval=1
3023 AC_CHECK_TYPES(struct timespec)
3025 # We need int64_t or else certian parts of the compile will fail.
3026 if test "x$ac_cv_have_int64_t" = "xno" && \
3027 test "x$ac_cv_sizeof_long_int" != "x8" && \
3028 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
3029 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3030 echo "an alternative compiler (I.E., GCC) before continuing."
3034 dnl test snprintf (broken on SCO w/gcc)
3039 #ifdef HAVE_SNPRINTF
3043 char expected_out[50];
3045 #if (SIZEOF_LONG_INT == 8)
3046 long int num = 0x7fffffffffffffff;
3048 long long num = 0x7fffffffffffffffll;
3050 strcpy(expected_out, "9223372036854775807");
3051 snprintf(buf, mazsize, "%lld", num);
3052 if(strcmp(buf, expected_out) != 0)
3059 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
3060 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
3064 dnl Checks for structure members
3065 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
3066 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
3067 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
3068 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
3069 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
3070 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
3071 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
3072 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
3073 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
3074 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
3075 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
3076 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
3077 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
3078 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
3079 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
3080 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
3081 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
3083 AC_CHECK_MEMBERS([struct stat.st_blksize])
3084 AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
3085 [Define if we don't have struct __res_state in resolv.h])],
3088 #if HAVE_SYS_TYPES_H
3089 # include <sys/types.h>
3091 #include <netinet/in.h>
3092 #include <arpa/nameser.h>
3096 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3097 ac_cv_have_ss_family_in_struct_ss, [
3100 #include <sys/types.h>
3101 #include <sys/socket.h>
3103 [ struct sockaddr_storage s; s.ss_family = 1; ],
3104 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3105 [ ac_cv_have_ss_family_in_struct_ss="no" ],
3108 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
3109 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
3112 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3113 ac_cv_have___ss_family_in_struct_ss, [
3116 #include <sys/types.h>
3117 #include <sys/socket.h>
3119 [ struct sockaddr_storage s; s.__ss_family = 1; ],
3120 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3121 [ ac_cv_have___ss_family_in_struct_ss="no" ]
3124 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
3125 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
3126 [Fields in struct sockaddr_storage])
3129 AC_CACHE_CHECK([for pw_class field in struct passwd],
3130 ac_cv_have_pw_class_in_struct_passwd, [
3135 [ struct passwd p; p.pw_class = 0; ],
3136 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3137 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
3140 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
3141 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
3142 [Define if your password has a pw_class field])
3145 AC_CACHE_CHECK([for pw_expire field in struct passwd],
3146 ac_cv_have_pw_expire_in_struct_passwd, [
3151 [ struct passwd p; p.pw_expire = 0; ],
3152 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3153 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
3156 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
3157 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
3158 [Define if your password has a pw_expire field])
3161 AC_CACHE_CHECK([for pw_change field in struct passwd],
3162 ac_cv_have_pw_change_in_struct_passwd, [
3167 [ struct passwd p; p.pw_change = 0; ],
3168 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3169 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
3172 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
3173 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
3174 [Define if your password has a pw_change field])
3177 dnl make sure we're using the real structure members and not defines
3178 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3179 ac_cv_have_accrights_in_msghdr, [
3182 #include <sys/types.h>
3183 #include <sys/socket.h>
3184 #include <sys/uio.h>
3186 #ifdef msg_accrights
3187 #error "msg_accrights is a macro"
3191 m.msg_accrights = 0;
3195 [ ac_cv_have_accrights_in_msghdr="yes" ],
3196 [ ac_cv_have_accrights_in_msghdr="no" ]
3199 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
3200 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
3201 [Define if your system uses access rights style
3202 file descriptor passing])
3205 AC_MSG_CHECKING(if struct statvfs.f_fsid is integral type)
3207 #include <sys/types.h>
3208 #include <sys/stat.h>
3209 #ifdef HAVE_SYS_TIME_H
3210 # include <sys/time.h>
3212 #ifdef HAVE_SYS_MOUNT_H
3213 #include <sys/mount.h>
3215 #ifdef HAVE_SYS_STATVFS_H
3216 #include <sys/statvfs.h>
3218 ], [struct statvfs s; s.f_fsid = 0;],
3219 [ AC_MSG_RESULT(yes) ],
3222 AC_MSG_CHECKING(if fsid_t has member val)
3224 #include <sys/types.h>
3225 #include <sys/statvfs.h>],
3226 [fsid_t t; t.val[0] = 0;],
3227 [ AC_MSG_RESULT(yes)
3228 AC_DEFINE(FSID_HAS_VAL, 1, fsid_t has member val) ],
3229 [ AC_MSG_RESULT(no) ])
3231 AC_MSG_CHECKING(if f_fsid has member __val)
3233 #include <sys/types.h>
3234 #include <sys/statvfs.h>],
3235 [fsid_t t; t.__val[0] = 0;],
3236 [ AC_MSG_RESULT(yes)
3237 AC_DEFINE(FSID_HAS___VAL, 1, fsid_t has member __val) ],
3238 [ AC_MSG_RESULT(no) ])
3241 AC_CACHE_CHECK([for msg_control field in struct msghdr],
3242 ac_cv_have_control_in_msghdr, [
3245 #include <sys/types.h>
3246 #include <sys/socket.h>
3247 #include <sys/uio.h>
3250 #error "msg_control is a macro"
3258 [ ac_cv_have_control_in_msghdr="yes" ],
3259 [ ac_cv_have_control_in_msghdr="no" ]
3262 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
3263 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
3264 [Define if your system uses ancillary data style
3265 file descriptor passing])
3268 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
3270 [ extern char *__progname; printf("%s", __progname); ],
3271 [ ac_cv_libc_defines___progname="yes" ],
3272 [ ac_cv_libc_defines___progname="no" ]
3275 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
3276 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
3279 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3283 [ printf("%s", __FUNCTION__); ],
3284 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3285 [ ac_cv_cc_implements___FUNCTION__="no" ]
3288 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
3289 AC_DEFINE(HAVE___FUNCTION__, 1,
3290 [Define if compiler implements __FUNCTION__])
3293 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3297 [ printf("%s", __func__); ],
3298 [ ac_cv_cc_implements___func__="yes" ],
3299 [ ac_cv_cc_implements___func__="no" ]
3302 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
3303 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
3306 AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3308 [#include <stdarg.h>
3311 [ ac_cv_have_va_copy="yes" ],
3312 [ ac_cv_have_va_copy="no" ]
3315 if test "x$ac_cv_have_va_copy" = "xyes" ; then
3316 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3319 AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3321 [#include <stdarg.h>
3324 [ ac_cv_have___va_copy="yes" ],
3325 [ ac_cv_have___va_copy="no" ]
3328 if test "x$ac_cv_have___va_copy" = "xyes" ; then
3329 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3332 AC_CACHE_CHECK([whether getopt has optreset support],
3333 ac_cv_have_getopt_optreset, [
3338 [ extern int optreset; optreset = 0; ],
3339 [ ac_cv_have_getopt_optreset="yes" ],
3340 [ ac_cv_have_getopt_optreset="no" ]
3343 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
3344 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3345 [Define if your getopt(3) defines and uses optreset])
3348 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
3350 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
3351 [ ac_cv_libc_defines_sys_errlist="yes" ],
3352 [ ac_cv_libc_defines_sys_errlist="no" ]
3355 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
3356 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3357 [Define if your system defines sys_errlist[]])
3361 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
3363 [ extern int sys_nerr; printf("%i", sys_nerr);],
3364 [ ac_cv_libc_defines_sys_nerr="yes" ],
3365 [ ac_cv_libc_defines_sys_nerr="no" ]
3368 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
3369 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
3372 # Check libraries needed by DNS fingerprint support
3373 AC_SEARCH_LIBS(getrrsetbyname, resolv,
3374 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3375 [Define if getrrsetbyname() exists])],
3377 # Needed by our getrrsetbyname()
3378 AC_SEARCH_LIBS(res_query, resolv)
3379 AC_SEARCH_LIBS(dn_expand, resolv)
3380 AC_MSG_CHECKING(if res_query will link)
3382 #include "confdefs.h"
3383 #include <sys/types.h>
3384 #include <netinet/in.h>
3385 #include <arpa/nameser.h>
3390 res_query (0, 0, 0, 0, 0);
3397 LIBS="$LIBS -lresolv"
3398 AC_MSG_CHECKING(for res_query in -lresolv)
3400 #include "confdefs.h"
3401 #include <sys/types.h>
3402 #include <netinet/in.h>
3403 #include <arpa/nameser.h>
3408 res_query (0, 0, 0, 0, 0);
3412 [AC_MSG_RESULT(yes)],
3416 AC_CHECK_FUNCS(_getshort _getlong)
3417 AC_CHECK_DECLS([_getshort, _getlong], , ,
3418 [#include <sys/types.h>
3419 #include <arpa/nameser.h>])
3420 AC_CHECK_MEMBER(HEADER.ad,
3421 [AC_DEFINE(HAVE_HEADER_AD, 1,
3422 [Define if HEADER.ad exists in arpa/nameser.h])],,
3423 [#include <arpa/nameser.h>])
3426 AC_MSG_CHECKING(if struct __res_state _res is an extern)
3429 #if HAVE_SYS_TYPES_H
3430 # include <sys/types.h>
3432 #include <netinet/in.h>
3433 #include <arpa/nameser.h>
3435 extern struct __res_state _res;
3436 int main() { return 0; }
3439 AC_DEFINE(HAVE__RES_EXTERN, 1,
3440 [Define if you have struct __res_state _res as an extern])
3442 [ AC_MSG_RESULT(no) ]
3445 # Check whether user wants SELinux support
3448 AC_ARG_WITH(selinux,
3449 [ --with-selinux Enable SELinux support],
3450 [ if test "x$withval" != "xno" ; then
3452 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3454 AC_CHECK_HEADER([selinux/selinux.h], ,
3455 AC_MSG_ERROR(SELinux support requires selinux.h header))
3456 AC_CHECK_LIB(selinux, setexeccon,
3457 [ LIBSELINUX="-lselinux"
3458 LIBS="$LIBS -lselinux"
3460 AC_MSG_ERROR(SELinux support requires libselinux library))
3461 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
3462 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
3467 # Check whether user wants Kerberos 5 support
3469 AC_ARG_WITH(kerberos5,
3470 [ --with-kerberos5=PATH Enable Kerberos 5 support],
3471 [ if test "x$withval" != "xno" ; then
3472 if test "x$withval" = "xyes" ; then
3473 KRB5ROOT="/usr/local"
3478 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
3481 AC_PATH_PROG([KRB5CONF],[krb5-config],
3482 [$KRB5ROOT/bin/krb5-config],
3483 [$KRB5ROOT/bin:$PATH])
3484 if test -x $KRB5CONF ; then
3486 AC_MSG_CHECKING(for gssapi support)
3487 if $KRB5CONF | grep gssapi >/dev/null ; then
3489 AC_DEFINE(GSSAPI, 1,
3490 [Define this if you want GSSAPI
3491 support in the version 2 protocol])
3497 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3498 K5LIBS="`$KRB5CONF --libs $k5confopts`"
3499 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
3500 AC_MSG_CHECKING(whether we are using Heimdal)
3501 AC_TRY_COMPILE([ #include <krb5.h> ],
3502 [ char *tmp = heimdal_version; ],
3503 [ AC_MSG_RESULT(yes)
3504 AC_DEFINE(HEIMDAL, 1,
3505 [Define this if you are using the
3506 Heimdal version of Kerberos V5]) ],
3510 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
3511 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
3512 AC_MSG_CHECKING(whether we are using Heimdal)
3513 AC_TRY_COMPILE([ #include <krb5.h> ],
3514 [ char *tmp = heimdal_version; ],
3515 [ AC_MSG_RESULT(yes)
3517 K5LIBS="-lkrb5 -ldes"
3518 K5LIBS="$K5LIBS -lcom_err -lasn1"
3519 AC_CHECK_LIB(roken, net_write,
3520 [K5LIBS="$K5LIBS -lroken"])
3523 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3526 AC_SEARCH_LIBS(dn_expand, resolv)
3528 AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,
3530 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3531 [ AC_CHECK_LIB(gssapi, gss_init_sec_context,
3533 K5LIBS="-lgssapi $K5LIBS" ],
3534 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3539 AC_CHECK_HEADER(gssapi.h, ,
3540 [ unset ac_cv_header_gssapi_h
3541 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3542 AC_CHECK_HEADERS(gssapi.h, ,
3543 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
3549 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3550 AC_CHECK_HEADER(gssapi_krb5.h, ,
3551 [ CPPFLAGS="$oldCPP" ])
3554 if test ! -z "$need_dash_r" ; then
3555 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3557 if test ! -z "$blibpath" ; then
3558 blibpath="$blibpath:${KRB5ROOT}/lib"
3561 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3562 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3563 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3565 LIBS="$LIBS $K5LIBS"
3566 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3567 [Define this if you want to use libkafs' AFS support]))
3572 # Looking for programs, paths and files
3574 PRIVSEP_PATH=/var/empty
3575 AC_ARG_WITH(privsep-path,
3576 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
3578 if test -n "$withval" && test "x$withval" != "xno" && \
3579 test "x${withval}" != "xyes"; then
3580 PRIVSEP_PATH=$withval
3584 AC_SUBST(PRIVSEP_PATH)
3587 [ --with-xauth=PATH Specify path to xauth program ],
3589 if test -n "$withval" && test "x$withval" != "xno" && \
3590 test "x${withval}" != "xyes"; then
3596 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3597 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3598 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3599 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3600 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3601 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3602 xauth_path="/usr/openwin/bin/xauth"
3608 AC_ARG_ENABLE(strip,
3609 [ --disable-strip Disable calling strip(1) on install],
3611 if test "x$enableval" = "xno" ; then
3618 if test -z "$xauth_path" ; then
3619 XAUTH_PATH="undefined"
3620 AC_SUBST(XAUTH_PATH)
3622 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3623 [Define if xauth is found in your path])
3624 XAUTH_PATH=$xauth_path
3625 AC_SUBST(XAUTH_PATH)
3628 # Check for mail directory (last resort if we cannot get it from headers)
3629 if test ! -z "$MAIL" ; then
3630 maildir=`dirname $MAIL`
3631 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3632 [Set this to your mail directory if you don't have maillock.h])
3635 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3636 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3637 disable_ptmx_check=yes
3639 if test -z "$no_dev_ptmx" ; then
3640 if test "x$disable_ptmx_check" != "xyes" ; then
3641 AC_CHECK_FILE("/dev/ptmx",
3643 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3644 [Define if you have /dev/ptmx])
3651 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3652 AC_CHECK_FILE("/dev/ptc",
3654 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3655 [Define if you have /dev/ptc])
3660 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3663 # Options from here on. Some of these are preset by platform above
3664 AC_ARG_WITH(mantype,
3665 [ --with-mantype=man|cat|doc Set man page type],
3672 AC_MSG_ERROR(invalid man type: $withval)
3677 if test -z "$MANTYPE"; then
3678 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3679 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3680 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3682 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3689 if test "$MANTYPE" = "doc"; then
3696 # Check whether to enable MD5 passwords
3698 AC_ARG_WITH(md5-passwords,
3699 [ --with-md5-passwords Enable use of MD5 passwords],
3701 if test "x$withval" != "xno" ; then
3702 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3703 [Define if you want to allow MD5 passwords])
3709 # Whether to disable shadow password support
3711 [ --without-shadow Disable shadow password support],
3713 if test "x$withval" = "xno" ; then
3714 AC_DEFINE(DISABLE_SHADOW)
3720 if test -z "$disable_shadow" ; then
3721 AC_MSG_CHECKING([if the systems has expire shadow information])
3724 #include <sys/types.h>
3727 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3728 [ sp_expire_available=yes ], []
3731 if test "x$sp_expire_available" = "xyes" ; then
3733 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3734 [Define if you want to use shadow password expire field])
3740 # Use ip address instead of hostname in $DISPLAY
3741 if test ! -z "$IPADDR_IN_DISPLAY" ; then
3742 DISPLAY_HACK_MSG="yes"
3743 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3744 [Define if you need to use IP address
3745 instead of hostname in $DISPLAY])
3747 DISPLAY_HACK_MSG="no"
3748 AC_ARG_WITH(ipaddr-display,
3749 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3751 if test "x$withval" != "xno" ; then
3752 AC_DEFINE(IPADDR_IN_DISPLAY)
3753 DISPLAY_HACK_MSG="yes"
3759 # check for /etc/default/login and use it if present.
3760 AC_ARG_ENABLE(etc-default-login,
3761 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3762 [ if test "x$enableval" = "xno"; then
3763 AC_MSG_NOTICE([/etc/default/login handling disabled])
3764 etc_default_login=no
3766 etc_default_login=yes
3768 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3770 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3771 etc_default_login=no
3773 etc_default_login=yes
3777 if test "x$etc_default_login" != "xno"; then
3778 AC_CHECK_FILE("/etc/default/login",
3779 [ external_path_file=/etc/default/login ])
3780 if test "x$external_path_file" = "x/etc/default/login"; then
3781 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3782 [Define if your system has /etc/default/login])
3786 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3787 if test $ac_cv_func_login_getcapbool = "yes" && \
3788 test $ac_cv_header_login_cap_h = "yes" ; then
3789 external_path_file=/etc/login.conf
3792 # Whether to mess with the default path
3793 SERVER_PATH_MSG="(default)"
3794 AC_ARG_WITH(default-path,
3795 [ --with-default-path= Specify default \$PATH environment for server],
3797 if test "x$external_path_file" = "x/etc/login.conf" ; then
3799 --with-default-path=PATH has no effect on this system.
3800 Edit /etc/login.conf instead.])
3801 elif test "x$withval" != "xno" ; then
3802 if test ! -z "$external_path_file" ; then
3804 --with-default-path=PATH will only be used if PATH is not defined in
3805 $external_path_file .])
3807 user_path="$withval"
3808 SERVER_PATH_MSG="$withval"
3811 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3812 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3814 if test ! -z "$external_path_file" ; then
3816 If PATH is defined in $external_path_file, ensure the path to scp is included,
3817 otherwise scp will not work.])
3821 /* find out what STDPATH is */
3826 #ifndef _PATH_STDPATH
3827 # ifdef _PATH_USERPATH /* Irix */
3828 # define _PATH_STDPATH _PATH_USERPATH
3830 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3833 #include <sys/types.h>
3834 #include <sys/stat.h>
3836 #define DATA "conftest.stdpath"
3843 fd = fopen(DATA,"w");
3847 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3853 [ user_path=`cat conftest.stdpath` ],
3854 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3855 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3857 # make sure $bindir is in USER_PATH so scp will work
3858 t_bindir=`eval echo ${bindir}`
3860 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3863 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3865 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3866 if test $? -ne 0 ; then
3867 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3868 if test $? -ne 0 ; then
3869 user_path=$user_path:$t_bindir
3870 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3875 if test "x$external_path_file" != "x/etc/login.conf" ; then
3876 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
3880 # Set superuser path separately to user path
3881 AC_ARG_WITH(superuser-path,
3882 [ --with-superuser-path= Specify different path for super-user],
3884 if test -n "$withval" && test "x$withval" != "xno" && \
3885 test "x${withval}" != "xyes"; then
3886 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3887 [Define if you want a different $PATH
3889 superuser_path=$withval
3895 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3896 IPV4_IN6_HACK_MSG="no"
3898 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3900 if test "x$withval" != "xno" ; then
3902 AC_DEFINE(IPV4_IN_IPV6, 1,
3903 [Detect IPv4 in IPv6 mapped addresses
3905 IPV4_IN6_HACK_MSG="yes"
3910 if test "x$inet6_default_4in6" = "xyes"; then
3911 AC_MSG_RESULT([yes (default)])
3912 AC_DEFINE(IPV4_IN_IPV6)
3913 IPV4_IN6_HACK_MSG="yes"
3915 AC_MSG_RESULT([no (default)])
3920 # Whether to enable BSD auth support
3922 AC_ARG_WITH(bsd-auth,
3923 [ --with-bsd-auth Enable BSD auth support],
3925 if test "x$withval" != "xno" ; then
3926 AC_DEFINE(BSD_AUTH, 1,
3927 [Define if you have BSD auth support])
3933 # Where to place sshd.pid
3935 # make sure the directory exists
3936 if test ! -d $piddir ; then
3937 piddir=`eval echo ${sysconfdir}`
3939 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3943 AC_ARG_WITH(pid-dir,
3944 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3946 if test -n "$withval" && test "x$withval" != "xno" && \
3947 test "x${withval}" != "xyes"; then
3949 if test ! -d $piddir ; then
3950 AC_MSG_WARN([** no $piddir directory on this system **])
3956 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3959 dnl allow user to disable some login recording features
3960 AC_ARG_ENABLE(lastlog,
3961 [ --disable-lastlog disable use of lastlog even if detected [no]],
3963 if test "x$enableval" = "xno" ; then
3964 AC_DEFINE(DISABLE_LASTLOG)
3969 [ --disable-utmp disable use of utmp even if detected [no]],
3971 if test "x$enableval" = "xno" ; then
3972 AC_DEFINE(DISABLE_UTMP)
3976 AC_ARG_ENABLE(utmpx,
3977 [ --disable-utmpx disable use of utmpx even if detected [no]],
3979 if test "x$enableval" = "xno" ; then
3980 AC_DEFINE(DISABLE_UTMPX, 1,
3981 [Define if you don't want to use utmpx])
3986 [ --disable-wtmp disable use of wtmp even if detected [no]],
3988 if test "x$enableval" = "xno" ; then
3989 AC_DEFINE(DISABLE_WTMP)
3993 AC_ARG_ENABLE(wtmpx,
3994 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3996 if test "x$enableval" = "xno" ; then
3997 AC_DEFINE(DISABLE_WTMPX, 1,
3998 [Define if you don't want to use wtmpx])
4002 AC_ARG_ENABLE(libutil,
4003 [ --disable-libutil disable use of libutil (login() etc.) [no]],
4005 if test "x$enableval" = "xno" ; then
4006 AC_DEFINE(DISABLE_LOGIN)
4010 AC_ARG_ENABLE(pututline,
4011 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
4013 if test "x$enableval" = "xno" ; then
4014 AC_DEFINE(DISABLE_PUTUTLINE, 1,
4015 [Define if you don't want to use pututline()
4016 etc. to write [uw]tmp])
4020 AC_ARG_ENABLE(pututxline,
4021 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
4023 if test "x$enableval" = "xno" ; then
4024 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
4025 [Define if you don't want to use pututxline()
4026 etc. to write [uw]tmpx])
4030 AC_ARG_WITH(lastlog,
4031 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
4033 if test "x$withval" = "xno" ; then
4034 AC_DEFINE(DISABLE_LASTLOG)
4035 elif test -n "$withval" && test "x${withval}" != "xyes"; then
4036 conf_lastlog_location=$withval
4041 dnl lastlog, [uw]tmpx? detection
4042 dnl NOTE: set the paths in the platform section to avoid the
4043 dnl need for command-line parameters
4044 dnl lastlog and [uw]tmp are subject to a file search if all else fails
4046 dnl lastlog detection
4047 dnl NOTE: the code itself will detect if lastlog is a directory
4048 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
4050 #include <sys/types.h>
4052 #ifdef HAVE_LASTLOG_H
4053 # include <lastlog.h>
4062 [ char *lastlog = LASTLOG_FILE; ],
4063 [ AC_MSG_RESULT(yes) ],
4066 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
4068 #include <sys/types.h>
4070 #ifdef HAVE_LASTLOG_H
4071 # include <lastlog.h>
4077 [ char *lastlog = _PATH_LASTLOG; ],
4078 [ AC_MSG_RESULT(yes) ],
4081 system_lastlog_path=no
4086 if test -z "$conf_lastlog_location"; then
4087 if test x"$system_lastlog_path" = x"no" ; then
4088 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
4089 if (test -d "$f" || test -f "$f") ; then
4090 conf_lastlog_location=$f
4093 if test -z "$conf_lastlog_location"; then
4094 AC_MSG_WARN([** Cannot find lastlog **])
4095 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
4100 if test -n "$conf_lastlog_location"; then
4101 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
4102 [Define if you want to specify the path to your lastlog file])
4106 AC_MSG_CHECKING([if your system defines UTMP_FILE])
4108 #include <sys/types.h>
4114 [ char *utmp = UTMP_FILE; ],
4115 [ AC_MSG_RESULT(yes) ],
4117 system_utmp_path=no ]
4119 if test -z "$conf_utmp_location"; then
4120 if test x"$system_utmp_path" = x"no" ; then
4121 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4122 if test -f $f ; then
4123 conf_utmp_location=$f
4126 if test -z "$conf_utmp_location"; then
4127 AC_DEFINE(DISABLE_UTMP)
4131 if test -n "$conf_utmp_location"; then
4132 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
4133 [Define if you want to specify the path to your utmp file])
4137 AC_MSG_CHECKING([if your system defines WTMP_FILE])
4139 #include <sys/types.h>
4145 [ char *wtmp = WTMP_FILE; ],
4146 [ AC_MSG_RESULT(yes) ],
4148 system_wtmp_path=no ]
4150 if test -z "$conf_wtmp_location"; then
4151 if test x"$system_wtmp_path" = x"no" ; then
4152 for f in /usr/adm/wtmp /var/log/wtmp; do
4153 if test -f $f ; then
4154 conf_wtmp_location=$f
4157 if test -z "$conf_wtmp_location"; then
4158 AC_DEFINE(DISABLE_WTMP)
4162 if test -n "$conf_wtmp_location"; then
4163 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
4164 [Define if you want to specify the path to your wtmp file])
4169 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
4171 #include <sys/types.h>
4180 [ char *wtmpx = WTMPX_FILE; ],
4181 [ AC_MSG_RESULT(yes) ],
4183 system_wtmpx_path=no ]
4185 if test -z "$conf_wtmpx_location"; then
4186 if test x"$system_wtmpx_path" = x"no" ; then
4187 AC_DEFINE(DISABLE_WTMPX)
4190 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
4191 [Define if you want to specify the path to your wtmpx file])
4195 if test ! -z "$blibpath" ; then
4196 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4197 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
4200 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4202 CFLAGS="$CFLAGS $werror_flags"
4204 if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4209 AC_CHECK_DECL(BROKEN_GETADDRINFO, TEST_SSH_IPV6=no)
4210 AC_SUBST(TEST_SSH_IPV6, $TEST_SSH_IPV6)
4213 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4214 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
4215 ssh_prng_cmds survey.sh])
4218 # Print summary of options
4220 # Someone please show me a better way :)
4221 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4222 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4223 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4224 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
4225 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
4226 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
4227 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
4228 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4229 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4230 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
4233 echo "OpenSSH has been configured with the following options:"
4234 echo " User binaries: $B"
4235 echo " System binaries: $C"
4236 echo " Configuration files: $D"
4237 echo " Askpass program: $E"
4238 echo " Manual pages: $F"
4239 echo " PID file: $G"
4240 echo " Privilege separation chroot path: $H"
4241 if test "x$external_path_file" = "x/etc/login.conf" ; then
4242 echo " At runtime, sshd will use the path defined in $external_path_file"
4243 echo " Make sure the path to scp is present, otherwise scp will not work"
4245 echo " sshd default user PATH: $I"
4246 if test ! -z "$external_path_file"; then
4247 echo " (If PATH is set in $external_path_file it will be used instead. If"
4248 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4251 if test ! -z "$superuser_path" ; then
4252 echo " sshd superuser user PATH: $J"
4254 echo " Manpage format: $MANTYPE"
4255 echo " PAM support: $PAM_MSG"
4256 echo " OSF SIA support: $SIA_MSG"
4257 echo " KerberosV support: $KRB5_MSG"
4258 echo " SELinux support: $SELINUX_MSG"
4259 echo " Smartcard support: $SCARD_MSG"
4260 echo " S/KEY support: $SKEY_MSG"
4261 echo " TCP Wrappers support: $TCPW_MSG"
4262 echo " MD5 password support: $MD5_MSG"
4263 echo " libedit support: $LIBEDIT_MSG"
4264 echo " Solaris process contract support: $SPC_MSG"
4265 echo " Solaris project support: $SP_MSG"
4266 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
4267 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4268 echo " BSD Auth support: $BSD_AUTH_MSG"
4269 echo " Random number source: $RAND_MSG"
4270 if test ! -z "$USE_RAND_HELPER" ; then
4271 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
4276 echo " Host: ${host}"
4277 echo " Compiler: ${CC}"
4278 echo " Compiler flags: ${CFLAGS}"
4279 echo "Preprocessor flags: ${CPPFLAGS}"
4280 echo " Linker flags: ${LDFLAGS}"
4281 echo " Libraries: ${LIBS}"
4282 if test ! -z "${SSHDLIBS}"; then
4283 echo " +for sshd: ${SSHDLIBS}"
4288 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
4289 echo "SVR4 style packages are supported with \"make package\""
4293 if test "x$PAM_MSG" = "xyes" ; then
4294 echo "PAM is enabled. You may need to install a PAM control file "
4295 echo "for sshd, otherwise password authentication may fail. "
4296 echo "Example PAM control files can be found in the contrib/ "
4301 if test ! -z "$RAND_HELPER_CMDHASH" ; then
4302 echo "WARNING: you are using the builtin random number collection "
4303 echo "service. Please read WARNING.RNG and request that your OS "
4304 echo "vendor includes kernel-based random number collection in "
4305 echo "future versions of your OS."
4309 if test ! -z "$NO_PEERCHECK" ; then
4310 echo "WARNING: the operating system that you are using does not"
4311 echo "appear to support getpeereid(), getpeerucred() or the"
4312 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4313 echo "enforce security checks to prevent unauthorised connections to"
4314 echo "ssh-agent. Their absence increases the risk that a malicious"
4315 echo "user can connect to your agent."
4319 if test "$AUDIT_MODULE" = "bsm" ; then
4320 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4321 echo "See the Solaris section in README.platform for details."