]> andersk Git - openssh.git/blobdiff - configure.ac
- guenther@cvs.openbsd.org 2009/12/20 07:28:36
[openssh.git] / configure.ac
index 85b076e7cd589c8cbf8259b040af7eb99e9cf738..71b313c5943872262234e623cb31f84dbfec538d 100644 (file)
@@ -90,18 +90,78 @@ AC_C_INLINE
 
 AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
 
+use_stack_protector=1
+AC_ARG_WITH(stackprotect,
+    [  --without-stackprotect  Don't use compiler's stack protection], [
+    if test "x$withval" = "xno"; then
+       use_stack_protector=0
+    fi ])
+
 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
        CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
        GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
        case $GCC_VER in
-               1.*) ;;
-               2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
-               2.*) ;;
-               3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
-               4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
+               1.*) no_attrib_nonnull=1 ;;
+               2.8* | 2.9*)
+                    CFLAGS="$CFLAGS -Wsign-compare"
+                    no_attrib_nonnull=1
+                    ;;
+               2.*) no_attrib_nonnull=1 ;;
+               3.*) CFLAGS="$CFLAGS -Wsign-compare -Wformat-security" ;;
+               4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign -Wformat-security" ;;
                *) ;;
        esac
 
+       AC_MSG_CHECKING(if $CC accepts -fno-builtin-memset)
+       saved_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS -fno-builtin-memset"
+       AC_LINK_IFELSE( [AC_LANG_SOURCE([[
+#include <string.h>
+int main(void){char b[10]; memset(b, 0, sizeof(b));}
+               ]])],
+               [ AC_MSG_RESULT(yes) ],
+               [ AC_MSG_RESULT(no)
+                 CFLAGS="$saved_CFLAGS" ]
+)
+
+       # -fstack-protector-all doesn't always work for some GCC versions
+       # and/or platforms, so we test if we can.  If it's not supported
+       # on a given platform gcc will emit a warning so we use -Werror.
+       if test "x$use_stack_protector" = "x1"; then
+           for t in -fstack-protector-all -fstack-protector; do
+               AC_MSG_CHECKING(if $CC supports $t)
+               saved_CFLAGS="$CFLAGS"
+               saved_LDFLAGS="$LDFLAGS"
+               CFLAGS="$CFLAGS $t -Werror"
+               LDFLAGS="$LDFLAGS $t -Werror"
+               AC_LINK_IFELSE(
+                       [AC_LANG_SOURCE([
+#include <stdio.h>
+int main(void){char x[[256]]; snprintf(x, sizeof(x), "XXX"); return 0;}
+                        ])],
+                   [ AC_MSG_RESULT(yes)
+                     CFLAGS="$saved_CFLAGS $t"
+                     LDFLAGS="$saved_LDFLAGS $t"
+                     AC_MSG_CHECKING(if $t works)
+                     AC_RUN_IFELSE(
+                       [AC_LANG_SOURCE([
+#include <stdio.h>
+int main(void){char x[[256]]; snprintf(x, sizeof(x), "XXX"); return 0;}
+                       ])],
+                       [ AC_MSG_RESULT(yes)
+                         break ],
+                       [ AC_MSG_RESULT(no) ],
+                       [ AC_MSG_WARN([cross compiling: cannot test])
+                         break ]
+                     )
+                   ],
+                   [ AC_MSG_RESULT(no) ]
+               )
+               CFLAGS="$saved_CFLAGS"
+               LDFLAGS="$saved_LDFLAGS"
+           done
+       fi
+
        if test -z "$have_llong_max"; then
                # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
                unset ac_cv_have_decl_LLONG_MAX
@@ -115,6 +175,10 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
        fi
 fi
 
+if test "x$no_attrib_nonnull" != "x1" ; then
+       AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
+fi
+
 AC_ARG_WITH(rpath,
        [  --without-rpath         Disable auto-added -R linker paths],
        [
@@ -127,9 +191,173 @@ AC_ARG_WITH(rpath,
        ]
 )
 
+# Allow user to specify flags
+AC_ARG_WITH(cflags,
+       [  --with-cflags           Specify additional flags to pass to compiler],
+       [
+               if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
+                   test "x${withval}" != "xyes"; then
+                       CFLAGS="$CFLAGS $withval"
+               fi
+       ]
+)
+AC_ARG_WITH(cppflags,
+       [  --with-cppflags         Specify additional flags to pass to preprocessor] ,
+       [
+               if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
+                   test "x${withval}" != "xyes"; then
+                       CPPFLAGS="$CPPFLAGS $withval"
+               fi
+       ]
+)
+AC_ARG_WITH(ldflags,
+       [  --with-ldflags          Specify additional flags to pass to linker],
+       [
+               if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
+                   test "x${withval}" != "xyes"; then
+                       LDFLAGS="$LDFLAGS $withval"
+               fi
+       ]
+)
+AC_ARG_WITH(libs,
+       [  --with-libs             Specify additional libraries to link with],
+       [
+               if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
+                   test "x${withval}" != "xyes"; then
+                       LIBS="$LIBS $withval"
+               fi
+       ]
+)
+AC_ARG_WITH(Werror,
+       [  --with-Werror           Build main code with -Werror],
+       [
+               if test -n "$withval"  &&  test "x$withval" != "xno"; then
+                       werror_flags="-Werror"
+                       if test "x${withval}" != "xyes"; then
+                               werror_flags="$withval"
+                       fi
+               fi
+       ]
+)
+
+AC_CHECK_HEADERS( \
+       bstring.h \
+       crypt.h \
+       crypto/sha2.h \
+       dirent.h \
+       endian.h \
+       features.h \
+       fcntl.h \
+       floatingpoint.h \
+       getopt.h \
+       glob.h \
+       ia.h \
+       iaf.h \
+       limits.h \
+       login.h \
+       maillock.h \
+       ndir.h \
+       net/if_tun.h \
+       netdb.h \
+       netgroup.h \
+       pam/pam_appl.h \
+       paths.h \
+       poll.h \
+       pty.h \
+       readpassphrase.h \
+       rpc/types.h \
+       security/pam_appl.h \
+       sha2.h \
+       shadow.h \
+       stddef.h \
+       stdint.h \
+       string.h \
+       strings.h \
+       sys/audit.h \
+       sys/bitypes.h \
+       sys/bsdtty.h \
+       sys/cdefs.h \
+       sys/dir.h \
+       sys/mman.h \
+       sys/ndir.h \
+       sys/poll.h \
+       sys/prctl.h \
+       sys/pstat.h \
+       sys/select.h \
+       sys/stat.h \
+       sys/stream.h \
+       sys/stropts.h \
+       sys/strtio.h \
+       sys/statvfs.h \
+       sys/sysmacros.h \
+       sys/time.h \
+       sys/timers.h \
+       sys/un.h \
+       time.h \
+       tmpdir.h \
+       ttyent.h \
+       ucred.h \
+       unistd.h \
+       usersec.h \
+       util.h \
+       utime.h \
+       utmp.h \
+       utmpx.h \
+       vis.h \
+)
+
+# lastlog.h requires sys/time.h to be included first on Solaris
+AC_CHECK_HEADERS(lastlog.h, [], [], [
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+])
+
+# sys/ptms.h requires sys/stream.h to be included first on Solaris
+AC_CHECK_HEADERS(sys/ptms.h, [], [], [
+#ifdef HAVE_SYS_STREAM_H
+# include <sys/stream.h>
+#endif
+])
+
+# login_cap.h requires sys/types.h on NetBSD
+AC_CHECK_HEADERS(login_cap.h, [], [], [
+#include <sys/types.h>
+])
+
+# older BSDs need sys/param.h before sys/mount.h
+AC_CHECK_HEADERS(sys/mount.h, [], [], [
+#include <sys/param.h>
+])
+
+# Messages for features tested for in target-specific section
+SIA_MSG="no"
+SPC_MSG="no"
+
 # Check for some target-specific stuff
 case "$host" in
 *-*-aix*)
