4 AC_CONFIG_SRCDIR([ssh.c])
6 AC_CONFIG_HEADER(config.h)
11 # Checks for programs.
16 AC_PATH_PROGS(PERL, perl5 perl)
18 AC_PATH_PROG(ENT, ent)
20 AC_PATH_PROGS(FILEPRIV, filepriv, true, /sbin:/usr/sbin)
21 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
22 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
23 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
29 if test -z "$AR" ; then
30 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
33 # Use LOGIN_PROGRAM from environment if possible
34 if test ! -z "$LOGIN_PROGRAM" ; then
35 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
38 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
39 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
40 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
44 if test -z "$LD" ; then
50 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
51 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
54 # Check for some target-specific stuff
58 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
59 LDFLAGS="$LDFLAGS -L/usr/local/lib"
60 if (test "$LD" != "gcc" && test -z "$blibpath"); then
61 AC_MSG_CHECKING([if linkage editor ($LD) accepts -blibpath])
62 saved_LDFLAGS="$LDFLAGS"
63 LDFLAGS="$LDFLAGS -blibpath:/usr/lib:/lib:/usr/local/lib"
68 blibpath="/usr/lib:/lib:/usr/local/lib"
72 LDFLAGS="$saved_LDFLAGS"
74 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
75 AC_DEFINE(BROKEN_GETADDRINFO)
76 AC_DEFINE(BROKEN_REALPATH)
77 dnl AIX handles lastlog as part of its login message
78 AC_DEFINE(DISABLE_LASTLOG)
79 AC_DEFINE(LOGIN_NEEDS_UTMPX)
82 LIBS="$LIBS /usr/lib/textmode.o"
83 AC_DEFINE(HAVE_CYGWIN)
85 AC_DEFINE(DISABLE_SHADOW)
86 AC_DEFINE(IPV4_DEFAULT)
87 AC_DEFINE(IP_TOS_IS_BROKEN)
88 AC_DEFINE(NO_X11_UNIX_SOCKETS)
89 AC_DEFINE(BROKEN_FD_PASSING)
90 AC_DEFINE(SETGROUPS_NOOP)
93 AC_DEFINE(IP_TOS_IS_BROKEN)
96 AC_DEFINE(BROKEN_GETADDRINFO)
99 if test -z "$GCC"; then
102 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
103 IPADDR_IN_DISPLAY=yes
104 AC_DEFINE(HAVE_SECUREWARE)
106 AC_DEFINE(LOGIN_NO_ENDOPT)
107 AC_DEFINE(LOGIN_NEEDS_UTMPX)
108 AC_DEFINE(DISABLE_SHADOW)
109 AC_DEFINE(DISABLE_UTMP)
110 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
111 LIBS="$LIBS -lxnet -lsec -lsecpw"
112 disable_ptmx_check=yes
115 if test -z "$GCC"; then
118 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
119 IPADDR_IN_DISPLAY=yes
121 AC_DEFINE(LOGIN_NO_ENDOPT)
122 AC_DEFINE(LOGIN_NEEDS_UTMPX)
123 AC_DEFINE(DISABLE_SHADOW)
124 AC_DEFINE(DISABLE_UTMP)
125 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
126 LIBS="$LIBS -lxnet -lsec"
129 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
130 IPADDR_IN_DISPLAY=yes
131 AC_DEFINE(PAM_SUN_CODEBASE)
133 AC_DEFINE(LOGIN_NO_ENDOPT)
134 AC_DEFINE(LOGIN_NEEDS_UTMPX)
135 AC_DEFINE(DISABLE_SHADOW)
136 AC_DEFINE(DISABLE_UTMP)
137 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
138 LIBS="$LIBS -lxnet -lsec"
141 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
143 PATH="$PATH:/usr/etc"
144 AC_DEFINE(BROKEN_INET_NTOA)
145 AC_DEFINE(WITH_ABBREV_NO_TTY)
148 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
150 PATH="$PATH:/usr/etc"
151 AC_DEFINE(WITH_IRIX_ARRAY)
152 AC_DEFINE(WITH_IRIX_PROJECT)
153 AC_DEFINE(WITH_IRIX_AUDIT)
154 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
155 AC_DEFINE(BROKEN_INET_NTOA)
156 AC_DEFINE(WITH_ABBREV_NO_TTY)
160 check_for_libcrypt_later=1
161 AC_DEFINE(DONT_TRY_OTHER_AF)
162 AC_DEFINE(PAM_TTY_KLUDGE)
163 inet6_default_4in6=yes
165 mips-sony-bsd|mips-sony-newsos4)
166 AC_DEFINE(HAVE_NEWS4)
173 check_for_libcrypt_later=1
176 conf_lastlog_location="/usr/adm/lastlog"
177 conf_utmp_location=/etc/utmp
178 conf_wtmp_location=/usr/adm/wtmp
181 AC_DEFINE(BROKEN_REALPATH)
183 AC_DEFINE(BROKEN_SAVED_UIDS)
184 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
188 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
189 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
191 AC_DEFINE(PAM_SUN_CODEBASE)
192 AC_DEFINE(LOGIN_NEEDS_UTMPX)
193 AC_DEFINE(LOGIN_NEEDS_TERM)
194 AC_DEFINE(PAM_TTY_KLUDGE)
195 # hardwire lastlog location (can't detect it on some versions)
196 conf_lastlog_location="/var/adm/lastlog"
197 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
198 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
199 if test "$sol2ver" -ge 8; then
201 AC_DEFINE(DISABLE_UTMP)
202 AC_DEFINE(DISABLE_WTMP)
208 CPPFLAGS="$CPPFLAGS -DSUNOS4"
209 AC_CHECK_FUNCS(getpwanam)
210 AC_DEFINE(PAM_SUN_CODEBASE)
211 conf_utmp_location=/etc/utmp
212 conf_wtmp_location=/var/adm/wtmp
213 conf_lastlog_location=/var/adm/lastlog
217 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
218 LDFLAGS="$LDFLAGS -L/usr/local/lib"
223 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
224 # /usr/ucblib MUST NOT be searched on ReliantUNIX
225 LDFLAGS="$LDFLAGS -L/usr/local/lib"
226 IPADDR_IN_DISPLAY=yes
228 AC_DEFINE(IP_TOS_IS_BROKEN)
229 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
230 # Attention: always take care to bind libsocket and libnsl before libc,
231 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
234 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
235 LDFLAGS="$LDFLAGS -L/usr/local/lib"
239 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
240 LDFLAGS="$LDFLAGS -L/usr/local/lib"
244 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
245 LDFLAGS="$LDFLAGS -L/usr/local/lib"
248 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
249 LDFLAGS="$LDFLAGS -L/usr/local/lib"
250 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
253 AC_DEFINE(BROKEN_SYS_TERMIO_H)
255 AC_DEFINE(HAVE_SECUREWARE)
256 AC_DEFINE(DISABLE_SHADOW)
257 AC_DEFINE(BROKEN_SAVED_UIDS)
258 AC_CHECK_FUNCS(getluid setluid)
260 do_sco3_extra_lib_check=yes
263 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
264 LDFLAGS="$LDFLAGS -L/usr/local/lib"
265 LIBS="$LIBS -lprot -lx -ltinfo -lm"
268 AC_DEFINE(HAVE_SECUREWARE)
269 AC_DEFINE(DISABLE_SHADOW)
270 AC_DEFINE(BROKEN_FD_PASSING)
271 AC_CHECK_FUNCS(getluid setluid)
278 AC_DEFINE(BROKEN_FD_PASSING)
279 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
280 LIBS="$LIBS -lgen -lrsc"
283 AC_MSG_CHECKING(for Digital Unix SIA)
286 [ --with-osfsia Enable Digital Unix SIA],
288 if test "x$withval" = "xno" ; then
289 AC_MSG_RESULT(disabled)
294 if test -z "$no_osfsia" ; then
295 if test -f /etc/sia/matrix.conf; then
297 AC_DEFINE(HAVE_OSF_SIA)
298 AC_DEFINE(DISABLE_LOGIN)
299 LIBS="$LIBS -lsecurity -ldb -lm -laud"
308 AC_DEFINE(NO_X11_UNIX_SOCKETS)
309 AC_DEFINE(MISSING_NFDBITS)
310 AC_DEFINE(MISSING_HOWMANY)
311 AC_DEFINE(MISSING_FD_MASK)
315 # Allow user to specify flags
317 [ --with-cflags Specify additional flags to pass to compiler],
319 if test "x$withval" != "xno" ; then
320 CFLAGS="$CFLAGS $withval"
324 AC_ARG_WITH(cppflags,
325 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
327 if test "x$withval" != "xno"; then
328 CPPFLAGS="$CPPFLAGS $withval"
333 [ --with-ldflags Specify additional flags to pass to linker],
335 if test "x$withval" != "xno" ; then
336 LDFLAGS="$LDFLAGS $withval"
341 [ --with-libs Specify additional libraries to link with],
343 if test "x$withval" != "xno" ; then
344 LIBS="$LIBS $withval"
349 # Checks for header files.
350 AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
351 getopt.h glob.h lastlog.h limits.h login.h \
352 login_cap.h maillock.h netdb.h netgroup.h \
353 netinet/in_systm.h paths.h pty.h readpassphrase.h \
354 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
355 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
356 sys/mman.h sys/select.h sys/stat.h \
357 sys/stropts.h sys/sysmacros.h sys/time.h \
358 sys/un.h time.h ttyent.h usersec.h \
359 util.h utime.h utmp.h utmpx.h)
361 # Checks for libraries.
362 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
363 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
365 dnl SCO OS3 needs this for libwrap
366 if test "x$with_tcp_wrappers" != "xno" ; then
367 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
368 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
372 AC_CHECK_FUNC(getspnam, ,
373 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
376 [ --without-rpath Disable auto-added -R linker paths],
378 if test "x$withval" = "xno" ; then
381 if test "x$withval" = "xyes" ; then
389 [ --with-zlib=PATH Use zlib in PATH],
391 if test "x$withval" = "xno" ; then
392 AC_MSG_ERROR([*** zlib is required ***])
394 if test -d "$withval/lib"; then
395 if test -n "${need_dash_r}"; then
396 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
398 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
401 if test -n "${need_dash_r}"; then
402 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
404 LDFLAGS="-L${withval} ${LDFLAGS}"
407 if test -d "$withval/include"; then
408 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
410 CPPFLAGS="-I${withval} ${CPPFLAGS}"
415 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
418 AC_CHECK_FUNC(strcasecmp,
419 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
421 AC_CHECK_FUNC(utimes,
422 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
425 dnl Checks for libutil functions
426 AC_CHECK_HEADERS(libutil.h)
427 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
428 AC_CHECK_FUNCS(logout updwtmp logwtmp)
432 # Check for ALTDIRFUNC glob() extension
433 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
434 AC_EGREP_CPP(FOUNDIT,
437 #ifdef GLOB_ALTDIRFUNC
442 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
450 # Check for g.gl_matchc glob() extension
451 AC_MSG_CHECKING(for gl_matchc field in glob_t)
452 AC_EGREP_CPP(FOUNDIT,
455 int main(void){glob_t g; g.gl_matchc = 1;}
458 AC_DEFINE(GLOB_HAS_GL_MATCHC)
466 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
469 #include <sys/types.h>
471 int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
473 [AC_MSG_RESULT(yes)],
476 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
480 # Check whether the user wants GSSAPI mechglue support
481 AC_ARG_WITH(mechglue,
482 [ --with-mechglue=PATH Build with GSSAPI mechglue library],
484 AC_MSG_CHECKING(for mechglue library)
486 if test -e ${withval}/libgssapi.a ; then
487 mechglue_lib=${withval}/libgssapi.a
488 elif test -e ${withval}/lib/libgssapi.a ; then
489 mechglue_lib=${withval}/lib/libgssapi.a
491 AC_MSG_ERROR("Can't find libgssapi in ${withval}");
493 LIBS="$LIBS ${mechglue_lib}"
494 AC_MSG_RESULT(${mechglue_lib})
496 # if test -e ${withval}/gssapi.h ; then
497 # CPPFLAGS="$CPPFLAGS -I${withval}"
498 # elif test -e ${withval}/include/gssapi.h ; then
499 # CPPFLAGS="$CPPFLAGS -I${withval}/include"
501 # AC_MSG_ERROR("Can't find gssapi.h in ${withval}");
504 AC_CHECK_LIB(dl, dlopen, , )
505 if test $ac_cv_lib_dl_dlopen = yes; then
506 LDFLAGS="$LDFLAGS -ldl -Wl,-Bsymbolic"
517 # Check whether the user wants GSI (Globus) support
520 [ --with-gsi=PATH Enable GSI/Globus authentication support],
527 [ --with-globus=PATH Enable GSI/Globus authentication support],
533 # Check whether the user has a Globus flavor type
534 globus_flavor_type="no"
535 AC_ARG_WITH(globus-flavor,
536 [ --with-globus-flavor=TYPE Describe Globus flavor type (ex: gcc32dbg, etc.)],
538 globus_flavor_type="$withval"
542 if test "x$gsi_path" != "xno" ; then
543 # Globus GSSAPI configuration
546 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
547 AC_MSG_ERROR([Previously configured GSSAPI library conflicts with Globus/GSI.])
549 if test -z "$GSSAPI"; then
554 # Find GLOBUS/GSI installation Directory
555 AC_MSG_CHECKING(for Globus/GSI installation directory)
557 globus_install_dir=$gsi_path
559 if test "x$globus_install_dir" = "xyes" ; then
560 AC_MSG_ERROR(Cannot find Globus/GSI installation directory -- a path must be specified!)
562 AC_MSG_RESULT($globus_install_dir)
564 # Find GLOBUS/GSI development directory
565 AC_MSG_CHECKING(for Globus/GSI development directory)
567 if test -d ${globus_install_dir}/lib ; then
568 # Looks like a flat directory structure from configure/make
569 # and not globus-install or gsi-install
570 globus_dev_dir=$globus_install_dir
573 # Assume a true globus installation with architecture
574 # directories and run globus-development-path to find
575 # the development directory
577 # Set GLOBUS_INSTALL_PATH
578 GLOBUS_INSTALL_PATH=$globus_install_dir
579 export GLOBUS_INSTALL_PATH
581 dev_path_program=${globus_install_dir}/bin/globus-development-path
583 if test ! -x ${dev_path_program} ; then
584 AC_MSG_ERROR(Cannot find Globus/GSI installation directory: program ${dev_path_program} does not exist or is not executable)
587 globus_dev_dir=`${dev_path_program}`
589 if test -z "$globus_dev_dir" -o "X$globus_dev_dir" = "X<not found>" ; then
590 AC_MSG_ERROR(Cannot find Globus/GSI development directory)
593 if test ! -d "$globus_dev_dir" ; then
594 AC_MSG_ERROR(Cannot find Globus/GSI development directory: $globus_dev_dir does not exist)
597 AC_MSG_RESULT($globus_dev_dir)
599 # Find GLOBUS/GSI flavor Directory
600 AC_MSG_CHECKING(for Globus flavor type)
602 if test "x$globus_flavor_type" = "xno" ; then
603 if test "$GSSAPI" = "mechglue"; then
604 GSI_LIBS="-lglobus_gss_assist -lglobus_gaa"
606 GSI_LIBS="-lglobus_gss_assist -lglobus_gss -lglobus_gaa"
608 GSI_LDFLAGS="-L${globus_dev_dir}/lib"
609 GSI_CPPFLAGS="-I${globus_dev_dir}/include"
612 GLOBUS_FLAVOR_TYPE_INCL_DIR="${globus_dev_dir}/include/${globus_flavor_type}"
614 if test ! -d "$GLOBUS_FLAVOR_TYPE_INCL_DIR" ; then
615 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_FLAVOR_TYPE_INCL_DIR})
618 AC_MSG_RESULT($globus_flavor_type)
619 if test "$GSSAPI" = "mechglue"; then
620 GSI_LIBS="${gsi_path}/lib/libglobus_gss_assist_${globus_flavor_type}.a"
622 GSI_LIBS="${gsi_path}/lib/libglobus_gss_assist_${globus_flavor_type}.a ${gsi_path}/lib/libglobus_gssapi_gsi_${globus_flavor_type}.a"
624 GSI_CPPFLAGS="-I${GLOBUS_FLAVOR_TYPE_INCL_DIR}"
627 LIBS="$LIBS $GSI_LIBS"
628 LDFLAGS="$LDFLAGS $GSI_LDFLAGS"
629 CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS"
634 AC_SUBST(INSTALL_GSISSH)
635 # End Globus/GSI section
637 # Check whether user wants S/Key support
640 [ --with-skey[[=PATH]] Enable S/Key support
641 (optionally in PATH)],
643 if test "x$withval" != "xno" ; then
645 if test "x$withval" != "xyes" ; then
646 CPPFLAGS="$CPPFLAGS -I${withval}/include"
647 LDFLAGS="$LDFLAGS -L${withval}/lib"
654 AC_MSG_CHECKING([for s/key support])
659 int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
661 [AC_MSG_RESULT(yes)],
664 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
670 # Check whether user wants TCP wrappers support
672 AC_ARG_WITH(tcp-wrappers,
673 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
674 (optionally in PATH)],
676 if test "x$withval" != "xno" ; then
678 saved_LDFLAGS="$LDFLAGS"
679 saved_CPPFLAGS="$CPPFLAGS"
680 if test -n "${withval}" -a "${withval}" != "yes"; then
681 if test -d "${withval}/lib"; then
682 if test -n "${need_dash_r}"; then
683 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
685 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
688 if test -n "${need_dash_r}"; then
689 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
691 LDFLAGS="-L${withval} ${LDFLAGS}"
694 if test -d "${withval}/include"; then
695 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
697 CPPFLAGS="-I${withval} ${CPPFLAGS}"
701 LIBS="$LIBWRAP $LIBS"
702 AC_MSG_CHECKING(for libwrap)
706 int deny_severity = 0, allow_severity = 0;
716 AC_MSG_ERROR([*** libwrap missing])
724 dnl Checks for library functions.
725 AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
726 clock fchmod fchown freeaddrinfo futimes gai_strerror \
727 getaddrinfo getcwd getgrouplist getnameinfo getopt \
728 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
729 inet_ntop innetgr login_getcapbool md5_crypt memmove \
730 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
731 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
732 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
733 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
734 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
735 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
737 if test $ac_cv_func_mmap = yes ; then
738 AC_MSG_CHECKING([for mmap anon shared])
742 #include <sys/mman.h>
743 #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
744 #define MAP_ANON MAP_ANONYMOUS
747 p = (char *) mmap(NULL, 10, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED, -1, 0);
755 AC_DEFINE(HAVE_MMAP_ANON_SHARED)
757 [ AC_MSG_RESULT(no) ]
761 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
762 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
763 AC_CHECK_LIB(gen, dirname,[
764 AC_CACHE_CHECK([for broken dirname],
765 ac_cv_have_broken_dirname, [
773 int main(int argc, char **argv) {
776 strncpy(buf,"/etc", 32);
778 if (!s || strncmp(s, "/", 32) != 0) {
785 [ ac_cv_have_broken_dirname="no" ],
786 [ ac_cv_have_broken_dirname="yes" ]
790 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
792 AC_DEFINE(HAVE_DIRNAME)
793 AC_CHECK_HEADERS(libgen.h)
798 dnl Checks for time functions
799 AC_CHECK_FUNCS(gettimeofday time)
800 dnl Checks for utmp functions
801 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
802 AC_CHECK_FUNCS(utmpname)
803 dnl Checks for utmpx functions
804 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
805 AC_CHECK_FUNCS(setutxent utmpxname)
807 AC_CHECK_FUNC(daemon,
808 [AC_DEFINE(HAVE_DAEMON)],
809 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
812 AC_CHECK_FUNC(getpagesize,
813 [AC_DEFINE(HAVE_GETPAGESIZE)],
814 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
817 # Check for broken snprintf
818 if test "x$ac_cv_func_snprintf" = "xyes" ; then
819 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
823 int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
825 [AC_MSG_RESULT(yes)],
828 AC_DEFINE(BROKEN_SNPRINTF)
829 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
839 [ --with-pam Enable PAM support ],
841 if test "x$withval" != "xno" ; then
842 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
843 AC_MSG_ERROR([PAM headers not found])
846 AC_CHECK_LIB(dl, dlopen, , )
847 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
848 AC_CHECK_FUNCS(pam_getenvlist)
849 AC_CHECK_FUNCS(pam_putenv)
855 if test $ac_cv_lib_dl_dlopen = yes; then
865 # Check for older PAM
866 if test "x$PAM_MSG" = "xyes" ; then
867 # Check PAM strerror arguments (old PAM)
868 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
872 #include <security/pam_appl.h>
874 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
877 AC_DEFINE(HAVE_OLD_PAM)
879 PAM_MSG="yes (old library)"
885 saved_CPPFLAGS="$CPPFLAGS"
886 saved_LDFLAGS="$LDFLAGS"
888 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
890 if test "x$withval" != "xno" ; then
891 if test -d "$withval/lib"; then
892 if test -n "${need_dash_r}"; then
893 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
895 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
898 if test -n "${need_dash_r}"; then
899 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
901 LDFLAGS="-L${withval} ${LDFLAGS}"
904 if test -d "$withval/include"; then
905 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
907 CPPFLAGS="-I${withval} ${CPPFLAGS}"
913 # Patch up SSL libraries for GSI authentication as needed
914 if test "x$globus_flavor_type" != "xno" ; then
915 # For Globus 2, always link with the static libraries
916 LIBS="$LIBS ${gsi_path}/lib/libglobus_ssl_utils_${globus_flavor_type}.a ${gsi_path}/lib/libssl_${globus_flavor_type}.a ${gsi_path}/lib/libcrypto_${globus_flavor_type}.a"
918 if test "x$gsi_path" != "xno" ; then
919 # Older GSI needs -lssl too
920 LIBS="$LIBS -lssl -lcrypto"
921 else # if no GSI authentication (i.e., OpenSSL default)
922 LIBS="$LIBS -lcrypto"
924 fi # globus_flavor_type
926 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
928 dnl Check default openssl install dir
929 if test -n "${need_dash_r}"; then
930 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
932 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
934 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
935 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
937 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
944 # Sanity check OpenSSL headers
945 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
949 #include <openssl/opensslv.h>
950 int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
957 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
961 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
962 # version in OpenSSL. Skip this for PAM
963 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
964 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
968 ### Configure cryptographic random number support
970 # Check wheter OpenSSL seeds itself
971 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
975 #include <openssl/rand.h>
976 int main(void) { return(RAND_status() == 1 ? 0 : 1); }
979 OPENSSL_SEEDS_ITSELF=yes
984 # Default to use of the rand helper if OpenSSL doesn't
991 # Do we want to force the use of the rand helper?
992 AC_ARG_WITH(rand-helper,
993 [ --with-rand-helper Use subprocess to gather strong randomness ],
995 if test "x$withval" = "xno" ; then
996 # Force use of OpenSSL's internal RNG, even if
997 # the previous test showed it to be unseeded.
998 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
999 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1000 OPENSSL_SEEDS_ITSELF=yes
1009 # Which randomness source do we use?
1010 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1012 AC_DEFINE(OPENSSL_PRNG_ONLY)
1013 RAND_MSG="OpenSSL internal ONLY"
1014 INSTALL_SSH_RAND_HELPER=""
1015 elif test ! -z "$USE_RAND_HELPER" ; then
1016 # install rand helper
1017 RAND_MSG="ssh-rand-helper"
1018 INSTALL_SSH_RAND_HELPER="yes"
1020 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1022 ### Configuration of ssh-rand-helper
1025 AC_ARG_WITH(prngd-port,
1026 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1035 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1038 if test ! -z "$withval" ; then
1039 PRNGD_PORT="$withval"
1040 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1045 # PRNGD Unix domain socket
1046 AC_ARG_WITH(prngd-socket,
1047 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1051 withval="/var/run/egd-pool"
1059 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1063 if test ! -z "$withval" ; then
1064 if test ! -z "$PRNGD_PORT" ; then
1065 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1067 if test ! -r "$withval" ; then
1068 AC_MSG_WARN(Entropy socket is not readable)
1070 PRNGD_SOCKET="$withval"
1071 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1075 # Check for existing socket only if we don't have a random device already
1076 if test "$USE_RAND_HELPER" = yes ; then
1077 AC_MSG_CHECKING(for PRNGD/EGD socket)
1078 # Insert other locations here
1079 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1080 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1081 PRNGD_SOCKET="$sock"
1082 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1086 if test ! -z "$PRNGD_SOCKET" ; then
1087 AC_MSG_RESULT($PRNGD_SOCKET)
1089 AC_MSG_RESULT(not found)
1095 # Change default command timeout for hashing entropy source
1097 AC_ARG_WITH(entropy-timeout,
1098 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1100 if test "x$withval" != "xno" ; then
1101 entropy_timeout=$withval
1105 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1107 SSH_PRIVSEP_USER=sshd
1108 AC_ARG_WITH(privsep-user,
1109 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1111 if test -n "$withval"; then
1112 SSH_PRIVSEP_USER=$withval
1116 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1117 AC_SUBST(SSH_PRIVSEP_USER)
1119 # We do this little dance with the search path to insure
1120 # that programs that we select for use by installed programs
1121 # (which may be run by the super-user) come from trusted
1122 # locations before they come from the user's private area.
1123 # This should help avoid accidentally configuring some
1124 # random version of a program in someone's personal bin.
1128 test -h /bin 2> /dev/null && PATH=/usr/bin
1129 test -d /sbin && PATH=$PATH:/sbin
1130 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1131 PATH=$PATH:/etc:$OPATH
1133 # These programs are used by the command hashing source to gather entropy
1134 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1135 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1136 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1137 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1138 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1139 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1140 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1141 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1142 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1143 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1144 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1145 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1146 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1147 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1148 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1149 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1153 # Where does ssh-rand-helper get its randomness from?
1154 INSTALL_SSH_PRNG_CMDS=""
1155 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1156 if test ! -z "$PRNGD_PORT" ; then
1157 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1158 elif test ! -z "$PRNGD_SOCKET" ; then
1159 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1161 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1162 RAND_HELPER_CMDHASH=yes
1163 INSTALL_SSH_PRNG_CMDS="yes"
1166 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1169 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1170 if test ! -z "$SONY" ; then
1171 LIBS="$LIBS -liberty";
1174 # Checks for data types
1175 AC_CHECK_SIZEOF(char, 1)
1176 AC_CHECK_SIZEOF(short int, 2)
1177 AC_CHECK_SIZEOF(int, 4)
1178 AC_CHECK_SIZEOF(long int, 4)
1179 AC_CHECK_SIZEOF(long long int, 8)
1181 # Sanity check long long for some platforms (AIX)
1182 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1183 ac_cv_sizeof_long_long_int=0
1186 # More checks for data types
1187 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1189 [ #include <sys/types.h> ],
1191 [ ac_cv_have_u_int="yes" ],
1192 [ ac_cv_have_u_int="no" ]
1195 if test "x$ac_cv_have_u_int" = "xyes" ; then
1196 AC_DEFINE(HAVE_U_INT)
1200 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1202 [ #include <sys/types.h> ],
1203 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1204 [ ac_cv_have_intxx_t="yes" ],
1205 [ ac_cv_have_intxx_t="no" ]
1208 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1209 AC_DEFINE(HAVE_INTXX_T)
1213 if (test -z "$have_intxx_t" && \
1214 test "x$ac_cv_header_stdint_h" = "xyes")
1216 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1218 [ #include <stdint.h> ],
1219 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1221 AC_DEFINE(HAVE_INTXX_T)
1224 [ AC_MSG_RESULT(no) ]
1228 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1230 [ #include <sys/types.h> ],
1231 [ int64_t a; a = 1;],
1232 [ ac_cv_have_int64_t="yes" ],
1233 [ ac_cv_have_int64_t="no" ]
1236 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1237 AC_DEFINE(HAVE_INT64_T)
1241 if test -z "$have_int64_t" ; then
1242 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1244 [ #include <sys/socket.h> ],
1245 [ int64_t a; a = 1],
1247 AC_DEFINE(HAVE_INT64_T)
1250 [ AC_MSG_RESULT(no) ]
1254 if test -z "$have_int64_t" ; then
1255 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1257 [ #include <sys/bitypes.h> ],
1258 [ int64_t a; a = 1],
1260 AC_DEFINE(HAVE_INT64_T)
1263 [ AC_MSG_RESULT(no) ]
1267 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1269 [ #include <sys/types.h> ],
1270 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1271 [ ac_cv_have_u_intxx_t="yes" ],
1272 [ ac_cv_have_u_intxx_t="no" ]
1275 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1276 AC_DEFINE(HAVE_U_INTXX_T)
1280 if test -z "$have_u_intxx_t" ; then
1281 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1283 [ #include <sys/socket.h> ],
1284 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1286 AC_DEFINE(HAVE_U_INTXX_T)
1289 [ AC_MSG_RESULT(no) ]
1293 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1295 [ #include <sys/types.h> ],
1296 [ u_int64_t a; a = 1;],
1297 [ ac_cv_have_u_int64_t="yes" ],
1298 [ ac_cv_have_u_int64_t="no" ]
1301 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1302 AC_DEFINE(HAVE_U_INT64_T)
1306 if test -z "$have_u_int64_t" ; then
1307 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1309 [ #include <sys/bitypes.h> ],
1310 [ u_int64_t a; a = 1],
1312 AC_DEFINE(HAVE_U_INT64_T)
1315 [ AC_MSG_RESULT(no) ]
1319 if test -z "$have_u_intxx_t" ; then
1320 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1323 #include <sys/types.h>
1325 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1326 [ ac_cv_have_uintxx_t="yes" ],
1327 [ ac_cv_have_uintxx_t="no" ]
1330 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1331 AC_DEFINE(HAVE_UINTXX_T)
1335 if test -z "$have_uintxx_t" ; then
1336 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1338 [ #include <stdint.h> ],
1339 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1341 AC_DEFINE(HAVE_UINTXX_T)
1344 [ AC_MSG_RESULT(no) ]
1348 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1349 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1351 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1354 #include <sys/bitypes.h>
1357 int8_t a; int16_t b; int32_t c;
1358 u_int8_t e; u_int16_t f; u_int32_t g;
1359 a = b = c = e = f = g = 1;
1362 AC_DEFINE(HAVE_U_INTXX_T)
1363 AC_DEFINE(HAVE_INTXX_T)
1371 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1374 #include <sys/types.h>
1376 [ u_char foo; foo = 125; ],
1377 [ ac_cv_have_u_char="yes" ],
1378 [ ac_cv_have_u_char="no" ]
1381 if test "x$ac_cv_have_u_char" = "xyes" ; then
1382 AC_DEFINE(HAVE_U_CHAR)
1387 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1389 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1392 #include <sys/types.h>
1394 [ size_t foo; foo = 1235; ],
1395 [ ac_cv_have_size_t="yes" ],
1396 [ ac_cv_have_size_t="no" ]
1399 if test "x$ac_cv_have_size_t" = "xyes" ; then
1400 AC_DEFINE(HAVE_SIZE_T)
1403 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1406 #include <sys/types.h>
1408 [ ssize_t foo; foo = 1235; ],
1409 [ ac_cv_have_ssize_t="yes" ],
1410 [ ac_cv_have_ssize_t="no" ]
1413 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1414 AC_DEFINE(HAVE_SSIZE_T)
1417 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1422 [ clock_t foo; foo = 1235; ],
1423 [ ac_cv_have_clock_t="yes" ],
1424 [ ac_cv_have_clock_t="no" ]
1427 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1428 AC_DEFINE(HAVE_CLOCK_T)
1431 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1434 #include <sys/types.h>
1435 #include <sys/socket.h>
1437 [ sa_family_t foo; foo = 1235; ],
1438 [ ac_cv_have_sa_family_t="yes" ],
1441 #include <sys/types.h>
1442 #include <sys/socket.h>
1443 #include <netinet/in.h>
1445 [ sa_family_t foo; foo = 1235; ],
1446 [ ac_cv_have_sa_family_t="yes" ],
1448 [ ac_cv_have_sa_family_t="no" ]
1452 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1453 AC_DEFINE(HAVE_SA_FAMILY_T)
1456 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1459 #include <sys/types.h>
1461 [ pid_t foo; foo = 1235; ],
1462 [ ac_cv_have_pid_t="yes" ],
1463 [ ac_cv_have_pid_t="no" ]
1466 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1467 AC_DEFINE(HAVE_PID_T)
1470 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1473 #include <sys/types.h>
1475 [ mode_t foo; foo = 1235; ],
1476 [ ac_cv_have_mode_t="yes" ],
1477 [ ac_cv_have_mode_t="no" ]
1480 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1481 AC_DEFINE(HAVE_MODE_T)
1485 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1488 #include <sys/types.h>
1489 #include <sys/socket.h>
1491 [ struct sockaddr_storage s; ],
1492 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1493 [ ac_cv_have_struct_sockaddr_storage="no" ]
1496 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1497 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1500 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1503 #include <sys/types.h>
1504 #include <netinet/in.h>
1506 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1507 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1508 [ ac_cv_have_struct_sockaddr_in6="no" ]
1511 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1512 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1515 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1518 #include <sys/types.h>
1519 #include <netinet/in.h>
1521 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1522 [ ac_cv_have_struct_in6_addr="yes" ],
1523 [ ac_cv_have_struct_in6_addr="no" ]
1526 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1527 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1530 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1533 #include <sys/types.h>
1534 #include <sys/socket.h>
1537 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1538 [ ac_cv_have_struct_addrinfo="yes" ],
1539 [ ac_cv_have_struct_addrinfo="no" ]
1542 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1543 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1546 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1548 [ #include <sys/time.h> ],
1549 [ struct timeval tv; tv.tv_sec = 1;],
1550 [ ac_cv_have_struct_timeval="yes" ],
1551 [ ac_cv_have_struct_timeval="no" ]
1554 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1555 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1556 have_struct_timeval=1
1559 # If we don't have int64_t then we can't compile sftp-server. So don't
1560 # even attempt to do it.
1561 if test "x$ac_cv_have_int64_t" = "xno" -a \
1562 "x$ac_cv_sizeof_long_int" != "x8" -a \
1563 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1566 dnl test snprintf (broken on SCO w/gcc)
1571 #ifdef HAVE_SNPRINTF
1575 char expected_out[50];
1577 #if (SIZEOF_LONG_INT == 8)
1578 long int num = 0x7fffffffffffffff;
1580 long long num = 0x7fffffffffffffffll;
1582 strcpy(expected_out, "9223372036854775807");
1583 snprintf(buf, mazsize, "%lld", num);
1584 if(strcmp(buf, expected_out) != 0)
1591 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1596 dnl Checks for structure members
1597 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1598 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1599 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1600 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1601 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1602 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1603 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1604 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1605 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1606 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1607 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1608 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1609 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1610 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1611 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1612 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1613 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1615 AC_CHECK_MEMBERS([struct stat.st_blksize])
1617 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1618 ac_cv_have_ss_family_in_struct_ss, [
1621 #include <sys/types.h>
1622 #include <sys/socket.h>
1624 [ struct sockaddr_storage s; s.ss_family = 1; ],
1625 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1626 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1629 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1630 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1633 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1634 ac_cv_have___ss_family_in_struct_ss, [
1637 #include <sys/types.h>
1638 #include <sys/socket.h>
1640 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1641 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1642 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1645 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1646 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1649 AC_CACHE_CHECK([for pw_class field in struct passwd],
1650 ac_cv_have_pw_class_in_struct_passwd, [
1655 [ struct passwd p; p.pw_class = 0; ],
1656 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1657 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1660 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1661 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1664 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1665 ac_cv_have_pw_expire_in_struct_passwd, [
1670 [ struct passwd p; p.pw_expire = 0; ],
1671 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1672 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1675 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1676 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1679 AC_CACHE_CHECK([for pw_change field in struct passwd],
1680 ac_cv_have_pw_change_in_struct_passwd, [
1685 [ struct passwd p; p.pw_change = 0; ],
1686 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1687 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1690 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1691 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1694 dnl make sure we're using the real structure members and not defines
1695 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1696 ac_cv_have_accrights_in_msghdr, [
1699 #include <sys/types.h>
1700 #include <sys/socket.h>
1701 #include <sys/uio.h>
1703 #ifdef msg_accrights
1707 m.msg_accrights = 0;
1711 [ ac_cv_have_accrights_in_msghdr="yes" ],
1712 [ ac_cv_have_accrights_in_msghdr="no" ]
1715 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1716 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1719 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1720 ac_cv_have_control_in_msghdr, [
1723 #include <sys/types.h>
1724 #include <sys/socket.h>
1725 #include <sys/uio.h>
1735 [ ac_cv_have_control_in_msghdr="yes" ],
1736 [ ac_cv_have_control_in_msghdr="no" ]
1739 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1740 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1743 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1745 [ extern char *__progname; printf("%s", __progname); ],
1746 [ ac_cv_libc_defines___progname="yes" ],
1747 [ ac_cv_libc_defines___progname="no" ]
1750 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1751 AC_DEFINE(HAVE___PROGNAME)
1754 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1758 [ printf("%s", __FUNCTION__); ],
1759 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1760 [ ac_cv_cc_implements___FUNCTION__="no" ]
1763 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1764 AC_DEFINE(HAVE___FUNCTION__)
1767 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1771 [ printf("%s", __func__); ],
1772 [ ac_cv_cc_implements___func__="yes" ],
1773 [ ac_cv_cc_implements___func__="no" ]
1776 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1777 AC_DEFINE(HAVE___func__)
1780 AC_CACHE_CHECK([whether getopt has optreset support],
1781 ac_cv_have_getopt_optreset, [
1786 [ extern int optreset; optreset = 0; ],
1787 [ ac_cv_have_getopt_optreset="yes" ],
1788 [ ac_cv_have_getopt_optreset="no" ]
1791 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1792 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1795 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1797 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1798 [ ac_cv_libc_defines_sys_errlist="yes" ],
1799 [ ac_cv_libc_defines_sys_errlist="no" ]
1802 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1803 AC_DEFINE(HAVE_SYS_ERRLIST)
1807 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1809 [ extern int sys_nerr; printf("%i", sys_nerr);],
1810 [ ac_cv_libc_defines_sys_nerr="yes" ],
1811 [ ac_cv_libc_defines_sys_nerr="no" ]
1814 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1815 AC_DEFINE(HAVE_SYS_NERR)
1820 # Check whether user wants sectok support
1822 [ --with-sectok Enable smartcard support using libsectok],
1824 if test "x$withval" != "xno" ; then
1825 if test "x$withval" != "xyes" ; then
1826 CPPFLAGS="$CPPFLAGS -I${withval}"
1827 LDFLAGS="$LDFLAGS -L${withval}"
1828 if test ! -z "$need_dash_r" ; then
1829 LDFLAGS="$LDFLAGS -R${withval}"
1831 if test ! -z "$blibpath" ; then
1832 blibpath="$blibpath:${withval}"
1835 AC_CHECK_HEADERS(sectok.h)
1836 if test "$ac_cv_header_sectok_h" != yes; then
1837 AC_MSG_ERROR(Can't find sectok.h)
1839 AC_CHECK_LIB(sectok, sectok_open)
1840 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1841 AC_MSG_ERROR(Can't find libsectok)
1843 AC_DEFINE(SMARTCARD)
1844 AC_DEFINE(USE_SECTOK)
1845 SCARD_MSG="yes, using sectok"
1850 # Check whether user wants OpenSC support
1852 AC_HELP_STRING([--with-opensc=PFX],
1853 [Enable smartcard support using OpenSC]),
1854 opensc_config_prefix="$withval", opensc_config_prefix="")
1855 if test x$opensc_config_prefix != x ; then
1856 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1857 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1858 if test "$OPENSC_CONFIG" != "no"; then
1859 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1860 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1861 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1862 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1863 AC_DEFINE(SMARTCARD)
1864 AC_DEFINE(USE_OPENSC)
1865 SCARD_MSG="yes, using OpenSC"
1869 # Check whether user wants Kerberos 5 support
1871 AC_ARG_WITH(kerberos5,
1872 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1874 if test "x$withval" != "xno" ; then
1875 if test "x$withval" = "xyes" ; then
1876 KRB5ROOT="/usr/local"
1880 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1881 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1884 AC_MSG_CHECKING(whether we are using Heimdal)
1885 AC_TRY_COMPILE([ #include <krb5.h> ],
1886 [ char *tmp = heimdal_version; ],
1887 [ AC_MSG_RESULT(yes)
1889 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1892 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1895 if test ! -z "$need_dash_r" ; then
1896 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1898 if test ! -z "$blibpath" ; then
1899 blibpath="$blibpath:${KRB5ROOT}/lib"
1901 AC_CHECK_LIB(resolv, dn_expand, , )
1903 # If we're using some other GSSAPI
1904 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
1905 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
1907 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1909 K5LIBS="-lgssapi $K5LIBS" ],
1910 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1912 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
1913 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
1918 AC_CHECK_HEADER(gssapi.h, ,
1919 [ unset ac_cv_header_gssapi_h
1920 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1921 AC_CHECK_HEADERS(gssapi.h, ,
1922 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
1927 AC_CHECK_LIB(gssapi, gss_krb5_copy_ccache, /bin/true,
1928 [ K5LIBS="-lgssapi_krb5 $K5LIBS"
1929 AC_CHECK_LIB(gssapi_krb5, gss_krb5_copy_ccache, /bin/true,
1930 AC_MSG_WARN([Cannot find gss_krb5_copy_ccache -- build may fail]),
1936 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1937 AC_CHECK_HEADER(gssapi_krb5.h, ,
1938 [ CPPFLAGS="$oldCPP" ])
1940 if test -z "$GSSAPI"; then
1948 # Check whether user wants Kerberos 4 support
1950 AC_ARG_WITH(kerberos4,
1951 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1953 if test "x$withval" != "xno" ; then
1954 if test "x$withval" != "xyes" ; then
1955 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1956 LDFLAGS="$LDFLAGS -L${withval}/lib"
1957 if test ! -z "$need_dash_r" ; then
1958 LDFLAGS="$LDFLAGS -R${withval}/lib"
1960 if test ! -z "$blibpath" ; then
1961 blibpath="$blibpath:${withval}/lib"
1964 if test -d /usr/include/kerberosIV ; then
1965 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1969 AC_CHECK_HEADERS(krb.h)
1970 if test "$ac_cv_header_krb_h" != yes; then
1971 AC_MSG_WARN([Cannot find krb.h, build may fail])
1973 AC_CHECK_LIB(krb, main)
1974 if test "$ac_cv_lib_krb_main" != yes; then
1975 AC_CHECK_LIB(krb4, main)
1976 if test "$ac_cv_lib_krb4_main" != yes; then
1977 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1984 AC_CHECK_LIB(des, des_cbc_encrypt)
1985 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1986 AC_CHECK_LIB(des425, des_cbc_encrypt)
1987 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1988 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1995 AC_CHECK_LIB(resolv, dn_expand, , )
2003 # Check whether user wants AFS support
2006 [ --with-afs=PATH Enable AFS support],
2008 if test "x$withval" != "xno" ; then
2010 if test "x$withval" != "xyes" ; then
2011 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2012 LDFLAGS="$LDFLAGS -L${withval}/lib"
2015 if test -z "$KRB4" ; then
2016 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
2020 if test ! -z "$AFS_LIBS" ; then
2021 LIBS="$LIBS $AFS_LIBS"
2028 LIBS="$LIBS $KLIBS $K5LIBS"
2030 # Looking for programs, paths and files
2032 PRIVSEP_PATH=/var/empty
2033 AC_ARG_WITH(privsep-path,
2034 [ --with-privsep-path=xxx Path for privilege separation chroot ],
2036 if test "x$withval" != "$no" ; then
2037 PRIVSEP_PATH=$withval
2041 AC_SUBST(PRIVSEP_PATH)
2044 [ --with-xauth=PATH Specify path to xauth program ],
2046 if test "x$withval" != "xno" ; then
2051 AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin)
2052 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2053 xauth_path="/usr/openwin/bin/xauth"
2058 if test -z "$xauth_path" ; then
2059 XAUTH_PATH="undefined"
2060 AC_SUBST(XAUTH_PATH)
2062 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2063 XAUTH_PATH=$xauth_path
2064 AC_SUBST(XAUTH_PATH)
2067 # Check for mail directory (last resort if we cannot get it from headers)
2068 if test ! -z "$MAIL" ; then
2069 maildir=`dirname $MAIL`
2070 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2073 if test -z "$no_dev_ptmx" ; then
2074 if test "x$disable_ptmx_check" != "xyes" ; then
2075 AC_CHECK_FILE("/dev/ptmx",
2077 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2083 AC_CHECK_FILE("/dev/ptc",
2085 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2090 # Options from here on. Some of these are preset by platform above
2091 AC_ARG_WITH(mantype,
2092 [ --with-mantype=man|cat|doc Set man page type],
2099 AC_MSG_ERROR(invalid man type: $withval)
2104 if test -z "$MANTYPE"; then
2105 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
2106 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2108 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2115 if test "$MANTYPE" = "doc"; then
2122 # Check whether to enable MD5 passwords
2124 AC_ARG_WITH(md5-passwords,
2125 [ --with-md5-passwords Enable use of MD5 passwords],
2127 if test "x$withval" != "xno" ; then
2128 AC_DEFINE(HAVE_MD5_PASSWORDS)
2134 # Whether to disable shadow password support
2136 [ --without-shadow Disable shadow password support],
2138 if test "x$withval" = "xno" ; then
2139 AC_DEFINE(DISABLE_SHADOW)
2145 if test -z "$disable_shadow" ; then
2146 AC_MSG_CHECKING([if the systems has expire shadow information])
2149 #include <sys/types.h>
2152 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2153 [ sp_expire_available=yes ], []
2156 if test "x$sp_expire_available" = "xyes" ; then
2158 AC_DEFINE(HAS_SHADOW_EXPIRE)
2164 # Use ip address instead of hostname in $DISPLAY
2165 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2166 DISPLAY_HACK_MSG="yes"
2167 AC_DEFINE(IPADDR_IN_DISPLAY)
2169 DISPLAY_HACK_MSG="no"
2170 AC_ARG_WITH(ipaddr-display,
2171 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2173 if test "x$withval" != "xno" ; then
2174 AC_DEFINE(IPADDR_IN_DISPLAY)
2175 DISPLAY_HACK_MSG="yes"
2181 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2182 if test $ac_cv_func_login_getcapbool = "yes" -a \
2183 $ac_cv_header_login_cap_h = "yes" ; then
2186 # Whether to mess with the default path
2187 SERVER_PATH_MSG="(default)"
2188 AC_ARG_WITH(default-path,
2189 [ --with-default-path= Specify default \$PATH environment for server],
2191 if test "$USES_LOGIN_CONF" = "yes" ; then
2193 --with-default-path=PATH has no effect on this system.
2194 Edit /etc/login.conf instead.])
2195 elif test "x$withval" != "xno" ; then
2196 user_path="$withval"
2197 SERVER_PATH_MSG="$withval"
2200 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2201 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2205 /* find out what STDPATH is */
2210 #ifndef _PATH_STDPATH
2211 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2213 #include <sys/types.h>
2214 #include <sys/stat.h>
2216 #define DATA "conftest.stdpath"
2223 fd = fopen(DATA,"w");
2227 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2232 ], [ user_path=`cat conftest.stdpath` ],
2233 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2234 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2236 # make sure $bindir is in USER_PATH so scp will work
2237 t_bindir=`eval echo ${bindir}`
2239 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2242 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2244 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2245 if test $? -ne 0 ; then
2246 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2247 if test $? -ne 0 ; then
2248 user_path=$user_path:$t_bindir
2249 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2254 if test "$USES_LOGIN_CONF" != "yes" ; then
2255 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2259 # Set superuser path separately to user path
2260 AC_ARG_WITH(superuser-path,
2261 [ --with-superuser-path= Specify different path for super-user],
2263 if test "x$withval" != "xno" ; then
2264 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2265 superuser_path=$withval
2271 # Whether to force IPv4 by default (needed on broken glibc Linux)
2273 AC_ARG_WITH(ipv4-default,
2274 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2276 if test "x$withval" != "xno" ; then
2277 AC_DEFINE(IPV4_DEFAULT)
2283 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2284 IPV4_IN6_HACK_MSG="no"
2286 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2288 if test "x$withval" != "xno" ; then
2290 AC_DEFINE(IPV4_IN_IPV6)
2291 IPV4_IN6_HACK_MSG="yes"
2296 if test "x$inet6_default_4in6" = "xyes"; then
2297 AC_MSG_RESULT([yes (default)])
2298 AC_DEFINE(IPV4_IN_IPV6)
2299 IPV4_IN6_HACK_MSG="yes"
2301 AC_MSG_RESULT([no (default)])
2306 # Whether to enable BSD auth support
2308 AC_ARG_WITH(bsd-auth,
2309 [ --with-bsd-auth Enable BSD auth support],
2311 if test "x$withval" != "xno" ; then
2318 # Where to place sshd.pid
2320 # make sure the directory exists
2321 if test ! -d $piddir ; then
2322 piddir=`eval echo ${sysconfdir}`
2324 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2328 AC_ARG_WITH(pid-dir,
2329 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2331 if test "x$withval" != "xno" ; then
2333 if test ! -d $piddir ; then
2334 AC_MSG_WARN([** no $piddir directory on this system **])
2340 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2343 dnl allow user to disable some login recording features
2344 AC_ARG_ENABLE(lastlog,
2345 [ --disable-lastlog disable use of lastlog even if detected [no]],
2346 [ AC_DEFINE(DISABLE_LASTLOG) ]
2349 [ --disable-utmp disable use of utmp even if detected [no]],
2350 [ AC_DEFINE(DISABLE_UTMP) ]
2352 AC_ARG_ENABLE(utmpx,
2353 [ --disable-utmpx disable use of utmpx even if detected [no]],
2354 [ AC_DEFINE(DISABLE_UTMPX) ]
2357 [ --disable-wtmp disable use of wtmp even if detected [no]],
2358 [ AC_DEFINE(DISABLE_WTMP) ]
2360 AC_ARG_ENABLE(wtmpx,
2361 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2362 [ AC_DEFINE(DISABLE_WTMPX) ]
2364 AC_ARG_ENABLE(libutil,
2365 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2366 [ AC_DEFINE(DISABLE_LOGIN) ]
2368 AC_ARG_ENABLE(pututline,
2369 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2370 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2372 AC_ARG_ENABLE(pututxline,
2373 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2374 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2376 AC_ARG_WITH(lastlog,
2377 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2379 if test "x$withval" = "xno" ; then
2380 AC_DEFINE(DISABLE_LASTLOG)
2382 conf_lastlog_location=$withval
2387 dnl lastlog, [uw]tmpx? detection
2388 dnl NOTE: set the paths in the platform section to avoid the
2389 dnl need for command-line parameters
2390 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2392 dnl lastlog detection
2393 dnl NOTE: the code itself will detect if lastlog is a directory
2394 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2396 #include <sys/types.h>
2398 #ifdef HAVE_LASTLOG_H
2399 # include <lastlog.h>
2408 [ char *lastlog = LASTLOG_FILE; ],
2409 [ AC_MSG_RESULT(yes) ],
2412 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2414 #include <sys/types.h>
2416 #ifdef HAVE_LASTLOG_H
2417 # include <lastlog.h>
2423 [ char *lastlog = _PATH_LASTLOG; ],
2424 [ AC_MSG_RESULT(yes) ],
2427 system_lastlog_path=no
2432 if test -z "$conf_lastlog_location"; then
2433 if test x"$system_lastlog_path" = x"no" ; then
2434 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2435 if (test -d "$f" || test -f "$f") ; then
2436 conf_lastlog_location=$f
2439 if test -z "$conf_lastlog_location"; then
2440 AC_MSG_WARN([** Cannot find lastlog **])
2441 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2446 if test -n "$conf_lastlog_location"; then
2447 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2451 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2453 #include <sys/types.h>
2459 [ char *utmp = UTMP_FILE; ],
2460 [ AC_MSG_RESULT(yes) ],
2462 system_utmp_path=no ]
2464 if test -z "$conf_utmp_location"; then
2465 if test x"$system_utmp_path" = x"no" ; then
2466 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2467 if test -f $f ; then
2468 conf_utmp_location=$f
2471 if test -z "$conf_utmp_location"; then
2472 AC_DEFINE(DISABLE_UTMP)
2476 if test -n "$conf_utmp_location"; then
2477 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2481 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2483 #include <sys/types.h>
2489 [ char *wtmp = WTMP_FILE; ],
2490 [ AC_MSG_RESULT(yes) ],
2492 system_wtmp_path=no ]
2494 if test -z "$conf_wtmp_location"; then
2495 if test x"$system_wtmp_path" = x"no" ; then
2496 for f in /usr/adm/wtmp /var/log/wtmp; do
2497 if test -f $f ; then
2498 conf_wtmp_location=$f
2501 if test -z "$conf_wtmp_location"; then
2502 AC_DEFINE(DISABLE_WTMP)
2506 if test -n "$conf_wtmp_location"; then
2507 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2511 dnl utmpx detection - I don't know any system so perverse as to require
2512 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2514 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2516 #include <sys/types.h>
2525 [ char *utmpx = UTMPX_FILE; ],
2526 [ AC_MSG_RESULT(yes) ],
2528 system_utmpx_path=no ]
2530 if test -z "$conf_utmpx_location"; then
2531 if test x"$system_utmpx_path" = x"no" ; then
2532 AC_DEFINE(DISABLE_UTMPX)
2535 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2539 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2541 #include <sys/types.h>
2550 [ char *wtmpx = WTMPX_FILE; ],
2551 [ AC_MSG_RESULT(yes) ],
2553 system_wtmpx_path=no ]
2555 if test -z "$conf_wtmpx_location"; then
2556 if test x"$system_wtmpx_path" = x"no" ; then
2557 AC_DEFINE(DISABLE_WTMPX)
2560 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2564 if test ! -z "$blibpath" ; then
2565 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2566 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2569 dnl remove pam and dl because they are in $LIBPAM
2570 if test "$PAM_MSG" = yes ; then
2571 LIBS=`echo $LIBS | sed 's/-lpam //'`
2573 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2574 LIBS=`echo $LIBS | sed 's/-ldl //'`
2578 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2581 # Print summary of options
2583 # Someone please show me a better way :)
2584 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2585 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2586 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2587 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2588 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2589 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2590 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2591 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2592 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2593 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2596 echo "OpenSSH has been configured with the following options:"
2597 echo " User binaries: $B"
2598 echo " System binaries: $C"
2599 echo " Configuration files: $D"
2600 echo " Askpass program: $E"
2601 echo " Manual pages: $F"
2602 echo " PID file: $G"
2603 echo " Privilege separation chroot path: $H"
2604 if test "$USES_LOGIN_CONF" = "yes" ; then
2605 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2607 echo " sshd default user PATH: $I"
2609 if test ! -z "$superuser_path" ; then
2610 echo " sshd superuser user PATH: $J"
2612 echo " Manpage format: $MANTYPE"
2613 echo " PAM support: ${PAM_MSG}"
2614 echo " KerberosIV support: $KRB4_MSG"
2615 echo " KerberosV support: $KRB5_MSG"
2616 echo " Smartcard support: $SCARD_MSG"
2617 echo " AFS support: $AFS_MSG"
2618 echo " S/KEY support: $SKEY_MSG"
2619 echo " TCP Wrappers support: $TCPW_MSG"
2620 echo " MD5 password support: $MD5_MSG"
2621 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2622 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2623 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2624 echo " BSD Auth support: $BSD_AUTH_MSG"
2625 echo " Random number source: $RAND_MSG"
2626 if test ! -z "$USE_RAND_HELPER" ; then
2627 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2632 echo " Host: ${host}"
2633 echo " Compiler: ${CC}"
2634 echo " Compiler flags: ${CFLAGS}"
2635 echo "Preprocessor flags: ${CPPFLAGS}"
2636 echo " Linker flags: ${LDFLAGS}"
2637 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2641 if test "x$PAM_MSG" = "xyes" ; then
2642 echo "PAM is enabled. You may need to install a PAM control file "
2643 echo "for sshd, otherwise password authentication may fail. "
2644 echo "Example PAM control files can be found in the contrib/ "
2649 if test ! -z "$NO_SFTP"; then
2650 echo "sftp-server will be disabled. Your compiler does not "
2651 echo "support 64bit integers."
2655 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2656 echo "WARNING: you are using the builtin random number collection "
2657 echo "service. Please read WARNING.RNG and request that your OS "
2658 echo "vendor includes kernel-based random number collection in "
2659 echo "future versions of your OS."