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
57 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
58 LDFLAGS="$LDFLAGS -L/usr/local/lib"
59 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
60 if (test -z "$blibpath"); then
61 blibpath="/usr/lib:/lib:/usr/local/lib"
63 saved_LDFLAGS="$LDFLAGS"
64 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
65 if (test -z "$blibflags"); then
66 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
67 AC_TRY_LINK([], [], [blibflags=$tryflags])
70 if (test -z "$blibflags"); then
71 AC_MSG_RESULT(not found)
72 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
74 AC_MSG_RESULT($blibflags)
76 LDFLAGS="$saved_LDFLAGS"
77 dnl Check for authenticate. Might be in libs.a on older AIXes
78 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
79 [AC_CHECK_LIB(s,authenticate,
80 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
84 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
85 AC_CHECK_DECL(loginfailed,
86 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
88 [#include <usersec.h>],
89 [(void)loginfailed("user","host","tty",0);],
91 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
95 [#include <usersec.h>]
97 AC_CHECK_FUNCS(setauthdb)
98 AC_DEFINE(BROKEN_GETADDRINFO)
99 AC_DEFINE(BROKEN_REALPATH)
100 dnl AIX handles lastlog as part of its login message
101 AC_DEFINE(DISABLE_LASTLOG)
102 AC_DEFINE(LOGIN_NEEDS_UTMPX)
103 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
106 check_for_libcrypt_later=1
107 LIBS="$LIBS /usr/lib/textmode.o"
108 AC_DEFINE(HAVE_CYGWIN)
110 AC_DEFINE(DISABLE_SHADOW)
111 AC_DEFINE(IP_TOS_IS_BROKEN)
112 AC_DEFINE(NO_X11_UNIX_SOCKETS)
113 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
114 AC_DEFINE(DISABLE_FD_PASSING)
115 AC_DEFINE(SETGROUPS_NOOP)
118 AC_DEFINE(IP_TOS_IS_BROKEN)
121 AC_MSG_CHECKING(if we have working getaddrinfo)
122 AC_TRY_RUN([#include <mach-o/dyld.h>
123 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
127 }], [AC_MSG_RESULT(working)],
128 [AC_MSG_RESULT(buggy)
129 AC_DEFINE(BROKEN_GETADDRINFO)],
130 [AC_MSG_RESULT(assume it is working)])
133 if test -z "$GCC"; then
136 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
137 IPADDR_IN_DISPLAY=yes
138 AC_DEFINE(HAVE_SECUREWARE)
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(SPT_TYPE,SPT_PSTAT)
145 LIBS="$LIBS -lsec -lsecpw"
146 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
147 disable_ptmx_check=yes
150 if test -z "$GCC"; then
153 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
154 IPADDR_IN_DISPLAY=yes
156 AC_DEFINE(LOGIN_NO_ENDOPT)
157 AC_DEFINE(LOGIN_NEEDS_UTMPX)
158 AC_DEFINE(DISABLE_SHADOW)
159 AC_DEFINE(DISABLE_UTMP)
160 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
162 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
165 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
166 IPADDR_IN_DISPLAY=yes
167 AC_DEFINE(PAM_SUN_CODEBASE)
169 AC_DEFINE(LOGIN_NO_ENDOPT)
170 AC_DEFINE(LOGIN_NEEDS_UTMPX)
171 AC_DEFINE(DISABLE_SHADOW)
172 AC_DEFINE(DISABLE_UTMP)
173 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
175 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
178 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
180 PATH="$PATH:/usr/etc"
181 AC_DEFINE(BROKEN_INET_NTOA)
182 AC_DEFINE(WITH_ABBREV_NO_TTY)
185 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
187 PATH="$PATH:/usr/etc"
188 AC_DEFINE(WITH_IRIX_ARRAY)
189 AC_DEFINE(WITH_IRIX_PROJECT)
190 AC_DEFINE(WITH_IRIX_AUDIT)
191 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
192 AC_DEFINE(BROKEN_INET_NTOA)
193 AC_DEFINE(WITH_ABBREV_NO_TTY)
197 check_for_libcrypt_later=1
198 check_for_openpty_ctty_bug=1
199 AC_DEFINE(DONT_TRY_OTHER_AF)
200 AC_DEFINE(PAM_TTY_KLUDGE)
201 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
202 inet6_default_4in6=yes
205 AC_DEFINE(BROKEN_CMSG_TYPE)
209 mips-sony-bsd|mips-sony-newsos4)
210 AC_DEFINE(HAVE_NEWS4)
214 check_for_libcrypt_before=1
218 check_for_libcrypt_later=1
221 conf_lastlog_location="/usr/adm/lastlog"
222 conf_utmp_location=/etc/utmp
223 conf_wtmp_location=/usr/adm/wtmp
226 AC_DEFINE(BROKEN_REALPATH)
228 AC_DEFINE(BROKEN_SAVED_UIDS)
229 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
233 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
234 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
236 AC_DEFINE(PAM_SUN_CODEBASE)
237 AC_DEFINE(LOGIN_NEEDS_UTMPX)
238 AC_DEFINE(LOGIN_NEEDS_TERM)
239 AC_DEFINE(PAM_TTY_KLUDGE)
240 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
241 AC_DEFINE(SSHD_ACQUIRES_CTTY)
242 # hardwire lastlog location (can't detect it on some versions)
243 conf_lastlog_location="/var/adm/lastlog"
244 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
245 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
246 if test "$sol2ver" -ge 8; then
248 AC_DEFINE(DISABLE_UTMP)
249 AC_DEFINE(DISABLE_WTMP)
255 CPPFLAGS="$CPPFLAGS -DSUNOS4"
256 AC_CHECK_FUNCS(getpwanam)
257 AC_DEFINE(PAM_SUN_CODEBASE)
258 conf_utmp_location=/etc/utmp
259 conf_wtmp_location=/var/adm/wtmp
260 conf_lastlog_location=/var/adm/lastlog
264 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
265 LDFLAGS="$LDFLAGS -L/usr/local/lib"
268 AC_DEFINE(SSHD_ACQUIRES_CTTY)
271 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
272 # /usr/ucblib MUST NOT be searched on ReliantUNIX
273 LDFLAGS="$LDFLAGS -L/usr/local/lib"
274 IPADDR_IN_DISPLAY=yes
276 AC_DEFINE(IP_TOS_IS_BROKEN)
277 AC_DEFINE(SSHD_ACQUIRES_CTTY)
278 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
279 # Attention: always take care to bind libsocket and libnsl before libc,
280 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
283 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
284 LDFLAGS="$LDFLAGS -L/usr/local/lib"
288 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
289 LDFLAGS="$LDFLAGS -L/usr/local/lib"
293 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
294 LDFLAGS="$LDFLAGS -L/usr/local/lib"
297 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
298 LDFLAGS="$LDFLAGS -L/usr/local/lib"
299 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
302 AC_DEFINE(BROKEN_SYS_TERMIO_H)
304 AC_DEFINE(HAVE_SECUREWARE)
305 AC_DEFINE(DISABLE_SHADOW)
306 AC_DEFINE(BROKEN_SAVED_UIDS)
307 AC_CHECK_FUNCS(getluid setluid)
309 do_sco3_extra_lib_check=yes
312 if test -z "$GCC"; then
313 CFLAGS="$CFLAGS -belf"
315 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
316 LDFLAGS="$LDFLAGS -L/usr/local/lib"
317 LIBS="$LIBS -lprot -lx -ltinfo -lm"
320 AC_DEFINE(HAVE_SECUREWARE)
321 AC_DEFINE(DISABLE_SHADOW)
322 AC_DEFINE(DISABLE_FD_PASSING)
323 AC_CHECK_FUNCS(getluid setluid)
328 AC_DEFINE(DISABLE_FD_PASSING)
330 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
335 AC_DEFINE(DISABLE_FD_PASSING)
336 AC_DEFINE(NO_SSH_LASTLOG)
337 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
338 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
342 AC_MSG_CHECKING(for Digital Unix SIA)
345 [ --with-osfsia Enable Digital Unix SIA],
347 if test "x$withval" = "xno" ; then
348 AC_MSG_RESULT(disabled)
353 if test -z "$no_osfsia" ; then
354 if test -f /etc/sia/matrix.conf; then
356 AC_DEFINE(HAVE_OSF_SIA)
357 AC_DEFINE(DISABLE_LOGIN)
358 AC_DEFINE(DISABLE_FD_PASSING)
359 LIBS="$LIBS -lsecurity -ldb -lm -laud"
364 AC_DEFINE(DISABLE_FD_PASSING)
369 AC_DEFINE(NO_X11_UNIX_SOCKETS)
370 AC_DEFINE(MISSING_NFDBITS)
371 AC_DEFINE(MISSING_HOWMANY)
372 AC_DEFINE(MISSING_FD_MASK)
376 # Allow user to specify flags
378 [ --with-cflags Specify additional flags to pass to compiler],
380 if test "x$withval" != "xno" ; then
381 CFLAGS="$CFLAGS $withval"
385 AC_ARG_WITH(cppflags,
386 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
388 if test "x$withval" != "xno"; then
389 CPPFLAGS="$CPPFLAGS $withval"
394 [ --with-ldflags Specify additional flags to pass to linker],
396 if test "x$withval" != "xno" ; then
397 LDFLAGS="$LDFLAGS $withval"
402 [ --with-libs Specify additional libraries to link with],
404 if test "x$withval" != "xno" ; then
405 LIBS="$LIBS $withval"
410 AC_MSG_CHECKING(compiler and flags for sanity)
415 [ AC_MSG_RESULT(yes) ],
418 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
422 # Checks for header files.
423 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
424 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
425 login_cap.h maillock.h netdb.h netgroup.h \
426 netinet/in_systm.h paths.h pty.h readpassphrase.h \
427 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
428 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
429 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
430 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
431 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
432 util.h utime.h utmp.h utmpx.h)
434 # Checks for libraries.
435 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
436 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
438 dnl SCO OS3 needs this for libwrap
439 if test "x$with_tcp_wrappers" != "xno" ; then
440 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
441 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
445 AC_CHECK_FUNC(getspnam, ,
446 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
449 [ --without-rpath Disable auto-added -R linker paths],
451 if test "x$withval" = "xno" ; then
454 if test "x$withval" = "xyes" ; then
462 [ --with-zlib=PATH Use zlib in PATH],
464 if test "x$withval" = "xno" ; then
465 AC_MSG_ERROR([*** zlib is required ***])
467 if test -d "$withval/lib"; then
468 if test -n "${need_dash_r}"; then
469 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
471 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
474 if test -n "${need_dash_r}"; then
475 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
477 LDFLAGS="-L${withval} ${LDFLAGS}"
480 if test -d "$withval/include"; then
481 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
483 CPPFLAGS="-I${withval} ${CPPFLAGS}"
488 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
491 AC_CHECK_FUNC(strcasecmp,
492 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
494 AC_CHECK_FUNC(utimes,
495 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
496 LIBS="$LIBS -lc89"]) ]
499 dnl Checks for libutil functions
500 AC_CHECK_HEADERS(libutil.h)
501 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
502 AC_CHECK_FUNCS(logout updwtmp logwtmp)
506 # Check for ALTDIRFUNC glob() extension
507 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
508 AC_EGREP_CPP(FOUNDIT,
511 #ifdef GLOB_ALTDIRFUNC
516 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
524 # Check for g.gl_matchc glob() extension
525 AC_MSG_CHECKING(for gl_matchc field in glob_t)
526 AC_EGREP_CPP(FOUNDIT,
529 int main(void){glob_t g; g.gl_matchc = 1;}
532 AC_DEFINE(GLOB_HAS_GL_MATCHC)
540 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
543 #include <sys/types.h>
545 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
547 [AC_MSG_RESULT(yes)],
550 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
554 # Check whether user wants S/Key support
557 [ --with-skey[[=PATH]] Enable S/Key support
558 (optionally in PATH)],
560 if test "x$withval" != "xno" ; then
562 if test "x$withval" != "xyes" ; then
563 CPPFLAGS="$CPPFLAGS -I${withval}/include"
564 LDFLAGS="$LDFLAGS -L${withval}/lib"
571 AC_MSG_CHECKING([for s/key support])
576 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
578 [AC_MSG_RESULT(yes)],
581 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
587 # Check whether user wants TCP wrappers support
589 AC_ARG_WITH(tcp-wrappers,
590 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
591 (optionally in PATH)],
593 if test "x$withval" != "xno" ; then
595 saved_LDFLAGS="$LDFLAGS"
596 saved_CPPFLAGS="$CPPFLAGS"
597 if test -n "${withval}" -a "${withval}" != "yes"; then
598 if test -d "${withval}/lib"; then
599 if test -n "${need_dash_r}"; then
600 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
602 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
605 if test -n "${need_dash_r}"; then
606 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
608 LDFLAGS="-L${withval} ${LDFLAGS}"
611 if test -d "${withval}/include"; then
612 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
614 CPPFLAGS="-I${withval} ${CPPFLAGS}"
618 LIBS="$LIBWRAP $LIBS"
619 AC_MSG_CHECKING(for libwrap)
623 int deny_severity = 0, allow_severity = 0;
633 AC_MSG_ERROR([*** libwrap missing])
641 dnl Checks for library functions. Please keep in alphabetical order
643 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
644 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
645 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
646 getpeereid _getpty getrlimit getttyent glob inet_aton \
647 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
648 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
649 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
650 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
651 setproctitle setregid setresgid setresuid setreuid setrlimit \
652 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
653 strlcat strlcpy strmode strnvis sysconf tcgetpgrp tcsendbreak \
654 truncate utimes vhangup vsnprintf waitpid \
657 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
658 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
660 dnl Make sure prototypes are defined for these before using them.
661 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
662 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
664 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
665 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
666 AC_CHECK_LIB(gen, dirname,[
667 AC_CACHE_CHECK([for broken dirname],
668 ac_cv_have_broken_dirname, [
676 int main(int argc, char **argv) {
679 strncpy(buf,"/etc", 32);
681 if (!s || strncmp(s, "/", 32) != 0) {
688 [ ac_cv_have_broken_dirname="no" ],
689 [ ac_cv_have_broken_dirname="yes" ]
693 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
695 AC_DEFINE(HAVE_DIRNAME)
696 AC_CHECK_HEADERS(libgen.h)
701 dnl Checks for time functions
702 AC_CHECK_FUNCS(gettimeofday time)
703 dnl Checks for utmp functions
704 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
705 AC_CHECK_FUNCS(utmpname)
706 dnl Checks for utmpx functions
707 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
708 AC_CHECK_FUNCS(setutxent utmpxname)
710 AC_CHECK_FUNC(daemon,
711 [AC_DEFINE(HAVE_DAEMON)],
712 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
715 AC_CHECK_FUNC(getpagesize,
716 [AC_DEFINE(HAVE_GETPAGESIZE)],
717 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
720 # Check for broken snprintf
721 if test "x$ac_cv_func_snprintf" = "xyes" ; then
722 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
726 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
728 [AC_MSG_RESULT(yes)],
731 AC_DEFINE(BROKEN_SNPRINTF)
732 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
737 dnl see whether mkstemp() requires XXXXXX
738 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
739 AC_MSG_CHECKING([for (overly) strict mkstemp])
743 main() { char template[]="conftest.mkstemp-test";
744 if (mkstemp(template) == -1)
746 unlink(template); exit(0);
754 AC_DEFINE(HAVE_STRICT_MKSTEMP)
758 AC_DEFINE(HAVE_STRICT_MKSTEMP)
763 dnl make sure that openpty does not reacquire controlling terminal
764 if test ! -z "$check_for_openpty_ctty_bug"; then
765 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
769 #include <sys/fcntl.h>
770 #include <sys/types.h>
771 #include <sys/wait.h>
777 int fd, ptyfd, ttyfd, status;
780 if (pid < 0) { /* failed */
782 } else if (pid > 0) { /* parent */
783 waitpid(pid, &status, 0);
784 if (WIFEXITED(status))
785 exit(WEXITSTATUS(status));
789 close(0); close(1); close(2);
791 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
792 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
794 exit(3); /* Acquired ctty: broken */
796 exit(0); /* Did not acquire ctty: OK */
805 AC_DEFINE(SSHD_ACQUIRES_CTTY)
815 [ --with-pam Enable PAM support ],
817 if test "x$withval" != "xno" ; then
818 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
819 AC_MSG_ERROR([PAM headers not found])
822 AC_CHECK_LIB(dl, dlopen, , )
823 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
824 AC_CHECK_FUNCS(pam_getenvlist)
830 if test $ac_cv_lib_dl_dlopen = yes; then
840 # Check for older PAM
841 if test "x$PAM_MSG" = "xyes" ; then
842 # Check PAM strerror arguments (old PAM)
843 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
847 #include <security/pam_appl.h>
849 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
852 AC_DEFINE(HAVE_OLD_PAM)
854 PAM_MSG="yes (old library)"
859 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
860 # because the system crypt() is more featureful.
861 if test "x$check_for_libcrypt_before" = "x1"; then
862 AC_CHECK_LIB(crypt, crypt)
866 saved_CPPFLAGS="$CPPFLAGS"
867 saved_LDFLAGS="$LDFLAGS"
869 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
871 if test "x$withval" != "xno" ; then
872 if test -d "$withval/lib"; then
873 if test -n "${need_dash_r}"; then
874 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
876 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
879 if test -n "${need_dash_r}"; then
880 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
882 LDFLAGS="-L${withval} ${LDFLAGS}"
885 if test -d "$withval/include"; then
886 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
888 CPPFLAGS="-I${withval} ${CPPFLAGS}"
893 LIBS="$LIBS -lcrypto"
894 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
896 dnl Check default openssl install dir
897 if test -n "${need_dash_r}"; then
898 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
900 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
902 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
903 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
905 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
911 # Determine OpenSSL header version
912 AC_MSG_CHECKING([OpenSSL header version])
917 #include <openssl/opensslv.h>
918 #define DATA "conftest.sslincver"
923 fd = fopen(DATA,"w");
927 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
934 ssl_header_ver=`cat conftest.sslincver`
935 AC_MSG_RESULT($ssl_header_ver)
938 AC_MSG_RESULT(not found)
939 AC_MSG_ERROR(OpenSSL version header not found.)
943 # Determine OpenSSL library version
944 AC_MSG_CHECKING([OpenSSL library version])
949 #include <openssl/opensslv.h>
950 #include <openssl/crypto.h>
951 #define DATA "conftest.ssllibver"
956 fd = fopen(DATA,"w");
960 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
967 ssl_library_ver=`cat conftest.ssllibver`
968 AC_MSG_RESULT($ssl_library_ver)
971 AC_MSG_RESULT(not found)
972 AC_MSG_ERROR(OpenSSL library not found.)
976 # Sanity check OpenSSL headers
977 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
981 #include <openssl/opensslv.h>
982 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
989 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
990 Check config.log for details.
991 Also see contrib/findssl.sh for help identifying header/library mismatches.])
995 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
996 # version in OpenSSL. Skip this for PAM
997 if test "x$check_for_libcrypt_later" = "x1"; then
998 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1002 ### Configure cryptographic random number support
1004 # Check wheter OpenSSL seeds itself
1005 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1009 #include <openssl/rand.h>
1010 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1013 OPENSSL_SEEDS_ITSELF=yes
1018 # Default to use of the rand helper if OpenSSL doesn't
1025 # Do we want to force the use of the rand helper?
1026 AC_ARG_WITH(rand-helper,
1027 [ --with-rand-helper Use subprocess to gather strong randomness ],
1029 if test "x$withval" = "xno" ; then
1030 # Force use of OpenSSL's internal RNG, even if
1031 # the previous test showed it to be unseeded.
1032 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1033 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1034 OPENSSL_SEEDS_ITSELF=yes
1043 # Which randomness source do we use?
1044 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1046 AC_DEFINE(OPENSSL_PRNG_ONLY)
1047 RAND_MSG="OpenSSL internal ONLY"
1048 INSTALL_SSH_RAND_HELPER=""
1049 elif test ! -z "$USE_RAND_HELPER" ; then
1050 # install rand helper
1051 RAND_MSG="ssh-rand-helper"
1052 INSTALL_SSH_RAND_HELPER="yes"
1054 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1056 ### Configuration of ssh-rand-helper
1059 AC_ARG_WITH(prngd-port,
1060 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1069 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1072 if test ! -z "$withval" ; then
1073 PRNGD_PORT="$withval"
1074 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1079 # PRNGD Unix domain socket
1080 AC_ARG_WITH(prngd-socket,
1081 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1085 withval="/var/run/egd-pool"
1093 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1097 if test ! -z "$withval" ; then
1098 if test ! -z "$PRNGD_PORT" ; then
1099 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1101 if test ! -r "$withval" ; then
1102 AC_MSG_WARN(Entropy socket is not readable)
1104 PRNGD_SOCKET="$withval"
1105 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1109 # Check for existing socket only if we don't have a random device already
1110 if test "$USE_RAND_HELPER" = yes ; then
1111 AC_MSG_CHECKING(for PRNGD/EGD socket)
1112 # Insert other locations here
1113 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1114 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1115 PRNGD_SOCKET="$sock"
1116 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1120 if test ! -z "$PRNGD_SOCKET" ; then
1121 AC_MSG_RESULT($PRNGD_SOCKET)
1123 AC_MSG_RESULT(not found)
1129 # Change default command timeout for hashing entropy source
1131 AC_ARG_WITH(entropy-timeout,
1132 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1134 if test "x$withval" != "xno" ; then
1135 entropy_timeout=$withval
1139 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1141 SSH_PRIVSEP_USER=sshd
1142 AC_ARG_WITH(privsep-user,
1143 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1145 if test -n "$withval"; then
1146 SSH_PRIVSEP_USER=$withval
1150 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1151 AC_SUBST(SSH_PRIVSEP_USER)
1153 # We do this little dance with the search path to insure
1154 # that programs that we select for use by installed programs
1155 # (which may be run by the super-user) come from trusted
1156 # locations before they come from the user's private area.
1157 # This should help avoid accidentally configuring some
1158 # random version of a program in someone's personal bin.
1162 test -h /bin 2> /dev/null && PATH=/usr/bin
1163 test -d /sbin && PATH=$PATH:/sbin
1164 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1165 PATH=$PATH:/etc:$OPATH
1167 # These programs are used by the command hashing source to gather entropy
1168 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1169 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1170 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1171 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1172 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1173 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1174 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1175 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1176 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1177 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1178 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1179 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1180 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1181 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1182 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1183 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1187 # Where does ssh-rand-helper get its randomness from?
1188 INSTALL_SSH_PRNG_CMDS=""
1189 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1190 if test ! -z "$PRNGD_PORT" ; then
1191 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1192 elif test ! -z "$PRNGD_SOCKET" ; then
1193 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1195 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1196 RAND_HELPER_CMDHASH=yes
1197 INSTALL_SSH_PRNG_CMDS="yes"
1200 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1203 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1204 if test ! -z "$SONY" ; then
1205 LIBS="$LIBS -liberty";
1208 # Checks for data types
1209 AC_CHECK_SIZEOF(char, 1)
1210 AC_CHECK_SIZEOF(short int, 2)
1211 AC_CHECK_SIZEOF(int, 4)
1212 AC_CHECK_SIZEOF(long int, 4)
1213 AC_CHECK_SIZEOF(long long int, 8)
1215 # Sanity check long long for some platforms (AIX)
1216 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1217 ac_cv_sizeof_long_long_int=0
1220 # More checks for data types
1221 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1223 [ #include <sys/types.h> ],
1225 [ ac_cv_have_u_int="yes" ],
1226 [ ac_cv_have_u_int="no" ]
1229 if test "x$ac_cv_have_u_int" = "xyes" ; then
1230 AC_DEFINE(HAVE_U_INT)
1234 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1236 [ #include <sys/types.h> ],
1237 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1238 [ ac_cv_have_intxx_t="yes" ],
1239 [ ac_cv_have_intxx_t="no" ]
1242 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1243 AC_DEFINE(HAVE_INTXX_T)
1247 if (test -z "$have_intxx_t" && \
1248 test "x$ac_cv_header_stdint_h" = "xyes")
1250 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1252 [ #include <stdint.h> ],
1253 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1255 AC_DEFINE(HAVE_INTXX_T)
1258 [ AC_MSG_RESULT(no) ]
1262 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1265 #include <sys/types.h>
1266 #ifdef HAVE_STDINT_H
1267 # include <stdint.h>
1269 #include <sys/socket.h>
1270 #ifdef HAVE_SYS_BITYPES_H
1271 # include <sys/bitypes.h>
1274 [ int64_t a; a = 1;],
1275 [ ac_cv_have_int64_t="yes" ],
1276 [ ac_cv_have_int64_t="no" ]
1279 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1280 AC_DEFINE(HAVE_INT64_T)
1283 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1285 [ #include <sys/types.h> ],
1286 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1287 [ ac_cv_have_u_intxx_t="yes" ],
1288 [ ac_cv_have_u_intxx_t="no" ]
1291 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1292 AC_DEFINE(HAVE_U_INTXX_T)
1296 if test -z "$have_u_intxx_t" ; then
1297 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1299 [ #include <sys/socket.h> ],
1300 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1302 AC_DEFINE(HAVE_U_INTXX_T)
1305 [ AC_MSG_RESULT(no) ]
1309 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1311 [ #include <sys/types.h> ],
1312 [ u_int64_t a; a = 1;],
1313 [ ac_cv_have_u_int64_t="yes" ],
1314 [ ac_cv_have_u_int64_t="no" ]
1317 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1318 AC_DEFINE(HAVE_U_INT64_T)
1322 if test -z "$have_u_int64_t" ; then
1323 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1325 [ #include <sys/bitypes.h> ],
1326 [ u_int64_t a; a = 1],
1328 AC_DEFINE(HAVE_U_INT64_T)
1331 [ AC_MSG_RESULT(no) ]
1335 if test -z "$have_u_intxx_t" ; then
1336 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1339 #include <sys/types.h>
1341 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1342 [ ac_cv_have_uintxx_t="yes" ],
1343 [ ac_cv_have_uintxx_t="no" ]
1346 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1347 AC_DEFINE(HAVE_UINTXX_T)
1351 if test -z "$have_uintxx_t" ; then
1352 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1354 [ #include <stdint.h> ],
1355 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1357 AC_DEFINE(HAVE_UINTXX_T)
1360 [ AC_MSG_RESULT(no) ]
1364 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1365 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1367 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1370 #include <sys/bitypes.h>
1373 int8_t a; int16_t b; int32_t c;
1374 u_int8_t e; u_int16_t f; u_int32_t g;
1375 a = b = c = e = f = g = 1;
1378 AC_DEFINE(HAVE_U_INTXX_T)
1379 AC_DEFINE(HAVE_INTXX_T)
1387 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1390 #include <sys/types.h>
1392 [ u_char foo; foo = 125; ],
1393 [ ac_cv_have_u_char="yes" ],
1394 [ ac_cv_have_u_char="no" ]
1397 if test "x$ac_cv_have_u_char" = "xyes" ; then
1398 AC_DEFINE(HAVE_U_CHAR)
1403 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1405 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1408 #include <sys/types.h>
1410 [ size_t foo; foo = 1235; ],
1411 [ ac_cv_have_size_t="yes" ],
1412 [ ac_cv_have_size_t="no" ]
1415 if test "x$ac_cv_have_size_t" = "xyes" ; then
1416 AC_DEFINE(HAVE_SIZE_T)
1419 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1422 #include <sys/types.h>
1424 [ ssize_t foo; foo = 1235; ],
1425 [ ac_cv_have_ssize_t="yes" ],
1426 [ ac_cv_have_ssize_t="no" ]
1429 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1430 AC_DEFINE(HAVE_SSIZE_T)
1433 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1438 [ clock_t foo; foo = 1235; ],
1439 [ ac_cv_have_clock_t="yes" ],
1440 [ ac_cv_have_clock_t="no" ]
1443 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1444 AC_DEFINE(HAVE_CLOCK_T)
1447 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1450 #include <sys/types.h>
1451 #include <sys/socket.h>
1453 [ sa_family_t foo; foo = 1235; ],
1454 [ ac_cv_have_sa_family_t="yes" ],
1457 #include <sys/types.h>
1458 #include <sys/socket.h>
1459 #include <netinet/in.h>
1461 [ sa_family_t foo; foo = 1235; ],
1462 [ ac_cv_have_sa_family_t="yes" ],
1464 [ ac_cv_have_sa_family_t="no" ]
1468 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1469 AC_DEFINE(HAVE_SA_FAMILY_T)
1472 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1475 #include <sys/types.h>
1477 [ pid_t foo; foo = 1235; ],
1478 [ ac_cv_have_pid_t="yes" ],
1479 [ ac_cv_have_pid_t="no" ]
1482 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1483 AC_DEFINE(HAVE_PID_T)
1486 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1489 #include <sys/types.h>
1491 [ mode_t foo; foo = 1235; ],
1492 [ ac_cv_have_mode_t="yes" ],
1493 [ ac_cv_have_mode_t="no" ]
1496 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1497 AC_DEFINE(HAVE_MODE_T)
1501 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1504 #include <sys/types.h>
1505 #include <sys/socket.h>
1507 [ struct sockaddr_storage s; ],
1508 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1509 [ ac_cv_have_struct_sockaddr_storage="no" ]
1512 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1513 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1516 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1519 #include <sys/types.h>
1520 #include <netinet/in.h>
1522 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1523 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1524 [ ac_cv_have_struct_sockaddr_in6="no" ]
1527 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1528 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1531 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1534 #include <sys/types.h>
1535 #include <netinet/in.h>
1537 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1538 [ ac_cv_have_struct_in6_addr="yes" ],
1539 [ ac_cv_have_struct_in6_addr="no" ]
1542 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1543 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1546 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1549 #include <sys/types.h>
1550 #include <sys/socket.h>
1553 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1554 [ ac_cv_have_struct_addrinfo="yes" ],
1555 [ ac_cv_have_struct_addrinfo="no" ]
1558 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1559 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1562 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1564 [ #include <sys/time.h> ],
1565 [ struct timeval tv; tv.tv_sec = 1;],
1566 [ ac_cv_have_struct_timeval="yes" ],
1567 [ ac_cv_have_struct_timeval="no" ]
1570 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1571 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1572 have_struct_timeval=1
1575 AC_CHECK_TYPES(struct timespec)
1577 # We need int64_t or else certian parts of the compile will fail.
1578 if test "x$ac_cv_have_int64_t" = "xno" -a \
1579 "x$ac_cv_sizeof_long_int" != "x8" -a \
1580 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1581 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1582 echo "an alternative compiler (I.E., GCC) before continuing."
1586 dnl test snprintf (broken on SCO w/gcc)
1591 #ifdef HAVE_SNPRINTF
1595 char expected_out[50];
1597 #if (SIZEOF_LONG_INT == 8)
1598 long int num = 0x7fffffffffffffff;
1600 long long num = 0x7fffffffffffffffll;
1602 strcpy(expected_out, "9223372036854775807");
1603 snprintf(buf, mazsize, "%lld", num);
1604 if(strcmp(buf, expected_out) != 0)
1611 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1615 dnl Checks for structure members
1616 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1617 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1618 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1619 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1620 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1621 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1622 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1623 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1624 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1625 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1626 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1627 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1628 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1629 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1630 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1631 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1632 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1634 AC_CHECK_MEMBERS([struct stat.st_blksize])
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 __ss_family field in struct sockaddr_storage],
1653 ac_cv_have___ss_family_in_struct_ss, [
1656 #include <sys/types.h>
1657 #include <sys/socket.h>
1659 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1660 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1661 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1664 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1665 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1668 AC_CACHE_CHECK([for pw_class field in struct passwd],
1669 ac_cv_have_pw_class_in_struct_passwd, [
1674 [ struct passwd p; p.pw_class = 0; ],
1675 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1676 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1679 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1680 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1683 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1684 ac_cv_have_pw_expire_in_struct_passwd, [
1689 [ struct passwd p; p.pw_expire = 0; ],
1690 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1691 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1694 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1695 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1698 AC_CACHE_CHECK([for pw_change field in struct passwd],
1699 ac_cv_have_pw_change_in_struct_passwd, [
1704 [ struct passwd p; p.pw_change = 0; ],
1705 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1706 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1709 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1710 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1713 dnl make sure we're using the real structure members and not defines
1714 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1715 ac_cv_have_accrights_in_msghdr, [
1718 #include <sys/types.h>
1719 #include <sys/socket.h>
1720 #include <sys/uio.h>
1722 #ifdef msg_accrights
1726 m.msg_accrights = 0;
1730 [ ac_cv_have_accrights_in_msghdr="yes" ],
1731 [ ac_cv_have_accrights_in_msghdr="no" ]
1734 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1735 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1738 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1739 ac_cv_have_control_in_msghdr, [
1742 #include <sys/types.h>
1743 #include <sys/socket.h>
1744 #include <sys/uio.h>
1754 [ ac_cv_have_control_in_msghdr="yes" ],
1755 [ ac_cv_have_control_in_msghdr="no" ]
1758 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1759 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1762 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1764 [ extern char *__progname; printf("%s", __progname); ],
1765 [ ac_cv_libc_defines___progname="yes" ],
1766 [ ac_cv_libc_defines___progname="no" ]
1769 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1770 AC_DEFINE(HAVE___PROGNAME)
1773 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1777 [ printf("%s", __FUNCTION__); ],
1778 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1779 [ ac_cv_cc_implements___FUNCTION__="no" ]
1782 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1783 AC_DEFINE(HAVE___FUNCTION__)
1786 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1790 [ printf("%s", __func__); ],
1791 [ ac_cv_cc_implements___func__="yes" ],
1792 [ ac_cv_cc_implements___func__="no" ]
1795 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1796 AC_DEFINE(HAVE___func__)
1799 AC_CACHE_CHECK([whether getopt has optreset support],
1800 ac_cv_have_getopt_optreset, [
1805 [ extern int optreset; optreset = 0; ],
1806 [ ac_cv_have_getopt_optreset="yes" ],
1807 [ ac_cv_have_getopt_optreset="no" ]
1810 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1811 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1814 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1816 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1817 [ ac_cv_libc_defines_sys_errlist="yes" ],
1818 [ ac_cv_libc_defines_sys_errlist="no" ]
1821 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1822 AC_DEFINE(HAVE_SYS_ERRLIST)
1826 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1828 [ extern int sys_nerr; printf("%i", sys_nerr);],
1829 [ ac_cv_libc_defines_sys_nerr="yes" ],
1830 [ ac_cv_libc_defines_sys_nerr="no" ]
1833 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1834 AC_DEFINE(HAVE_SYS_NERR)
1838 # Check whether user wants sectok support
1840 [ --with-sectok Enable smartcard support using libsectok],
1842 if test "x$withval" != "xno" ; then
1843 if test "x$withval" != "xyes" ; then
1844 CPPFLAGS="$CPPFLAGS -I${withval}"
1845 LDFLAGS="$LDFLAGS -L${withval}"
1846 if test ! -z "$need_dash_r" ; then
1847 LDFLAGS="$LDFLAGS -R${withval}"
1849 if test ! -z "$blibpath" ; then
1850 blibpath="$blibpath:${withval}"
1853 AC_CHECK_HEADERS(sectok.h)
1854 if test "$ac_cv_header_sectok_h" != yes; then
1855 AC_MSG_ERROR(Can't find sectok.h)
1857 AC_CHECK_LIB(sectok, sectok_open)
1858 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1859 AC_MSG_ERROR(Can't find libsectok)
1861 AC_DEFINE(SMARTCARD)
1862 AC_DEFINE(USE_SECTOK)
1863 SCARD_MSG="yes, using sectok"
1868 # Check whether user wants OpenSC support
1870 AC_HELP_STRING([--with-opensc=PFX],
1871 [Enable smartcard support using OpenSC]),
1872 opensc_config_prefix="$withval", opensc_config_prefix="")
1873 if test x$opensc_config_prefix != x ; then
1874 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1875 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1876 if test "$OPENSC_CONFIG" != "no"; then
1877 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1878 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1879 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1880 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1881 AC_DEFINE(SMARTCARD)
1882 AC_DEFINE(USE_OPENSC)
1883 SCARD_MSG="yes, using OpenSC"
1887 # Check whether user wants DNS support
1890 [ --with-dns Support for fetching keys from DNS (experimental)],
1892 if test "x$withval" != "xno" ; then
1895 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1896 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1898 # Needed by our getrrsetbyname()
1899 AC_SEARCH_LIBS(res_query, resolv)
1900 AC_SEARCH_LIBS(dn_expand, resolv)
1906 # Check whether user wants Kerberos 5 support
1908 AC_ARG_WITH(kerberos5,
1909 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1911 if test "x$withval" != "xno" ; then
1912 if test "x$withval" = "xyes" ; then
1913 KRB5ROOT="/usr/local"
1917 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1918 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1921 AC_MSG_CHECKING(whether we are using Heimdal)
1922 AC_TRY_COMPILE([ #include <krb5.h> ],
1923 [ char *tmp = heimdal_version; ],
1924 [ AC_MSG_RESULT(yes)
1926 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1929 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1932 if test ! -z "$need_dash_r" ; then
1933 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1935 if test ! -z "$blibpath" ; then
1936 blibpath="$blibpath:${KRB5ROOT}/lib"
1938 AC_SEARCH_LIBS(dn_expand, resolv)
1944 LIBS="$LIBS $K5LIBS"
1946 # Looking for programs, paths and files
1948 PRIVSEP_PATH=/var/empty
1949 AC_ARG_WITH(privsep-path,
1950 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
1952 if test "x$withval" != "$no" ; then
1953 PRIVSEP_PATH=$withval
1957 AC_SUBST(PRIVSEP_PATH)
1960 [ --with-xauth=PATH Specify path to xauth program ],
1962 if test "x$withval" != "xno" ; then
1968 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
1969 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
1970 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
1971 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
1972 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
1973 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
1974 xauth_path="/usr/openwin/bin/xauth"
1980 AC_ARG_ENABLE(strip,
1981 [ --disable-strip Disable calling strip(1) on install],
1983 if test "x$enableval" = "xno" ; then
1990 if test -z "$xauth_path" ; then
1991 XAUTH_PATH="undefined"
1992 AC_SUBST(XAUTH_PATH)
1994 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
1995 XAUTH_PATH=$xauth_path
1996 AC_SUBST(XAUTH_PATH)
1999 # Check for mail directory (last resort if we cannot get it from headers)
2000 if test ! -z "$MAIL" ; then
2001 maildir=`dirname $MAIL`
2002 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2005 if test -z "$no_dev_ptmx" ; then
2006 if test "x$disable_ptmx_check" != "xyes" ; then
2007 AC_CHECK_FILE("/dev/ptmx",
2009 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2015 AC_CHECK_FILE("/dev/ptc",
2017 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2022 # Options from here on. Some of these are preset by platform above
2023 AC_ARG_WITH(mantype,
2024 [ --with-mantype=man|cat|doc Set man page type],
2031 AC_MSG_ERROR(invalid man type: $withval)
2036 if test -z "$MANTYPE"; then
2037 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2038 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2039 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2041 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2048 if test "$MANTYPE" = "doc"; then
2055 # Check whether to enable MD5 passwords
2057 AC_ARG_WITH(md5-passwords,
2058 [ --with-md5-passwords Enable use of MD5 passwords],
2060 if test "x$withval" != "xno" ; then
2061 AC_DEFINE(HAVE_MD5_PASSWORDS)
2067 # Whether to disable shadow password support
2069 [ --without-shadow Disable shadow password support],
2071 if test "x$withval" = "xno" ; then
2072 AC_DEFINE(DISABLE_SHADOW)
2078 if test -z "$disable_shadow" ; then
2079 AC_MSG_CHECKING([if the systems has expire shadow information])
2082 #include <sys/types.h>
2085 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2086 [ sp_expire_available=yes ], []
2089 if test "x$sp_expire_available" = "xyes" ; then
2091 AC_DEFINE(HAS_SHADOW_EXPIRE)
2097 # Use ip address instead of hostname in $DISPLAY
2098 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2099 DISPLAY_HACK_MSG="yes"
2100 AC_DEFINE(IPADDR_IN_DISPLAY)
2102 DISPLAY_HACK_MSG="no"
2103 AC_ARG_WITH(ipaddr-display,
2104 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2106 if test "x$withval" != "xno" ; then
2107 AC_DEFINE(IPADDR_IN_DISPLAY)
2108 DISPLAY_HACK_MSG="yes"
2114 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2115 if test $ac_cv_func_login_getcapbool = "yes" -a \
2116 $ac_cv_header_login_cap_h = "yes" ; then
2119 # Whether to mess with the default path
2120 SERVER_PATH_MSG="(default)"
2121 AC_ARG_WITH(default-path,
2122 [ --with-default-path= Specify default \$PATH environment for server],
2124 if test "$USES_LOGIN_CONF" = "yes" ; then
2126 --with-default-path=PATH has no effect on this system.
2127 Edit /etc/login.conf instead.])
2128 elif test "x$withval" != "xno" ; then
2129 user_path="$withval"
2130 SERVER_PATH_MSG="$withval"
2133 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2134 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2138 /* find out what STDPATH is */
2143 #ifndef _PATH_STDPATH
2144 # ifdef _PATH_USERPATH /* Irix */
2145 # define _PATH_STDPATH _PATH_USERPATH
2147 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2150 #include <sys/types.h>
2151 #include <sys/stat.h>
2153 #define DATA "conftest.stdpath"
2160 fd = fopen(DATA,"w");
2164 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2169 ], [ user_path=`cat conftest.stdpath` ],
2170 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2171 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2173 # make sure $bindir is in USER_PATH so scp will work
2174 t_bindir=`eval echo ${bindir}`
2176 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2179 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2181 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2182 if test $? -ne 0 ; then
2183 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2184 if test $? -ne 0 ; then
2185 user_path=$user_path:$t_bindir
2186 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2191 if test "$USES_LOGIN_CONF" != "yes" ; then
2192 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2196 # Set superuser path separately to user path
2197 AC_ARG_WITH(superuser-path,
2198 [ --with-superuser-path= Specify different path for super-user],
2200 if test "x$withval" != "xno" ; then
2201 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2202 superuser_path=$withval
2208 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2209 IPV4_IN6_HACK_MSG="no"
2211 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2213 if test "x$withval" != "xno" ; then
2215 AC_DEFINE(IPV4_IN_IPV6)
2216 IPV4_IN6_HACK_MSG="yes"
2221 if test "x$inet6_default_4in6" = "xyes"; then
2222 AC_MSG_RESULT([yes (default)])
2223 AC_DEFINE(IPV4_IN_IPV6)
2224 IPV4_IN6_HACK_MSG="yes"
2226 AC_MSG_RESULT([no (default)])
2231 # Whether to enable BSD auth support
2233 AC_ARG_WITH(bsd-auth,
2234 [ --with-bsd-auth Enable BSD auth support],
2236 if test "x$withval" != "xno" ; then
2243 # Where to place sshd.pid
2245 # make sure the directory exists
2246 if test ! -d $piddir ; then
2247 piddir=`eval echo ${sysconfdir}`
2249 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2253 AC_ARG_WITH(pid-dir,
2254 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2256 if test "x$withval" != "xno" ; then
2258 if test ! -d $piddir ; then
2259 AC_MSG_WARN([** no $piddir directory on this system **])
2265 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2268 dnl allow user to disable some login recording features
2269 AC_ARG_ENABLE(lastlog,
2270 [ --disable-lastlog disable use of lastlog even if detected [no]],
2272 if test "x$enableval" = "xno" ; then
2273 AC_DEFINE(DISABLE_LASTLOG)
2278 [ --disable-utmp disable use of utmp even if detected [no]],
2280 if test "x$enableval" = "xno" ; then
2281 AC_DEFINE(DISABLE_UTMP)
2285 AC_ARG_ENABLE(utmpx,
2286 [ --disable-utmpx disable use of utmpx even if detected [no]],
2288 if test "x$enableval" = "xno" ; then
2289 AC_DEFINE(DISABLE_UTMPX)
2294 [ --disable-wtmp disable use of wtmp even if detected [no]],
2296 if test "x$enableval" = "xno" ; then
2297 AC_DEFINE(DISABLE_WTMP)
2301 AC_ARG_ENABLE(wtmpx,
2302 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2304 if test "x$enableval" = "xno" ; then
2305 AC_DEFINE(DISABLE_WTMPX)
2309 AC_ARG_ENABLE(libutil,
2310 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2312 if test "x$enableval" = "xno" ; then
2313 AC_DEFINE(DISABLE_LOGIN)
2317 AC_ARG_ENABLE(pututline,
2318 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2320 if test "x$enableval" = "xno" ; then
2321 AC_DEFINE(DISABLE_PUTUTLINE)
2325 AC_ARG_ENABLE(pututxline,
2326 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2328 if test "x$enableval" = "xno" ; then
2329 AC_DEFINE(DISABLE_PUTUTXLINE)
2333 AC_ARG_WITH(lastlog,
2334 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2336 if test "x$withval" = "xno" ; then
2337 AC_DEFINE(DISABLE_LASTLOG)
2339 conf_lastlog_location=$withval
2344 dnl lastlog, [uw]tmpx? detection
2345 dnl NOTE: set the paths in the platform section to avoid the
2346 dnl need for command-line parameters
2347 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2349 dnl lastlog detection
2350 dnl NOTE: the code itself will detect if lastlog is a directory
2351 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2353 #include <sys/types.h>
2355 #ifdef HAVE_LASTLOG_H
2356 # include <lastlog.h>
2365 [ char *lastlog = LASTLOG_FILE; ],
2366 [ AC_MSG_RESULT(yes) ],
2369 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2371 #include <sys/types.h>
2373 #ifdef HAVE_LASTLOG_H
2374 # include <lastlog.h>
2380 [ char *lastlog = _PATH_LASTLOG; ],
2381 [ AC_MSG_RESULT(yes) ],
2384 system_lastlog_path=no
2389 if test -z "$conf_lastlog_location"; then
2390 if test x"$system_lastlog_path" = x"no" ; then
2391 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2392 if (test -d "$f" || test -f "$f") ; then
2393 conf_lastlog_location=$f
2396 if test -z "$conf_lastlog_location"; then
2397 AC_MSG_WARN([** Cannot find lastlog **])
2398 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2403 if test -n "$conf_lastlog_location"; then
2404 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2408 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2410 #include <sys/types.h>
2416 [ char *utmp = UTMP_FILE; ],
2417 [ AC_MSG_RESULT(yes) ],
2419 system_utmp_path=no ]
2421 if test -z "$conf_utmp_location"; then
2422 if test x"$system_utmp_path" = x"no" ; then
2423 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2424 if test -f $f ; then
2425 conf_utmp_location=$f
2428 if test -z "$conf_utmp_location"; then
2429 AC_DEFINE(DISABLE_UTMP)
2433 if test -n "$conf_utmp_location"; then
2434 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2438 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2440 #include <sys/types.h>
2446 [ char *wtmp = WTMP_FILE; ],
2447 [ AC_MSG_RESULT(yes) ],
2449 system_wtmp_path=no ]
2451 if test -z "$conf_wtmp_location"; then
2452 if test x"$system_wtmp_path" = x"no" ; then
2453 for f in /usr/adm/wtmp /var/log/wtmp; do
2454 if test -f $f ; then
2455 conf_wtmp_location=$f
2458 if test -z "$conf_wtmp_location"; then
2459 AC_DEFINE(DISABLE_WTMP)
2463 if test -n "$conf_wtmp_location"; then
2464 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2468 dnl utmpx detection - I don't know any system so perverse as to require
2469 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2471 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2473 #include <sys/types.h>
2482 [ char *utmpx = UTMPX_FILE; ],
2483 [ AC_MSG_RESULT(yes) ],
2485 system_utmpx_path=no ]
2487 if test -z "$conf_utmpx_location"; then
2488 if test x"$system_utmpx_path" = x"no" ; then
2489 AC_DEFINE(DISABLE_UTMPX)
2492 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2496 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2498 #include <sys/types.h>
2507 [ char *wtmpx = WTMPX_FILE; ],
2508 [ AC_MSG_RESULT(yes) ],
2510 system_wtmpx_path=no ]
2512 if test -z "$conf_wtmpx_location"; then
2513 if test x"$system_wtmpx_path" = x"no" ; then
2514 AC_DEFINE(DISABLE_WTMPX)
2517 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2521 if test ! -z "$blibpath" ; then
2522 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2523 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2526 dnl remove pam and dl because they are in $LIBPAM
2527 if test "$PAM_MSG" = yes ; then
2528 LIBS=`echo $LIBS | sed 's/-lpam //'`
2530 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2531 LIBS=`echo $LIBS | sed 's/-ldl //'`
2535 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2538 # Print summary of options
2540 # Someone please show me a better way :)
2541 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2542 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2543 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2544 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2545 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2546 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2547 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2548 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2549 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2550 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2553 echo "OpenSSH has been configured with the following options:"
2554 echo " User binaries: $B"
2555 echo " System binaries: $C"
2556 echo " Configuration files: $D"
2557 echo " Askpass program: $E"
2558 echo " Manual pages: $F"
2559 echo " PID file: $G"
2560 echo " Privilege separation chroot path: $H"
2561 if test "$USES_LOGIN_CONF" = "yes" ; then
2562 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2564 echo " sshd default user PATH: $I"
2566 if test ! -z "$superuser_path" ; then
2567 echo " sshd superuser user PATH: $J"
2569 echo " Manpage format: $MANTYPE"
2570 echo " DNS support: $DNS_MSG"
2571 echo " PAM support: $PAM_MSG"
2572 echo " KerberosV support: $KRB5_MSG"
2573 echo " Smartcard support: $SCARD_MSG"
2574 echo " S/KEY support: $SKEY_MSG"
2575 echo " TCP Wrappers support: $TCPW_MSG"
2576 echo " MD5 password support: $MD5_MSG"
2577 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2578 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2579 echo " BSD Auth support: $BSD_AUTH_MSG"
2580 echo " Random number source: $RAND_MSG"
2581 if test ! -z "$USE_RAND_HELPER" ; then
2582 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2587 echo " Host: ${host}"
2588 echo " Compiler: ${CC}"
2589 echo " Compiler flags: ${CFLAGS}"
2590 echo "Preprocessor flags: ${CPPFLAGS}"
2591 echo " Linker flags: ${LDFLAGS}"
2592 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2596 if test "x$PAM_MSG" = "xyes" ; then
2597 echo "PAM is enabled. You may need to install a PAM control file "
2598 echo "for sshd, otherwise password authentication may fail. "
2599 echo "Example PAM control files can be found in the contrib/ "
2604 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2605 echo "WARNING: you are using the builtin random number collection "
2606 echo "service. Please read WARNING.RNG and request that your OS "
2607 echo "vendor includes kernel-based random number collection in "
2608 echo "future versions of your OS."