+       # Some versions of VAC won't allow macro redefinitions at
+       # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
+       # particularly with older versions of vac or xlc.
+       # It also throws errors about null macro argments, but these are
+       # not fatal.
+       AC_MSG_CHECKING(if compiler allows macro redefinitions)
+       AC_COMPILE_IFELSE(
+           [AC_LANG_SOURCE([[
+#define testmacro foo
+#define testmacro bar
+int main(void) { exit(0); }
+           ]])],
+           [ AC_MSG_RESULT(yes) ],
+           [ AC_MSG_RESULT(no)
+             CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
+             LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
+             CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
+             CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
+           ]
+       )
+
        AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
        if (test -z "$blibpath"); then
                blibpath="/usr/lib:/lib"
@@ -179,7 +407,7 @@ case "$host" in
                [],
                [#include <usersec.h>]
        )
-       AC_CHECK_FUNCS(setauthdb)
+       AC_CHECK_FUNCS(getgrset setauthdb)
        AC_CHECK_DECL(F_CLOSEM,
            AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
            [],
@@ -205,13 +433,11 @@ case "$host" in
        ;;
 *-*-cygwin*)
        check_for_libcrypt_later=1
-       LIBS="$LIBS /usr/lib/textmode.o"
+       LIBS="$LIBS /usr/lib/textreadmode.o"
        AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
        AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
        AC_DEFINE(DISABLE_SHADOW, 1,
                [Define if you want to disable shadow passwords])
-       AC_DEFINE(IP_TOS_IS_BROKEN, 1,
-               [Define if your system choked on IP TOS setting])
        AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
                [Define if X11 doesn't support AF_UNIX sockets on that system])
        AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
@@ -220,9 +446,11 @@ case "$host" in
        AC_DEFINE(DISABLE_FD_PASSING, 1,
                [Define if your platform needs to skip post auth
                file descriptor passing])
+       AC_DEFINE(SSH_IOBUFSZ, 65536, [Windows is sensitive to read buffer size])
        ;;
 *-*-dgux*)
-       AC_DEFINE(IP_TOS_IS_BROKEN)
+       AC_DEFINE(IP_TOS_IS_BROKEN, 1,
+               [Define if your system choked on IP TOS setting])
        AC_DEFINE(SETEUID_BREAKS_SETUID)
        AC_DEFINE(BROKEN_SETREUID)
        AC_DEFINE(BROKEN_SETREGID)
@@ -241,6 +469,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
        AC_DEFINE(SETEUID_BREAKS_SETUID)
        AC_DEFINE(BROKEN_SETREUID)
        AC_DEFINE(BROKEN_SETREGID)
+       AC_DEFINE(BROKEN_GLOB, 1, [OS X glob does not do what we expect])
        AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
                [Define if your resolver libs need this for getrrsetbyname])
        AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
@@ -248,6 +477,16 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
            [Use tunnel device compatibility to OpenBSD])
        AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
            [Prepend the address family to IP tunnel traffic])
+       m4_pattern_allow(AU_IPv)
+       AC_CHECK_DECL(AU_IPv4, [], 
+           AC_DEFINE(AU_IPv4, 0, [System only supports IPv4 audit records])
+           [#include <bsm/audit.h>]
+       AC_DEFINE(LASTLOG_WRITE_PUTUTXLINE, 1,
+           [Define if pututxline updates lastlog too])
+       )
+       ;;
+*-*-dragonfly*)
+       SSHDLIBS="$SSHDLIBS -lcrypt"
        ;;
 *-*-hpux*)
        # first we define all of the options common to all HP-UX releases
@@ -328,11 +567,18 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
        AC_DEFINE(WITH_ABBREV_NO_TTY)
        AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
        ;;
+*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
+       check_for_libcrypt_later=1
+       AC_DEFINE(PAM_TTY_KLUDGE)
+       AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
+       AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
+       AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
+       AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
+       ;;
 *-*-linux*)
        no_dev_ptmx=1
        check_for_libcrypt_later=1
        check_for_openpty_ctty_bug=1
