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(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV)
90 AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0')
93 check_for_libcrypt_later=1
94 LIBS="$LIBS /usr/lib/textmode.o"
95 AC_DEFINE(HAVE_CYGWIN)
97 AC_DEFINE(DISABLE_SHADOW)
98 AC_DEFINE(IPV4_DEFAULT)
99 AC_DEFINE(IP_TOS_IS_BROKEN)
100 AC_DEFINE(NO_X11_UNIX_SOCKETS)
101 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
102 AC_DEFINE(DISABLE_FD_PASSING)
103 AC_DEFINE(SETGROUPS_NOOP)
106 AC_DEFINE(IP_TOS_IS_BROKEN)
109 AC_MSG_CHECKING(if we have working getaddrinfo)
110 AC_TRY_RUN([#include <mach-o/dyld.h>
111 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
115 }], [AC_MSG_RESULT(working)],
116 [AC_MSG_RESULT(buggy)
117 AC_DEFINE(BROKEN_GETADDRINFO)],
118 [AC_MSG_RESULT(assume it is working)])
121 if test -z "$GCC"; then
124 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
125 IPADDR_IN_DISPLAY=yes
126 AC_DEFINE(HAVE_SECUREWARE)
128 AC_DEFINE(LOGIN_NO_ENDOPT)
129 AC_DEFINE(LOGIN_NEEDS_UTMPX)
130 AC_DEFINE(DISABLE_SHADOW)
131 AC_DEFINE(DISABLE_UTMP)
132 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT)
133 LIBS="$LIBS -lsec -lsecpw"
134 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
135 disable_ptmx_check=yes
138 if test -z "$GCC"; then
141 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
142 IPADDR_IN_DISPLAY=yes
144 AC_DEFINE(LOGIN_NO_ENDOPT)
145 AC_DEFINE(LOGIN_NEEDS_UTMPX)
146 AC_DEFINE(DISABLE_SHADOW)
147 AC_DEFINE(DISABLE_UTMP)
148 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT)
150 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
153 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
154 IPADDR_IN_DISPLAY=yes
155 AC_DEFINE(PAM_SUN_CODEBASE)
157 AC_DEFINE(LOGIN_NO_ENDOPT)
158 AC_DEFINE(LOGIN_NEEDS_UTMPX)
159 AC_DEFINE(DISABLE_SHADOW)
160 AC_DEFINE(DISABLE_UTMP)
161 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT)
163 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
166 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
168 PATH="$PATH:/usr/etc"
169 AC_DEFINE(BROKEN_INET_NTOA)
170 AC_DEFINE(WITH_ABBREV_NO_TTY)
173 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
175 PATH="$PATH:/usr/etc"
176 AC_DEFINE(WITH_IRIX_ARRAY)
177 AC_DEFINE(WITH_IRIX_PROJECT)
178 AC_DEFINE(WITH_IRIX_AUDIT)
179 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
180 AC_DEFINE(BROKEN_INET_NTOA)
181 AC_DEFINE(WITH_ABBREV_NO_TTY)
185 check_for_libcrypt_later=1
186 AC_DEFINE(DONT_TRY_OTHER_AF)
187 AC_DEFINE(PAM_TTY_KLUDGE)
188 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV)
189 AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0')
190 inet6_default_4in6=yes
191 # openpty can be in libutil, needed for controlling tty test
192 AC_SEARCH_LIBS(openpty, util)
193 # make sure that openpty does not reacquire controlling terminal
194 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
198 #include <sys/fcntl.h>
199 #include <sys/types.h>
200 #include <sys/wait.h>
206 int fd, ptyfd, ttyfd, status;
209 if (pid < 0) { /* failed */
211 } else if (pid > 0) { /* parent */
212 waitpid(pid, &status, 0);
213 if (WIFEXITED(status))
214 exit(WEXITSTATUS(status));
218 close(0); close(1); close(2);
220 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
221 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
223 exit(3); /* Acquired ctty: broken */
225 exit(0); /* Did not acquire ctty: OK */
234 AC_DEFINE(SSHD_ACQUIRES_CTTY)
239 AC_DEFINE(BROKEN_CMSG_TYPE)
243 mips-sony-bsd|mips-sony-newsos4)
244 AC_DEFINE(HAVE_NEWS4)
248 check_for_libcrypt_before=1
252 check_for_libcrypt_later=1
255 conf_lastlog_location="/usr/adm/lastlog"
256 conf_utmp_location=/etc/utmp
257 conf_wtmp_location=/usr/adm/wtmp
260 AC_DEFINE(BROKEN_REALPATH)
262 AC_DEFINE(BROKEN_SAVED_UIDS)
263 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
267 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
268 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
270 AC_DEFINE(PAM_SUN_CODEBASE)
271 AC_DEFINE(LOGIN_NEEDS_UTMPX)
272 AC_DEFINE(LOGIN_NEEDS_TERM)
273 AC_DEFINE(PAM_TTY_KLUDGE)
274 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
275 AC_DEFINE(SSHD_ACQUIRES_CTTY)
276 # hardwire lastlog location (can't detect it on some versions)
277 conf_lastlog_location="/var/adm/lastlog"
278 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
279 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
280 if test "$sol2ver" -ge 8; then
282 AC_DEFINE(DISABLE_UTMP)
283 AC_DEFINE(DISABLE_WTMP)
289 CPPFLAGS="$CPPFLAGS -DSUNOS4"
290 AC_CHECK_FUNCS(getpwanam)
291 AC_DEFINE(PAM_SUN_CODEBASE)
292 conf_utmp_location=/etc/utmp
293 conf_wtmp_location=/var/adm/wtmp
294 conf_lastlog_location=/var/adm/lastlog
298 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
299 LDFLAGS="$LDFLAGS -L/usr/local/lib"
304 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
305 # /usr/ucblib MUST NOT be searched on ReliantUNIX
306 LDFLAGS="$LDFLAGS -L/usr/local/lib"
307 IPADDR_IN_DISPLAY=yes
309 AC_DEFINE(IP_TOS_IS_BROKEN)
310 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
311 # Attention: always take care to bind libsocket and libnsl before libc,
312 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
315 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
316 LDFLAGS="$LDFLAGS -L/usr/local/lib"
320 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
321 LDFLAGS="$LDFLAGS -L/usr/local/lib"
325 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
326 LDFLAGS="$LDFLAGS -L/usr/local/lib"
329 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
330 LDFLAGS="$LDFLAGS -L/usr/local/lib"
331 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
334 AC_DEFINE(BROKEN_SYS_TERMIO_H)
336 AC_DEFINE(HAVE_SECUREWARE)
337 AC_DEFINE(DISABLE_SHADOW)
338 AC_DEFINE(BROKEN_SAVED_UIDS)
339 AC_CHECK_FUNCS(getluid setluid)
341 do_sco3_extra_lib_check=yes
344 if test -z "$GCC"; then
345 CFLAGS="$CFLAGS -belf"
347 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
348 LDFLAGS="$LDFLAGS -L/usr/local/lib"
349 LIBS="$LIBS -lprot -lx -ltinfo -lm"
352 AC_DEFINE(HAVE_SECUREWARE)
353 AC_DEFINE(DISABLE_SHADOW)
354 AC_DEFINE(DISABLE_FD_PASSING)
355 AC_CHECK_FUNCS(getluid setluid)
360 AC_DEFINE(DISABLE_FD_PASSING)
362 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
367 AC_DEFINE(DISABLE_FD_PASSING)
368 AC_DEFINE(NO_SSH_LASTLOG)
369 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
370 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
374 AC_MSG_CHECKING(for Digital Unix SIA)
377 [ --with-osfsia Enable Digital Unix SIA],
379 if test "x$withval" = "xno" ; then
380 AC_MSG_RESULT(disabled)
385 if test -z "$no_osfsia" ; then
386 if test -f /etc/sia/matrix.conf; then
388 AC_DEFINE(HAVE_OSF_SIA)
389 AC_DEFINE(DISABLE_LOGIN)
390 AC_DEFINE(DISABLE_FD_PASSING)
391 LIBS="$LIBS -lsecurity -ldb -lm -laud"
396 AC_DEFINE(DISABLE_FD_PASSING)
401 AC_DEFINE(NO_X11_UNIX_SOCKETS)
402 AC_DEFINE(MISSING_NFDBITS)
403 AC_DEFINE(MISSING_HOWMANY)
404 AC_DEFINE(MISSING_FD_MASK)
408 # Allow user to specify flags
410 [ --with-cflags Specify additional flags to pass to compiler],
412 if test "x$withval" != "xno" ; then
413 CFLAGS="$CFLAGS $withval"
417 AC_ARG_WITH(cppflags,
418 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
420 if test "x$withval" != "xno"; then
421 CPPFLAGS="$CPPFLAGS $withval"
426 [ --with-ldflags Specify additional flags to pass to linker],
428 if test "x$withval" != "xno" ; then
429 LDFLAGS="$LDFLAGS $withval"
434 [ --with-libs Specify additional libraries to link with],
436 if test "x$withval" != "xno" ; then
437 LIBS="$LIBS $withval"
442 # Checks for header files.
443 AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
444 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
445 login_cap.h maillock.h netdb.h netgroup.h \
446 netinet/in_systm.h paths.h pty.h readpassphrase.h \
447 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
448 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
449 sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
450 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
451 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
452 util.h utime.h utmp.h utmpx.h)
454 # Checks for libraries.
455 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
456 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
458 dnl SCO OS3 needs this for libwrap
459 if test "x$with_tcp_wrappers" != "xno" ; then
460 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
461 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
465 AC_CHECK_FUNC(getspnam, ,
466 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
469 [ --without-rpath Disable auto-added -R linker paths],
471 if test "x$withval" = "xno" ; then
474 if test "x$withval" = "xyes" ; then
482 [ --with-zlib=PATH Use zlib in PATH],
484 if test "x$withval" = "xno" ; then
485 AC_MSG_ERROR([*** zlib is required ***])
487 if test -d "$withval/lib"; then
488 if test -n "${need_dash_r}"; then
489 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
491 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
494 if test -n "${need_dash_r}"; then
495 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
497 LDFLAGS="-L${withval} ${LDFLAGS}"
500 if test -d "$withval/include"; then
501 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
503 CPPFLAGS="-I${withval} ${CPPFLAGS}"
508 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
511 AC_CHECK_FUNC(strcasecmp,
512 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
514 AC_CHECK_FUNC(utimes,
515 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
516 LIBS="$LIBS -lc89"]) ]
519 dnl Checks for libutil functions
520 AC_CHECK_HEADERS(libutil.h)
521 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
522 AC_CHECK_FUNCS(logout updwtmp logwtmp)
526 # Check for ALTDIRFUNC glob() extension
527 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
528 AC_EGREP_CPP(FOUNDIT,
531 #ifdef GLOB_ALTDIRFUNC
536 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
544 # Check for g.gl_matchc glob() extension
545 AC_MSG_CHECKING(for gl_matchc field in glob_t)
546 AC_EGREP_CPP(FOUNDIT,
549 int main(void){glob_t g; g.gl_matchc = 1;}
552 AC_DEFINE(GLOB_HAS_GL_MATCHC)
560 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
563 #include <sys/types.h>
565 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
567 [AC_MSG_RESULT(yes)],
570 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
574 # Check whether user wants S/Key support
577 [ --with-skey[[=PATH]] Enable S/Key support
578 (optionally in PATH)],
580 if test "x$withval" != "xno" ; then
582 if test "x$withval" != "xyes" ; then
583 CPPFLAGS="$CPPFLAGS -I${withval}/include"
584 LDFLAGS="$LDFLAGS -L${withval}/lib"
591 AC_MSG_CHECKING([for s/key support])
596 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
598 [AC_MSG_RESULT(yes)],
601 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
607 # Check whether user wants TCP wrappers support
609 AC_ARG_WITH(tcp-wrappers,
610 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
611 (optionally in PATH)],
613 if test "x$withval" != "xno" ; then
615 saved_LDFLAGS="$LDFLAGS"
616 saved_CPPFLAGS="$CPPFLAGS"
617 if test -n "${withval}" -a "${withval}" != "yes"; then
618 if test -d "${withval}/lib"; then
619 if test -n "${need_dash_r}"; then
620 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
622 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
625 if test -n "${need_dash_r}"; then
626 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
628 LDFLAGS="-L${withval} ${LDFLAGS}"
631 if test -d "${withval}/include"; then
632 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
634 CPPFLAGS="-I${withval} ${CPPFLAGS}"
638 LIBS="$LIBWRAP $LIBS"
639 AC_MSG_CHECKING(for libwrap)
643 int deny_severity = 0, allow_severity = 0;
653 AC_MSG_ERROR([*** libwrap missing])
661 dnl Checks for library functions. Please keep in alphabetical order
663 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename bcopy \
664 bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
665 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
666 getpeereid _getpty getrlimit getrusage getttyent glob inet_aton \
667 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
668 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openpty pstat \
669 readpassphrase realpath recvmsg rresvport_af sendmsg setdtablesize \
670 setegid setenv seteuid setgroups setlogin setpcred setproctitle \
671 setresgid setreuid setrlimit setsid setvbuf sigaction sigvec \
672 snprintf socketpair strerror strlcat strlcpy strmode strnvis \
673 sysconf tcgetpgrp truncate utimes vhangup vsnprintf waitpid \
676 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
677 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
679 dnl Make sure strsep prototype is defined before defining HAVE_STRSEP
680 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
682 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
683 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
684 AC_CHECK_LIB(gen, dirname,[
685 AC_CACHE_CHECK([for broken dirname],
686 ac_cv_have_broken_dirname, [
694 int main(int argc, char **argv) {
697 strncpy(buf,"/etc", 32);
699 if (!s || strncmp(s, "/", 32) != 0) {
706 [ ac_cv_have_broken_dirname="no" ],
707 [ ac_cv_have_broken_dirname="yes" ]
711 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
713 AC_DEFINE(HAVE_DIRNAME)
714 AC_CHECK_HEADERS(libgen.h)
719 dnl Checks for time functions
720 AC_CHECK_FUNCS(gettimeofday time)
721 dnl Checks for utmp functions
722 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
723 AC_CHECK_FUNCS(utmpname)
724 dnl Checks for utmpx functions
725 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
726 AC_CHECK_FUNCS(setutxent utmpxname)
728 AC_CHECK_FUNC(daemon,
729 [AC_DEFINE(HAVE_DAEMON)],
730 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
733 AC_CHECK_FUNC(getpagesize,
734 [AC_DEFINE(HAVE_GETPAGESIZE)],
735 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
738 # Check for broken snprintf
739 if test "x$ac_cv_func_snprintf" = "xyes" ; then
740 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
744 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
746 [AC_MSG_RESULT(yes)],
749 AC_DEFINE(BROKEN_SNPRINTF)
750 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
755 dnl see whether mkstemp() requires XXXXXX
756 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
757 AC_MSG_CHECKING([for (overly) strict mkstemp])
761 main() { char template[]="conftest.mkstemp-test";
762 if (mkstemp(template) == -1)
764 unlink(template); exit(0);
772 AC_DEFINE(HAVE_STRICT_MKSTEMP)
776 AC_DEFINE(HAVE_STRICT_MKSTEMP)
786 [ --with-pam Enable PAM support ],
788 if test "x$withval" != "xno" ; then
789 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
790 AC_MSG_ERROR([PAM headers not found])
793 AC_CHECK_LIB(dl, dlopen, , )
794 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
795 AC_CHECK_FUNCS(pam_getenvlist)
801 if test $ac_cv_lib_dl_dlopen = yes; then
811 # Check for older PAM
812 if test "x$PAM_MSG" = "xyes" ; then
813 # Check PAM strerror arguments (old PAM)
814 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
818 #include <security/pam_appl.h>
820 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
823 AC_DEFINE(HAVE_OLD_PAM)
825 PAM_MSG="yes (old library)"
830 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
831 # because the system crypt() is more featureful.
832 if test "x$check_for_libcrypt_before" = "x1"; then
833 AC_CHECK_LIB(crypt, crypt)
837 saved_CPPFLAGS="$CPPFLAGS"
838 saved_LDFLAGS="$LDFLAGS"
840 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
842 if test "x$withval" != "xno" ; then
843 if test -d "$withval/lib"; then
844 if test -n "${need_dash_r}"; then
845 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
847 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
850 if test -n "${need_dash_r}"; then
851 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
853 LDFLAGS="-L${withval} ${LDFLAGS}"
856 if test -d "$withval/include"; then
857 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
859 CPPFLAGS="-I${withval} ${CPPFLAGS}"
864 LIBS="$LIBS -lcrypto"
865 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
867 dnl Check default openssl install dir
868 if test -n "${need_dash_r}"; then
869 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
871 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
873 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
874 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
876 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
882 # Determine OpenSSL header version
883 AC_MSG_CHECKING([OpenSSL header version])
888 #include <openssl/opensslv.h>
889 #define DATA "conftest.sslincver"
894 fd = fopen(DATA,"w");
898 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
905 ssl_header_ver=`cat conftest.sslincver`
906 AC_MSG_RESULT($ssl_header_ver)
909 AC_MSG_RESULT(not found)
910 AC_MSG_ERROR(OpenSSL version header not found.)
914 # Determine OpenSSL library version
915 AC_MSG_CHECKING([OpenSSL library version])
920 #include <openssl/opensslv.h>
921 #include <openssl/crypto.h>
922 #define DATA "conftest.ssllibver"
927 fd = fopen(DATA,"w");
931 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
938 ssl_library_ver=`cat conftest.ssllibver`
939 AC_MSG_RESULT($ssl_library_ver)
942 AC_MSG_RESULT(not found)
943 AC_MSG_ERROR(OpenSSL library not found.)
947 # Sanity check OpenSSL headers
948 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
952 #include <openssl/opensslv.h>
953 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
960 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
964 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
965 # version in OpenSSL. Skip this for PAM
966 if test "x$check_for_libcrypt_later" = "x1"; then
967 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
971 ### Configure cryptographic random number support
973 # Check wheter OpenSSL seeds itself
974 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
978 #include <openssl/rand.h>
979 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
982 OPENSSL_SEEDS_ITSELF=yes
987 # Default to use of the rand helper if OpenSSL doesn't
994 # Do we want to force the use of the rand helper?
995 AC_ARG_WITH(rand-helper,
996 [ --with-rand-helper Use subprocess to gather strong randomness ],
998 if test "x$withval" = "xno" ; then
999 # Force use of OpenSSL's internal RNG, even if
1000 # the previous test showed it to be unseeded.
1001 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1002 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1003 OPENSSL_SEEDS_ITSELF=yes
1012 # Which randomness source do we use?
1013 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1015 AC_DEFINE(OPENSSL_PRNG_ONLY)
1016 RAND_MSG="OpenSSL internal ONLY"
1017 INSTALL_SSH_RAND_HELPER=""
1018 elif test ! -z "$USE_RAND_HELPER" ; then
1019 # install rand helper
1020 RAND_MSG="ssh-rand-helper"
1021 INSTALL_SSH_RAND_HELPER="yes"
1023 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1025 ### Configuration of ssh-rand-helper
1028 AC_ARG_WITH(prngd-port,
1029 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1038 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1041 if test ! -z "$withval" ; then
1042 PRNGD_PORT="$withval"
1043 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1048 # PRNGD Unix domain socket
1049 AC_ARG_WITH(prngd-socket,
1050 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1054 withval="/var/run/egd-pool"
1062 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1066 if test ! -z "$withval" ; then
1067 if test ! -z "$PRNGD_PORT" ; then
1068 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1070 if test ! -r "$withval" ; then
1071 AC_MSG_WARN(Entropy socket is not readable)
1073 PRNGD_SOCKET="$withval"
1074 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1078 # Check for existing socket only if we don't have a random device already
1079 if test "$USE_RAND_HELPER" = yes ; then
1080 AC_MSG_CHECKING(for PRNGD/EGD socket)
1081 # Insert other locations here
1082 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1083 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1084 PRNGD_SOCKET="$sock"
1085 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1089 if test ! -z "$PRNGD_SOCKET" ; then
1090 AC_MSG_RESULT($PRNGD_SOCKET)
1092 AC_MSG_RESULT(not found)
1098 # Change default command timeout for hashing entropy source
1100 AC_ARG_WITH(entropy-timeout,
1101 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1103 if test "x$withval" != "xno" ; then
1104 entropy_timeout=$withval
1108 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1110 SSH_PRIVSEP_USER=sshd
1111 AC_ARG_WITH(privsep-user,
1112 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1114 if test -n "$withval"; then
1115 SSH_PRIVSEP_USER=$withval
1119 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1120 AC_SUBST(SSH_PRIVSEP_USER)
1122 # We do this little dance with the search path to insure
1123 # that programs that we select for use by installed programs
1124 # (which may be run by the super-user) come from trusted
1125 # locations before they come from the user's private area.
1126 # This should help avoid accidentally configuring some
1127 # random version of a program in someone's personal bin.
1131 test -h /bin 2> /dev/null && PATH=/usr/bin
1132 test -d /sbin && PATH=$PATH:/sbin
1133 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1134 PATH=$PATH:/etc:$OPATH
1136 # These programs are used by the command hashing source to gather entropy
1137 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1138 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1139 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1140 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1141 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1142 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1143 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1144 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1145 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1146 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1147 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1148 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1149 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1150 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1151 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1152 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1156 # Where does ssh-rand-helper get its randomness from?
1157 INSTALL_SSH_PRNG_CMDS=""
1158 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1159 if test ! -z "$PRNGD_PORT" ; then
1160 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1161 elif test ! -z "$PRNGD_SOCKET" ; then
1162 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1164 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1165 RAND_HELPER_CMDHASH=yes
1166 INSTALL_SSH_PRNG_CMDS="yes"
1169 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1172 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1173 if test ! -z "$SONY" ; then
1174 LIBS="$LIBS -liberty";
1177 # Checks for data types
1178 AC_CHECK_SIZEOF(char, 1)
1179 AC_CHECK_SIZEOF(short int, 2)
1180 AC_CHECK_SIZEOF(int, 4)
1181 AC_CHECK_SIZEOF(long int, 4)
1182 AC_CHECK_SIZEOF(long long int, 8)
1184 # Sanity check long long for some platforms (AIX)
1185 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1186 ac_cv_sizeof_long_long_int=0
1189 # More checks for data types
1190 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1192 [ #include <sys/types.h> ],
1194 [ ac_cv_have_u_int="yes" ],
1195 [ ac_cv_have_u_int="no" ]
1198 if test "x$ac_cv_have_u_int" = "xyes" ; then
1199 AC_DEFINE(HAVE_U_INT)
1203 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1205 [ #include <sys/types.h> ],
1206 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1207 [ ac_cv_have_intxx_t="yes" ],
1208 [ ac_cv_have_intxx_t="no" ]
1211 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1212 AC_DEFINE(HAVE_INTXX_T)
1216 if (test -z "$have_intxx_t" && \
1217 test "x$ac_cv_header_stdint_h" = "xyes")
1219 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1221 [ #include <stdint.h> ],
1222 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1224 AC_DEFINE(HAVE_INTXX_T)
1227 [ AC_MSG_RESULT(no) ]
1231 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1234 #include <sys/types.h>
1235 #ifdef HAVE_STDINT_H
1236 # include <stdint.h>
1238 #include <sys/socket.h>
1239 #ifdef HAVE_SYS_BITYPES_H
1240 # include <sys/bitypes.h>
1243 [ int64_t a; a = 1;],
1244 [ ac_cv_have_int64_t="yes" ],
1245 [ ac_cv_have_int64_t="no" ]
1248 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1249 AC_DEFINE(HAVE_INT64_T)
1252 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1254 [ #include <sys/types.h> ],
1255 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1256 [ ac_cv_have_u_intxx_t="yes" ],
1257 [ ac_cv_have_u_intxx_t="no" ]
1260 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1261 AC_DEFINE(HAVE_U_INTXX_T)
1265 if test -z "$have_u_intxx_t" ; then
1266 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1268 [ #include <sys/socket.h> ],
1269 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1271 AC_DEFINE(HAVE_U_INTXX_T)
1274 [ AC_MSG_RESULT(no) ]
1278 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1280 [ #include <sys/types.h> ],
1281 [ u_int64_t a; a = 1;],
1282 [ ac_cv_have_u_int64_t="yes" ],
1283 [ ac_cv_have_u_int64_t="no" ]
1286 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1287 AC_DEFINE(HAVE_U_INT64_T)
1291 if test -z "$have_u_int64_t" ; then
1292 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1294 [ #include <sys/bitypes.h> ],
1295 [ u_int64_t a; a = 1],
1297 AC_DEFINE(HAVE_U_INT64_T)
1300 [ AC_MSG_RESULT(no) ]
1304 if test -z "$have_u_intxx_t" ; then
1305 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1308 #include <sys/types.h>
1310 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1311 [ ac_cv_have_uintxx_t="yes" ],
1312 [ ac_cv_have_uintxx_t="no" ]
1315 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1316 AC_DEFINE(HAVE_UINTXX_T)
1320 if test -z "$have_uintxx_t" ; then
1321 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1323 [ #include <stdint.h> ],
1324 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1326 AC_DEFINE(HAVE_UINTXX_T)
1329 [ AC_MSG_RESULT(no) ]
1333 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1334 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1336 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1339 #include <sys/bitypes.h>
1342 int8_t a; int16_t b; int32_t c;
1343 u_int8_t e; u_int16_t f; u_int32_t g;
1344 a = b = c = e = f = g = 1;
1347 AC_DEFINE(HAVE_U_INTXX_T)
1348 AC_DEFINE(HAVE_INTXX_T)
1356 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1359 #include <sys/types.h>
1361 [ u_char foo; foo = 125; ],
1362 [ ac_cv_have_u_char="yes" ],
1363 [ ac_cv_have_u_char="no" ]
1366 if test "x$ac_cv_have_u_char" = "xyes" ; then
1367 AC_DEFINE(HAVE_U_CHAR)
1372 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1374 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1377 #include <sys/types.h>
1379 [ size_t foo; foo = 1235; ],
1380 [ ac_cv_have_size_t="yes" ],
1381 [ ac_cv_have_size_t="no" ]
1384 if test "x$ac_cv_have_size_t" = "xyes" ; then
1385 AC_DEFINE(HAVE_SIZE_T)
1388 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1391 #include <sys/types.h>
1393 [ ssize_t foo; foo = 1235; ],
1394 [ ac_cv_have_ssize_t="yes" ],
1395 [ ac_cv_have_ssize_t="no" ]
1398 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1399 AC_DEFINE(HAVE_SSIZE_T)
1402 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1407 [ clock_t foo; foo = 1235; ],
1408 [ ac_cv_have_clock_t="yes" ],
1409 [ ac_cv_have_clock_t="no" ]
1412 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1413 AC_DEFINE(HAVE_CLOCK_T)
1416 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1419 #include <sys/types.h>
1420 #include <sys/socket.h>
1422 [ sa_family_t foo; foo = 1235; ],
1423 [ ac_cv_have_sa_family_t="yes" ],
1426 #include <sys/types.h>
1427 #include <sys/socket.h>
1428 #include <netinet/in.h>
1430 [ sa_family_t foo; foo = 1235; ],
1431 [ ac_cv_have_sa_family_t="yes" ],
1433 [ ac_cv_have_sa_family_t="no" ]
1437 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1438 AC_DEFINE(HAVE_SA_FAMILY_T)
1441 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1444 #include <sys/types.h>
1446 [ pid_t foo; foo = 1235; ],
1447 [ ac_cv_have_pid_t="yes" ],
1448 [ ac_cv_have_pid_t="no" ]
1451 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1452 AC_DEFINE(HAVE_PID_T)
1455 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1458 #include <sys/types.h>
1460 [ mode_t foo; foo = 1235; ],
1461 [ ac_cv_have_mode_t="yes" ],
1462 [ ac_cv_have_mode_t="no" ]
1465 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1466 AC_DEFINE(HAVE_MODE_T)
1470 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1473 #include <sys/types.h>
1474 #include <sys/socket.h>
1476 [ struct sockaddr_storage s; ],
1477 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1478 [ ac_cv_have_struct_sockaddr_storage="no" ]
1481 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1482 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1485 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1488 #include <sys/types.h>
1489 #include <netinet/in.h>
1491 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1492 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1493 [ ac_cv_have_struct_sockaddr_in6="no" ]
1496 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1497 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1500 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1503 #include <sys/types.h>
1504 #include <netinet/in.h>
1506 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1507 [ ac_cv_have_struct_in6_addr="yes" ],
1508 [ ac_cv_have_struct_in6_addr="no" ]
1511 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1512 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1515 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1518 #include <sys/types.h>
1519 #include <sys/socket.h>
1522 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1523 [ ac_cv_have_struct_addrinfo="yes" ],
1524 [ ac_cv_have_struct_addrinfo="no" ]
1527 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1528 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1531 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1533 [ #include <sys/time.h> ],
1534 [ struct timeval tv; tv.tv_sec = 1;],
1535 [ ac_cv_have_struct_timeval="yes" ],
1536 [ ac_cv_have_struct_timeval="no" ]
1539 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1540 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1541 have_struct_timeval=1
1544 AC_CHECK_TYPES(struct timespec)
1546 # We need int64_t or else certian parts of the compile will fail.
1547 if test "x$ac_cv_have_int64_t" = "xno" -a \
1548 "x$ac_cv_sizeof_long_int" != "x8" -a \
1549 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1550 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1551 echo "an alternative compiler (I.E., GCC) before continuing."
1555 dnl test snprintf (broken on SCO w/gcc)
1560 #ifdef HAVE_SNPRINTF
1564 char expected_out[50];
1566 #if (SIZEOF_LONG_INT == 8)
1567 long int num = 0x7fffffffffffffff;
1569 long long num = 0x7fffffffffffffffll;
1571 strcpy(expected_out, "9223372036854775807");
1572 snprintf(buf, mazsize, "%lld", num);
1573 if(strcmp(buf, expected_out) != 0)
1580 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1584 dnl Checks for structure members
1585 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1586 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1587 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1588 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1589 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1590 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1591 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1592 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1593 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1594 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1595 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1596 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1597 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1598 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1599 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1600 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1601 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1603 AC_CHECK_MEMBERS([struct stat.st_blksize])
1605 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1606 ac_cv_have_ss_family_in_struct_ss, [
1609 #include <sys/types.h>
1610 #include <sys/socket.h>
1612 [ struct sockaddr_storage s; s.ss_family = 1; ],
1613 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1614 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1617 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1618 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1621 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1622 ac_cv_have___ss_family_in_struct_ss, [
1625 #include <sys/types.h>
1626 #include <sys/socket.h>
1628 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1629 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1630 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1633 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1634 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1637 AC_CACHE_CHECK([for pw_class field in struct passwd],
1638 ac_cv_have_pw_class_in_struct_passwd, [
1643 [ struct passwd p; p.pw_class = 0; ],
1644 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1645 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1648 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1649 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1652 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1653 ac_cv_have_pw_expire_in_struct_passwd, [
1658 [ struct passwd p; p.pw_expire = 0; ],
1659 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1660 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1663 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1664 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1667 AC_CACHE_CHECK([for pw_change field in struct passwd],
1668 ac_cv_have_pw_change_in_struct_passwd, [
1673 [ struct passwd p; p.pw_change = 0; ],
1674 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1675 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1678 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1679 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1682 dnl make sure we're using the real structure members and not defines
1683 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1684 ac_cv_have_accrights_in_msghdr, [
1687 #include <sys/types.h>
1688 #include <sys/socket.h>
1689 #include <sys/uio.h>
1691 #ifdef msg_accrights
1695 m.msg_accrights = 0;
1699 [ ac_cv_have_accrights_in_msghdr="yes" ],
1700 [ ac_cv_have_accrights_in_msghdr="no" ]
1703 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1704 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1707 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1708 ac_cv_have_control_in_msghdr, [
1711 #include <sys/types.h>
1712 #include <sys/socket.h>
1713 #include <sys/uio.h>
1723 [ ac_cv_have_control_in_msghdr="yes" ],
1724 [ ac_cv_have_control_in_msghdr="no" ]
1727 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1728 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1731 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1733 [ extern char *__progname; printf("%s", __progname); ],
1734 [ ac_cv_libc_defines___progname="yes" ],
1735 [ ac_cv_libc_defines___progname="no" ]
1738 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1739 AC_DEFINE(HAVE___PROGNAME)
1742 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1746 [ printf("%s", __FUNCTION__); ],
1747 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1748 [ ac_cv_cc_implements___FUNCTION__="no" ]
1751 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1752 AC_DEFINE(HAVE___FUNCTION__)
1755 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1759 [ printf("%s", __func__); ],
1760 [ ac_cv_cc_implements___func__="yes" ],
1761 [ ac_cv_cc_implements___func__="no" ]
1764 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1765 AC_DEFINE(HAVE___func__)
1768 AC_CACHE_CHECK([whether getopt has optreset support],
1769 ac_cv_have_getopt_optreset, [
1774 [ extern int optreset; optreset = 0; ],
1775 [ ac_cv_have_getopt_optreset="yes" ],
1776 [ ac_cv_have_getopt_optreset="no" ]
1779 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1780 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1783 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1785 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1786 [ ac_cv_libc_defines_sys_errlist="yes" ],
1787 [ ac_cv_libc_defines_sys_errlist="no" ]
1790 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1791 AC_DEFINE(HAVE_SYS_ERRLIST)
1795 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1797 [ extern int sys_nerr; printf("%i", sys_nerr);],
1798 [ ac_cv_libc_defines_sys_nerr="yes" ],
1799 [ ac_cv_libc_defines_sys_nerr="no" ]
1802 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1803 AC_DEFINE(HAVE_SYS_NERR)
1808 # Check whether user wants sectok support
1810 [ --with-sectok Enable smartcard support using libsectok],
1812 if test "x$withval" != "xno" ; then
1813 if test "x$withval" != "xyes" ; then
1814 CPPFLAGS="$CPPFLAGS -I${withval}"
1815 LDFLAGS="$LDFLAGS -L${withval}"
1816 if test ! -z "$need_dash_r" ; then
1817 LDFLAGS="$LDFLAGS -R${withval}"
1819 if test ! -z "$blibpath" ; then
1820 blibpath="$blibpath:${withval}"
1823 AC_CHECK_HEADERS(sectok.h)
1824 if test "$ac_cv_header_sectok_h" != yes; then
1825 AC_MSG_ERROR(Can't find sectok.h)
1827 AC_CHECK_LIB(sectok, sectok_open)
1828 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1829 AC_MSG_ERROR(Can't find libsectok)
1831 AC_DEFINE(SMARTCARD)
1832 AC_DEFINE(USE_SECTOK)
1833 SCARD_MSG="yes, using sectok"
1838 # Check whether user wants OpenSC support
1840 AC_HELP_STRING([--with-opensc=PFX],
1841 [Enable smartcard support using OpenSC]),
1842 opensc_config_prefix="$withval", opensc_config_prefix="")
1843 if test x$opensc_config_prefix != x ; then
1844 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1845 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1846 if test "$OPENSC_CONFIG" != "no"; then
1847 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1848 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1849 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1850 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1851 AC_DEFINE(SMARTCARD)
1852 AC_DEFINE(USE_OPENSC)
1853 SCARD_MSG="yes, using OpenSC"
1857 # Check whether user wants Kerberos 5 support
1859 AC_ARG_WITH(kerberos5,
1860 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1862 if test "x$withval" != "xno" ; then
1863 if test "x$withval" = "xyes" ; then
1864 KRB5ROOT="/usr/local"
1868 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1869 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1872 AC_MSG_CHECKING(whether we are using Heimdal)
1873 AC_TRY_COMPILE([ #include <krb5.h> ],
1874 [ char *tmp = heimdal_version; ],
1875 [ AC_MSG_RESULT(yes)
1877 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1880 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1883 if test ! -z "$need_dash_r" ; then
1884 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1886 if test ! -z "$blibpath" ; then
1887 blibpath="$blibpath:${KRB5ROOT}/lib"
1889 AC_CHECK_LIB(resolv, dn_expand, , )
1895 # Check whether user wants Kerberos 4 support
1897 AC_ARG_WITH(kerberos4,
1898 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1900 if test "x$withval" != "xno" ; then
1901 if test "x$withval" != "xyes" ; then
1902 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1903 LDFLAGS="$LDFLAGS -L${withval}/lib"
1904 if test ! -z "$need_dash_r" ; then
1905 LDFLAGS="$LDFLAGS -R${withval}/lib"
1907 if test ! -z "$blibpath" ; then
1908 blibpath="$blibpath:${withval}/lib"
1911 if test -d /usr/include/kerberosIV ; then
1912 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1916 AC_CHECK_HEADERS(krb.h)
1917 if test "$ac_cv_header_krb_h" != yes; then
1918 AC_MSG_WARN([Cannot find krb.h, build may fail])
1920 AC_CHECK_LIB(krb, main)
1921 if test "$ac_cv_lib_krb_main" != yes; then
1922 AC_CHECK_LIB(krb4, main)
1923 if test "$ac_cv_lib_krb4_main" != yes; then
1924 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1931 AC_CHECK_LIB(des, des_cbc_encrypt)
1932 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1933 AC_CHECK_LIB(des425, des_cbc_encrypt)
1934 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1935 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1942 AC_CHECK_LIB(resolv, dn_expand, , )
1950 # Check whether user wants AFS support
1953 [ --with-afs=PATH Enable AFS support],
1955 if test "x$withval" != "xno" ; then
1957 if test "x$withval" != "xyes" ; then
1958 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1959 LDFLAGS="$LDFLAGS -L${withval}/lib"
1962 if test -z "$KRB4" ; then
1963 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1967 if test ! -z "$AFS_LIBS" ; then
1968 LIBS="$LIBS $AFS_LIBS"
1975 LIBS="$LIBS $KLIBS $K5LIBS"
1977 # Looking for programs, paths and files
1979 PRIVSEP_PATH=/var/empty
1980 AC_ARG_WITH(privsep-path,
1981 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
1983 if test "x$withval" != "$no" ; then
1984 PRIVSEP_PATH=$withval
1988 AC_SUBST(PRIVSEP_PATH)
1991 [ --with-xauth=PATH Specify path to xauth program ],
1993 if test "x$withval" != "xno" ; then
1999 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2000 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2001 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2002 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2003 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2004 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2005 xauth_path="/usr/openwin/bin/xauth"
2011 AC_ARG_ENABLE(strip,
2012 [ --disable-strip Disable calling strip(1) on install],
2014 if test "x$enableval" = "xno" ; then
2021 if test -z "$xauth_path" ; then
2022 XAUTH_PATH="undefined"
2023 AC_SUBST(XAUTH_PATH)
2025 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2026 XAUTH_PATH=$xauth_path
2027 AC_SUBST(XAUTH_PATH)
2030 # Check for mail directory (last resort if we cannot get it from headers)
2031 if test ! -z "$MAIL" ; then
2032 maildir=`dirname $MAIL`
2033 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2036 if test -z "$no_dev_ptmx" ; then
2037 if test "x$disable_ptmx_check" != "xyes" ; then
2038 AC_CHECK_FILE("/dev/ptmx",
2040 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2046 AC_CHECK_FILE("/dev/ptc",
2048 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2053 # Options from here on. Some of these are preset by platform above
2054 AC_ARG_WITH(mantype,
2055 [ --with-mantype=man|cat|doc Set man page type],
2062 AC_MSG_ERROR(invalid man type: $withval)
2067 if test -z "$MANTYPE"; then
2068 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2069 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2070 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2072 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2079 if test "$MANTYPE" = "doc"; then
2086 # Check whether to enable MD5 passwords
2088 AC_ARG_WITH(md5-passwords,
2089 [ --with-md5-passwords Enable use of MD5 passwords],
2091 if test "x$withval" != "xno" ; then
2092 AC_DEFINE(HAVE_MD5_PASSWORDS)
2098 # Whether to disable shadow password support
2100 [ --without-shadow Disable shadow password support],
2102 if test "x$withval" = "xno" ; then
2103 AC_DEFINE(DISABLE_SHADOW)
2109 if test -z "$disable_shadow" ; then
2110 AC_MSG_CHECKING([if the systems has expire shadow information])
2113 #include <sys/types.h>
2116 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2117 [ sp_expire_available=yes ], []
2120 if test "x$sp_expire_available" = "xyes" ; then
2122 AC_DEFINE(HAS_SHADOW_EXPIRE)
2128 # Use ip address instead of hostname in $DISPLAY
2129 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2130 DISPLAY_HACK_MSG="yes"
2131 AC_DEFINE(IPADDR_IN_DISPLAY)
2133 DISPLAY_HACK_MSG="no"
2134 AC_ARG_WITH(ipaddr-display,
2135 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2137 if test "x$withval" != "xno" ; then
2138 AC_DEFINE(IPADDR_IN_DISPLAY)
2139 DISPLAY_HACK_MSG="yes"
2145 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2146 if test $ac_cv_func_login_getcapbool = "yes" -a \
2147 $ac_cv_header_login_cap_h = "yes" ; then
2150 # Whether to mess with the default path
2151 SERVER_PATH_MSG="(default)"
2152 AC_ARG_WITH(default-path,
2153 [ --with-default-path= Specify default \$PATH environment for server],
2155 if test "$USES_LOGIN_CONF" = "yes" ; then
2157 --with-default-path=PATH has no effect on this system.
2158 Edit /etc/login.conf instead.])
2159 elif test "x$withval" != "xno" ; then
2160 user_path="$withval"
2161 SERVER_PATH_MSG="$withval"
2164 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2165 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2169 /* find out what STDPATH is */
2174 #ifndef _PATH_STDPATH
2175 # ifdef _PATH_USERPATH /* Irix */
2176 # define _PATH_STDPATH _PATH_USERPATH
2178 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2181 #include <sys/types.h>
2182 #include <sys/stat.h>
2184 #define DATA "conftest.stdpath"
2191 fd = fopen(DATA,"w");
2195 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2200 ], [ user_path=`cat conftest.stdpath` ],
2201 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2202 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2204 # make sure $bindir is in USER_PATH so scp will work
2205 t_bindir=`eval echo ${bindir}`
2207 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2210 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2212 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2213 if test $? -ne 0 ; then
2214 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2215 if test $? -ne 0 ; then
2216 user_path=$user_path:$t_bindir
2217 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2222 if test "$USES_LOGIN_CONF" != "yes" ; then
2223 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2227 # Set superuser path separately to user path
2228 AC_ARG_WITH(superuser-path,
2229 [ --with-superuser-path= Specify different path for super-user],
2231 if test "x$withval" != "xno" ; then
2232 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2233 superuser_path=$withval
2239 # Whether to force IPv4 by default (needed on broken glibc Linux)
2241 AC_ARG_WITH(ipv4-default,
2242 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2244 if test "x$withval" != "xno" ; then
2245 AC_DEFINE(IPV4_DEFAULT)
2251 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2252 IPV4_IN6_HACK_MSG="no"
2254 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2256 if test "x$withval" != "xno" ; then
2258 AC_DEFINE(IPV4_IN_IPV6)
2259 IPV4_IN6_HACK_MSG="yes"
2264 if test "x$inet6_default_4in6" = "xyes"; then
2265 AC_MSG_RESULT([yes (default)])
2266 AC_DEFINE(IPV4_IN_IPV6)
2267 IPV4_IN6_HACK_MSG="yes"
2269 AC_MSG_RESULT([no (default)])
2274 # Whether to enable BSD auth support
2276 AC_ARG_WITH(bsd-auth,
2277 [ --with-bsd-auth Enable BSD auth support],
2279 if test "x$withval" != "xno" ; then
2286 # Where to place sshd.pid
2288 # make sure the directory exists
2289 if test ! -d $piddir ; then
2290 piddir=`eval echo ${sysconfdir}`
2292 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2296 AC_ARG_WITH(pid-dir,
2297 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2299 if test "x$withval" != "xno" ; then
2301 if test ! -d $piddir ; then
2302 AC_MSG_WARN([** no $piddir directory on this system **])
2308 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2311 dnl allow user to disable some login recording features
2312 AC_ARG_ENABLE(lastlog,
2313 [ --disable-lastlog disable use of lastlog even if detected [no]],
2314 [ AC_DEFINE(DISABLE_LASTLOG) ]
2317 [ --disable-utmp disable use of utmp even if detected [no]],
2318 [ AC_DEFINE(DISABLE_UTMP) ]
2320 AC_ARG_ENABLE(utmpx,
2321 [ --disable-utmpx disable use of utmpx even if detected [no]],
2322 [ AC_DEFINE(DISABLE_UTMPX) ]
2325 [ --disable-wtmp disable use of wtmp even if detected [no]],
2326 [ AC_DEFINE(DISABLE_WTMP) ]
2328 AC_ARG_ENABLE(wtmpx,
2329 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2330 [ AC_DEFINE(DISABLE_WTMPX) ]
2332 AC_ARG_ENABLE(libutil,
2333 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2334 [ AC_DEFINE(DISABLE_LOGIN) ]
2336 AC_ARG_ENABLE(pututline,
2337 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2338 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2340 AC_ARG_ENABLE(pututxline,
2341 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2342 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2344 AC_ARG_WITH(lastlog,
2345 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2347 if test "x$withval" = "xno" ; then
2348 AC_DEFINE(DISABLE_LASTLOG)
2350 conf_lastlog_location=$withval
2355 dnl lastlog, [uw]tmpx? detection
2356 dnl NOTE: set the paths in the platform section to avoid the
2357 dnl need for command-line parameters
2358 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2360 dnl lastlog detection
2361 dnl NOTE: the code itself will detect if lastlog is a directory
2362 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2364 #include <sys/types.h>
2366 #ifdef HAVE_LASTLOG_H
2367 # include <lastlog.h>
2376 [ char *lastlog = LASTLOG_FILE; ],
2377 [ AC_MSG_RESULT(yes) ],
2380 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2382 #include <sys/types.h>
2384 #ifdef HAVE_LASTLOG_H
2385 # include <lastlog.h>
2391 [ char *lastlog = _PATH_LASTLOG; ],
2392 [ AC_MSG_RESULT(yes) ],
2395 system_lastlog_path=no
2400 if test -z "$conf_lastlog_location"; then
2401 if test x"$system_lastlog_path" = x"no" ; then
2402 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2403 if (test -d "$f" || test -f "$f") ; then
2404 conf_lastlog_location=$f
2407 if test -z "$conf_lastlog_location"; then
2408 AC_MSG_WARN([** Cannot find lastlog **])
2409 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2414 if test -n "$conf_lastlog_location"; then
2415 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2419 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2421 #include <sys/types.h>
2427 [ char *utmp = UTMP_FILE; ],
2428 [ AC_MSG_RESULT(yes) ],
2430 system_utmp_path=no ]
2432 if test -z "$conf_utmp_location"; then
2433 if test x"$system_utmp_path" = x"no" ; then
2434 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2435 if test -f $f ; then
2436 conf_utmp_location=$f
2439 if test -z "$conf_utmp_location"; then
2440 AC_DEFINE(DISABLE_UTMP)
2444 if test -n "$conf_utmp_location"; then
2445 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2449 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2451 #include <sys/types.h>
2457 [ char *wtmp = WTMP_FILE; ],
2458 [ AC_MSG_RESULT(yes) ],
2460 system_wtmp_path=no ]
2462 if test -z "$conf_wtmp_location"; then
2463 if test x"$system_wtmp_path" = x"no" ; then
2464 for f in /usr/adm/wtmp /var/log/wtmp; do
2465 if test -f $f ; then
2466 conf_wtmp_location=$f
2469 if test -z "$conf_wtmp_location"; then
2470 AC_DEFINE(DISABLE_WTMP)
2474 if test -n "$conf_wtmp_location"; then
2475 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2479 dnl utmpx detection - I don't know any system so perverse as to require
2480 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2482 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2484 #include <sys/types.h>
2493 [ char *utmpx = UTMPX_FILE; ],
2494 [ AC_MSG_RESULT(yes) ],
2496 system_utmpx_path=no ]
2498 if test -z "$conf_utmpx_location"; then
2499 if test x"$system_utmpx_path" = x"no" ; then
2500 AC_DEFINE(DISABLE_UTMPX)
2503 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2507 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2509 #include <sys/types.h>
2518 [ char *wtmpx = WTMPX_FILE; ],
2519 [ AC_MSG_RESULT(yes) ],
2521 system_wtmpx_path=no ]
2523 if test -z "$conf_wtmpx_location"; then
2524 if test x"$system_wtmpx_path" = x"no" ; then
2525 AC_DEFINE(DISABLE_WTMPX)
2528 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2532 if test ! -z "$blibpath" ; then
2533 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2534 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2537 dnl remove pam and dl because they are in $LIBPAM
2538 if test "$PAM_MSG" = yes ; then
2539 LIBS=`echo $LIBS | sed 's/-lpam //'`
2541 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2542 LIBS=`echo $LIBS | sed 's/-ldl //'`
2546 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2549 # Print summary of options
2551 # Someone please show me a better way :)
2552 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2553 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2554 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2555 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2556 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2557 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2558 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2559 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2560 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2561 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2564 echo "OpenSSH has been configured with the following options:"
2565 echo " User binaries: $B"
2566 echo " System binaries: $C"
2567 echo " Configuration files: $D"
2568 echo " Askpass program: $E"
2569 echo " Manual pages: $F"
2570 echo " PID file: $G"
2571 echo " Privilege separation chroot path: $H"
2572 if test "$USES_LOGIN_CONF" = "yes" ; then
2573 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2575 echo " sshd default user PATH: $I"
2577 if test ! -z "$superuser_path" ; then
2578 echo " sshd superuser user PATH: $J"
2580 echo " Manpage format: $MANTYPE"
2581 echo " PAM support: ${PAM_MSG}"
2582 echo " KerberosIV support: $KRB4_MSG"
2583 echo " KerberosV support: $KRB5_MSG"
2584 echo " Smartcard support: $SCARD_MSG"
2585 echo " AFS support: $AFS_MSG"
2586 echo " S/KEY support: $SKEY_MSG"
2587 echo " TCP Wrappers support: $TCPW_MSG"
2588 echo " MD5 password support: $MD5_MSG"
2589 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2590 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2591 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2592 echo " BSD Auth support: $BSD_AUTH_MSG"
2593 echo " Random number source: $RAND_MSG"
2594 if test ! -z "$USE_RAND_HELPER" ; then
2595 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2600 echo " Host: ${host}"
2601 echo " Compiler: ${CC}"
2602 echo " Compiler flags: ${CFLAGS}"
2603 echo "Preprocessor flags: ${CPPFLAGS}"
2604 echo " Linker flags: ${LDFLAGS}"
2605 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2609 if test "x$PAM_MSG" = "xyes" ; then
2610 echo "PAM is enabled. You may need to install a PAM control file "
2611 echo "for sshd, otherwise password authentication may fail. "
2612 echo "Example PAM control files can be found in the contrib/ "
2617 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2618 echo "WARNING: you are using the builtin random number collection "
2619 echo "service. Please read WARNING.RNG and request that your OS "
2620 echo "vendor includes kernel-based random number collection in "
2621 echo "future versions of your OS."