4 AC_CONFIG_SRCDIR([ssh.c])
6 AC_CONFIG_HEADER(config.h)
11 # Checks for programs.
16 AC_PATH_PROGS(PERL, perl5 perl)
17 AC_PATH_PROG(SED, sed)
19 AC_PATH_PROG(ENT, ent)
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_CHECK_LIB(s,authenticate,
76 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
80 AC_DEFINE(BROKEN_GETADDRINFO)
81 AC_DEFINE(BROKEN_REALPATH)
82 dnl AIX handles lastlog as part of its login message
83 AC_DEFINE(DISABLE_LASTLOG)
84 AC_DEFINE(LOGIN_NEEDS_UTMPX)
85 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV)
86 AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0')
89 check_for_libcrypt_later=1
90 LIBS="$LIBS /usr/lib/textmode.o"
91 AC_DEFINE(HAVE_CYGWIN)
93 AC_DEFINE(DISABLE_SHADOW)
94 AC_DEFINE(IPV4_DEFAULT)
95 AC_DEFINE(IP_TOS_IS_BROKEN)
96 AC_DEFINE(NO_X11_UNIX_SOCKETS)
97 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
98 AC_DEFINE(DISABLE_FD_PASSING)
99 AC_DEFINE(SETGROUPS_NOOP)
102 AC_DEFINE(IP_TOS_IS_BROKEN)
105 AC_MSG_CHECKING(if we have working getaddrinfo)
106 AC_TRY_RUN([#include <mach-o/dyld.h>
107 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
111 }], [AC_MSG_RESULT(working)],
112 [AC_MSG_RESULT(buggy)
113 AC_DEFINE(BROKEN_GETADDRINFO)],
114 [AC_MSG_RESULT(assume it is working)])
117 if test -z "$GCC"; then
120 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
121 IPADDR_IN_DISPLAY=yes
122 AC_DEFINE(HAVE_SECUREWARE)
124 AC_DEFINE(LOGIN_NO_ENDOPT)
125 AC_DEFINE(LOGIN_NEEDS_UTMPX)
126 AC_DEFINE(DISABLE_SHADOW)
127 AC_DEFINE(DISABLE_UTMP)
128 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT)
129 LIBS="$LIBS -lsec -lsecpw"
130 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
131 disable_ptmx_check=yes
134 if test -z "$GCC"; then
137 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
138 IPADDR_IN_DISPLAY=yes
140 AC_DEFINE(LOGIN_NO_ENDOPT)
141 AC_DEFINE(LOGIN_NEEDS_UTMPX)
142 AC_DEFINE(DISABLE_SHADOW)
143 AC_DEFINE(DISABLE_UTMP)
144 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT)
146 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
149 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
150 IPADDR_IN_DISPLAY=yes
151 AC_DEFINE(PAM_SUN_CODEBASE)
153 AC_DEFINE(LOGIN_NO_ENDOPT)
154 AC_DEFINE(LOGIN_NEEDS_UTMPX)
155 AC_DEFINE(DISABLE_SHADOW)
156 AC_DEFINE(DISABLE_UTMP)
157 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT)
159 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
162 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
164 PATH="$PATH:/usr/etc"
165 AC_DEFINE(BROKEN_INET_NTOA)
166 AC_DEFINE(WITH_ABBREV_NO_TTY)
169 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
171 PATH="$PATH:/usr/etc"
172 AC_DEFINE(WITH_IRIX_ARRAY)
173 AC_DEFINE(WITH_IRIX_PROJECT)
174 AC_DEFINE(WITH_IRIX_AUDIT)
175 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
176 AC_DEFINE(BROKEN_INET_NTOA)
177 AC_DEFINE(WITH_ABBREV_NO_TTY)
181 check_for_libcrypt_later=1
182 AC_DEFINE(DONT_TRY_OTHER_AF)
183 AC_DEFINE(PAM_TTY_KLUDGE)
184 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV)
185 AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0')
186 inet6_default_4in6=yes
188 mips-sony-bsd|mips-sony-newsos4)
189 AC_DEFINE(HAVE_NEWS4)
193 check_for_libcrypt_before=1
197 check_for_libcrypt_later=1
200 conf_lastlog_location="/usr/adm/lastlog"
201 conf_utmp_location=/etc/utmp
202 conf_wtmp_location=/usr/adm/wtmp
205 AC_DEFINE(BROKEN_REALPATH)
207 AC_DEFINE(BROKEN_SAVED_UIDS)
208 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
212 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
213 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
215 AC_DEFINE(PAM_SUN_CODEBASE)
216 AC_DEFINE(LOGIN_NEEDS_UTMPX)
217 AC_DEFINE(LOGIN_NEEDS_TERM)
218 AC_DEFINE(PAM_TTY_KLUDGE)
219 AC_DEFINE(STREAMS_PUSH_ACQUIRES_CTTY)
220 # hardwire lastlog location (can't detect it on some versions)
221 conf_lastlog_location="/var/adm/lastlog"
222 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
223 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
224 if test "$sol2ver" -ge 8; then
226 AC_DEFINE(DISABLE_UTMP)
227 AC_DEFINE(DISABLE_WTMP)
233 CPPFLAGS="$CPPFLAGS -DSUNOS4"
234 AC_CHECK_FUNCS(getpwanam)
235 AC_DEFINE(PAM_SUN_CODEBASE)
236 conf_utmp_location=/etc/utmp
237 conf_wtmp_location=/var/adm/wtmp
238 conf_lastlog_location=/var/adm/lastlog
242 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
243 LDFLAGS="$LDFLAGS -L/usr/local/lib"
248 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
249 # /usr/ucblib MUST NOT be searched on ReliantUNIX
250 LDFLAGS="$LDFLAGS -L/usr/local/lib"
251 IPADDR_IN_DISPLAY=yes
253 AC_DEFINE(IP_TOS_IS_BROKEN)
254 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
255 # Attention: always take care to bind libsocket and libnsl before libc,
256 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
259 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
260 LDFLAGS="$LDFLAGS -L/usr/local/lib"
264 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
265 LDFLAGS="$LDFLAGS -L/usr/local/lib"
269 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
270 LDFLAGS="$LDFLAGS -L/usr/local/lib"
273 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
274 LDFLAGS="$LDFLAGS -L/usr/local/lib"
275 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
278 AC_DEFINE(BROKEN_SYS_TERMIO_H)
280 AC_DEFINE(HAVE_SECUREWARE)
281 AC_DEFINE(DISABLE_SHADOW)
282 AC_DEFINE(BROKEN_SAVED_UIDS)
283 AC_CHECK_FUNCS(getluid setluid)
285 do_sco3_extra_lib_check=yes
288 if test -z "$GCC"; then
289 CFLAGS="$CFLAGS -belf"
291 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
292 LDFLAGS="$LDFLAGS -L/usr/local/lib"
293 LIBS="$LIBS -lprot -lx -ltinfo -lm"
296 AC_DEFINE(HAVE_SECUREWARE)
297 AC_DEFINE(DISABLE_SHADOW)
298 AC_DEFINE(DISABLE_FD_PASSING)
299 AC_CHECK_FUNCS(getluid setluid)
304 AC_DEFINE(DISABLE_FD_PASSING)
306 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
311 AC_DEFINE(DISABLE_FD_PASSING)
312 AC_DEFINE(NO_SSH_LASTLOG)
313 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
314 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
318 AC_MSG_CHECKING(for Digital Unix SIA)
321 [ --with-osfsia Enable Digital Unix SIA],
323 if test "x$withval" = "xno" ; then
324 AC_MSG_RESULT(disabled)
329 if test -z "$no_osfsia" ; then
330 if test -f /etc/sia/matrix.conf; then
332 AC_DEFINE(HAVE_OSF_SIA)
333 AC_DEFINE(DISABLE_LOGIN)
334 AC_DEFINE(DISABLE_FD_PASSING)
335 LIBS="$LIBS -lsecurity -ldb -lm -laud"
340 AC_DEFINE(DISABLE_FD_PASSING)
345 AC_DEFINE(NO_X11_UNIX_SOCKETS)
346 AC_DEFINE(MISSING_NFDBITS)
347 AC_DEFINE(MISSING_HOWMANY)
348 AC_DEFINE(MISSING_FD_MASK)
352 # Allow user to specify flags
354 [ --with-cflags Specify additional flags to pass to compiler],
356 if test "x$withval" != "xno" ; then
357 CFLAGS="$CFLAGS $withval"
361 AC_ARG_WITH(cppflags,
362 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
364 if test "x$withval" != "xno"; then
365 CPPFLAGS="$CPPFLAGS $withval"
370 [ --with-ldflags Specify additional flags to pass to linker],
372 if test "x$withval" != "xno" ; then
373 LDFLAGS="$LDFLAGS $withval"
378 [ --with-libs Specify additional libraries to link with],
380 if test "x$withval" != "xno" ; then
381 LIBS="$LIBS $withval"
386 # Checks for header files.
387 AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
388 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
389 login_cap.h maillock.h netdb.h netgroup.h \
390 netinet/in_systm.h paths.h pty.h readpassphrase.h \
391 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
392 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
393 sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
394 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
395 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
396 util.h utime.h utmp.h utmpx.h)
398 # Checks for libraries.
399 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
400 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
402 dnl SCO OS3 needs this for libwrap
403 if test "x$with_tcp_wrappers" != "xno" ; then
404 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
405 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
409 AC_CHECK_FUNC(getspnam, ,
410 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
413 [ --without-rpath Disable auto-added -R linker paths],
415 if test "x$withval" = "xno" ; then
418 if test "x$withval" = "xyes" ; then
426 [ --with-zlib=PATH Use zlib in PATH],
428 if test "x$withval" = "xno" ; then
429 AC_MSG_ERROR([*** zlib is required ***])
431 if test -d "$withval/lib"; then
432 if test -n "${need_dash_r}"; then
433 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
435 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
438 if test -n "${need_dash_r}"; then
439 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
441 LDFLAGS="-L${withval} ${LDFLAGS}"
444 if test -d "$withval/include"; then
445 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
447 CPPFLAGS="-I${withval} ${CPPFLAGS}"
452 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
455 AC_CHECK_FUNC(strcasecmp,
456 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
458 AC_CHECK_FUNC(utimes,
459 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
460 LIBS="$LIBS -lc89"]) ]
463 dnl Checks for libutil functions
464 AC_CHECK_HEADERS(libutil.h)
465 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
466 AC_CHECK_FUNCS(logout updwtmp logwtmp)
470 # Check for ALTDIRFUNC glob() extension
471 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
472 AC_EGREP_CPP(FOUNDIT,
475 #ifdef GLOB_ALTDIRFUNC
480 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
488 # Check for g.gl_matchc glob() extension
489 AC_MSG_CHECKING(for gl_matchc field in glob_t)
490 AC_EGREP_CPP(FOUNDIT,
493 int main(void){glob_t g; g.gl_matchc = 1;}
496 AC_DEFINE(GLOB_HAS_GL_MATCHC)
504 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
507 #include <sys/types.h>
509 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
511 [AC_MSG_RESULT(yes)],
514 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
518 # Check whether the user wants GSSAPI mechglue support
519 AC_ARG_WITH(mechglue,
520 [ --with-mechglue=PATH Build with GSSAPI mechglue library],
522 AC_MSG_CHECKING(for mechglue library)
524 if test -e ${withval}/libgssapi.a ; then
525 mechglue_lib=${withval}/libgssapi.a
526 elif test -e ${withval}/lib/libgssapi.a ; then
527 mechglue_lib=${withval}/lib/libgssapi.a
529 AC_MSG_ERROR("Can't find libgssapi in ${withval}");
531 LIBS="$LIBS ${mechglue_lib}"
532 AC_MSG_RESULT(${mechglue_lib})
534 AC_CHECK_LIB(dl, dlopen, , )
535 if test $ac_cv_lib_dl_dlopen = yes; then
536 LDFLAGS="$LDFLAGS -ldl -Wl,-Bsymbolic"
547 # Check whether the user wants GSI (Globus) support
550 [ --with-gsi=PATH Enable GSI/Globus authentication support],
557 [ --with-globus=PATH Enable GSI/Globus authentication support],
563 # Check whether the user has a Globus flavor type
564 globus_flavor_type="no"
565 AC_ARG_WITH(globus-flavor,
566 [ --with-globus-flavor=TYPE Describe Globus flavor type (ex: gcc32dbg, etc.)],
568 globus_flavor_type="$withval"
572 if test "x$gsi_path" != "xno" ; then
573 # Globus GSSAPI configuration
574 AC_MSG_CHECKING(for Globus GSI)
577 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
578 AC_MSG_ERROR([Previously configured GSSAPI library conflicts with Globus/GSI.])
580 if test -z "$GSSAPI"; then
585 if test "x$globus_install_dir" = "xyes" ; then
586 AC_MSG_ERROR(--with-globus=PATH must specify a path)
589 if test "x$globus_flavor_type" = "xno" ; then
590 AC_MSG_ERROR(--with-globus-flavor=TYPE must be specified)
592 if test "x$globus_flavor_type" = "xyes" ; then
593 AC_MSG_ERROR(--with-globus-flavor=TYPE must specify a flavor type)
596 GLOBUS_INCLUDE="${gsi_path}/include/${globus_flavor_type}"
597 if test ! -d "$GLOBUS_INCLUDE" ; then
598 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_INCLUDE})
600 GSI_CPPFLAGS="-I${GLOBUS_INCLUDE}"
602 if test -x ${gsi_path}/bin/globus-makefile-header ; then
603 GSI_LIBS=`${gsi_path}/bin/globus-makefile-header -static -flavor=${globus_flavor_type} globus_gss_assist | perl -n -e 'if (/GLOBUS_PKG_LIBS = (.*)/){print $1;}'`
604 elif test -x ${gsi_path}/sbin/globus-makefile-header ; then
605 GSI_LDFLAGS="-L${gsi_path}/lib"
606 GSI_LIBS=`${gsi_path}/sbin/globus-makefile-header -flavor=${globus_flavor_type} globus_gss_assist | perl -n -e 'if (/GLOBUS_PKG_LIBS = (.*)/){print $1;}'`
608 AC_MSG_ERROR(Cannot find globus-makefile-header: Globus installation is incomplete)
610 if test -z "$GSI_LIBS" ; then
611 AC_MSG_ERROR(globus-makefile-header failed)
614 LIBS="$LIBS $GSI_LIBS"
615 LDFLAGS="$LDFLAGS $GSI_LDFLAGS"
616 CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS"
618 # test that we got the libraries OK
626 AC_MSG_ERROR(link with Globus libraries failed)
633 AC_SUBST(INSTALL_GSISSH)
634 # End Globus/GSI section
636 # Check whether user wants S/Key support
639 [ --with-skey[[=PATH]] Enable S/Key support
640 (optionally in PATH)],
642 if test "x$withval" != "xno" ; then
644 if test "x$withval" != "xyes" ; then
645 CPPFLAGS="$CPPFLAGS -I${withval}/include"
646 LDFLAGS="$LDFLAGS -L${withval}/lib"
653 AC_MSG_CHECKING([for s/key support])
658 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
660 [AC_MSG_RESULT(yes)],
663 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
669 # Check whether user wants TCP wrappers support
671 AC_ARG_WITH(tcp-wrappers,
672 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
673 (optionally in PATH)],
675 if test "x$withval" != "xno" ; then
677 saved_LDFLAGS="$LDFLAGS"
678 saved_CPPFLAGS="$CPPFLAGS"
679 if test -n "${withval}" -a "${withval}" != "yes"; then
680 if test -d "${withval}/lib"; then
681 if test -n "${need_dash_r}"; then
682 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
684 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
687 if test -n "${need_dash_r}"; then
688 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
690 LDFLAGS="-L${withval} ${LDFLAGS}"
693 if test -d "${withval}/include"; then
694 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
696 CPPFLAGS="-I${withval} ${CPPFLAGS}"
700 LIBS="$LIBWRAP $LIBS"
701 AC_MSG_CHECKING(for libwrap)
705 int deny_severity = 0, allow_severity = 0;
715 AC_MSG_ERROR([*** libwrap missing])
723 dnl Checks for library functions. Please keep in alphabetical order
725 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename bcopy \
726 bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
727 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
728 getpeereid _getpty getrlimit getrusage getttyent glob inet_aton \
729 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
730 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openpty pstat \
731 readpassphrase realpath recvmsg rresvport_af sendmsg setdtablesize \
732 setegid setenv seteuid setgroups setlogin setpcred setproctitle \
733 setresgid setreuid setrlimit setsid setvbuf sigaction sigvec \
734 snprintf socketpair strerror strlcat strlcpy strmode strnvis \
735 sysconf tcgetpgrp truncate utimes vhangup vsnprintf waitpid \
738 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
740 dnl IRIX has basename() in libgen
741 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
743 dnl Make sure strsep prototype is defined before defining HAVE_STRSEP
744 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
746 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
747 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
748 AC_CHECK_LIB(gen, dirname,[
749 AC_CACHE_CHECK([for broken dirname],
750 ac_cv_have_broken_dirname, [
758 int main(int argc, char **argv) {
761 strncpy(buf,"/etc", 32);
763 if (!s || strncmp(s, "/", 32) != 0) {
770 [ ac_cv_have_broken_dirname="no" ],
771 [ ac_cv_have_broken_dirname="yes" ]
775 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
777 AC_DEFINE(HAVE_DIRNAME)
778 AC_CHECK_HEADERS(libgen.h)
783 dnl Checks for time functions
784 AC_CHECK_FUNCS(gettimeofday time)
785 dnl Checks for utmp functions
786 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
787 AC_CHECK_FUNCS(utmpname)
788 dnl Checks for utmpx functions
789 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
790 AC_CHECK_FUNCS(setutxent utmpxname)
792 AC_CHECK_FUNC(daemon,
793 [AC_DEFINE(HAVE_DAEMON)],
794 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
797 AC_CHECK_FUNC(getpagesize,
798 [AC_DEFINE(HAVE_GETPAGESIZE)],
799 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
802 # Check for broken snprintf
803 if test "x$ac_cv_func_snprintf" = "xyes" ; then
804 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
808 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
810 [AC_MSG_RESULT(yes)],
813 AC_DEFINE(BROKEN_SNPRINTF)
814 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
819 dnl see whether mkstemp() requires XXXXXX
820 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
821 AC_MSG_CHECKING([for (overly) strict mkstemp])
825 main() { char template[]="conftest.mkstemp-test";
826 if (mkstemp(template) == -1)
828 unlink(template); exit(0);
836 AC_DEFINE(HAVE_STRICT_MKSTEMP)
840 AC_DEFINE(HAVE_STRICT_MKSTEMP)
850 [ --with-pam Enable PAM support ],
852 if test "x$withval" != "xno" ; then
853 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
854 AC_MSG_ERROR([PAM headers not found])
857 AC_CHECK_LIB(dl, dlopen, , )
858 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
859 AC_CHECK_FUNCS(pam_getenvlist)
860 AC_CHECK_FUNCS(pam_putenv)
866 if test $ac_cv_lib_dl_dlopen = yes; then
876 # Check for older PAM
877 if test "x$PAM_MSG" = "xyes" ; then
878 # Check PAM strerror arguments (old PAM)
879 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
883 #include <security/pam_appl.h>
885 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
888 AC_DEFINE(HAVE_OLD_PAM)
890 PAM_MSG="yes (old library)"
895 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
896 # because the system crypt() is more featureful.
897 if test "x$check_for_libcrypt_before" = "x1"; then
898 AC_CHECK_LIB(crypt, crypt)
902 saved_CPPFLAGS="$CPPFLAGS"
903 saved_LDFLAGS="$LDFLAGS"
905 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
907 if test "x$withval" != "xno" ; then
908 if test -d "$withval/lib"; then
909 if test -n "${need_dash_r}"; then
910 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
912 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
915 if test -n "${need_dash_r}"; then
916 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
918 LDFLAGS="-L${withval} ${LDFLAGS}"
921 if test -d "$withval/include"; then
922 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
924 CPPFLAGS="-I${withval} ${CPPFLAGS}"
929 if test -z "$GSI_LIBS" ; then
930 LIBS="$LIBS -lcrypto"
932 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
934 dnl Check default openssl install dir
935 if test -n "${need_dash_r}"; then
936 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
938 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
940 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
941 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
943 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
949 # Determine OpenSSL header version
950 AC_MSG_CHECKING([OpenSSL header version])
955 #include <openssl/opensslv.h>
956 #define DATA "conftest.sslincver"
961 fd = fopen(DATA,"w");
965 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
972 ssl_header_ver=`cat conftest.sslincver`
973 AC_MSG_RESULT($ssl_header_ver)
976 AC_MSG_RESULT(not found)
977 AC_MSG_ERROR(OpenSSL version header not found.)
981 # Determine OpenSSL library version
982 AC_MSG_CHECKING([OpenSSL library version])
987 #include <openssl/opensslv.h>
988 #include <openssl/crypto.h>
989 #define DATA "conftest.ssllibver"
994 fd = fopen(DATA,"w");
998 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1005 ssl_library_ver=`cat conftest.ssllibver`
1006 AC_MSG_RESULT($ssl_library_ver)
1009 AC_MSG_RESULT(not found)
1010 AC_MSG_ERROR(OpenSSL library not found.)
1014 # Sanity check OpenSSL headers
1015 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1019 #include <openssl/opensslv.h>
1020 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1027 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
1031 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1032 # version in OpenSSL. Skip this for PAM
1033 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
1034 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1038 ### Configure cryptographic random number support
1040 # Check wheter OpenSSL seeds itself
1041 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1045 #include <openssl/rand.h>
1046 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1049 OPENSSL_SEEDS_ITSELF=yes
1054 # Default to use of the rand helper if OpenSSL doesn't
1061 # Do we want to force the use of the rand helper?
1062 AC_ARG_WITH(rand-helper,
1063 [ --with-rand-helper Use subprocess to gather strong randomness ],
1065 if test "x$withval" = "xno" ; then
1066 # Force use of OpenSSL's internal RNG, even if
1067 # the previous test showed it to be unseeded.
1068 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1069 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1070 OPENSSL_SEEDS_ITSELF=yes
1079 # Which randomness source do we use?
1080 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1082 AC_DEFINE(OPENSSL_PRNG_ONLY)
1083 RAND_MSG="OpenSSL internal ONLY"
1084 INSTALL_SSH_RAND_HELPER=""
1085 elif test ! -z "$USE_RAND_HELPER" ; then
1086 # install rand helper
1087 RAND_MSG="ssh-rand-helper"
1088 INSTALL_SSH_RAND_HELPER="yes"
1090 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1092 ### Configuration of ssh-rand-helper
1095 AC_ARG_WITH(prngd-port,
1096 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1105 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1108 if test ! -z "$withval" ; then
1109 PRNGD_PORT="$withval"
1110 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1115 # PRNGD Unix domain socket
1116 AC_ARG_WITH(prngd-socket,
1117 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1121 withval="/var/run/egd-pool"
1129 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1133 if test ! -z "$withval" ; then
1134 if test ! -z "$PRNGD_PORT" ; then
1135 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1137 if test ! -r "$withval" ; then
1138 AC_MSG_WARN(Entropy socket is not readable)
1140 PRNGD_SOCKET="$withval"
1141 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1145 # Check for existing socket only if we don't have a random device already
1146 if test "$USE_RAND_HELPER" = yes ; then
1147 AC_MSG_CHECKING(for PRNGD/EGD socket)
1148 # Insert other locations here
1149 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1150 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1151 PRNGD_SOCKET="$sock"
1152 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1156 if test ! -z "$PRNGD_SOCKET" ; then
1157 AC_MSG_RESULT($PRNGD_SOCKET)
1159 AC_MSG_RESULT(not found)
1165 # Change default command timeout for hashing entropy source
1167 AC_ARG_WITH(entropy-timeout,
1168 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1170 if test "x$withval" != "xno" ; then
1171 entropy_timeout=$withval
1175 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1177 SSH_PRIVSEP_USER=sshd
1178 AC_ARG_WITH(privsep-user,
1179 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1181 if test -n "$withval"; then
1182 SSH_PRIVSEP_USER=$withval
1186 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1187 AC_SUBST(SSH_PRIVSEP_USER)
1189 # We do this little dance with the search path to insure
1190 # that programs that we select for use by installed programs
1191 # (which may be run by the super-user) come from trusted
1192 # locations before they come from the user's private area.
1193 # This should help avoid accidentally configuring some
1194 # random version of a program in someone's personal bin.
1198 test -h /bin 2> /dev/null && PATH=/usr/bin
1199 test -d /sbin && PATH=$PATH:/sbin
1200 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1201 PATH=$PATH:/etc:$OPATH
1203 # These programs are used by the command hashing source to gather entropy
1204 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1205 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1206 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1207 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1208 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1209 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1210 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1211 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1212 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1213 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1214 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1215 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1216 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1217 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1218 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1219 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1223 # Where does ssh-rand-helper get its randomness from?
1224 INSTALL_SSH_PRNG_CMDS=""
1225 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1226 if test ! -z "$PRNGD_PORT" ; then
1227 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1228 elif test ! -z "$PRNGD_SOCKET" ; then
1229 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1231 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1232 RAND_HELPER_CMDHASH=yes
1233 INSTALL_SSH_PRNG_CMDS="yes"
1236 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1239 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1240 if test ! -z "$SONY" ; then
1241 LIBS="$LIBS -liberty";
1244 # Checks for data types
1245 AC_CHECK_SIZEOF(char, 1)
1246 AC_CHECK_SIZEOF(short int, 2)
1247 AC_CHECK_SIZEOF(int, 4)
1248 AC_CHECK_SIZEOF(long int, 4)
1249 AC_CHECK_SIZEOF(long long int, 8)
1251 # Sanity check long long for some platforms (AIX)
1252 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1253 ac_cv_sizeof_long_long_int=0
1256 # More checks for data types
1257 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1259 [ #include <sys/types.h> ],
1261 [ ac_cv_have_u_int="yes" ],
1262 [ ac_cv_have_u_int="no" ]
1265 if test "x$ac_cv_have_u_int" = "xyes" ; then
1266 AC_DEFINE(HAVE_U_INT)
1270 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1272 [ #include <sys/types.h> ],
1273 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1274 [ ac_cv_have_intxx_t="yes" ],
1275 [ ac_cv_have_intxx_t="no" ]
1278 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1279 AC_DEFINE(HAVE_INTXX_T)
1283 if (test -z "$have_intxx_t" && \
1284 test "x$ac_cv_header_stdint_h" = "xyes")
1286 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1288 [ #include <stdint.h> ],
1289 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1291 AC_DEFINE(HAVE_INTXX_T)
1294 [ AC_MSG_RESULT(no) ]
1298 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1301 #include <sys/types.h>
1302 #ifdef HAVE_STDINT_H
1303 # include <stdint.h>
1305 #include <sys/socket.h>
1306 #ifdef HAVE_SYS_BITYPES_H
1307 # include <sys/bitypes.h>
1310 [ int64_t a; a = 1;],
1311 [ ac_cv_have_int64_t="yes" ],
1312 [ ac_cv_have_int64_t="no" ]
1315 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1316 AC_DEFINE(HAVE_INT64_T)
1319 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1321 [ #include <sys/types.h> ],
1322 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1323 [ ac_cv_have_u_intxx_t="yes" ],
1324 [ ac_cv_have_u_intxx_t="no" ]
1327 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1328 AC_DEFINE(HAVE_U_INTXX_T)
1332 if test -z "$have_u_intxx_t" ; then
1333 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1335 [ #include <sys/socket.h> ],
1336 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1338 AC_DEFINE(HAVE_U_INTXX_T)
1341 [ AC_MSG_RESULT(no) ]
1345 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1347 [ #include <sys/types.h> ],
1348 [ u_int64_t a; a = 1;],
1349 [ ac_cv_have_u_int64_t="yes" ],
1350 [ ac_cv_have_u_int64_t="no" ]
1353 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1354 AC_DEFINE(HAVE_U_INT64_T)
1358 if test -z "$have_u_int64_t" ; then
1359 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1361 [ #include <sys/bitypes.h> ],
1362 [ u_int64_t a; a = 1],
1364 AC_DEFINE(HAVE_U_INT64_T)
1367 [ AC_MSG_RESULT(no) ]
1371 if test -z "$have_u_intxx_t" ; then
1372 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1375 #include <sys/types.h>
1377 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1378 [ ac_cv_have_uintxx_t="yes" ],
1379 [ ac_cv_have_uintxx_t="no" ]
1382 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1383 AC_DEFINE(HAVE_UINTXX_T)
1387 if test -z "$have_uintxx_t" ; then
1388 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1390 [ #include <stdint.h> ],
1391 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1393 AC_DEFINE(HAVE_UINTXX_T)
1396 [ AC_MSG_RESULT(no) ]
1400 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1401 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1403 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1406 #include <sys/bitypes.h>
1409 int8_t a; int16_t b; int32_t c;
1410 u_int8_t e; u_int16_t f; u_int32_t g;
1411 a = b = c = e = f = g = 1;
1414 AC_DEFINE(HAVE_U_INTXX_T)
1415 AC_DEFINE(HAVE_INTXX_T)
1423 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1426 #include <sys/types.h>
1428 [ u_char foo; foo = 125; ],
1429 [ ac_cv_have_u_char="yes" ],
1430 [ ac_cv_have_u_char="no" ]
1433 if test "x$ac_cv_have_u_char" = "xyes" ; then
1434 AC_DEFINE(HAVE_U_CHAR)
1439 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1441 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1444 #include <sys/types.h>
1446 [ size_t foo; foo = 1235; ],
1447 [ ac_cv_have_size_t="yes" ],
1448 [ ac_cv_have_size_t="no" ]
1451 if test "x$ac_cv_have_size_t" = "xyes" ; then
1452 AC_DEFINE(HAVE_SIZE_T)
1455 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1458 #include <sys/types.h>
1460 [ ssize_t foo; foo = 1235; ],
1461 [ ac_cv_have_ssize_t="yes" ],
1462 [ ac_cv_have_ssize_t="no" ]
1465 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1466 AC_DEFINE(HAVE_SSIZE_T)
1469 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1474 [ clock_t foo; foo = 1235; ],
1475 [ ac_cv_have_clock_t="yes" ],
1476 [ ac_cv_have_clock_t="no" ]
1479 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1480 AC_DEFINE(HAVE_CLOCK_T)
1483 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1486 #include <sys/types.h>
1487 #include <sys/socket.h>
1489 [ sa_family_t foo; foo = 1235; ],
1490 [ ac_cv_have_sa_family_t="yes" ],
1493 #include <sys/types.h>
1494 #include <sys/socket.h>
1495 #include <netinet/in.h>
1497 [ sa_family_t foo; foo = 1235; ],
1498 [ ac_cv_have_sa_family_t="yes" ],
1500 [ ac_cv_have_sa_family_t="no" ]
1504 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1505 AC_DEFINE(HAVE_SA_FAMILY_T)
1508 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1511 #include <sys/types.h>
1513 [ pid_t foo; foo = 1235; ],
1514 [ ac_cv_have_pid_t="yes" ],
1515 [ ac_cv_have_pid_t="no" ]
1518 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1519 AC_DEFINE(HAVE_PID_T)
1522 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1525 #include <sys/types.h>
1527 [ mode_t foo; foo = 1235; ],
1528 [ ac_cv_have_mode_t="yes" ],
1529 [ ac_cv_have_mode_t="no" ]
1532 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1533 AC_DEFINE(HAVE_MODE_T)
1537 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1540 #include <sys/types.h>
1541 #include <sys/socket.h>
1543 [ struct sockaddr_storage s; ],
1544 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1545 [ ac_cv_have_struct_sockaddr_storage="no" ]
1548 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1549 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1552 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1555 #include <sys/types.h>
1556 #include <netinet/in.h>
1558 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1559 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1560 [ ac_cv_have_struct_sockaddr_in6="no" ]
1563 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1564 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1567 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1570 #include <sys/types.h>
1571 #include <netinet/in.h>
1573 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1574 [ ac_cv_have_struct_in6_addr="yes" ],
1575 [ ac_cv_have_struct_in6_addr="no" ]
1578 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1579 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1582 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1585 #include <sys/types.h>
1586 #include <sys/socket.h>
1589 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1590 [ ac_cv_have_struct_addrinfo="yes" ],
1591 [ ac_cv_have_struct_addrinfo="no" ]
1594 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1595 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1598 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1600 [ #include <sys/time.h> ],
1601 [ struct timeval tv; tv.tv_sec = 1;],
1602 [ ac_cv_have_struct_timeval="yes" ],
1603 [ ac_cv_have_struct_timeval="no" ]
1606 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1607 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1608 have_struct_timeval=1
1611 AC_CHECK_TYPES(struct timespec)
1613 # We need int64_t or else certian parts of the compile will fail.
1614 if test "x$ac_cv_have_int64_t" = "xno" -a \
1615 "x$ac_cv_sizeof_long_int" != "x8" -a \
1616 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1617 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1618 echo "an alternative compiler (I.E., GCC) before continuing."
1622 dnl test snprintf (broken on SCO w/gcc)
1627 #ifdef HAVE_SNPRINTF
1631 char expected_out[50];
1633 #if (SIZEOF_LONG_INT == 8)
1634 long int num = 0x7fffffffffffffff;
1636 long long num = 0x7fffffffffffffffll;
1638 strcpy(expected_out, "9223372036854775807");
1639 snprintf(buf, mazsize, "%lld", num);
1640 if(strcmp(buf, expected_out) != 0)
1647 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1651 dnl Checks for structure members
1652 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1653 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1654 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1655 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1656 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1657 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1658 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1659 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1660 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1661 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1662 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1663 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1664 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1665 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1666 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1667 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1668 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1670 AC_CHECK_MEMBERS([struct stat.st_blksize])
1672 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1673 ac_cv_have_ss_family_in_struct_ss, [
1676 #include <sys/types.h>
1677 #include <sys/socket.h>
1679 [ struct sockaddr_storage s; s.ss_family = 1; ],
1680 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1681 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1684 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1685 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1688 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1689 ac_cv_have___ss_family_in_struct_ss, [
1692 #include <sys/types.h>
1693 #include <sys/socket.h>
1695 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1696 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1697 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1700 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1701 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1704 AC_CACHE_CHECK([for pw_class field in struct passwd],
1705 ac_cv_have_pw_class_in_struct_passwd, [
1710 [ struct passwd p; p.pw_class = 0; ],
1711 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1712 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1715 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1716 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1719 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1720 ac_cv_have_pw_expire_in_struct_passwd, [
1725 [ struct passwd p; p.pw_expire = 0; ],
1726 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1727 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1730 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1731 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1734 AC_CACHE_CHECK([for pw_change field in struct passwd],
1735 ac_cv_have_pw_change_in_struct_passwd, [
1740 [ struct passwd p; p.pw_change = 0; ],
1741 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1742 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1745 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1746 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1749 dnl make sure we're using the real structure members and not defines
1750 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1751 ac_cv_have_accrights_in_msghdr, [
1754 #include <sys/types.h>
1755 #include <sys/socket.h>
1756 #include <sys/uio.h>
1758 #ifdef msg_accrights
1762 m.msg_accrights = 0;
1766 [ ac_cv_have_accrights_in_msghdr="yes" ],
1767 [ ac_cv_have_accrights_in_msghdr="no" ]
1770 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1771 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1774 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1775 ac_cv_have_control_in_msghdr, [
1778 #include <sys/types.h>
1779 #include <sys/socket.h>
1780 #include <sys/uio.h>
1790 [ ac_cv_have_control_in_msghdr="yes" ],
1791 [ ac_cv_have_control_in_msghdr="no" ]
1794 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1795 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1798 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1800 [ extern char *__progname; printf("%s", __progname); ],
1801 [ ac_cv_libc_defines___progname="yes" ],
1802 [ ac_cv_libc_defines___progname="no" ]
1805 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1806 AC_DEFINE(HAVE___PROGNAME)
1809 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1813 [ printf("%s", __FUNCTION__); ],
1814 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1815 [ ac_cv_cc_implements___FUNCTION__="no" ]
1818 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1819 AC_DEFINE(HAVE___FUNCTION__)
1822 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1826 [ printf("%s", __func__); ],
1827 [ ac_cv_cc_implements___func__="yes" ],
1828 [ ac_cv_cc_implements___func__="no" ]
1831 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1832 AC_DEFINE(HAVE___func__)
1835 AC_CACHE_CHECK([whether getopt has optreset support],
1836 ac_cv_have_getopt_optreset, [
1841 [ extern int optreset; optreset = 0; ],
1842 [ ac_cv_have_getopt_optreset="yes" ],
1843 [ ac_cv_have_getopt_optreset="no" ]
1846 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1847 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1850 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1852 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1853 [ ac_cv_libc_defines_sys_errlist="yes" ],
1854 [ ac_cv_libc_defines_sys_errlist="no" ]
1857 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1858 AC_DEFINE(HAVE_SYS_ERRLIST)
1862 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1864 [ extern int sys_nerr; printf("%i", sys_nerr);],
1865 [ ac_cv_libc_defines_sys_nerr="yes" ],
1866 [ ac_cv_libc_defines_sys_nerr="no" ]
1869 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1870 AC_DEFINE(HAVE_SYS_NERR)
1875 # Check whether user wants sectok support
1877 [ --with-sectok Enable smartcard support using libsectok],
1879 if test "x$withval" != "xno" ; then
1880 if test "x$withval" != "xyes" ; then
1881 CPPFLAGS="$CPPFLAGS -I${withval}"
1882 LDFLAGS="$LDFLAGS -L${withval}"
1883 if test ! -z "$need_dash_r" ; then
1884 LDFLAGS="$LDFLAGS -R${withval}"
1886 if test ! -z "$blibpath" ; then
1887 blibpath="$blibpath:${withval}"
1890 AC_CHECK_HEADERS(sectok.h)
1891 if test "$ac_cv_header_sectok_h" != yes; then
1892 AC_MSG_ERROR(Can't find sectok.h)
1894 AC_CHECK_LIB(sectok, sectok_open)
1895 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1896 AC_MSG_ERROR(Can't find libsectok)
1898 AC_DEFINE(SMARTCARD)
1899 AC_DEFINE(USE_SECTOK)
1900 SCARD_MSG="yes, using sectok"
1905 # Check whether user wants OpenSC support
1907 AC_HELP_STRING([--with-opensc=PFX],
1908 [Enable smartcard support using OpenSC]),
1909 opensc_config_prefix="$withval", opensc_config_prefix="")
1910 if test x$opensc_config_prefix != x ; then
1911 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1912 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1913 if test "$OPENSC_CONFIG" != "no"; then
1914 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1915 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1916 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1917 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1918 AC_DEFINE(SMARTCARD)
1919 AC_DEFINE(USE_OPENSC)
1920 SCARD_MSG="yes, using OpenSC"
1924 # Check whether user wants Kerberos 5 support
1926 AC_ARG_WITH(kerberos5,
1927 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1929 if test "x$withval" != "xno" ; then
1930 if test "x$withval" = "xyes" ; then
1931 KRB5ROOT="/usr/local"
1935 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1936 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1939 AC_MSG_CHECKING(whether we are using Heimdal)
1940 AC_TRY_COMPILE([ #include <krb5.h> ],
1941 [ char *tmp = heimdal_version; ],
1942 [ AC_MSG_RESULT(yes)
1944 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1947 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1950 if test ! -z "$need_dash_r" ; then
1951 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1953 if test ! -z "$blibpath" ; then
1954 blibpath="$blibpath:${KRB5ROOT}/lib"
1956 AC_CHECK_LIB(resolv, dn_expand, , )
1958 # If we're using some other GSSAPI
1959 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
1960 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
1962 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1964 K5LIBS="-lgssapi $K5LIBS" ],
1965 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1967 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
1968 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
1973 AC_CHECK_HEADER(gssapi.h, ,
1974 [ unset ac_cv_header_gssapi_h
1975 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1976 AC_CHECK_HEADERS(gssapi.h, ,
1977 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
1982 AC_CHECK_LIB(gssapi, gss_krb5_copy_ccache, /bin/true,
1983 [ K5LIBS="-lgssapi_krb5 $K5LIBS"
1984 AC_CHECK_LIB(gssapi_krb5, gss_krb5_copy_ccache, /bin/true,
1985 AC_MSG_WARN([Cannot find gss_krb5_copy_ccache -- build may fail]),
1991 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1992 AC_CHECK_HEADER(gssapi_krb5.h, ,
1993 [ CPPFLAGS="$oldCPP" ])
1995 if test -z "$GSSAPI"; then
2003 # Check whether user wants Kerberos 4 support
2005 AC_ARG_WITH(kerberos4,
2006 [ --with-kerberos4=PATH Enable Kerberos 4 support],
2008 if test "x$withval" != "xno" ; then
2009 if test "x$withval" != "xyes" ; then
2010 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2011 LDFLAGS="$LDFLAGS -L${withval}/lib"
2012 if test ! -z "$need_dash_r" ; then
2013 LDFLAGS="$LDFLAGS -R${withval}/lib"
2015 if test ! -z "$blibpath" ; then
2016 blibpath="$blibpath:${withval}/lib"
2019 if test -d /usr/include/kerberosIV ; then
2020 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
2024 AC_CHECK_HEADERS(krb.h)
2025 if test "$ac_cv_header_krb_h" != yes; then
2026 AC_MSG_WARN([Cannot find krb.h, build may fail])
2028 AC_CHECK_LIB(krb, main)
2029 if test "$ac_cv_lib_krb_main" != yes; then
2030 AC_CHECK_LIB(krb4, main)
2031 if test "$ac_cv_lib_krb4_main" != yes; then
2032 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
2039 AC_CHECK_LIB(des, des_cbc_encrypt)
2040 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
2041 AC_CHECK_LIB(des425, des_cbc_encrypt)
2042 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
2043 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
2050 AC_CHECK_LIB(resolv, dn_expand, , )
2058 # Check whether user wants AFS_KRB5 support
2060 AC_ARG_WITH(afs-krb5,
2061 [ --with-afs-krb5[[=AKLOG_PATH]] Enable aklog to get token (default=/usr/bin/aklog).],
2063 if test "x$withval" != "xno" ; then
2065 if test "x$withval" != "xyes" ; then
2066 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval")
2068 AC_DEFINE_UNQUOTED(AKLOG_PATH, "/usr/bin/aklog")
2071 if test -z "$KRB5" ; then
2072 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
2075 LIBS="-lkrbafs $LIBS"
2076 if test ! -z "$AFS_LIBS" ; then
2077 LIBS="$LIBS $AFS_LIBS"
2085 # Check whether user wants AFS support
2088 [ --with-afs=PATH Enable AFS support],
2090 if test "x$withval" != "xno" ; then
2092 if test "x$withval" != "xyes" ; then
2093 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2094 LDFLAGS="$LDFLAGS -L${withval}/lib"
2097 if test -z "$KRB4" ; then
2098 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
2102 if test ! -z "$AFS_LIBS" ; then
2103 LIBS="$LIBS $AFS_LIBS"
2110 LIBS="$LIBS $KLIBS $K5LIBS"
2112 AC_ARG_WITH(session-hooks,
2113 [ --with-session-hooks Enable hooks for executing external commands before/after a session],
2114 [ AC_DEFINE(SESSION_HOOKS) ]
2117 # Looking for programs, paths and files
2119 PRIVSEP_PATH=/var/empty
2120 AC_ARG_WITH(privsep-path,
2121 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2123 if test "x$withval" != "$no" ; then
2124 PRIVSEP_PATH=$withval
2128 AC_SUBST(PRIVSEP_PATH)
2131 [ --with-xauth=PATH Specify path to xauth program ],
2133 if test "x$withval" != "xno" ; then
2139 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2140 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2141 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2142 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2143 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2144 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2145 xauth_path="/usr/openwin/bin/xauth"
2151 AC_ARG_ENABLE(strip,
2152 [ --disable-strip Disable calling strip(1) on install],
2154 if test "x$enableval" = "xno" ; then
2161 if test -z "$xauth_path" ; then
2162 XAUTH_PATH="undefined"
2163 AC_SUBST(XAUTH_PATH)
2165 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2166 XAUTH_PATH=$xauth_path
2167 AC_SUBST(XAUTH_PATH)
2170 # Check for mail directory (last resort if we cannot get it from headers)
2171 if test ! -z "$MAIL" ; then
2172 maildir=`dirname $MAIL`
2173 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2176 if test -z "$no_dev_ptmx" ; then
2177 if test "x$disable_ptmx_check" != "xyes" ; then
2178 AC_CHECK_FILE("/dev/ptmx",
2180 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2186 AC_CHECK_FILE("/dev/ptc",
2188 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2193 # Options from here on. Some of these are preset by platform above
2194 AC_ARG_WITH(mantype,
2195 [ --with-mantype=man|cat|doc Set man page type],
2202 AC_MSG_ERROR(invalid man type: $withval)
2207 if test -z "$MANTYPE"; then
2208 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2209 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2210 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2212 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2219 if test "$MANTYPE" = "doc"; then
2226 # Check whether to enable MD5 passwords
2228 AC_ARG_WITH(md5-passwords,
2229 [ --with-md5-passwords Enable use of MD5 passwords],
2231 if test "x$withval" != "xno" ; then
2232 AC_DEFINE(HAVE_MD5_PASSWORDS)
2238 # Whether to disable shadow password support
2240 [ --without-shadow Disable shadow password support],
2242 if test "x$withval" = "xno" ; then
2243 AC_DEFINE(DISABLE_SHADOW)
2249 if test -z "$disable_shadow" ; then
2250 AC_MSG_CHECKING([if the systems has expire shadow information])
2253 #include <sys/types.h>
2256 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2257 [ sp_expire_available=yes ], []
2260 if test "x$sp_expire_available" = "xyes" ; then
2262 AC_DEFINE(HAS_SHADOW_EXPIRE)
2268 # Use ip address instead of hostname in $DISPLAY
2269 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2270 DISPLAY_HACK_MSG="yes"
2271 AC_DEFINE(IPADDR_IN_DISPLAY)
2273 DISPLAY_HACK_MSG="no"
2274 AC_ARG_WITH(ipaddr-display,
2275 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2277 if test "x$withval" != "xno" ; then
2278 AC_DEFINE(IPADDR_IN_DISPLAY)
2279 DISPLAY_HACK_MSG="yes"
2285 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2286 if test $ac_cv_func_login_getcapbool = "yes" -a \
2287 $ac_cv_header_login_cap_h = "yes" ; then
2290 # Whether to mess with the default path
2291 SERVER_PATH_MSG="(default)"
2292 AC_ARG_WITH(default-path,
2293 [ --with-default-path= Specify default \$PATH environment for server],
2295 if test "$USES_LOGIN_CONF" = "yes" ; then
2297 --with-default-path=PATH has no effect on this system.
2298 Edit /etc/login.conf instead.])
2299 elif test "x$withval" != "xno" ; then
2300 user_path="$withval"
2301 SERVER_PATH_MSG="$withval"
2304 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2305 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2309 /* find out what STDPATH is */
2314 #ifndef _PATH_STDPATH
2315 # ifdef _PATH_USERPATH /* Irix */
2316 # define _PATH_STDPATH _PATH_USERPATH
2318 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2321 #include <sys/types.h>
2322 #include <sys/stat.h>
2324 #define DATA "conftest.stdpath"
2331 fd = fopen(DATA,"w");
2335 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2340 ], [ user_path=`cat conftest.stdpath` ],
2341 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2342 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2344 # make sure $bindir is in USER_PATH so scp will work
2345 t_bindir=`eval echo ${bindir}`
2347 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2350 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2352 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2353 if test $? -ne 0 ; then
2354 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2355 if test $? -ne 0 ; then
2356 user_path=$user_path:$t_bindir
2357 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2362 if test "$USES_LOGIN_CONF" != "yes" ; then
2363 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2367 # Set superuser path separately to user path
2368 AC_ARG_WITH(superuser-path,
2369 [ --with-superuser-path= Specify different path for super-user],
2371 if test "x$withval" != "xno" ; then
2372 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2373 superuser_path=$withval
2379 # Whether to force IPv4 by default (needed on broken glibc Linux)
2381 AC_ARG_WITH(ipv4-default,
2382 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2384 if test "x$withval" != "xno" ; then
2385 AC_DEFINE(IPV4_DEFAULT)
2391 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2392 IPV4_IN6_HACK_MSG="no"
2394 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2396 if test "x$withval" != "xno" ; then
2398 AC_DEFINE(IPV4_IN_IPV6)
2399 IPV4_IN6_HACK_MSG="yes"
2404 if test "x$inet6_default_4in6" = "xyes"; then
2405 AC_MSG_RESULT([yes (default)])
2406 AC_DEFINE(IPV4_IN_IPV6)
2407 IPV4_IN6_HACK_MSG="yes"
2409 AC_MSG_RESULT([no (default)])
2414 # Whether to enable BSD auth support
2416 AC_ARG_WITH(bsd-auth,
2417 [ --with-bsd-auth Enable BSD auth support],
2419 if test "x$withval" != "xno" ; then
2426 # Where to place sshd.pid
2428 # make sure the directory exists
2429 if test ! -d $piddir ; then
2430 piddir=`eval echo ${sysconfdir}`
2432 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2436 AC_ARG_WITH(pid-dir,
2437 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2439 if test "x$withval" != "xno" ; then
2441 if test ! -d $piddir ; then
2442 AC_MSG_WARN([** no $piddir directory on this system **])
2448 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2451 dnl allow user to disable some login recording features
2452 AC_ARG_ENABLE(lastlog,
2453 [ --disable-lastlog disable use of lastlog even if detected [no]],
2454 [ AC_DEFINE(DISABLE_LASTLOG) ]
2457 [ --disable-utmp disable use of utmp even if detected [no]],
2458 [ AC_DEFINE(DISABLE_UTMP) ]
2460 AC_ARG_ENABLE(utmpx,
2461 [ --disable-utmpx disable use of utmpx even if detected [no]],
2462 [ AC_DEFINE(DISABLE_UTMPX) ]
2465 [ --disable-wtmp disable use of wtmp even if detected [no]],
2466 [ AC_DEFINE(DISABLE_WTMP) ]
2468 AC_ARG_ENABLE(wtmpx,
2469 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2470 [ AC_DEFINE(DISABLE_WTMPX) ]
2472 AC_ARG_ENABLE(libutil,
2473 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2474 [ AC_DEFINE(DISABLE_LOGIN) ]
2476 AC_ARG_ENABLE(pututline,
2477 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2478 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2480 AC_ARG_ENABLE(pututxline,
2481 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2482 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2484 AC_ARG_WITH(lastlog,
2485 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2487 if test "x$withval" = "xno" ; then
2488 AC_DEFINE(DISABLE_LASTLOG)
2490 conf_lastlog_location=$withval
2495 dnl lastlog, [uw]tmpx? detection
2496 dnl NOTE: set the paths in the platform section to avoid the
2497 dnl need for command-line parameters
2498 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2500 dnl lastlog detection
2501 dnl NOTE: the code itself will detect if lastlog is a directory
2502 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2504 #include <sys/types.h>
2506 #ifdef HAVE_LASTLOG_H
2507 # include <lastlog.h>
2516 [ char *lastlog = LASTLOG_FILE; ],
2517 [ AC_MSG_RESULT(yes) ],
2520 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2522 #include <sys/types.h>
2524 #ifdef HAVE_LASTLOG_H
2525 # include <lastlog.h>
2531 [ char *lastlog = _PATH_LASTLOG; ],
2532 [ AC_MSG_RESULT(yes) ],
2535 system_lastlog_path=no
2540 if test -z "$conf_lastlog_location"; then
2541 if test x"$system_lastlog_path" = x"no" ; then
2542 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2543 if (test -d "$f" || test -f "$f") ; then
2544 conf_lastlog_location=$f
2547 if test -z "$conf_lastlog_location"; then
2548 AC_MSG_WARN([** Cannot find lastlog **])
2549 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2554 if test -n "$conf_lastlog_location"; then
2555 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2559 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2561 #include <sys/types.h>
2567 [ char *utmp = UTMP_FILE; ],
2568 [ AC_MSG_RESULT(yes) ],
2570 system_utmp_path=no ]
2572 if test -z "$conf_utmp_location"; then
2573 if test x"$system_utmp_path" = x"no" ; then
2574 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2575 if test -f $f ; then
2576 conf_utmp_location=$f
2579 if test -z "$conf_utmp_location"; then
2580 AC_DEFINE(DISABLE_UTMP)
2584 if test -n "$conf_utmp_location"; then
2585 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2589 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2591 #include <sys/types.h>
2597 [ char *wtmp = WTMP_FILE; ],
2598 [ AC_MSG_RESULT(yes) ],
2600 system_wtmp_path=no ]
2602 if test -z "$conf_wtmp_location"; then
2603 if test x"$system_wtmp_path" = x"no" ; then
2604 for f in /usr/adm/wtmp /var/log/wtmp; do
2605 if test -f $f ; then
2606 conf_wtmp_location=$f
2609 if test -z "$conf_wtmp_location"; then
2610 AC_DEFINE(DISABLE_WTMP)
2614 if test -n "$conf_wtmp_location"; then
2615 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2619 dnl utmpx detection - I don't know any system so perverse as to require
2620 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2622 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2624 #include <sys/types.h>
2633 [ char *utmpx = UTMPX_FILE; ],
2634 [ AC_MSG_RESULT(yes) ],
2636 system_utmpx_path=no ]
2638 if test -z "$conf_utmpx_location"; then
2639 if test x"$system_utmpx_path" = x"no" ; then
2640 AC_DEFINE(DISABLE_UTMPX)
2643 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2647 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2649 #include <sys/types.h>
2658 [ char *wtmpx = WTMPX_FILE; ],
2659 [ AC_MSG_RESULT(yes) ],
2661 system_wtmpx_path=no ]
2663 if test -z "$conf_wtmpx_location"; then
2664 if test x"$system_wtmpx_path" = x"no" ; then
2665 AC_DEFINE(DISABLE_WTMPX)
2668 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2672 if test ! -z "$blibpath" ; then
2673 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2674 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2677 dnl remove pam and dl because they are in $LIBPAM
2678 if test "$PAM_MSG" = yes ; then
2679 LIBS=`echo $LIBS | sed 's/-lpam //'`
2681 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2682 LIBS=`echo $LIBS | sed 's/-ldl //'`
2686 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2689 # Print summary of options
2691 # Someone please show me a better way :)
2692 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2693 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2694 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2695 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2696 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2697 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2698 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2699 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2700 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2701 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2704 echo "OpenSSH has been configured with the following options:"
2705 echo " User binaries: $B"
2706 echo " System binaries: $C"
2707 echo " Configuration files: $D"
2708 echo " Askpass program: $E"
2709 echo " Manual pages: $F"
2710 echo " PID file: $G"
2711 echo " Privilege separation chroot path: $H"
2712 if test "$USES_LOGIN_CONF" = "yes" ; then
2713 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2715 echo " sshd default user PATH: $I"
2717 if test ! -z "$superuser_path" ; then
2718 echo " sshd superuser user PATH: $J"
2720 echo " Manpage format: $MANTYPE"
2721 echo " PAM support: ${PAM_MSG}"
2722 echo " KerberosIV support: $KRB4_MSG"
2723 echo " KerberosV support: $KRB5_MSG"
2724 echo " Smartcard support: $SCARD_MSG"
2725 echo " AFS support: $AFS_MSG"
2726 echo " S/KEY support: $SKEY_MSG"
2727 echo " TCP Wrappers support: $TCPW_MSG"
2728 echo " MD5 password support: $MD5_MSG"
2729 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2730 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2731 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2732 echo " BSD Auth support: $BSD_AUTH_MSG"
2733 echo " Random number source: $RAND_MSG"
2734 if test ! -z "$USE_RAND_HELPER" ; then
2735 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2740 echo " Host: ${host}"
2741 echo " Compiler: ${CC}"
2742 echo " Compiler flags: ${CFLAGS}"
2743 echo "Preprocessor flags: ${CPPFLAGS}"
2744 echo " Linker flags: ${LDFLAGS}"
2745 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2749 if test "x$PAM_MSG" = "xyes" ; then
2750 echo "PAM is enabled. You may need to install a PAM control file "
2751 echo "for sshd, otherwise password authentication may fail. "
2752 echo "Example PAM control files can be found in the contrib/ "
2757 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2758 echo "WARNING: you are using the builtin random number collection "
2759 echo "service. Please read WARNING.RNG and request that your OS "
2760 echo "vendor includes kernel-based random number collection in "
2761 echo "future versions of your OS."