-       AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
        AC_DEFINE(PAM_TTY_KLUDGE, 1,
                [Work around problematic Linux PAM modules handling of PAM_TTY])
        AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
@@ -343,6 +589,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
                if it doesn't return EOPNOTSUPP.])
        AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
        AC_DEFINE(USE_BTMP)
+       AC_DEFINE(LINUX_OOM_ADJUST, 1, [Adjust Linux out-of-memory killer])
        inet6_default_4in6=yes
        case `uname -r` in
        1.*|2.0.*)
@@ -382,6 +629,7 @@ mips-sony-bsd|mips-sony-newsos4)
        AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
        AC_CHECK_HEADER([net/if_tap.h], ,
            AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
+       AC_DEFINE(BROKEN_GLOB, 1, [FreeBSD glob does not do what we need])
        ;;
 *-*-bsdi*)
        AC_DEFINE(SETEUID_BREAKS_SETUID)
@@ -425,6 +673,7 @@ mips-sony-bsd|mips-sony-newsos4)
                after setsid()])
        AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
                in case the name is longer than 8 chars])
+       AC_DEFINE(BROKEN_TCGETATTR_ICANON, 1, [tcgetattr with ICANON may hang])
        external_path_file=/etc/default/login
        # hardwire lastlog location (can't detect it on some versions)
        conf_lastlog_location="/var/adm/lastlog"
@@ -438,6 +687,17 @@ mips-sony-bsd|mips-sony-newsos4)
        else
                AC_MSG_RESULT(no)
        fi
+       AC_ARG_WITH(solaris-contracts,
+               [  --with-solaris-contracts Enable Solaris process contracts (experimental)],
+               [
+               AC_CHECK_LIB(contract, ct_tmpl_activate,
+                       [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
+                               [Define if you have Solaris process contracts])
+                         SSHDLIBS="$SSHDLIBS -lcontract"
+                         AC_SUBST(SSHDLIBS)
+                         SPC_MSG="yes" ], )
+               ],
+       )
        ;;
 *-*-sunos4*)
        CPPFLAGS="$CPPFLAGS -DSUNOS4"
@@ -475,7 +735,6 @@ mips-sony-bsd|mips-sony-newsos4)
        ;;
 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
 *-*-sysv4.2*)
-       CFLAGS="$CFLAGS -Dva_list=_VA_LIST"
        AC_DEFINE(USE_PIPES)
        AC_DEFINE(SETEUID_BREAKS_SETUID)
        AC_DEFINE(BROKEN_SETREUID)
@@ -485,7 +744,6 @@ mips-sony-bsd|mips-sony-newsos4)
        ;;
 # UnixWare 7.x, OpenUNIX 8
 *-*-sysv5*)
-       check_for_libcrypt_later=1
        AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
        AC_DEFINE(USE_PIPES)
        AC_DEFINE(SETEUID_BREAKS_SETUID)
@@ -497,8 +755,15 @@ mips-sony-bsd|mips-sony-newsos4)
                TEST_SHELL=/u95/bin/sh
                AC_DEFINE(BROKEN_LIBIAF, 1,
                        [ia_uinfo routines not supported by OS yet])
+               AC_DEFINE(BROKEN_UPDWTMPX)
+               AC_CHECK_LIB(prot, getluid,[ LIBS="$LIBS -lprot"
+                       AC_CHECK_FUNCS(getluid setluid,,,-lprot)
+                       AC_DEFINE(HAVE_SECUREWARE)
+                       AC_DEFINE(DISABLE_SHADOW)
+                       ],,)
                ;;
        *)      AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
+               check_for_libcrypt_later=1
                ;;
        esac
        ;;
@@ -586,6 +851,7 @@ mips-sony-bsd|mips-sony-newsos4)
                                system's login() call])
                        AC_DEFINE(DISABLE_FD_PASSING)
                        LIBS="$LIBS -lsecurity -ldb -lm -laud"
+                       SIA_MSG="yes"
                else
                        AC_MSG_RESULT(no)
                        AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
@@ -596,6 +862,7 @@ mips-sony-bsd|mips-sony-newsos4)
        AC_DEFINE(SETEUID_BREAKS_SETUID)
        AC_DEFINE(BROKEN_SETREUID)
        AC_DEFINE(BROKEN_SETREGID)
+       AC_DEFINE(BROKEN_READV_COMPARISON, 1, [Can't do comparisons on readv])
        ;;
 
 *-*-nto-qnx*)
@@ -606,168 +873,44 @@ mips-sony-bsd|mips-sony-newsos4)
        AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
        AC_DEFINE(DISABLE_LASTLOG)
        AC_DEFINE(SSHD_ACQUIRES_CTTY)
+       AC_DEFINE(BROKEN_SHADOW_EXPIRE, 1, [QNX shadow support is broken])
        enable_etc_default_login=no     # has incompatible /etc/default/login
+       case "$host" in
+       *-*-nto-qnx6*)
+               AC_DEFINE(DISABLE_FD_PASSING)
+               ;;
+       esac
        ;;
 
 *-*-ultrix*)
        AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
        AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
