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 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
61 if (test -z "$blibpath"); then
62 blibpath="/usr/lib:/lib:/usr/local/lib"
64 saved_LDFLAGS="$LDFLAGS"
65 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
66 if (test -z "$blibflags"); then
67 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
68 AC_TRY_LINK([], [], [blibflags=$tryflags])
71 if (test -z "$blibflags"); then
72 AC_MSG_RESULT(not found)
73 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
75 AC_MSG_RESULT($blibflags)
77 LDFLAGS="$saved_LDFLAGS"
78 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
79 [AC_CHECK_LIB(s,authenticate,
80 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
84 AC_DEFINE(BROKEN_GETADDRINFO)
85 AC_DEFINE(BROKEN_REALPATH)
86 dnl AIX handles lastlog as part of its login message
87 AC_DEFINE(DISABLE_LASTLOG)
88 AC_DEFINE(LOGIN_NEEDS_UTMPX)
89 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
92 check_for_libcrypt_later=1
93 LIBS="$LIBS /usr/lib/textmode.o"
94 AC_DEFINE(HAVE_CYGWIN)
96 AC_DEFINE(DISABLE_SHADOW)
97 AC_DEFINE(IP_TOS_IS_BROKEN)
98 AC_DEFINE(NO_X11_UNIX_SOCKETS)
99 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
100 AC_DEFINE(DISABLE_FD_PASSING)
101 AC_DEFINE(SETGROUPS_NOOP)
104 AC_DEFINE(IP_TOS_IS_BROKEN)
107 AC_MSG_CHECKING(if we have working getaddrinfo)
108 AC_TRY_RUN([#include <mach-o/dyld.h>
109 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
113 }], [AC_MSG_RESULT(working)],
114 [AC_MSG_RESULT(buggy)
115 AC_DEFINE(BROKEN_GETADDRINFO)],
116 [AC_MSG_RESULT(assume it is working)])
119 if test -z "$GCC"; then
122 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
123 IPADDR_IN_DISPLAY=yes
124 AC_DEFINE(HAVE_SECUREWARE)
126 AC_DEFINE(LOGIN_NO_ENDOPT)
127 AC_DEFINE(LOGIN_NEEDS_UTMPX)
128 AC_DEFINE(DISABLE_SHADOW)
129 AC_DEFINE(DISABLE_UTMP)
130 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
131 LIBS="$LIBS -lsec -lsecpw"
132 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
133 disable_ptmx_check=yes
136 if test -z "$GCC"; then
139 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
140 IPADDR_IN_DISPLAY=yes
142 AC_DEFINE(LOGIN_NO_ENDOPT)
143 AC_DEFINE(LOGIN_NEEDS_UTMPX)
144 AC_DEFINE(DISABLE_SHADOW)
145 AC_DEFINE(DISABLE_UTMP)
146 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
148 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
151 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
152 IPADDR_IN_DISPLAY=yes
153 AC_DEFINE(PAM_SUN_CODEBASE)
155 AC_DEFINE(LOGIN_NO_ENDOPT)
156 AC_DEFINE(LOGIN_NEEDS_UTMPX)
157 AC_DEFINE(DISABLE_SHADOW)
158 AC_DEFINE(DISABLE_UTMP)
159 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
161 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
164 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
166 PATH="$PATH:/usr/etc"
167 AC_DEFINE(BROKEN_INET_NTOA)
168 AC_DEFINE(WITH_ABBREV_NO_TTY)
171 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
173 PATH="$PATH:/usr/etc"
174 AC_DEFINE(WITH_IRIX_ARRAY)
175 AC_DEFINE(WITH_IRIX_PROJECT)
176 AC_DEFINE(WITH_IRIX_AUDIT)
177 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
178 AC_DEFINE(BROKEN_INET_NTOA)
179 AC_DEFINE(WITH_ABBREV_NO_TTY)
183 check_for_libcrypt_later=1
184 AC_DEFINE(DONT_TRY_OTHER_AF)
185 AC_DEFINE(PAM_TTY_KLUDGE)
186 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
187 inet6_default_4in6=yes
188 # openpty can be in libutil, needed for controlling tty test
189 AC_SEARCH_LIBS(openpty, util)
190 # make sure that openpty does not reacquire controlling terminal
191 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
195 #include <sys/fcntl.h>
196 #include <sys/types.h>
197 #include <sys/wait.h>
203 int fd, ptyfd, ttyfd, status;
206 if (pid < 0) { /* failed */
208 } else if (pid > 0) { /* parent */
209 waitpid(pid, &status, 0);
210 if (WIFEXITED(status))
211 exit(WEXITSTATUS(status));
215 close(0); close(1); close(2);
217 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
218 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
220 exit(3); /* Acquired ctty: broken */
222 exit(0); /* Did not acquire ctty: OK */
231 AC_DEFINE(SSHD_ACQUIRES_CTTY)
236 AC_DEFINE(BROKEN_CMSG_TYPE)
240 mips-sony-bsd|mips-sony-newsos4)
241 AC_DEFINE(HAVE_NEWS4)
245 check_for_libcrypt_before=1
249 check_for_libcrypt_later=1
252 conf_lastlog_location="/usr/adm/lastlog"
253 conf_utmp_location=/etc/utmp
254 conf_wtmp_location=/usr/adm/wtmp
257 AC_DEFINE(BROKEN_REALPATH)
259 AC_DEFINE(BROKEN_SAVED_UIDS)
260 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
264 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
265 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
267 AC_DEFINE(PAM_SUN_CODEBASE)
268 AC_DEFINE(LOGIN_NEEDS_UTMPX)
269 AC_DEFINE(LOGIN_NEEDS_TERM)
270 AC_DEFINE(PAM_TTY_KLUDGE)
271 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
272 AC_DEFINE(SSHD_ACQUIRES_CTTY)
273 # hardwire lastlog location (can't detect it on some versions)
274 conf_lastlog_location="/var/adm/lastlog"
275 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
276 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
277 if test "$sol2ver" -ge 8; then
279 AC_DEFINE(DISABLE_UTMP)
280 AC_DEFINE(DISABLE_WTMP)
286 CPPFLAGS="$CPPFLAGS -DSUNOS4"
287 AC_CHECK_FUNCS(getpwanam)
288 AC_DEFINE(PAM_SUN_CODEBASE)
289 conf_utmp_location=/etc/utmp
290 conf_wtmp_location=/var/adm/wtmp
291 conf_lastlog_location=/var/adm/lastlog
295 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
296 LDFLAGS="$LDFLAGS -L/usr/local/lib"
299 AC_DEFINE(SSHD_ACQUIRES_CTTY)
302 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
303 # /usr/ucblib MUST NOT be searched on ReliantUNIX
304 LDFLAGS="$LDFLAGS -L/usr/local/lib"
305 IPADDR_IN_DISPLAY=yes
307 AC_DEFINE(IP_TOS_IS_BROKEN)
308 AC_DEFINE(SSHD_ACQUIRES_CTTY)
309 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
310 # Attention: always take care to bind libsocket and libnsl before libc,
311 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
314 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
315 LDFLAGS="$LDFLAGS -L/usr/local/lib"
319 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
320 LDFLAGS="$LDFLAGS -L/usr/local/lib"
324 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
325 LDFLAGS="$LDFLAGS -L/usr/local/lib"
328 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
329 LDFLAGS="$LDFLAGS -L/usr/local/lib"
330 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
333 AC_DEFINE(BROKEN_SYS_TERMIO_H)
335 AC_DEFINE(HAVE_SECUREWARE)
336 AC_DEFINE(DISABLE_SHADOW)
337 AC_DEFINE(BROKEN_SAVED_UIDS)
338 AC_CHECK_FUNCS(getluid setluid)
340 do_sco3_extra_lib_check=yes
343 if test -z "$GCC"; then
344 CFLAGS="$CFLAGS -belf"
346 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
347 LDFLAGS="$LDFLAGS -L/usr/local/lib"
348 LIBS="$LIBS -lprot -lx -ltinfo -lm"
351 AC_DEFINE(HAVE_SECUREWARE)
352 AC_DEFINE(DISABLE_SHADOW)
353 AC_DEFINE(DISABLE_FD_PASSING)
354 AC_CHECK_FUNCS(getluid setluid)
359 AC_DEFINE(DISABLE_FD_PASSING)
361 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
366 AC_DEFINE(DISABLE_FD_PASSING)
367 AC_DEFINE(NO_SSH_LASTLOG)
368 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
369 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
373 AC_MSG_CHECKING(for Digital Unix SIA)
376 [ --with-osfsia Enable Digital Unix SIA],
378 if test "x$withval" = "xno" ; then
379 AC_MSG_RESULT(disabled)
384 if test -z "$no_osfsia" ; then
385 if test -f /etc/sia/matrix.conf; then
387 AC_DEFINE(HAVE_OSF_SIA)
388 AC_DEFINE(DISABLE_LOGIN)
389 AC_DEFINE(DISABLE_FD_PASSING)
390 LIBS="$LIBS -lsecurity -ldb -lm -laud"
395 AC_DEFINE(DISABLE_FD_PASSING)
400 AC_DEFINE(NO_X11_UNIX_SOCKETS)
401 AC_DEFINE(MISSING_NFDBITS)
402 AC_DEFINE(MISSING_HOWMANY)
403 AC_DEFINE(MISSING_FD_MASK)
407 # Allow user to specify flags
409 [ --with-cflags Specify additional flags to pass to compiler],
411 if test "x$withval" != "xno" ; then
412 CFLAGS="$CFLAGS $withval"
416 AC_ARG_WITH(cppflags,
417 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
419 if test "x$withval" != "xno"; then
420 CPPFLAGS="$CPPFLAGS $withval"
425 [ --with-ldflags Specify additional flags to pass to linker],
427 if test "x$withval" != "xno" ; then
428 LDFLAGS="$LDFLAGS $withval"
433 [ --with-libs Specify additional libraries to link with],
435 if test "x$withval" != "xno" ; then
436 LIBS="$LIBS $withval"
441 AC_MSG_CHECKING(compiler and flags for sanity)
446 [ AC_MSG_RESULT(yes) ],
449 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
453 # Checks for header files.
454 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
455 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
456 login_cap.h maillock.h netdb.h netgroup.h \
457 netinet/in_systm.h paths.h pty.h readpassphrase.h \
458 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
459 strings.h sys/strtio.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
460 sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
461 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
462 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
463 util.h utime.h utmp.h utmpx.h)
465 # Checks for libraries.
466 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
467 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
469 dnl SCO OS3 needs this for libwrap
470 if test "x$with_tcp_wrappers" != "xno" ; then
471 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
472 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
476 AC_CHECK_FUNC(getspnam, ,
477 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
480 [ --without-rpath Disable auto-added -R linker paths],
482 if test "x$withval" = "xno" ; then
485 if test "x$withval" = "xyes" ; then
493 [ --with-zlib=PATH Use zlib in PATH],
495 if test "x$withval" = "xno" ; then
496 AC_MSG_ERROR([*** zlib is required ***])
498 if test -d "$withval/lib"; then
499 if test -n "${need_dash_r}"; then
500 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
502 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
505 if test -n "${need_dash_r}"; then
506 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
508 LDFLAGS="-L${withval} ${LDFLAGS}"
511 if test -d "$withval/include"; then
512 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
514 CPPFLAGS="-I${withval} ${CPPFLAGS}"
519 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
522 AC_CHECK_FUNC(strcasecmp,
523 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
525 AC_CHECK_FUNC(utimes,
526 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
527 LIBS="$LIBS -lc89"]) ]
530 dnl Checks for libutil functions
531 AC_CHECK_HEADERS(libutil.h)
532 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
533 AC_CHECK_FUNCS(logout updwtmp logwtmp)
537 # Check for ALTDIRFUNC glob() extension
538 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
539 AC_EGREP_CPP(FOUNDIT,
542 #ifdef GLOB_ALTDIRFUNC
547 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
555 # Check for g.gl_matchc glob() extension
556 AC_MSG_CHECKING(for gl_matchc field in glob_t)
557 AC_EGREP_CPP(FOUNDIT,
560 int main(void){glob_t g; g.gl_matchc = 1;}
563 AC_DEFINE(GLOB_HAS_GL_MATCHC)
571 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
574 #include <sys/types.h>
576 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
578 [AC_MSG_RESULT(yes)],
581 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
585 # Check whether user wants S/Key support
588 [ --with-skey[[=PATH]] Enable S/Key support
589 (optionally in PATH)],
591 if test "x$withval" != "xno" ; then
593 if test "x$withval" != "xyes" ; then
594 CPPFLAGS="$CPPFLAGS -I${withval}/include"
595 LDFLAGS="$LDFLAGS -L${withval}/lib"
602 AC_MSG_CHECKING([for s/key support])
607 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
609 [AC_MSG_RESULT(yes)],
612 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
618 # Check whether user wants TCP wrappers support
620 AC_ARG_WITH(tcp-wrappers,
621 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
622 (optionally in PATH)],
624 if test "x$withval" != "xno" ; then
626 saved_LDFLAGS="$LDFLAGS"
627 saved_CPPFLAGS="$CPPFLAGS"
628 if test -n "${withval}" -a "${withval}" != "yes"; then
629 if test -d "${withval}/lib"; then
630 if test -n "${need_dash_r}"; then
631 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
633 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
636 if test -n "${need_dash_r}"; then
637 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
639 LDFLAGS="-L${withval} ${LDFLAGS}"
642 if test -d "${withval}/include"; then
643 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
645 CPPFLAGS="-I${withval} ${CPPFLAGS}"
649 LIBS="$LIBWRAP $LIBS"
650 AC_MSG_CHECKING(for libwrap)
654 int deny_severity = 0, allow_severity = 0;
664 AC_MSG_ERROR([*** libwrap missing])
672 dnl Checks for library functions. Please keep in alphabetical order
674 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
675 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
676 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
677 getpeereid _getpty getrlimit getttyent glob inet_aton \
678 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
679 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
680 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
681 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
682 setproctitle setregid setresgid setresuid setreuid setrlimit \
683 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
684 strlcat strlcpy strmode strnvis sysconf tcgetpgrp truncate utimes \
685 vhangup vsnprintf waitpid \
688 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
689 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
691 dnl Make sure prototypes are defined for these before using them.
692 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
693 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
695 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
696 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
697 AC_CHECK_LIB(gen, dirname,[
698 AC_CACHE_CHECK([for broken dirname],
699 ac_cv_have_broken_dirname, [
707 int main(int argc, char **argv) {
710 strncpy(buf,"/etc", 32);
712 if (!s || strncmp(s, "/", 32) != 0) {
719 [ ac_cv_have_broken_dirname="no" ],
720 [ ac_cv_have_broken_dirname="yes" ]
724 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
726 AC_DEFINE(HAVE_DIRNAME)
727 AC_CHECK_HEADERS(libgen.h)
732 dnl Checks for time functions
733 AC_CHECK_FUNCS(gettimeofday time)
734 dnl Checks for utmp functions
735 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
736 AC_CHECK_FUNCS(utmpname)
737 dnl Checks for utmpx functions
738 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
739 AC_CHECK_FUNCS(setutxent utmpxname)
741 AC_CHECK_FUNC(daemon,
742 [AC_DEFINE(HAVE_DAEMON)],
743 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
746 AC_CHECK_FUNC(getpagesize,
747 [AC_DEFINE(HAVE_GETPAGESIZE)],
748 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
751 # Check for broken snprintf
752 if test "x$ac_cv_func_snprintf" = "xyes" ; then
753 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
757 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
759 [AC_MSG_RESULT(yes)],
762 AC_DEFINE(BROKEN_SNPRINTF)
763 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
768 dnl see whether mkstemp() requires XXXXXX
769 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
770 AC_MSG_CHECKING([for (overly) strict mkstemp])
774 main() { char template[]="conftest.mkstemp-test";
775 if (mkstemp(template) == -1)
777 unlink(template); exit(0);
785 AC_DEFINE(HAVE_STRICT_MKSTEMP)
789 AC_DEFINE(HAVE_STRICT_MKSTEMP)
799 [ --with-pam Enable PAM support ],
801 if test "x$withval" != "xno" ; then
802 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
803 AC_MSG_ERROR([PAM headers not found])
806 AC_CHECK_LIB(dl, dlopen, , )
807 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
808 AC_CHECK_FUNCS(pam_getenvlist)
814 if test $ac_cv_lib_dl_dlopen = yes; then
824 # Check for older PAM
825 if test "x$PAM_MSG" = "xyes" ; then
826 # Check PAM strerror arguments (old PAM)
827 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
831 #include <security/pam_appl.h>
833 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
836 AC_DEFINE(HAVE_OLD_PAM)
838 PAM_MSG="yes (old library)"
843 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
844 # because the system crypt() is more featureful.
845 if test "x$check_for_libcrypt_before" = "x1"; then
846 AC_CHECK_LIB(crypt, crypt)
850 saved_CPPFLAGS="$CPPFLAGS"
851 saved_LDFLAGS="$LDFLAGS"
853 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
855 if test "x$withval" != "xno" ; then
856 if test -d "$withval/lib"; then
857 if test -n "${need_dash_r}"; then
858 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
860 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
863 if test -n "${need_dash_r}"; then
864 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
866 LDFLAGS="-L${withval} ${LDFLAGS}"
869 if test -d "$withval/include"; then
870 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
872 CPPFLAGS="-I${withval} ${CPPFLAGS}"
877 LIBS="$LIBS -lcrypto"
878 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
880 dnl Check default openssl install dir
881 if test -n "${need_dash_r}"; then
882 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
884 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
886 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
887 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
889 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
895 # Determine OpenSSL header version
896 AC_MSG_CHECKING([OpenSSL header version])
901 #include <openssl/opensslv.h>
902 #define DATA "conftest.sslincver"
907 fd = fopen(DATA,"w");
911 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
918 ssl_header_ver=`cat conftest.sslincver`
919 AC_MSG_RESULT($ssl_header_ver)
922 AC_MSG_RESULT(not found)
923 AC_MSG_ERROR(OpenSSL version header not found.)
927 # Determine OpenSSL library version
928 AC_MSG_CHECKING([OpenSSL library version])
933 #include <openssl/opensslv.h>
934 #include <openssl/crypto.h>
935 #define DATA "conftest.ssllibver"
940 fd = fopen(DATA,"w");
944 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
951 ssl_library_ver=`cat conftest.ssllibver`
952 AC_MSG_RESULT($ssl_library_ver)
955 AC_MSG_RESULT(not found)
956 AC_MSG_ERROR(OpenSSL library not found.)
960 # Sanity check OpenSSL headers
961 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
965 #include <openssl/opensslv.h>
966 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
973 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
974 Check config.log for details.
975 Also see contrib/findssl.sh for help identifying header/library mismatches.])
979 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
980 # version in OpenSSL. Skip this for PAM
981 if test "x$check_for_libcrypt_later" = "x1"; then
982 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
986 ### Configure cryptographic random number support
988 # Check wheter OpenSSL seeds itself
989 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
993 #include <openssl/rand.h>
994 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
997 OPENSSL_SEEDS_ITSELF=yes
1002 # Default to use of the rand helper if OpenSSL doesn't
1009 # Do we want to force the use of the rand helper?
1010 AC_ARG_WITH(rand-helper,
1011 [ --with-rand-helper Use subprocess to gather strong randomness ],
1013 if test "x$withval" = "xno" ; then
1014 # Force use of OpenSSL's internal RNG, even if
1015 # the previous test showed it to be unseeded.
1016 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1017 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1018 OPENSSL_SEEDS_ITSELF=yes
1027 # Which randomness source do we use?
1028 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1030 AC_DEFINE(OPENSSL_PRNG_ONLY)
1031 RAND_MSG="OpenSSL internal ONLY"
1032 INSTALL_SSH_RAND_HELPER=""
1033 elif test ! -z "$USE_RAND_HELPER" ; then
1034 # install rand helper
1035 RAND_MSG="ssh-rand-helper"
1036 INSTALL_SSH_RAND_HELPER="yes"
1038 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1040 ### Configuration of ssh-rand-helper
1043 AC_ARG_WITH(prngd-port,
1044 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1053 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1056 if test ! -z "$withval" ; then
1057 PRNGD_PORT="$withval"
1058 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1063 # PRNGD Unix domain socket
1064 AC_ARG_WITH(prngd-socket,
1065 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1069 withval="/var/run/egd-pool"
1077 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1081 if test ! -z "$withval" ; then
1082 if test ! -z "$PRNGD_PORT" ; then
1083 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1085 if test ! -r "$withval" ; then
1086 AC_MSG_WARN(Entropy socket is not readable)
1088 PRNGD_SOCKET="$withval"
1089 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1093 # Check for existing socket only if we don't have a random device already
1094 if test "$USE_RAND_HELPER" = yes ; then
1095 AC_MSG_CHECKING(for PRNGD/EGD socket)
1096 # Insert other locations here
1097 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1098 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1099 PRNGD_SOCKET="$sock"
1100 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1104 if test ! -z "$PRNGD_SOCKET" ; then
1105 AC_MSG_RESULT($PRNGD_SOCKET)
1107 AC_MSG_RESULT(not found)
1113 # Change default command timeout for hashing entropy source
1115 AC_ARG_WITH(entropy-timeout,
1116 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1118 if test "x$withval" != "xno" ; then
1119 entropy_timeout=$withval
1123 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1125 SSH_PRIVSEP_USER=sshd
1126 AC_ARG_WITH(privsep-user,
1127 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1129 if test -n "$withval"; then
1130 SSH_PRIVSEP_USER=$withval
1134 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1135 AC_SUBST(SSH_PRIVSEP_USER)
1137 # We do this little dance with the search path to insure
1138 # that programs that we select for use by installed programs
1139 # (which may be run by the super-user) come from trusted
1140 # locations before they come from the user's private area.
1141 # This should help avoid accidentally configuring some
1142 # random version of a program in someone's personal bin.
1146 test -h /bin 2> /dev/null && PATH=/usr/bin
1147 test -d /sbin && PATH=$PATH:/sbin
1148 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1149 PATH=$PATH:/etc:$OPATH
1151 # These programs are used by the command hashing source to gather entropy
1152 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1153 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1154 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1155 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1156 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1157 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1158 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1159 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1160 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1161 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1162 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1163 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1164 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1165 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1166 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1167 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1171 # Where does ssh-rand-helper get its randomness from?
1172 INSTALL_SSH_PRNG_CMDS=""
1173 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1174 if test ! -z "$PRNGD_PORT" ; then
1175 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1176 elif test ! -z "$PRNGD_SOCKET" ; then
1177 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1179 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1180 RAND_HELPER_CMDHASH=yes
1181 INSTALL_SSH_PRNG_CMDS="yes"
1184 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1187 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1188 if test ! -z "$SONY" ; then
1189 LIBS="$LIBS -liberty";
1192 # Checks for data types
1193 AC_CHECK_SIZEOF(char, 1)
1194 AC_CHECK_SIZEOF(short int, 2)
1195 AC_CHECK_SIZEOF(int, 4)
1196 AC_CHECK_SIZEOF(long int, 4)
1197 AC_CHECK_SIZEOF(long long int, 8)
1199 # Sanity check long long for some platforms (AIX)
1200 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1201 ac_cv_sizeof_long_long_int=0
1204 # More checks for data types
1205 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1207 [ #include <sys/types.h> ],
1209 [ ac_cv_have_u_int="yes" ],
1210 [ ac_cv_have_u_int="no" ]
1213 if test "x$ac_cv_have_u_int" = "xyes" ; then
1214 AC_DEFINE(HAVE_U_INT)
1218 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1220 [ #include <sys/types.h> ],
1221 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1222 [ ac_cv_have_intxx_t="yes" ],
1223 [ ac_cv_have_intxx_t="no" ]
1226 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1227 AC_DEFINE(HAVE_INTXX_T)
1231 if (test -z "$have_intxx_t" && \
1232 test "x$ac_cv_header_stdint_h" = "xyes")
1234 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1236 [ #include <stdint.h> ],
1237 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1239 AC_DEFINE(HAVE_INTXX_T)
1242 [ AC_MSG_RESULT(no) ]
1246 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1249 #include <sys/types.h>
1250 #ifdef HAVE_STDINT_H
1251 # include <stdint.h>
1253 #include <sys/socket.h>
1254 #ifdef HAVE_SYS_BITYPES_H
1255 # include <sys/bitypes.h>
1258 [ int64_t a; a = 1;],
1259 [ ac_cv_have_int64_t="yes" ],
1260 [ ac_cv_have_int64_t="no" ]
1263 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1264 AC_DEFINE(HAVE_INT64_T)
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 AC_CHECK_TYPES(struct timespec)
1561 # We need int64_t or else certian parts of the compile will fail.
1562 if test "x$ac_cv_have_int64_t" = "xno" -a \
1563 "x$ac_cv_sizeof_long_int" != "x8" -a \
1564 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1565 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1566 echo "an alternative compiler (I.E., GCC) before continuing."
1570 dnl test snprintf (broken on SCO w/gcc)
1575 #ifdef HAVE_SNPRINTF
1579 char expected_out[50];
1581 #if (SIZEOF_LONG_INT == 8)
1582 long int num = 0x7fffffffffffffff;
1584 long long num = 0x7fffffffffffffffll;
1586 strcpy(expected_out, "9223372036854775807");
1587 snprintf(buf, mazsize, "%lld", num);
1588 if(strcmp(buf, expected_out) != 0)
1595 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1599 dnl Checks for structure members
1600 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1601 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1602 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1603 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1604 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1605 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1606 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1607 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1608 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1609 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1610 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1611 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1612 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1613 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1614 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1615 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1616 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1618 AC_CHECK_MEMBERS([struct stat.st_blksize])
1620 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1621 ac_cv_have_ss_family_in_struct_ss, [
1624 #include <sys/types.h>
1625 #include <sys/socket.h>
1627 [ struct sockaddr_storage s; s.ss_family = 1; ],
1628 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1629 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1632 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1633 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1636 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1637 ac_cv_have___ss_family_in_struct_ss, [
1640 #include <sys/types.h>
1641 #include <sys/socket.h>
1643 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1644 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1645 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1648 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1649 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1652 AC_CACHE_CHECK([for pw_class field in struct passwd],
1653 ac_cv_have_pw_class_in_struct_passwd, [
1658 [ struct passwd p; p.pw_class = 0; ],
1659 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1660 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1663 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1664 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1667 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1668 ac_cv_have_pw_expire_in_struct_passwd, [
1673 [ struct passwd p; p.pw_expire = 0; ],
1674 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1675 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1678 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1679 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1682 AC_CACHE_CHECK([for pw_change field in struct passwd],
1683 ac_cv_have_pw_change_in_struct_passwd, [
1688 [ struct passwd p; p.pw_change = 0; ],
1689 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1690 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1693 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1694 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1697 dnl make sure we're using the real structure members and not defines
1698 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1699 ac_cv_have_accrights_in_msghdr, [
1702 #include <sys/types.h>
1703 #include <sys/socket.h>
1704 #include <sys/uio.h>
1706 #ifdef msg_accrights
1710 m.msg_accrights = 0;
1714 [ ac_cv_have_accrights_in_msghdr="yes" ],
1715 [ ac_cv_have_accrights_in_msghdr="no" ]
1718 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1719 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1722 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1723 ac_cv_have_control_in_msghdr, [
1726 #include <sys/types.h>
1727 #include <sys/socket.h>
1728 #include <sys/uio.h>
1738 [ ac_cv_have_control_in_msghdr="yes" ],
1739 [ ac_cv_have_control_in_msghdr="no" ]
1742 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1743 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1746 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1748 [ extern char *__progname; printf("%s", __progname); ],
1749 [ ac_cv_libc_defines___progname="yes" ],
1750 [ ac_cv_libc_defines___progname="no" ]
1753 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1754 AC_DEFINE(HAVE___PROGNAME)
1757 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1761 [ printf("%s", __FUNCTION__); ],
1762 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1763 [ ac_cv_cc_implements___FUNCTION__="no" ]
1766 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1767 AC_DEFINE(HAVE___FUNCTION__)
1770 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1774 [ printf("%s", __func__); ],
1775 [ ac_cv_cc_implements___func__="yes" ],
1776 [ ac_cv_cc_implements___func__="no" ]
1779 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1780 AC_DEFINE(HAVE___func__)
1783 AC_CACHE_CHECK([whether getopt has optreset support],
1784 ac_cv_have_getopt_optreset, [
1789 [ extern int optreset; optreset = 0; ],
1790 [ ac_cv_have_getopt_optreset="yes" ],
1791 [ ac_cv_have_getopt_optreset="no" ]
1794 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1795 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1798 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1800 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1801 [ ac_cv_libc_defines_sys_errlist="yes" ],
1802 [ ac_cv_libc_defines_sys_errlist="no" ]
1805 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1806 AC_DEFINE(HAVE_SYS_ERRLIST)
1810 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1812 [ extern int sys_nerr; printf("%i", sys_nerr);],
1813 [ ac_cv_libc_defines_sys_nerr="yes" ],
1814 [ ac_cv_libc_defines_sys_nerr="no" ]
1817 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1818 AC_DEFINE(HAVE_SYS_NERR)
1822 # Check whether user wants sectok support
1824 [ --with-sectok Enable smartcard support using libsectok],
1826 if test "x$withval" != "xno" ; then
1827 if test "x$withval" != "xyes" ; then
1828 CPPFLAGS="$CPPFLAGS -I${withval}"
1829 LDFLAGS="$LDFLAGS -L${withval}"
1830 if test ! -z "$need_dash_r" ; then
1831 LDFLAGS="$LDFLAGS -R${withval}"
1833 if test ! -z "$blibpath" ; then
1834 blibpath="$blibpath:${withval}"
1837 AC_CHECK_HEADERS(sectok.h)
1838 if test "$ac_cv_header_sectok_h" != yes; then
1839 AC_MSG_ERROR(Can't find sectok.h)
1841 AC_CHECK_LIB(sectok, sectok_open)
1842 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1843 AC_MSG_ERROR(Can't find libsectok)
1845 AC_DEFINE(SMARTCARD)
1846 AC_DEFINE(USE_SECTOK)
1847 SCARD_MSG="yes, using sectok"
1852 # Check whether user wants OpenSC support
1854 AC_HELP_STRING([--with-opensc=PFX],
1855 [Enable smartcard support using OpenSC]),
1856 opensc_config_prefix="$withval", opensc_config_prefix="")
1857 if test x$opensc_config_prefix != x ; then
1858 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1859 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1860 if test "$OPENSC_CONFIG" != "no"; then
1861 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1862 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1863 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1864 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1865 AC_DEFINE(SMARTCARD)
1866 AC_DEFINE(USE_OPENSC)
1867 SCARD_MSG="yes, using OpenSC"
1871 # Check whether user wants DNS support
1874 [ --with-dns Support for fetching keys from DNS (experimental)],
1876 if test "x$withval" != "xno" ; then
1879 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1880 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1882 # Needed by our getrrsetbyname()
1883 AC_SEARCH_LIBS(res_query, resolv)
1884 AC_SEARCH_LIBS(dn_expand, resolv)
1890 # Check whether user wants Kerberos 5 support
1892 AC_ARG_WITH(kerberos5,
1893 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1895 if test "x$withval" != "xno" ; then
1896 if test "x$withval" = "xyes" ; then
1897 KRB5ROOT="/usr/local"
1901 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1902 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1905 AC_MSG_CHECKING(whether we are using Heimdal)
1906 AC_TRY_COMPILE([ #include <krb5.h> ],
1907 [ char *tmp = heimdal_version; ],
1908 [ AC_MSG_RESULT(yes)
1910 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1913 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1916 if test ! -z "$need_dash_r" ; then
1917 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1919 if test ! -z "$blibpath" ; then
1920 blibpath="$blibpath:${KRB5ROOT}/lib"
1922 AC_SEARCH_LIBS(dn_expand, resolv)
1928 # Check whether user wants Kerberos 4 support
1930 AC_ARG_WITH(kerberos4,
1931 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1933 if test "x$withval" != "xno" ; then
1934 if test "x$withval" != "xyes" ; then
1935 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1936 LDFLAGS="$LDFLAGS -L${withval}/lib"
1937 if test ! -z "$need_dash_r" ; then
1938 LDFLAGS="$LDFLAGS -R${withval}/lib"
1940 if test ! -z "$blibpath" ; then
1941 blibpath="$blibpath:${withval}/lib"
1944 if test -d /usr/include/kerberosIV ; then
1945 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1949 AC_CHECK_HEADERS(krb.h)
1950 if test "$ac_cv_header_krb_h" != yes; then
1951 AC_MSG_WARN([Cannot find krb.h, build may fail])
1953 AC_CHECK_LIB(krb, main)
1954 if test "$ac_cv_lib_krb_main" != yes; then
1955 AC_CHECK_LIB(krb4, main)
1956 if test "$ac_cv_lib_krb4_main" != yes; then
1957 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1964 AC_CHECK_LIB(des, des_cbc_encrypt)
1965 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1966 AC_CHECK_LIB(des425, des_cbc_encrypt)
1967 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1968 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1975 AC_CHECK_LIB(resolv, dn_expand, , )
1983 # Check whether user wants AFS support
1986 [ --with-afs=PATH Enable AFS support],
1988 if test "x$withval" != "xno" ; then
1990 if test "x$withval" != "xyes" ; then
1991 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1992 LDFLAGS="$LDFLAGS -L${withval}/lib"
1995 if test -z "$KRB4" ; then
1996 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
2000 if test ! -z "$AFS_LIBS" ; then
2001 LIBS="$LIBS $AFS_LIBS"
2008 LIBS="$LIBS $KLIBS $K5LIBS"
2010 # Looking for programs, paths and files
2012 PRIVSEP_PATH=/var/empty
2013 AC_ARG_WITH(privsep-path,
2014 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2016 if test "x$withval" != "$no" ; then
2017 PRIVSEP_PATH=$withval
2021 AC_SUBST(PRIVSEP_PATH)
2024 [ --with-xauth=PATH Specify path to xauth program ],
2026 if test "x$withval" != "xno" ; then
2032 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2033 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2034 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2035 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2036 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2037 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2038 xauth_path="/usr/openwin/bin/xauth"
2044 AC_ARG_ENABLE(strip,
2045 [ --disable-strip Disable calling strip(1) on install],
2047 if test "x$enableval" = "xno" ; then
2054 if test -z "$xauth_path" ; then
2055 XAUTH_PATH="undefined"
2056 AC_SUBST(XAUTH_PATH)
2058 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2059 XAUTH_PATH=$xauth_path
2060 AC_SUBST(XAUTH_PATH)
2063 # Check for mail directory (last resort if we cannot get it from headers)
2064 if test ! -z "$MAIL" ; then
2065 maildir=`dirname $MAIL`
2066 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2069 if test -z "$no_dev_ptmx" ; then
2070 if test "x$disable_ptmx_check" != "xyes" ; then
2071 AC_CHECK_FILE("/dev/ptmx",
2073 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2079 AC_CHECK_FILE("/dev/ptc",
2081 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2086 # Options from here on. Some of these are preset by platform above
2087 AC_ARG_WITH(mantype,
2088 [ --with-mantype=man|cat|doc Set man page type],
2095 AC_MSG_ERROR(invalid man type: $withval)
2100 if test -z "$MANTYPE"; then
2101 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2102 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2103 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2105 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2112 if test "$MANTYPE" = "doc"; then
2119 # Check whether to enable MD5 passwords
2121 AC_ARG_WITH(md5-passwords,
2122 [ --with-md5-passwords Enable use of MD5 passwords],
2124 if test "x$withval" != "xno" ; then
2125 AC_DEFINE(HAVE_MD5_PASSWORDS)
2131 # Whether to disable shadow password support
2133 [ --without-shadow Disable shadow password support],
2135 if test "x$withval" = "xno" ; then
2136 AC_DEFINE(DISABLE_SHADOW)
2142 if test -z "$disable_shadow" ; then
2143 AC_MSG_CHECKING([if the systems has expire shadow information])
2146 #include <sys/types.h>
2149 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2150 [ sp_expire_available=yes ], []
2153 if test "x$sp_expire_available" = "xyes" ; then
2155 AC_DEFINE(HAS_SHADOW_EXPIRE)
2161 # Use ip address instead of hostname in $DISPLAY
2162 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2163 DISPLAY_HACK_MSG="yes"
2164 AC_DEFINE(IPADDR_IN_DISPLAY)
2166 DISPLAY_HACK_MSG="no"
2167 AC_ARG_WITH(ipaddr-display,
2168 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2170 if test "x$withval" != "xno" ; then
2171 AC_DEFINE(IPADDR_IN_DISPLAY)
2172 DISPLAY_HACK_MSG="yes"
2178 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2179 if test $ac_cv_func_login_getcapbool = "yes" -a \
2180 $ac_cv_header_login_cap_h = "yes" ; then
2183 # Whether to mess with the default path
2184 SERVER_PATH_MSG="(default)"
2185 AC_ARG_WITH(default-path,
2186 [ --with-default-path= Specify default \$PATH environment for server],
2188 if test "$USES_LOGIN_CONF" = "yes" ; then
2190 --with-default-path=PATH has no effect on this system.
2191 Edit /etc/login.conf instead.])
2192 elif test "x$withval" != "xno" ; then
2193 user_path="$withval"
2194 SERVER_PATH_MSG="$withval"
2197 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2198 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2202 /* find out what STDPATH is */
2207 #ifndef _PATH_STDPATH
2208 # ifdef _PATH_USERPATH /* Irix */
2209 # define _PATH_STDPATH _PATH_USERPATH
2211 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2214 #include <sys/types.h>
2215 #include <sys/stat.h>
2217 #define DATA "conftest.stdpath"
2224 fd = fopen(DATA,"w");
2228 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2233 ], [ user_path=`cat conftest.stdpath` ],
2234 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2235 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2237 # make sure $bindir is in USER_PATH so scp will work
2238 t_bindir=`eval echo ${bindir}`
2240 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2243 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2245 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2246 if test $? -ne 0 ; then
2247 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2248 if test $? -ne 0 ; then
2249 user_path=$user_path:$t_bindir
2250 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2255 if test "$USES_LOGIN_CONF" != "yes" ; then
2256 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2260 # Set superuser path separately to user path
2261 AC_ARG_WITH(superuser-path,
2262 [ --with-superuser-path= Specify different path for super-user],
2264 if test "x$withval" != "xno" ; then
2265 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2266 superuser_path=$withval
2272 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2273 IPV4_IN6_HACK_MSG="no"
2275 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2277 if test "x$withval" != "xno" ; then
2279 AC_DEFINE(IPV4_IN_IPV6)
2280 IPV4_IN6_HACK_MSG="yes"
2285 if test "x$inet6_default_4in6" = "xyes"; then
2286 AC_MSG_RESULT([yes (default)])
2287 AC_DEFINE(IPV4_IN_IPV6)
2288 IPV4_IN6_HACK_MSG="yes"
2290 AC_MSG_RESULT([no (default)])
2295 # Whether to enable BSD auth support
2297 AC_ARG_WITH(bsd-auth,
2298 [ --with-bsd-auth Enable BSD auth support],
2300 if test "x$withval" != "xno" ; then
2307 # Where to place sshd.pid
2309 # make sure the directory exists
2310 if test ! -d $piddir ; then
2311 piddir=`eval echo ${sysconfdir}`
2313 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2317 AC_ARG_WITH(pid-dir,
2318 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2320 if test "x$withval" != "xno" ; then
2322 if test ! -d $piddir ; then
2323 AC_MSG_WARN([** no $piddir directory on this system **])
2329 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2332 dnl allow user to disable some login recording features
2333 AC_ARG_ENABLE(lastlog,
2334 [ --disable-lastlog disable use of lastlog even if detected [no]],
2336 if test "x$enableval" = "xno" ; then
2337 AC_DEFINE(DISABLE_LASTLOG)
2342 [ --disable-utmp disable use of utmp even if detected [no]],
2344 if test "x$enableval" = "xno" ; then
2345 AC_DEFINE(DISABLE_UTMP)
2349 AC_ARG_ENABLE(utmpx,
2350 [ --disable-utmpx disable use of utmpx even if detected [no]],
2352 if test "x$enableval" = "xno" ; then
2353 AC_DEFINE(DISABLE_UTMPX)
2358 [ --disable-wtmp disable use of wtmp even if detected [no]],
2360 if test "x$enableval" = "xno" ; then
2361 AC_DEFINE(DISABLE_WTMP)
2365 AC_ARG_ENABLE(wtmpx,
2366 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2368 if test "x$enableval" = "xno" ; then
2369 AC_DEFINE(DISABLE_WTMPX)
2373 AC_ARG_ENABLE(libutil,
2374 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2376 if test "x$enableval" = "xno" ; then
2377 AC_DEFINE(DISABLE_LOGIN)
2381 AC_ARG_ENABLE(pututline,
2382 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2384 if test "x$enableval" = "xno" ; then
2385 AC_DEFINE(DISABLE_PUTUTLINE)
2389 AC_ARG_ENABLE(pututxline,
2390 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2392 if test "x$enableval" = "xno" ; then
2393 AC_DEFINE(DISABLE_PUTUTXLINE)
2397 AC_ARG_WITH(lastlog,
2398 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2400 if test "x$withval" = "xno" ; then
2401 AC_DEFINE(DISABLE_LASTLOG)
2403 conf_lastlog_location=$withval
2408 dnl lastlog, [uw]tmpx? detection
2409 dnl NOTE: set the paths in the platform section to avoid the
2410 dnl need for command-line parameters
2411 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2413 dnl lastlog detection
2414 dnl NOTE: the code itself will detect if lastlog is a directory
2415 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2417 #include <sys/types.h>
2419 #ifdef HAVE_LASTLOG_H
2420 # include <lastlog.h>
2429 [ char *lastlog = LASTLOG_FILE; ],
2430 [ AC_MSG_RESULT(yes) ],
2433 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2435 #include <sys/types.h>
2437 #ifdef HAVE_LASTLOG_H
2438 # include <lastlog.h>
2444 [ char *lastlog = _PATH_LASTLOG; ],
2445 [ AC_MSG_RESULT(yes) ],
2448 system_lastlog_path=no
2453 if test -z "$conf_lastlog_location"; then
2454 if test x"$system_lastlog_path" = x"no" ; then
2455 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2456 if (test -d "$f" || test -f "$f") ; then
2457 conf_lastlog_location=$f
2460 if test -z "$conf_lastlog_location"; then
2461 AC_MSG_WARN([** Cannot find lastlog **])
2462 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2467 if test -n "$conf_lastlog_location"; then
2468 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2472 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2474 #include <sys/types.h>
2480 [ char *utmp = UTMP_FILE; ],
2481 [ AC_MSG_RESULT(yes) ],
2483 system_utmp_path=no ]
2485 if test -z "$conf_utmp_location"; then
2486 if test x"$system_utmp_path" = x"no" ; then
2487 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2488 if test -f $f ; then
2489 conf_utmp_location=$f
2492 if test -z "$conf_utmp_location"; then
2493 AC_DEFINE(DISABLE_UTMP)
2497 if test -n "$conf_utmp_location"; then
2498 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2502 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2504 #include <sys/types.h>
2510 [ char *wtmp = WTMP_FILE; ],
2511 [ AC_MSG_RESULT(yes) ],
2513 system_wtmp_path=no ]
2515 if test -z "$conf_wtmp_location"; then
2516 if test x"$system_wtmp_path" = x"no" ; then
2517 for f in /usr/adm/wtmp /var/log/wtmp; do
2518 if test -f $f ; then
2519 conf_wtmp_location=$f
2522 if test -z "$conf_wtmp_location"; then
2523 AC_DEFINE(DISABLE_WTMP)
2527 if test -n "$conf_wtmp_location"; then
2528 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2532 dnl utmpx detection - I don't know any system so perverse as to require
2533 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2535 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2537 #include <sys/types.h>
2546 [ char *utmpx = UTMPX_FILE; ],
2547 [ AC_MSG_RESULT(yes) ],
2549 system_utmpx_path=no ]
2551 if test -z "$conf_utmpx_location"; then
2552 if test x"$system_utmpx_path" = x"no" ; then
2553 AC_DEFINE(DISABLE_UTMPX)
2556 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2560 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2562 #include <sys/types.h>
2571 [ char *wtmpx = WTMPX_FILE; ],
2572 [ AC_MSG_RESULT(yes) ],
2574 system_wtmpx_path=no ]
2576 if test -z "$conf_wtmpx_location"; then
2577 if test x"$system_wtmpx_path" = x"no" ; then
2578 AC_DEFINE(DISABLE_WTMPX)
2581 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2585 if test ! -z "$blibpath" ; then
2586 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2587 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2590 dnl remove pam and dl because they are in $LIBPAM
2591 if test "$PAM_MSG" = yes ; then
2592 LIBS=`echo $LIBS | sed 's/-lpam //'`
2594 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2595 LIBS=`echo $LIBS | sed 's/-ldl //'`
2599 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2602 # Print summary of options
2604 # Someone please show me a better way :)
2605 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2606 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2607 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2608 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2609 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2610 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2611 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2612 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2613 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2614 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2617 echo "OpenSSH has been configured with the following options:"
2618 echo " User binaries: $B"
2619 echo " System binaries: $C"
2620 echo " Configuration files: $D"
2621 echo " Askpass program: $E"
2622 echo " Manual pages: $F"
2623 echo " PID file: $G"
2624 echo " Privilege separation chroot path: $H"
2625 if test "$USES_LOGIN_CONF" = "yes" ; then
2626 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2628 echo " sshd default user PATH: $I"
2630 if test ! -z "$superuser_path" ; then
2631 echo " sshd superuser user PATH: $J"
2633 echo " Manpage format: $MANTYPE"
2634 echo " DNS support: $DNS_MSG"
2635 echo " PAM support: $PAM_MSG"
2636 echo " KerberosIV support: $KRB4_MSG"
2637 echo " KerberosV support: $KRB5_MSG"
2638 echo " Smartcard support: $SCARD_MSG"
2639 echo " AFS support: $AFS_MSG"
2640 echo " S/KEY support: $SKEY_MSG"
2641 echo " TCP Wrappers support: $TCPW_MSG"
2642 echo " MD5 password support: $MD5_MSG"
2643 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2644 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2645 echo " BSD Auth support: $BSD_AUTH_MSG"
2646 echo " Random number source: $RAND_MSG"
2647 if test ! -z "$USE_RAND_HELPER" ; then
2648 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2653 echo " Host: ${host}"
2654 echo " Compiler: ${CC}"
2655 echo " Compiler flags: ${CFLAGS}"
2656 echo "Preprocessor flags: ${CPPFLAGS}"
2657 echo " Linker flags: ${LDFLAGS}"
2658 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2662 if test "x$PAM_MSG" = "xyes" ; then
2663 echo "PAM is enabled. You may need to install a PAM control file "
2664 echo "for sshd, otherwise password authentication may fail. "
2665 echo "Example PAM control files can be found in the contrib/ "
2670 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2671 echo "WARNING: you are using the builtin random number collection "
2672 echo "service. Please read WARNING.RNG and request that your OS "
2673 echo "vendor includes kernel-based random number collection in "
2674 echo "future versions of your OS."