-       AC_DEFINE(NEED_SETPGRP)
-       AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
-       ;;
-
-*-*-lynxos)
-        CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
-       AC_DEFINE(MISSING_HOWMANY)
-        AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
-        ;;
-esac
-
-# Allow user to specify flags
-AC_ARG_WITH(cflags,
-       [  --with-cflags           Specify additional flags to pass to compiler],
-       [
-               if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
-                   test "x${withval}" != "xyes"; then
-                       CFLAGS="$CFLAGS $withval"
-               fi
-       ]
-)
-AC_ARG_WITH(cppflags,
-       [  --with-cppflags         Specify additional flags to pass to preprocessor] ,
-       [
-               if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
-                   test "x${withval}" != "xyes"; then
-                       CPPFLAGS="$CPPFLAGS $withval"
-               fi
-       ]
-)
-AC_ARG_WITH(ldflags,
-       [  --with-ldflags          Specify additional flags to pass to linker],
-       [
-               if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
-                   test "x${withval}" != "xyes"; then
-                       LDFLAGS="$LDFLAGS $withval"
-               fi
-       ]
-)
-AC_ARG_WITH(libs,
-       [  --with-libs             Specify additional libraries to link with],
-       [
-               if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
-                   test "x${withval}" != "xyes"; then
-                       LIBS="$LIBS $withval"
-               fi
-       ]
-)
-AC_ARG_WITH(Werror,
-       [  --with-Werror           Build main code with -Werror],
-       [
-               if test -n "$withval"  &&  test "x$withval" != "xno"; then
-                       werror_flags="-Werror"
-                       if test "x${withval}" != "xyes"; then
-                               werror_flags="$withval"
-                       fi
-               fi
-       ]
-)
-
-AC_MSG_CHECKING(compiler and flags for sanity)
-AC_RUN_IFELSE(
-       [AC_LANG_SOURCE([
-#include <stdio.h>
-int main(){exit(0);}
-       ])],
-       [       AC_MSG_RESULT(yes) ],
-       [
-               AC_MSG_RESULT(no)
-               AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
-       ],
-       [       AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
-)
-
-dnl Checks for header files.
-AC_CHECK_HEADERS( \
-       bstring.h \
-       crypt.h \
-       crypto/sha2.h \
-       dirent.h \
-       endian.h \
-       features.h \
-       fcntl.h \
-       floatingpoint.h \
-       getopt.h \
-       glob.h \
-       ia.h \
-       iaf.h \
-       limits.h \
-       login.h \
-       maillock.h \
-       ndir.h \
-       net/if_tun.h \
-       netdb.h \
-       netgroup.h \
-       pam/pam_appl.h \
-       paths.h \
-       pty.h \
-       readpassphrase.h \
-       rpc/types.h \
-       security/pam_appl.h \
-       sha2.h \
-       shadow.h \
-       stddef.h \
-       stdint.h \
-       string.h \
-       strings.h \
-       sys/audit.h \
-       sys/bitypes.h \
-       sys/bsdtty.h \
-       sys/cdefs.h \
-       sys/dir.h \
-       sys/mman.h \
-       sys/ndir.h \
-       sys/prctl.h \
-       sys/pstat.h \
-       sys/select.h \
-       sys/stat.h \
-       sys/stream.h \
-       sys/stropts.h \
-       sys/strtio.h \
-       sys/sysmacros.h \
-       sys/time.h \
-       sys/timers.h \
-       sys/un.h \
-       time.h \
-       tmpdir.h \
-       ttyent.h \
-       unistd.h \
-       usersec.h \
-       util.h \
-       utime.h \
-       utmp.h \
-       utmpx.h \
-       vis.h \
-)
-
-# lastlog.h requires sys/time.h to be included first on Solaris
-AC_CHECK_HEADERS(lastlog.h, [], [], [
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-])
-
-# sys/ptms.h requires sys/stream.h to be included first on Solaris
-AC_CHECK_HEADERS(sys/ptms.h, [], [], [
-#ifdef HAVE_SYS_STREAM_H
-# include <sys/stream.h>
-#endif
-])
+       AC_DEFINE(NEED_SETPGRP)
+       AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
+       ;;
 
-# login_cap.h requires sys/types.h on NetBSD
-AC_CHECK_HEADERS(login_cap.h, [], [], [
-#include <sys/types.h>
-])
+*-*-lynxos)
+        CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
+       AC_DEFINE(MISSING_HOWMANY)
+        AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
+        ;;
+esac
+
+AC_MSG_CHECKING(compiler and flags for sanity)
+AC_RUN_IFELSE(
+       [AC_LANG_SOURCE([
+#include <stdio.h>
+int main(){exit(0);}
+       ])],
+       [       AC_MSG_RESULT(yes) ],
+       [
+               AC_MSG_RESULT(no)
+               AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
+       ],
+       [       AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
+)
 
+dnl Checks for header files.
 # Checks for libraries.
 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
@@ -842,6 +985,7 @@ AC_ARG_WITH(zlib,
        fi ]
 )
 
+AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
 AC_CHECK_LIB(z, deflate, ,
        [
                saved_CPPFLAGS="$CPPFLAGS"
@@ -862,7 +1006,6 @@ AC_CHECK_LIB(z, deflate, ,
                )
        ]
 )
-AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
 
 AC_ARG_WITH(zlib-version-check,
        [  --without-zlib-version-check Disable zlib version check],
@@ -926,7 +1069,7 @@ dnl    Checks for libutil functions
 AC_CHECK_HEADERS(libutil.h)
 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
        [Define if your libraries define login()])])
-AC_CHECK_FUNCS(logout updwtmp logwtmp)
+AC_CHECK_FUNCS(fmt_scaled logout updwtmp logwtmp)
 
 AC_FUNC_STRFTIME
 
@@ -966,6 +1109,8 @@ AC_TRY_COMPILE(
        ]
 )
 
+AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
+
 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
 AC_RUN_IFELSE(
        [AC_LANG_SOURCE([[
@@ -1067,8 +1212,7 @@ AC_ARG_WITH(tcp-wrappers,
                                        CPPFLAGS="-I${withval} ${CPPFLAGS}"
                                fi
                        fi
-                       LIBWRAP="-lwrap"
-                       LIBS="$LIBWRAP $LIBS"
+                       LIBS="-lwrap $LIBS"
                        AC_MSG_CHECKING(for libwrap)
                        AC_TRY_LINK(
                                [
@@ -1084,7 +1228,7 @@ AC_ARG_WITH(tcp-wrappers,
                                        AC_DEFINE(LIBWRAP, 1,
                                                [Define if you want
                                                TCP Wrappers support])
-                                       AC_SUBST(LIBWRAP)
+                                       SSHDLIBS="$SSHDLIBS -lwrap"
                                        TCPW_MSG="yes"
                                ],
                                [
@@ -1147,13 +1291,19 @@ AC_ARG_WITH(audit,
                AUDIT_MODULE=bsm
                dnl    Checks for headers, libs and functions
                AC_CHECK_HEADERS(bsm/audit.h, [],
-                   [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
+                   [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
+                   [
+#ifdef HAVE_TIME_H
+# include <time.h>
+#endif
+                   ]
+)
                AC_CHECK_LIB(bsm, getaudit, [],
                    [AC_MSG_ERROR(BSM enabled and required library not found)])
                AC_CHECK_FUNCS(getaudit, [],
                    [AC_MSG_ERROR(BSM enabled and required function not found)])
                # These are optional
-               AC_CHECK_FUNCS(getaudit_addr)
+               AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
                AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
                ;;
          debug)
@@ -1173,6 +1323,8 @@ AC_ARG_WITH(audit,
 dnl    Checks for library functions. Please keep in alphabetical order
 AC_CHECK_FUNCS( \
        arc4random \
+       arc4random_buf \
+       arc4random_uniform \
        asprintf \
        b64_ntop \
        __b64_ntop \
@@ -1186,6 +1338,7 @@ AC_CHECK_FUNCS( \
        fchmod \
        fchown \
        freeaddrinfo \
+       fstatvfs \
        futimes \
        getaddrinfo \
        getcwd \
@@ -1193,6 +1346,7 @@ AC_CHECK_FUNCS( \
        getnameinfo \
        getopt \
        getpeereid \
+       getpeerucred \
        _getpty \
        getrlimit \
        getttyent \
@@ -1211,6 +1365,7 @@ AC_CHECK_FUNCS( \
        ogetaddrinfo \
        openlog_r \
        openpty \
+       poll \
        prctl \
        pstat \
        readpassphrase \
@@ -1235,6 +1390,8 @@ AC_CHECK_FUNCS( \
        sigvec \
        snprintf \
        socketpair \
+       statfs \
+       statvfs \
        strdup \
        strerror \
        strlcat \
@@ -1244,6 +1401,7 @@ AC_CHECK_FUNCS( \
        strtonum \
        strtoll \
        strtoul \
+       swap32 \
        sysconf \
        tcgetpgrp \
        truncate \
@@ -1310,6 +1468,20 @@ AC_CHECK_DECLS(O_NONBLOCK, , ,
 #endif
        ])
 
+AC_CHECK_DECLS(writev, , , [
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+       ])
+
+AC_CHECK_DECLS(MAXSYMLINKS, , , [
+#include <sys/param.h>
+       ])
+
+AC_CHECK_DECLS(offsetof, , , [
+#include <stddef.h>
+       ])
+
 AC_CHECK_FUNCS(setresuid, [
        dnl Some platorms have setresuid that isn't implemented, test for this
        AC_MSG_CHECKING(if setresuid seems to work)
@@ -1352,6 +1524,8 @@ AC_CHECK_FUNCS(utmpname)
 dnl    Checks for utmpx functions
 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
 AC_CHECK_FUNCS(setutxent utmpxname)
+dnl    Checks for lastlog functions
+AC_CHECK_FUNCS(getlastlogxbyname)
 
 AC_CHECK_FUNC(daemon,
        [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
@@ -1435,7 +1609,7 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
 
 # Check for missing getpeereid (or equiv) support
 NO_PEERCHECK=""
-if test "x$ac_cv_func_getpeereid" != "xyes" ; then
+if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
        AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
        AC_TRY_COMPILE(
                [#include <sys/types.h>
@@ -1680,61 +1854,6 @@ fi
 
 AC_FUNC_GETPGRP
 
-# Check for PAM libs
-PAM_MSG="no"
-AC_ARG_WITH(pam,
-       [  --with-pam              Enable PAM support ],
-       [
-               if test "x$withval" != "xno" ; then
-                       if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
-                          test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
-                               AC_MSG_ERROR([PAM headers not found])
-                       fi
-
-                       AC_CHECK_LIB(dl, dlopen, , )
-                       AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
-                       AC_CHECK_FUNCS(pam_getenvlist)
-                       AC_CHECK_FUNCS(pam_putenv)
-
-                       PAM_MSG="yes"
-
-                       AC_DEFINE(USE_PAM, 1,
-                               [Define if you want to enable PAM support])
-                       if test $ac_cv_lib_dl_dlopen = yes; then
-                               LIBPAM="-lpam -ldl"
-                       else
-                               LIBPAM="-lpam"
-                       fi
-                       AC_SUBST(LIBPAM)
-               fi
-       ]
-)
-
-# Check for older PAM
-if test "x$PAM_MSG" = "xyes" ; then
-       # Check PAM strerror arguments (old PAM)
-       AC_MSG_CHECKING([whether pam_strerror takes only one argument])
-       AC_TRY_COMPILE(
-               [
-#include <stdlib.h>
-#if defined(HAVE_SECURITY_PAM_APPL_H)
-#include <security/pam_appl.h>
-#elif defined (HAVE_PAM_PAM_APPL_H)
-#include <pam/pam_appl.h>
-#endif
-               ],
-               [(void)pam_strerror((pam_handle_t *)NULL, -1);],
-               [AC_MSG_RESULT(no)],
-               [
-                       AC_DEFINE(HAVE_OLD_PAM, 1,
-                               [Define if you have an old version of PAM
-                               which takes only one argument to pam_strerror])
-                       AC_MSG_RESULT(yes)
-                       PAM_MSG="yes (old library)"
-               ]
-       )
-fi
-
 # Search for OpenSSL
 saved_CPPFLAGS="$CPPFLAGS"
 saved_LDFLAGS="$LDFLAGS"
@@ -1779,6 +1898,8 @@ AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
                        LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
                fi
                CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
+               AC_CHECK_HEADER([openssl/opensslv.h], ,
+                   AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***]))
                AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
                        [
                                AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
@@ -1858,6 +1979,14 @@ int main(void) {
        ]
 )
 
+AC_ARG_WITH(openssl-header-check,
+       [  --without-openssl-header-check Disable OpenSSL version consistency check],
+       [  if test "x$withval" = "xno" ; then
+               openssl_check_nonfatal=1
+          fi
+       ]
+)
+
 # Sanity check OpenSSL headers
 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
 AC_RUN_IFELSE(
@@ -1871,15 +2000,54 @@ int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
        ],
        [
                AC_MSG_RESULT(no)
-               AC_MSG_ERROR([Your OpenSSL headers do not match your library.
-Check config.log for details.
+               if test "x$openssl_check_nonfatal" = "x"; then
+                       AC_MSG_ERROR([Your OpenSSL headers do not match your
+library. Check config.log for details.
+If you are sure your installation is consistent, you can disable the check
+by running "./configure --without-openssl-header-check".
+Also see contrib/findssl.sh for help identifying header/library mismatches.
+])
+               else
+                       AC_MSG_WARN([Your OpenSSL headers do not match your
+library. Check config.log for details.
 Also see contrib/findssl.sh for help identifying header/library mismatches.])
+               fi
        ],
        [
                AC_MSG_WARN([cross compiling: not checking])
        ]
 )
 
+AC_MSG_CHECKING([if programs using OpenSSL functions will link])
+AC_LINK_IFELSE(
+       [AC_LANG_SOURCE([[
+#include <openssl/evp.h>
+int main(void) { SSLeay_add_all_algorithms(); }
+       ]])],
+       [
+               AC_MSG_RESULT(yes)
+       ],
+       [
+               AC_MSG_RESULT(no)
+               saved_LIBS="$LIBS"
+               LIBS="$LIBS -ldl"
+               AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
+               AC_LINK_IFELSE(
+                       [AC_LANG_SOURCE([[
+#include <openssl/evp.h>
+int main(void) { SSLeay_add_all_algorithms(); }
+                       ]])],
+                       [
+                               AC_MSG_RESULT(yes)
+                       ],
+                       [
+                               AC_MSG_RESULT(no)
+                               LIBS="$saved_LIBS"
+                       ]
+               )
+       ]
+)
+
 AC_ARG_WITH(ssl-engine,
        [  --with-ssl-engine       Enable OpenSSL (hardware) ENGINE support ],
        [ if test "x$withval" != "xno" ; then
@@ -1887,7 +2055,7 @@ AC_ARG_WITH(ssl-engine,
                AC_TRY_COMPILE(
                        [ #include <openssl/engine.h>],
                        [
-int main(void){ENGINE_load_builtin_engines();ENGINE_register_all_complete();}
+ENGINE_load_builtin_engines();ENGINE_register_all_complete();
                        ],
                        [ AC_MSG_RESULT(yes)
                          AC_DEFINE(USE_OPENSSL_ENGINE, 1,
@@ -1916,6 +2084,23 @@ int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
        ]
 )
 
+AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
+AC_LINK_IFELSE(
+       [AC_LANG_SOURCE([[
+#include <string.h>
+#include <openssl/evp.h>
+int main(void) { if(EVP_DigestUpdate(NULL, NULL,0)) exit(0); }
+       ]])],
+       [
+               AC_MSG_RESULT(yes)
+       ],
+       [
+               AC_MSG_RESULT(no)
+               AC_DEFINE(OPENSSL_EVP_DIGESTUPDATE_VOID, 1,
+                   [Define if EVP_DigestUpdate returns void])
+       ]
+)
+
 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
 # because the system crypt() is more featureful.
 if test "x$check_for_libcrypt_before" = "x1"; then
@@ -1931,7 +2116,15 @@ fi
 # Search for SHA256 support in libc and/or OpenSSL
 AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
 
-AC_CHECK_LIB(iaf, ia_openinfo)
+saved_LIBS="$LIBS"
+AC_CHECK_LIB(iaf, ia_openinfo, [
+       LIBS="$LIBS -liaf"
+       AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
+                               AC_DEFINE(HAVE_LIBIAF, 1,
+                       [Define if system has libiaf that supports set_id])
+                               ])
+])
+LIBS="$saved_LIBS"
 
 ### Configure cryptographic random number support
 
@@ -1961,6 +2154,68 @@ int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
        ]
 )
 
+# Check for PAM libs
+PAM_MSG="no"
+AC_ARG_WITH(pam,
+       [  --with-pam              Enable PAM support ],
+       [
+               if test "x$withval" != "xno" ; then
+                       if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
+                          test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
+                               AC_MSG_ERROR([PAM headers not found])
+                       fi
+
+                       saved_LIBS="$LIBS"
+                       AC_CHECK_LIB(dl, dlopen, , )
+                       AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
+                       AC_CHECK_FUNCS(pam_getenvlist)
+                       AC_CHECK_FUNCS(pam_putenv)
+                       LIBS="$saved_LIBS"
+
+                       PAM_MSG="yes"
+
+                       SSHDLIBS="$SSHDLIBS -lpam"
+                       AC_DEFINE(USE_PAM, 1,
+                               [Define if you want to enable PAM support])
+
+                       if test $ac_cv_lib_dl_dlopen = yes; then
+                               case "$LIBS" in
+                               *-ldl*)
+                                       # libdl already in LIBS
+                                       ;;
+                               *)
+                                       SSHDLIBS="$SSHDLIBS -ldl"
+                                       ;;
+                               esac
+                       fi
+               fi
+       ]
+)
+
+# Check for older PAM
+if test "x$PAM_MSG" = "xyes" ; then
+       # Check PAM strerror arguments (old PAM)
+       AC_MSG_CHECKING([whether pam_strerror takes only one argument])
+       AC_TRY_COMPILE(
+               [
+#include <stdlib.h>
+#if defined(HAVE_SECURITY_PAM_APPL_H)
+#include <security/pam_appl.h>
+#elif defined (HAVE_PAM_PAM_APPL_H)
+#include <pam/pam_appl.h>
+#endif
+               ],
+               [(void)pam_strerror((pam_handle_t *)NULL, -1);],
+               [AC_MSG_RESULT(no)],
+               [
+                       AC_DEFINE(HAVE_OLD_PAM, 1,
+                               [Define if you have an old version of PAM
+                               which takes only one argument to pam_strerror])
+                       AC_MSG_RESULT(yes)
+                       PAM_MSG="yes (old library)"
+               ]
+       )
+fi
 
 # Do we want to force the use of the rand helper?
 AC_ARG_WITH(rand-helper,
@@ -2451,8 +2706,20 @@ fi
 TYPE_SOCKLEN_T
 
 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
+AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t],,,[
+#include <sys/types.h>
+#ifdef HAVE_SYS_BITYPES_H
+#include <sys/bitypes.h>
+#endif
+#ifdef HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+])
 
-AC_CHECK_TYPES(in_addr_t,,,
+AC_CHECK_TYPES([in_addr_t, in_port_t],,,
 [#include <sys/types.h>
 #include <netinet/in.h>])
 
@@ -2599,6 +2866,15 @@ AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
        AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
                [define if you have struct in6_addr data type])
+
+dnl Now check for sin6_scope_id
+       AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
+               [
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#include <netinet/in.h>
+               ])
 fi
 
 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
@@ -2813,6 +3089,42 @@ if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
                file descriptor passing])
 fi
 
+AC_MSG_CHECKING(if struct statvfs.f_fsid is integral type)
+AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+], [struct statvfs s; s.f_fsid = 0;],
+[ AC_MSG_RESULT(yes) ],
+[ AC_MSG_RESULT(no)
+
+       AC_MSG_CHECKING(if fsid_t has member val)
+       AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/statvfs.h>],
+       [fsid_t t; t.val[0] = 0;],
+       [ AC_MSG_RESULT(yes)
+         AC_DEFINE(FSID_HAS_VAL, 1, fsid_t has member val) ],
+       [ AC_MSG_RESULT(no) ])
+
+       AC_MSG_CHECKING(if f_fsid has member __val)
+       AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/statvfs.h>],
+       [fsid_t t; t.__val[0] = 0;],
+       [ AC_MSG_RESULT(yes)
+         AC_DEFINE(FSID_HAS___VAL, 1, fsid_t has member __val) ],
+       [ AC_MSG_RESULT(no) ])
+])
+
 AC_CACHE_CHECK([for msg_control field in struct msghdr],
                ac_cv_have_control_in_msghdr, [
        AC_COMPILE_IFELSE(
@@ -2984,16 +3296,23 @@ AC_ARG_WITH(opensc,
        [  --with-opensc[[=PFX]]     Enable smartcard support using OpenSC (optionally in PATH)],
        [
            if test "x$withval" != "xno" ; then
-               if test "x$withval" != "xyes" ; then
-                       OPENSC_CONFIG=$withval/bin/opensc-config
+               AC_PATH_PROG(PKGCONFIG, pkg-config, no)
+               AC_MSG_CHECKING(how to get opensc config)
+               if test "x$withval" != "xyes" -a "x$PKGCONFIG" = "xno"; then
+                       OPENSC_CONFIG="$withval/bin/opensc-config"
+               elif test -f "$withval/src/libopensc/libopensc.pc"; then
+                       OPENSC_CONFIG="$PKGCONFIG $withval/src/libopensc/libopensc.pc"
+               elif test "x$PKGCONFIG" != "xno"; then
+                       OPENSC_CONFIG="$PKGCONFIG libopensc"
                else
-                       AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
+                       AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
                fi
+               AC_MSG_RESULT($OPENSC_CONFIG)
                if test "$OPENSC_CONFIG" != "no"; then
                        LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
                        LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
                        CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
-                       LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
+                       LIBS="$LIBS $LIBOPENSC_LIBS"
                        AC_DEFINE(SMARTCARD)
                        AC_DEFINE(USE_OPENSC, 1,
                                [Define if you want smartcard support
@@ -3013,12 +3332,30 @@ AC_SEARCH_LIBS(getrrsetbyname, resolv,
                AC_SEARCH_LIBS(res_query, resolv)
                AC_SEARCH_LIBS(dn_expand, resolv)
                AC_MSG_CHECKING(if res_query will link)
-               AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
+               AC_LINK_IFELSE([
+#include "confdefs.h"
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <netdb.h>
+#include <resolv.h>
+int main()
+{
+       res_query (0, 0, 0, 0, 0);
+       return 0;
+}
+                  ],
+                   AC_MSG_RESULT(yes),
                   [AC_MSG_RESULT(no)
                    saved_LIBS="$LIBS"
                    LIBS="$LIBS -lresolv"
                    AC_MSG_CHECKING(for res_query in -lresolv)
                    AC_LINK_IFELSE([
+#include "confdefs.h"
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <netdb.h>
 #include <resolv.h>
 int main()
 {
@@ -3026,8 +3363,7 @@ int main()
        return 0;
 }
                        ],
-                       [LIBS="$LIBS -lresolv"
-                        AC_MSG_RESULT(yes)],
+                       [AC_MSG_RESULT(yes)],
                        [LIBS="$saved_LIBS"
                         AC_MSG_RESULT(no)])
                    ])
@@ -3041,22 +3377,43 @@ int main()
                        [#include <arpa/nameser.h>])
        ])
 
+AC_MSG_CHECKING(if struct __res_state _res is an extern)
+AC_LINK_IFELSE([
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+extern struct __res_state _res;
+int main() { return 0; }
+               ],
+               [AC_MSG_RESULT(yes)
+                AC_DEFINE(HAVE__RES_EXTERN, 1,
+                   [Define if you have struct __res_state _res as an extern])
+               ],
+               [ AC_MSG_RESULT(no) ]
+)
+
 # Check whether user wants SELinux support
 SELINUX_MSG="no"
 LIBSELINUX=""
 AC_ARG_WITH(selinux,
-       [  --with-selinux   Enable SELinux support],
+       [  --with-selinux          Enable SELinux support],
        [ if test "x$withval" != "xno" ; then
+               save_LIBS="$LIBS"
                AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
                SELINUX_MSG="yes"
                AC_CHECK_HEADER([selinux/selinux.h], ,
                    AC_MSG_ERROR(SELinux support requires selinux.h header))
                AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
                    AC_MSG_ERROR(SELinux support requires libselinux library))
+               SSHDLIBS="$SSHDLIBS $LIBSELINUX"
                AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
+               LIBS="$save_LIBS"
        fi ]
 )
-AC_SUBST(LIBSELINUX)
 
 # Check whether user wants Kerberos 5 support
 KRB5_MSG="no"
@@ -3072,10 +3429,10 @@ AC_ARG_WITH(kerberos5,
                AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
                KRB5_MSG="yes"
 
-               AC_MSG_CHECKING(for krb5-config)
-               if test -x  $KRB5ROOT/bin/krb5-config ; then
-                       KRB5CONF=$KRB5ROOT/bin/krb5-config
-                       AC_MSG_RESULT($KRB5CONF)
+               AC_PATH_PROG([KRB5CONF],[krb5-config],
+                            [$KRB5ROOT/bin/krb5-config],
+                            [$KRB5ROOT/bin:$PATH])
+               if test -x $KRB5CONF ; then
 
                        AC_MSG_CHECKING(for gssapi support)
                        if $KRB5CONF | grep gssapi >/dev/null ; then
@@ -3101,7 +3458,6 @@ AC_ARG_WITH(kerberos5,
                                         AC_MSG_RESULT(no)
                        )
                else
-                       AC_MSG_RESULT(no)
                        CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
                        LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
                        AC_MSG_CHECKING(whether we are using Heimdal)
@@ -3120,12 +3476,12 @@ AC_ARG_WITH(kerberos5,
                        )
                        AC_SEARCH_LIBS(dn_expand, resolv)
 
-                       AC_CHECK_LIB(gssapi,gss_init_sec_context,
+                       AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,
                                [ AC_DEFINE(GSSAPI)
-                                 K5LIBS="-lgssapi $K5LIBS" ],
-                               [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
+                                 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
+                               [ AC_CHECK_LIB(gssapigss_init_sec_context,
                                        [ AC_DEFINE(GSSAPI)
-                                         K5LIBS="-lgssapi_krb5 $K5LIBS" ],
+                                         K5LIBS="-lgssapi $K5LIBS" ],
                                        AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
                                        $K5LIBS)
                                ],
@@ -3820,21 +4176,21 @@ if test ! -z "$blibpath" ; then
        AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
 fi
 
-dnl remove pam and dl because they are in $LIBPAM
-if test "$PAM_MSG" = yes ; then
-       LIBS=`echo $LIBS | sed 's/-lpam //'`
-fi
-if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
-       LIBS=`echo $LIBS | sed 's/-ldl //'`
-fi
-
 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
 dnl Add now.
 CFLAGS="$CFLAGS $werror_flags"
 
+if grep "#define BROKEN_GETADDRINFO 1" confdefs.h >/dev/null || \
+    test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
+       AC_SUBST(TEST_SSH_IPV6, no)
+else
+       AC_SUBST(TEST_SSH_IPV6, yes)
+fi
+
 AC_EXEEXT
-AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
-       openbsd-compat/regress/Makefile scard/Makefile ssh_prng_cmds survey.sh])
+AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
+       openbsd-compat/Makefile openbsd-compat/regress/Makefile \
+       scard/Makefile ssh_prng_cmds survey.sh])
 AC_OUTPUT
 
 # Print summary of options
@@ -3875,6 +4231,7 @@ echo "          sshd superuser user PATH: $J"
 fi
 echo "                    Manpage format: $MANTYPE"
 echo "                       PAM support: $PAM_MSG"
+echo "                   OSF SIA support: $SIA_MSG"
 echo "                 KerberosV support: $KRB5_MSG"
 echo "                   SELinux support: $SELINUX_MSG"
 echo "                 Smartcard support: $SCARD_MSG"
@@ -3882,6 +4239,7 @@ echo "                     S/KEY support: $SKEY_MSG"
 echo "              TCP Wrappers support: $TCPW_MSG"
 echo "              MD5 password support: $MD5_MSG"
 echo "                   libedit support: $LIBEDIT_MSG"
+echo "  Solaris process contract support: $SPC_MSG"
 echo "       IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
 echo "           Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
 echo "                  BSD Auth support: $BSD_AUTH_MSG"
@@ -3897,7 +4255,10 @@ echo "          Compiler: ${CC}"
 echo "    Compiler flags: ${CFLAGS}"
 echo "Preprocessor flags: ${CPPFLAGS}"
 echo "      Linker flags: ${LDFLAGS}"
-echo "         Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
+echo "         Libraries: ${LIBS}"
+if test ! -z "${SSHDLIBS}"; then
+echo "         +for sshd: ${SSHDLIBS}"
+fi
 
 echo ""
 
@@ -3923,12 +4284,12 @@ if test ! -z "$RAND_HELPER_CMDHASH" ; then
 fi
 
 if test ! -z "$NO_PEERCHECK" ; then
-       echo "WARNING: the operating system that you are using does not "
-       echo "appear to support either the getpeereid() API nor the "
-       echo "SO_PEERCRED getsockopt() option. These facilities are used to "
-       echo "enforce security checks to prevent unauthorised connections to "
-       echo "ssh-agent. Their absence increases the risk that a malicious "
-       echo "user can connect to your agent. "
+       echo "WARNING: the operating system that you are using does not"
+       echo "appear to support getpeereid(), getpeerucred() or the"
+       echo "SO_PEERCRED getsockopt() option. These facilities are used to"
+       echo "enforce security checks to prevent unauthorised connections to"
+       echo "ssh-agent. Their absence increases the risk that a malicious"
+       echo "user can connect to your agent."
        echo ""
 fi
 
This page took 0.935904 seconds and 4 git commands to generate.