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 AC_DEFINE(DONT_TRY_OTHER_AF)
199 AC_DEFINE(PAM_TTY_KLUDGE)
200 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
201 inet6_default_4in6=yes
202 # openpty can be in libutil, needed for controlling tty test
203 AC_SEARCH_LIBS(openpty, util)
204 # make sure that openpty does not reacquire controlling terminal
205 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
209 #include <sys/fcntl.h>
210 #include <sys/types.h>
211 #include <sys/wait.h>
217 int fd, ptyfd, ttyfd, status;
220 if (pid < 0) { /* failed */
222 } else if (pid > 0) { /* parent */
223 waitpid(pid, &status, 0);
224 if (WIFEXITED(status))
225 exit(WEXITSTATUS(status));
229 close(0); close(1); close(2);
231 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
232 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
234 exit(3); /* Acquired ctty: broken */
236 exit(0); /* Did not acquire ctty: OK */
245 AC_DEFINE(SSHD_ACQUIRES_CTTY)
250 AC_DEFINE(BROKEN_CMSG_TYPE)
254 mips-sony-bsd|mips-sony-newsos4)
255 AC_DEFINE(HAVE_NEWS4)
259 check_for_libcrypt_before=1
263 check_for_libcrypt_later=1
266 conf_lastlog_location="/usr/adm/lastlog"
267 conf_utmp_location=/etc/utmp
268 conf_wtmp_location=/usr/adm/wtmp
271 AC_DEFINE(BROKEN_REALPATH)
273 AC_DEFINE(BROKEN_SAVED_UIDS)
274 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
278 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
279 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
281 AC_DEFINE(PAM_SUN_CODEBASE)
282 AC_DEFINE(LOGIN_NEEDS_UTMPX)
283 AC_DEFINE(LOGIN_NEEDS_TERM)
284 AC_DEFINE(PAM_TTY_KLUDGE)
285 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
286 AC_DEFINE(SSHD_ACQUIRES_CTTY)
287 # hardwire lastlog location (can't detect it on some versions)
288 conf_lastlog_location="/var/adm/lastlog"
289 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
290 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
291 if test "$sol2ver" -ge 8; then
293 AC_DEFINE(DISABLE_UTMP)
294 AC_DEFINE(DISABLE_WTMP)
300 CPPFLAGS="$CPPFLAGS -DSUNOS4"
301 AC_CHECK_FUNCS(getpwanam)
302 AC_DEFINE(PAM_SUN_CODEBASE)
303 conf_utmp_location=/etc/utmp
304 conf_wtmp_location=/var/adm/wtmp
305 conf_lastlog_location=/var/adm/lastlog
309 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
310 LDFLAGS="$LDFLAGS -L/usr/local/lib"
313 AC_DEFINE(SSHD_ACQUIRES_CTTY)
316 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
317 # /usr/ucblib MUST NOT be searched on ReliantUNIX
318 LDFLAGS="$LDFLAGS -L/usr/local/lib"
319 IPADDR_IN_DISPLAY=yes
321 AC_DEFINE(IP_TOS_IS_BROKEN)
322 AC_DEFINE(SSHD_ACQUIRES_CTTY)
323 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
324 # Attention: always take care to bind libsocket and libnsl before libc,
325 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
328 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
329 LDFLAGS="$LDFLAGS -L/usr/local/lib"
333 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
334 LDFLAGS="$LDFLAGS -L/usr/local/lib"
338 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
339 LDFLAGS="$LDFLAGS -L/usr/local/lib"
342 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
343 LDFLAGS="$LDFLAGS -L/usr/local/lib"
344 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
347 AC_DEFINE(BROKEN_SYS_TERMIO_H)
349 AC_DEFINE(HAVE_SECUREWARE)
350 AC_DEFINE(DISABLE_SHADOW)
351 AC_DEFINE(BROKEN_SAVED_UIDS)
352 AC_CHECK_FUNCS(getluid setluid)
354 do_sco3_extra_lib_check=yes
357 if test -z "$GCC"; then
358 CFLAGS="$CFLAGS -belf"
360 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
361 LDFLAGS="$LDFLAGS -L/usr/local/lib"
362 LIBS="$LIBS -lprot -lx -ltinfo -lm"
365 AC_DEFINE(HAVE_SECUREWARE)
366 AC_DEFINE(DISABLE_SHADOW)
367 AC_DEFINE(DISABLE_FD_PASSING)
368 AC_CHECK_FUNCS(getluid setluid)
373 AC_DEFINE(DISABLE_FD_PASSING)
375 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
380 AC_DEFINE(DISABLE_FD_PASSING)
381 AC_DEFINE(NO_SSH_LASTLOG)
382 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
383 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
387 AC_MSG_CHECKING(for Digital Unix SIA)
390 [ --with-osfsia Enable Digital Unix SIA],
392 if test "x$withval" = "xno" ; then
393 AC_MSG_RESULT(disabled)
398 if test -z "$no_osfsia" ; then
399 if test -f /etc/sia/matrix.conf; then
401 AC_DEFINE(HAVE_OSF_SIA)
402 AC_DEFINE(DISABLE_LOGIN)
403 AC_DEFINE(DISABLE_FD_PASSING)
404 LIBS="$LIBS -lsecurity -ldb -lm -laud"
409 AC_DEFINE(DISABLE_FD_PASSING)
414 AC_DEFINE(NO_X11_UNIX_SOCKETS)
415 AC_DEFINE(MISSING_NFDBITS)
416 AC_DEFINE(MISSING_HOWMANY)
417 AC_DEFINE(MISSING_FD_MASK)
421 # Allow user to specify flags
423 [ --with-cflags Specify additional flags to pass to compiler],
425 if test "x$withval" != "xno" ; then
426 CFLAGS="$CFLAGS $withval"
430 AC_ARG_WITH(cppflags,
431 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
433 if test "x$withval" != "xno"; then
434 CPPFLAGS="$CPPFLAGS $withval"
439 [ --with-ldflags Specify additional flags to pass to linker],
441 if test "x$withval" != "xno" ; then
442 LDFLAGS="$LDFLAGS $withval"
447 [ --with-libs Specify additional libraries to link with],
449 if test "x$withval" != "xno" ; then
450 LIBS="$LIBS $withval"
455 AC_MSG_CHECKING(compiler and flags for sanity)
460 [ AC_MSG_RESULT(yes) ],
463 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
467 # Checks for header files.
468 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
469 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
470 login_cap.h maillock.h netdb.h netgroup.h \
471 netinet/in_systm.h paths.h pty.h readpassphrase.h \
472 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
473 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
474 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
475 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
476 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
477 util.h utime.h utmp.h utmpx.h)
479 # Checks for libraries.
480 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
481 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
483 dnl SCO OS3 needs this for libwrap
484 if test "x$with_tcp_wrappers" != "xno" ; then
485 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
486 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
490 AC_CHECK_FUNC(getspnam, ,
491 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
494 [ --without-rpath Disable auto-added -R linker paths],
496 if test "x$withval" = "xno" ; then
499 if test "x$withval" = "xyes" ; then
507 [ --with-zlib=PATH Use zlib in PATH],
509 if test "x$withval" = "xno" ; then
510 AC_MSG_ERROR([*** zlib is required ***])
512 if test -d "$withval/lib"; then
513 if test -n "${need_dash_r}"; then
514 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
516 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
519 if test -n "${need_dash_r}"; then
520 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
522 LDFLAGS="-L${withval} ${LDFLAGS}"
525 if test -d "$withval/include"; then
526 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
528 CPPFLAGS="-I${withval} ${CPPFLAGS}"
533 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
536 AC_CHECK_FUNC(strcasecmp,
537 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
539 AC_CHECK_FUNC(utimes,
540 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
541 LIBS="$LIBS -lc89"]) ]
544 dnl Checks for libutil functions
545 AC_CHECK_HEADERS(libutil.h)
546 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
547 AC_CHECK_FUNCS(logout updwtmp logwtmp)
551 # Check for ALTDIRFUNC glob() extension
552 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
553 AC_EGREP_CPP(FOUNDIT,
556 #ifdef GLOB_ALTDIRFUNC
561 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
569 # Check for g.gl_matchc glob() extension
570 AC_MSG_CHECKING(for gl_matchc field in glob_t)
571 AC_EGREP_CPP(FOUNDIT,
574 int main(void){glob_t g; g.gl_matchc = 1;}
577 AC_DEFINE(GLOB_HAS_GL_MATCHC)
585 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
588 #include <sys/types.h>
590 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
592 [AC_MSG_RESULT(yes)],
595 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
599 # Check whether user wants S/Key support
602 [ --with-skey[[=PATH]] Enable S/Key support
603 (optionally in PATH)],
605 if test "x$withval" != "xno" ; then
607 if test "x$withval" != "xyes" ; then
608 CPPFLAGS="$CPPFLAGS -I${withval}/include"
609 LDFLAGS="$LDFLAGS -L${withval}/lib"
616 AC_MSG_CHECKING([for s/key support])
621 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
623 [AC_MSG_RESULT(yes)],
626 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
632 # Check whether user wants TCP wrappers support
634 AC_ARG_WITH(tcp-wrappers,
635 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
636 (optionally in PATH)],
638 if test "x$withval" != "xno" ; then
640 saved_LDFLAGS="$LDFLAGS"
641 saved_CPPFLAGS="$CPPFLAGS"
642 if test -n "${withval}" -a "${withval}" != "yes"; then
643 if test -d "${withval}/lib"; then
644 if test -n "${need_dash_r}"; then
645 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
647 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
650 if test -n "${need_dash_r}"; then
651 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
653 LDFLAGS="-L${withval} ${LDFLAGS}"
656 if test -d "${withval}/include"; then
657 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
659 CPPFLAGS="-I${withval} ${CPPFLAGS}"
663 LIBS="$LIBWRAP $LIBS"
664 AC_MSG_CHECKING(for libwrap)
668 int deny_severity = 0, allow_severity = 0;
678 AC_MSG_ERROR([*** libwrap missing])
686 dnl Checks for library functions. Please keep in alphabetical order
688 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
689 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
690 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
691 getpeereid _getpty getrlimit getttyent glob inet_aton \
692 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
693 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
694 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
695 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
696 setproctitle setregid setresgid setresuid setreuid setrlimit \
697 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
698 strlcat strlcpy strmode strnvis sysconf tcgetpgrp truncate utimes \
699 vhangup vsnprintf waitpid \
702 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
703 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
705 dnl Make sure prototypes are defined for these before using them.
706 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
707 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
709 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
710 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
711 AC_CHECK_LIB(gen, dirname,[
712 AC_CACHE_CHECK([for broken dirname],
713 ac_cv_have_broken_dirname, [
721 int main(int argc, char **argv) {
724 strncpy(buf,"/etc", 32);
726 if (!s || strncmp(s, "/", 32) != 0) {
733 [ ac_cv_have_broken_dirname="no" ],
734 [ ac_cv_have_broken_dirname="yes" ]
738 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
740 AC_DEFINE(HAVE_DIRNAME)
741 AC_CHECK_HEADERS(libgen.h)
746 dnl Checks for time functions
747 AC_CHECK_FUNCS(gettimeofday time)
748 dnl Checks for utmp functions
749 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
750 AC_CHECK_FUNCS(utmpname)
751 dnl Checks for utmpx functions
752 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
753 AC_CHECK_FUNCS(setutxent utmpxname)
755 AC_CHECK_FUNC(daemon,
756 [AC_DEFINE(HAVE_DAEMON)],
757 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
760 AC_CHECK_FUNC(getpagesize,
761 [AC_DEFINE(HAVE_GETPAGESIZE)],
762 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
765 # Check for broken snprintf
766 if test "x$ac_cv_func_snprintf" = "xyes" ; then
767 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
771 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
773 [AC_MSG_RESULT(yes)],
776 AC_DEFINE(BROKEN_SNPRINTF)
777 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
782 dnl see whether mkstemp() requires XXXXXX
783 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
784 AC_MSG_CHECKING([for (overly) strict mkstemp])
788 main() { char template[]="conftest.mkstemp-test";
789 if (mkstemp(template) == -1)
791 unlink(template); exit(0);
799 AC_DEFINE(HAVE_STRICT_MKSTEMP)
803 AC_DEFINE(HAVE_STRICT_MKSTEMP)
813 [ --with-pam Enable PAM support ],
815 if test "x$withval" != "xno" ; then
816 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
817 AC_MSG_ERROR([PAM headers not found])
820 AC_CHECK_LIB(dl, dlopen, , )
821 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
822 AC_CHECK_FUNCS(pam_getenvlist)
828 if test $ac_cv_lib_dl_dlopen = yes; then
838 # Check for older PAM
839 if test "x$PAM_MSG" = "xyes" ; then
840 # Check PAM strerror arguments (old PAM)
841 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
845 #include <security/pam_appl.h>
847 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
850 AC_DEFINE(HAVE_OLD_PAM)
852 PAM_MSG="yes (old library)"
857 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
858 # because the system crypt() is more featureful.
859 if test "x$check_for_libcrypt_before" = "x1"; then
860 AC_CHECK_LIB(crypt, crypt)
864 saved_CPPFLAGS="$CPPFLAGS"
865 saved_LDFLAGS="$LDFLAGS"
867 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
869 if test "x$withval" != "xno" ; then
870 if test -d "$withval/lib"; then
871 if test -n "${need_dash_r}"; then
872 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
874 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
877 if test -n "${need_dash_r}"; then
878 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
880 LDFLAGS="-L${withval} ${LDFLAGS}"
883 if test -d "$withval/include"; then
884 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
886 CPPFLAGS="-I${withval} ${CPPFLAGS}"
891 LIBS="$LIBS -lcrypto"
892 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
894 dnl Check default openssl install dir
895 if test -n "${need_dash_r}"; then
896 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
898 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
900 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
901 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
903 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
909 # Determine OpenSSL header version
910 AC_MSG_CHECKING([OpenSSL header version])
915 #include <openssl/opensslv.h>
916 #define DATA "conftest.sslincver"
921 fd = fopen(DATA,"w");
925 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
932 ssl_header_ver=`cat conftest.sslincver`
933 AC_MSG_RESULT($ssl_header_ver)
936 AC_MSG_RESULT(not found)
937 AC_MSG_ERROR(OpenSSL version header not found.)
941 # Determine OpenSSL library version
942 AC_MSG_CHECKING([OpenSSL library version])
947 #include <openssl/opensslv.h>
948 #include <openssl/crypto.h>
949 #define DATA "conftest.ssllibver"
954 fd = fopen(DATA,"w");
958 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
965 ssl_library_ver=`cat conftest.ssllibver`
966 AC_MSG_RESULT($ssl_library_ver)
969 AC_MSG_RESULT(not found)
970 AC_MSG_ERROR(OpenSSL library not found.)
974 # Sanity check OpenSSL headers
975 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
979 #include <openssl/opensslv.h>
980 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
987 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
988 Check config.log for details.
989 Also see contrib/findssl.sh for help identifying header/library mismatches.])
993 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
994 # version in OpenSSL. Skip this for PAM
995 if test "x$check_for_libcrypt_later" = "x1"; then
996 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1000 ### Configure cryptographic random number support
1002 # Check wheter OpenSSL seeds itself
1003 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1007 #include <openssl/rand.h>
1008 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1011 OPENSSL_SEEDS_ITSELF=yes
1016 # Default to use of the rand helper if OpenSSL doesn't
1023 # Do we want to force the use of the rand helper?
1024 AC_ARG_WITH(rand-helper,
1025 [ --with-rand-helper Use subprocess to gather strong randomness ],
1027 if test "x$withval" = "xno" ; then
1028 # Force use of OpenSSL's internal RNG, even if
1029 # the previous test showed it to be unseeded.
1030 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1031 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1032 OPENSSL_SEEDS_ITSELF=yes
1041 # Which randomness source do we use?
1042 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1044 AC_DEFINE(OPENSSL_PRNG_ONLY)
1045 RAND_MSG="OpenSSL internal ONLY"
1046 INSTALL_SSH_RAND_HELPER=""
1047 elif test ! -z "$USE_RAND_HELPER" ; then
1048 # install rand helper
1049 RAND_MSG="ssh-rand-helper"
1050 INSTALL_SSH_RAND_HELPER="yes"
1052 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1054 ### Configuration of ssh-rand-helper
1057 AC_ARG_WITH(prngd-port,
1058 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1067 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1070 if test ! -z "$withval" ; then
1071 PRNGD_PORT="$withval"
1072 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1077 # PRNGD Unix domain socket
1078 AC_ARG_WITH(prngd-socket,
1079 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1083 withval="/var/run/egd-pool"
1091 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1095 if test ! -z "$withval" ; then
1096 if test ! -z "$PRNGD_PORT" ; then
1097 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1099 if test ! -r "$withval" ; then
1100 AC_MSG_WARN(Entropy socket is not readable)
1102 PRNGD_SOCKET="$withval"
1103 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1107 # Check for existing socket only if we don't have a random device already
1108 if test "$USE_RAND_HELPER" = yes ; then
1109 AC_MSG_CHECKING(for PRNGD/EGD socket)
1110 # Insert other locations here
1111 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1112 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1113 PRNGD_SOCKET="$sock"
1114 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1118 if test ! -z "$PRNGD_SOCKET" ; then
1119 AC_MSG_RESULT($PRNGD_SOCKET)
1121 AC_MSG_RESULT(not found)
1127 # Change default command timeout for hashing entropy source
1129 AC_ARG_WITH(entropy-timeout,
1130 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1132 if test "x$withval" != "xno" ; then
1133 entropy_timeout=$withval
1137 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1139 SSH_PRIVSEP_USER=sshd
1140 AC_ARG_WITH(privsep-user,
1141 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1143 if test -n "$withval"; then
1144 SSH_PRIVSEP_USER=$withval
1148 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1149 AC_SUBST(SSH_PRIVSEP_USER)
1151 # We do this little dance with the search path to insure
1152 # that programs that we select for use by installed programs
1153 # (which may be run by the super-user) come from trusted
1154 # locations before they come from the user's private area.
1155 # This should help avoid accidentally configuring some
1156 # random version of a program in someone's personal bin.
1160 test -h /bin 2> /dev/null && PATH=/usr/bin
1161 test -d /sbin && PATH=$PATH:/sbin
1162 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1163 PATH=$PATH:/etc:$OPATH
1165 # These programs are used by the command hashing source to gather entropy
1166 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1167 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1168 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1169 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1170 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1171 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1172 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1173 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1174 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1175 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1176 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1177 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1178 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1179 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1180 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1181 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1185 # Where does ssh-rand-helper get its randomness from?
1186 INSTALL_SSH_PRNG_CMDS=""
1187 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1188 if test ! -z "$PRNGD_PORT" ; then
1189 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1190 elif test ! -z "$PRNGD_SOCKET" ; then
1191 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1193 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1194 RAND_HELPER_CMDHASH=yes
1195 INSTALL_SSH_PRNG_CMDS="yes"
1198 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1201 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1202 if test ! -z "$SONY" ; then
1203 LIBS="$LIBS -liberty";
1206 # Checks for data types
1207 AC_CHECK_SIZEOF(char, 1)
1208 AC_CHECK_SIZEOF(short int, 2)
1209 AC_CHECK_SIZEOF(int, 4)
1210 AC_CHECK_SIZEOF(long int, 4)
1211 AC_CHECK_SIZEOF(long long int, 8)
1213 # Sanity check long long for some platforms (AIX)
1214 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1215 ac_cv_sizeof_long_long_int=0
1218 # More checks for data types
1219 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1221 [ #include <sys/types.h> ],
1223 [ ac_cv_have_u_int="yes" ],
1224 [ ac_cv_have_u_int="no" ]
1227 if test "x$ac_cv_have_u_int" = "xyes" ; then
1228 AC_DEFINE(HAVE_U_INT)
1232 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1234 [ #include <sys/types.h> ],
1235 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1236 [ ac_cv_have_intxx_t="yes" ],
1237 [ ac_cv_have_intxx_t="no" ]
1240 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1241 AC_DEFINE(HAVE_INTXX_T)
1245 if (test -z "$have_intxx_t" && \
1246 test "x$ac_cv_header_stdint_h" = "xyes")
1248 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1250 [ #include <stdint.h> ],
1251 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1253 AC_DEFINE(HAVE_INTXX_T)
1256 [ AC_MSG_RESULT(no) ]
1260 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1263 #include <sys/types.h>
1264 #ifdef HAVE_STDINT_H
1265 # include <stdint.h>
1267 #include <sys/socket.h>
1268 #ifdef HAVE_SYS_BITYPES_H
1269 # include <sys/bitypes.h>
1272 [ int64_t a; a = 1;],
1273 [ ac_cv_have_int64_t="yes" ],
1274 [ ac_cv_have_int64_t="no" ]
1277 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1278 AC_DEFINE(HAVE_INT64_T)
1281 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1283 [ #include <sys/types.h> ],
1284 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1285 [ ac_cv_have_u_intxx_t="yes" ],
1286 [ ac_cv_have_u_intxx_t="no" ]
1289 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1290 AC_DEFINE(HAVE_U_INTXX_T)
1294 if test -z "$have_u_intxx_t" ; then
1295 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1297 [ #include <sys/socket.h> ],
1298 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1300 AC_DEFINE(HAVE_U_INTXX_T)
1303 [ AC_MSG_RESULT(no) ]
1307 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1309 [ #include <sys/types.h> ],
1310 [ u_int64_t a; a = 1;],
1311 [ ac_cv_have_u_int64_t="yes" ],
1312 [ ac_cv_have_u_int64_t="no" ]
1315 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1316 AC_DEFINE(HAVE_U_INT64_T)
1320 if test -z "$have_u_int64_t" ; then
1321 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1323 [ #include <sys/bitypes.h> ],
1324 [ u_int64_t a; a = 1],
1326 AC_DEFINE(HAVE_U_INT64_T)
1329 [ AC_MSG_RESULT(no) ]
1333 if test -z "$have_u_intxx_t" ; then
1334 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1337 #include <sys/types.h>
1339 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1340 [ ac_cv_have_uintxx_t="yes" ],
1341 [ ac_cv_have_uintxx_t="no" ]
1344 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1345 AC_DEFINE(HAVE_UINTXX_T)
1349 if test -z "$have_uintxx_t" ; then
1350 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1352 [ #include <stdint.h> ],
1353 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1355 AC_DEFINE(HAVE_UINTXX_T)
1358 [ AC_MSG_RESULT(no) ]
1362 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1363 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1365 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1368 #include <sys/bitypes.h>
1371 int8_t a; int16_t b; int32_t c;
1372 u_int8_t e; u_int16_t f; u_int32_t g;
1373 a = b = c = e = f = g = 1;
1376 AC_DEFINE(HAVE_U_INTXX_T)
1377 AC_DEFINE(HAVE_INTXX_T)
1385 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1388 #include <sys/types.h>
1390 [ u_char foo; foo = 125; ],
1391 [ ac_cv_have_u_char="yes" ],
1392 [ ac_cv_have_u_char="no" ]
1395 if test "x$ac_cv_have_u_char" = "xyes" ; then
1396 AC_DEFINE(HAVE_U_CHAR)
1401 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1403 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1406 #include <sys/types.h>
1408 [ size_t foo; foo = 1235; ],
1409 [ ac_cv_have_size_t="yes" ],
1410 [ ac_cv_have_size_t="no" ]
1413 if test "x$ac_cv_have_size_t" = "xyes" ; then
1414 AC_DEFINE(HAVE_SIZE_T)
1417 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1420 #include <sys/types.h>
1422 [ ssize_t foo; foo = 1235; ],
1423 [ ac_cv_have_ssize_t="yes" ],
1424 [ ac_cv_have_ssize_t="no" ]
1427 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1428 AC_DEFINE(HAVE_SSIZE_T)
1431 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1436 [ clock_t foo; foo = 1235; ],
1437 [ ac_cv_have_clock_t="yes" ],
1438 [ ac_cv_have_clock_t="no" ]
1441 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1442 AC_DEFINE(HAVE_CLOCK_T)
1445 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1448 #include <sys/types.h>
1449 #include <sys/socket.h>
1451 [ sa_family_t foo; foo = 1235; ],
1452 [ ac_cv_have_sa_family_t="yes" ],
1455 #include <sys/types.h>
1456 #include <sys/socket.h>
1457 #include <netinet/in.h>
1459 [ sa_family_t foo; foo = 1235; ],
1460 [ ac_cv_have_sa_family_t="yes" ],
1462 [ ac_cv_have_sa_family_t="no" ]
1466 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1467 AC_DEFINE(HAVE_SA_FAMILY_T)
1470 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1473 #include <sys/types.h>
1475 [ pid_t foo; foo = 1235; ],
1476 [ ac_cv_have_pid_t="yes" ],
1477 [ ac_cv_have_pid_t="no" ]
1480 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1481 AC_DEFINE(HAVE_PID_T)
1484 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1487 #include <sys/types.h>
1489 [ mode_t foo; foo = 1235; ],
1490 [ ac_cv_have_mode_t="yes" ],
1491 [ ac_cv_have_mode_t="no" ]
1494 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1495 AC_DEFINE(HAVE_MODE_T)
1499 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1502 #include <sys/types.h>
1503 #include <sys/socket.h>
1505 [ struct sockaddr_storage s; ],
1506 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1507 [ ac_cv_have_struct_sockaddr_storage="no" ]
1510 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1511 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1514 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1517 #include <sys/types.h>
1518 #include <netinet/in.h>
1520 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1521 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1522 [ ac_cv_have_struct_sockaddr_in6="no" ]
1525 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1526 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1529 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1532 #include <sys/types.h>
1533 #include <netinet/in.h>
1535 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1536 [ ac_cv_have_struct_in6_addr="yes" ],
1537 [ ac_cv_have_struct_in6_addr="no" ]
1540 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1541 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1544 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1547 #include <sys/types.h>
1548 #include <sys/socket.h>
1551 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1552 [ ac_cv_have_struct_addrinfo="yes" ],
1553 [ ac_cv_have_struct_addrinfo="no" ]
1556 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1557 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1560 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1562 [ #include <sys/time.h> ],
1563 [ struct timeval tv; tv.tv_sec = 1;],
1564 [ ac_cv_have_struct_timeval="yes" ],
1565 [ ac_cv_have_struct_timeval="no" ]
1568 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1569 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1570 have_struct_timeval=1
1573 AC_CHECK_TYPES(struct timespec)
1575 # We need int64_t or else certian parts of the compile will fail.
1576 if test "x$ac_cv_have_int64_t" = "xno" -a \
1577 "x$ac_cv_sizeof_long_int" != "x8" -a \
1578 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1579 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1580 echo "an alternative compiler (I.E., GCC) before continuing."
1584 dnl test snprintf (broken on SCO w/gcc)
1589 #ifdef HAVE_SNPRINTF
1593 char expected_out[50];
1595 #if (SIZEOF_LONG_INT == 8)
1596 long int num = 0x7fffffffffffffff;
1598 long long num = 0x7fffffffffffffffll;
1600 strcpy(expected_out, "9223372036854775807");
1601 snprintf(buf, mazsize, "%lld", num);
1602 if(strcmp(buf, expected_out) != 0)
1609 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1613 dnl Checks for structure members
1614 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1615 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1616 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1617 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1618 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1619 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1620 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1621 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1622 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1623 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1624 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1625 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1626 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1627 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1628 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1629 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1630 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1632 AC_CHECK_MEMBERS([struct stat.st_blksize])
1634 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1635 ac_cv_have_ss_family_in_struct_ss, [
1638 #include <sys/types.h>
1639 #include <sys/socket.h>
1641 [ struct sockaddr_storage s; s.ss_family = 1; ],
1642 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1643 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1646 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1647 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1650 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1651 ac_cv_have___ss_family_in_struct_ss, [
1654 #include <sys/types.h>
1655 #include <sys/socket.h>
1657 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1658 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1659 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1662 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1663 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1666 AC_CACHE_CHECK([for pw_class field in struct passwd],
1667 ac_cv_have_pw_class_in_struct_passwd, [
1672 [ struct passwd p; p.pw_class = 0; ],
1673 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1674 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1677 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1678 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1681 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1682 ac_cv_have_pw_expire_in_struct_passwd, [
1687 [ struct passwd p; p.pw_expire = 0; ],
1688 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1689 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1692 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1693 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1696 AC_CACHE_CHECK([for pw_change field in struct passwd],
1697 ac_cv_have_pw_change_in_struct_passwd, [
1702 [ struct passwd p; p.pw_change = 0; ],
1703 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1704 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1707 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1708 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1711 dnl make sure we're using the real structure members and not defines
1712 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1713 ac_cv_have_accrights_in_msghdr, [
1716 #include <sys/types.h>
1717 #include <sys/socket.h>
1718 #include <sys/uio.h>
1720 #ifdef msg_accrights
1724 m.msg_accrights = 0;
1728 [ ac_cv_have_accrights_in_msghdr="yes" ],
1729 [ ac_cv_have_accrights_in_msghdr="no" ]
1732 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1733 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1736 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1737 ac_cv_have_control_in_msghdr, [
1740 #include <sys/types.h>
1741 #include <sys/socket.h>
1742 #include <sys/uio.h>
1752 [ ac_cv_have_control_in_msghdr="yes" ],
1753 [ ac_cv_have_control_in_msghdr="no" ]
1756 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1757 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1760 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1762 [ extern char *__progname; printf("%s", __progname); ],
1763 [ ac_cv_libc_defines___progname="yes" ],
1764 [ ac_cv_libc_defines___progname="no" ]
1767 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1768 AC_DEFINE(HAVE___PROGNAME)
1771 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1775 [ printf("%s", __FUNCTION__); ],
1776 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1777 [ ac_cv_cc_implements___FUNCTION__="no" ]
1780 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1781 AC_DEFINE(HAVE___FUNCTION__)
1784 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1788 [ printf("%s", __func__); ],
1789 [ ac_cv_cc_implements___func__="yes" ],
1790 [ ac_cv_cc_implements___func__="no" ]
1793 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1794 AC_DEFINE(HAVE___func__)
1797 AC_CACHE_CHECK([whether getopt has optreset support],
1798 ac_cv_have_getopt_optreset, [
1803 [ extern int optreset; optreset = 0; ],
1804 [ ac_cv_have_getopt_optreset="yes" ],
1805 [ ac_cv_have_getopt_optreset="no" ]
1808 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1809 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1812 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1814 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1815 [ ac_cv_libc_defines_sys_errlist="yes" ],
1816 [ ac_cv_libc_defines_sys_errlist="no" ]
1819 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1820 AC_DEFINE(HAVE_SYS_ERRLIST)
1824 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1826 [ extern int sys_nerr; printf("%i", sys_nerr);],
1827 [ ac_cv_libc_defines_sys_nerr="yes" ],
1828 [ ac_cv_libc_defines_sys_nerr="no" ]
1831 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1832 AC_DEFINE(HAVE_SYS_NERR)
1836 # Check whether user wants sectok support
1838 [ --with-sectok Enable smartcard support using libsectok],
1840 if test "x$withval" != "xno" ; then
1841 if test "x$withval" != "xyes" ; then
1842 CPPFLAGS="$CPPFLAGS -I${withval}"
1843 LDFLAGS="$LDFLAGS -L${withval}"
1844 if test ! -z "$need_dash_r" ; then
1845 LDFLAGS="$LDFLAGS -R${withval}"
1847 if test ! -z "$blibpath" ; then
1848 blibpath="$blibpath:${withval}"
1851 AC_CHECK_HEADERS(sectok.h)
1852 if test "$ac_cv_header_sectok_h" != yes; then
1853 AC_MSG_ERROR(Can't find sectok.h)
1855 AC_CHECK_LIB(sectok, sectok_open)
1856 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1857 AC_MSG_ERROR(Can't find libsectok)
1859 AC_DEFINE(SMARTCARD)
1860 AC_DEFINE(USE_SECTOK)
1861 SCARD_MSG="yes, using sectok"
1866 # Check whether user wants OpenSC support
1868 AC_HELP_STRING([--with-opensc=PFX],
1869 [Enable smartcard support using OpenSC]),
1870 opensc_config_prefix="$withval", opensc_config_prefix="")
1871 if test x$opensc_config_prefix != x ; then
1872 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1873 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1874 if test "$OPENSC_CONFIG" != "no"; then
1875 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1876 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1877 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1878 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1879 AC_DEFINE(SMARTCARD)
1880 AC_DEFINE(USE_OPENSC)
1881 SCARD_MSG="yes, using OpenSC"
1885 # Check whether user wants DNS support
1888 [ --with-dns Support for fetching keys from DNS (experimental)],
1890 if test "x$withval" != "xno" ; then
1893 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1894 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1896 # Needed by our getrrsetbyname()
1897 AC_SEARCH_LIBS(res_query, resolv)
1898 AC_SEARCH_LIBS(dn_expand, resolv)
1904 # Check whether user wants Kerberos 5 support
1906 AC_ARG_WITH(kerberos5,
1907 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1909 if test "x$withval" != "xno" ; then
1910 if test "x$withval" = "xyes" ; then
1911 KRB5ROOT="/usr/local"
1915 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1916 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1919 AC_MSG_CHECKING(whether we are using Heimdal)
1920 AC_TRY_COMPILE([ #include <krb5.h> ],
1921 [ char *tmp = heimdal_version; ],
1922 [ AC_MSG_RESULT(yes)
1924 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1927 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1930 if test ! -z "$need_dash_r" ; then
1931 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1933 if test ! -z "$blibpath" ; then
1934 blibpath="$blibpath:${KRB5ROOT}/lib"
1936 AC_SEARCH_LIBS(dn_expand, resolv)
1942 LIBS="$LIBS $K5LIBS"
1944 # Looking for programs, paths and files
1946 PRIVSEP_PATH=/var/empty
1947 AC_ARG_WITH(privsep-path,
1948 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
1950 if test "x$withval" != "$no" ; then
1951 PRIVSEP_PATH=$withval
1955 AC_SUBST(PRIVSEP_PATH)
1958 [ --with-xauth=PATH Specify path to xauth program ],
1960 if test "x$withval" != "xno" ; then
1966 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
1967 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
1968 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
1969 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
1970 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
1971 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
1972 xauth_path="/usr/openwin/bin/xauth"
1978 AC_ARG_ENABLE(strip,
1979 [ --disable-strip Disable calling strip(1) on install],
1981 if test "x$enableval" = "xno" ; then
1988 if test -z "$xauth_path" ; then
1989 XAUTH_PATH="undefined"
1990 AC_SUBST(XAUTH_PATH)
1992 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
1993 XAUTH_PATH=$xauth_path
1994 AC_SUBST(XAUTH_PATH)
1997 # Check for mail directory (last resort if we cannot get it from headers)
1998 if test ! -z "$MAIL" ; then
1999 maildir=`dirname $MAIL`
2000 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2003 if test -z "$no_dev_ptmx" ; then
2004 if test "x$disable_ptmx_check" != "xyes" ; then
2005 AC_CHECK_FILE("/dev/ptmx",
2007 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2013 AC_CHECK_FILE("/dev/ptc",
2015 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2020 # Options from here on. Some of these are preset by platform above
2021 AC_ARG_WITH(mantype,
2022 [ --with-mantype=man|cat|doc Set man page type],
2029 AC_MSG_ERROR(invalid man type: $withval)
2034 if test -z "$MANTYPE"; then
2035 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2036 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2037 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2039 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2046 if test "$MANTYPE" = "doc"; then
2053 # Check whether to enable MD5 passwords
2055 AC_ARG_WITH(md5-passwords,
2056 [ --with-md5-passwords Enable use of MD5 passwords],
2058 if test "x$withval" != "xno" ; then
2059 AC_DEFINE(HAVE_MD5_PASSWORDS)
2065 # Whether to disable shadow password support
2067 [ --without-shadow Disable shadow password support],
2069 if test "x$withval" = "xno" ; then
2070 AC_DEFINE(DISABLE_SHADOW)
2076 if test -z "$disable_shadow" ; then
2077 AC_MSG_CHECKING([if the systems has expire shadow information])
2080 #include <sys/types.h>
2083 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2084 [ sp_expire_available=yes ], []
2087 if test "x$sp_expire_available" = "xyes" ; then
2089 AC_DEFINE(HAS_SHADOW_EXPIRE)
2095 # Use ip address instead of hostname in $DISPLAY
2096 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2097 DISPLAY_HACK_MSG="yes"
2098 AC_DEFINE(IPADDR_IN_DISPLAY)
2100 DISPLAY_HACK_MSG="no"
2101 AC_ARG_WITH(ipaddr-display,
2102 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2104 if test "x$withval" != "xno" ; then
2105 AC_DEFINE(IPADDR_IN_DISPLAY)
2106 DISPLAY_HACK_MSG="yes"
2112 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2113 if test $ac_cv_func_login_getcapbool = "yes" -a \
2114 $ac_cv_header_login_cap_h = "yes" ; then
2117 # Whether to mess with the default path
2118 SERVER_PATH_MSG="(default)"
2119 AC_ARG_WITH(default-path,
2120 [ --with-default-path= Specify default \$PATH environment for server],
2122 if test "$USES_LOGIN_CONF" = "yes" ; then
2124 --with-default-path=PATH has no effect on this system.
2125 Edit /etc/login.conf instead.])
2126 elif test "x$withval" != "xno" ; then
2127 user_path="$withval"
2128 SERVER_PATH_MSG="$withval"
2131 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2132 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2136 /* find out what STDPATH is */
2141 #ifndef _PATH_STDPATH
2142 # ifdef _PATH_USERPATH /* Irix */
2143 # define _PATH_STDPATH _PATH_USERPATH
2145 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2148 #include <sys/types.h>
2149 #include <sys/stat.h>
2151 #define DATA "conftest.stdpath"
2158 fd = fopen(DATA,"w");
2162 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2167 ], [ user_path=`cat conftest.stdpath` ],
2168 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2169 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2171 # make sure $bindir is in USER_PATH so scp will work
2172 t_bindir=`eval echo ${bindir}`
2174 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2177 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2179 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2180 if test $? -ne 0 ; then
2181 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2182 if test $? -ne 0 ; then
2183 user_path=$user_path:$t_bindir
2184 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2189 if test "$USES_LOGIN_CONF" != "yes" ; then
2190 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2194 # Set superuser path separately to user path
2195 AC_ARG_WITH(superuser-path,
2196 [ --with-superuser-path= Specify different path for super-user],
2198 if test "x$withval" != "xno" ; then
2199 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2200 superuser_path=$withval
2206 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2207 IPV4_IN6_HACK_MSG="no"
2209 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2211 if test "x$withval" != "xno" ; then
2213 AC_DEFINE(IPV4_IN_IPV6)
2214 IPV4_IN6_HACK_MSG="yes"
2219 if test "x$inet6_default_4in6" = "xyes"; then
2220 AC_MSG_RESULT([yes (default)])
2221 AC_DEFINE(IPV4_IN_IPV6)
2222 IPV4_IN6_HACK_MSG="yes"
2224 AC_MSG_RESULT([no (default)])
2229 # Whether to enable BSD auth support
2231 AC_ARG_WITH(bsd-auth,
2232 [ --with-bsd-auth Enable BSD auth support],
2234 if test "x$withval" != "xno" ; then
2241 # Where to place sshd.pid
2243 # make sure the directory exists
2244 if test ! -d $piddir ; then
2245 piddir=`eval echo ${sysconfdir}`
2247 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2251 AC_ARG_WITH(pid-dir,
2252 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2254 if test "x$withval" != "xno" ; then
2256 if test ! -d $piddir ; then
2257 AC_MSG_WARN([** no $piddir directory on this system **])
2263 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2266 dnl allow user to disable some login recording features
2267 AC_ARG_ENABLE(lastlog,
2268 [ --disable-lastlog disable use of lastlog even if detected [no]],
2270 if test "x$enableval" = "xno" ; then
2271 AC_DEFINE(DISABLE_LASTLOG)
2276 [ --disable-utmp disable use of utmp even if detected [no]],
2278 if test "x$enableval" = "xno" ; then
2279 AC_DEFINE(DISABLE_UTMP)
2283 AC_ARG_ENABLE(utmpx,
2284 [ --disable-utmpx disable use of utmpx even if detected [no]],
2286 if test "x$enableval" = "xno" ; then
2287 AC_DEFINE(DISABLE_UTMPX)
2292 [ --disable-wtmp disable use of wtmp even if detected [no]],
2294 if test "x$enableval" = "xno" ; then
2295 AC_DEFINE(DISABLE_WTMP)
2299 AC_ARG_ENABLE(wtmpx,
2300 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2302 if test "x$enableval" = "xno" ; then
2303 AC_DEFINE(DISABLE_WTMPX)
2307 AC_ARG_ENABLE(libutil,
2308 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2310 if test "x$enableval" = "xno" ; then
2311 AC_DEFINE(DISABLE_LOGIN)
2315 AC_ARG_ENABLE(pututline,
2316 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2318 if test "x$enableval" = "xno" ; then
2319 AC_DEFINE(DISABLE_PUTUTLINE)
2323 AC_ARG_ENABLE(pututxline,
2324 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2326 if test "x$enableval" = "xno" ; then
2327 AC_DEFINE(DISABLE_PUTUTXLINE)
2331 AC_ARG_WITH(lastlog,
2332 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2334 if test "x$withval" = "xno" ; then
2335 AC_DEFINE(DISABLE_LASTLOG)
2337 conf_lastlog_location=$withval
2342 dnl lastlog, [uw]tmpx? detection
2343 dnl NOTE: set the paths in the platform section to avoid the
2344 dnl need for command-line parameters
2345 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2347 dnl lastlog detection
2348 dnl NOTE: the code itself will detect if lastlog is a directory
2349 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2351 #include <sys/types.h>
2353 #ifdef HAVE_LASTLOG_H
2354 # include <lastlog.h>
2363 [ char *lastlog = LASTLOG_FILE; ],
2364 [ AC_MSG_RESULT(yes) ],
2367 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2369 #include <sys/types.h>
2371 #ifdef HAVE_LASTLOG_H
2372 # include <lastlog.h>
2378 [ char *lastlog = _PATH_LASTLOG; ],
2379 [ AC_MSG_RESULT(yes) ],
2382 system_lastlog_path=no
2387 if test -z "$conf_lastlog_location"; then
2388 if test x"$system_lastlog_path" = x"no" ; then
2389 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2390 if (test -d "$f" || test -f "$f") ; then
2391 conf_lastlog_location=$f
2394 if test -z "$conf_lastlog_location"; then
2395 AC_MSG_WARN([** Cannot find lastlog **])
2396 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2401 if test -n "$conf_lastlog_location"; then
2402 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2406 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2408 #include <sys/types.h>
2414 [ char *utmp = UTMP_FILE; ],
2415 [ AC_MSG_RESULT(yes) ],
2417 system_utmp_path=no ]
2419 if test -z "$conf_utmp_location"; then
2420 if test x"$system_utmp_path" = x"no" ; then
2421 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2422 if test -f $f ; then
2423 conf_utmp_location=$f
2426 if test -z "$conf_utmp_location"; then
2427 AC_DEFINE(DISABLE_UTMP)
2431 if test -n "$conf_utmp_location"; then
2432 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2436 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2438 #include <sys/types.h>
2444 [ char *wtmp = WTMP_FILE; ],
2445 [ AC_MSG_RESULT(yes) ],
2447 system_wtmp_path=no ]
2449 if test -z "$conf_wtmp_location"; then
2450 if test x"$system_wtmp_path" = x"no" ; then
2451 for f in /usr/adm/wtmp /var/log/wtmp; do
2452 if test -f $f ; then
2453 conf_wtmp_location=$f
2456 if test -z "$conf_wtmp_location"; then
2457 AC_DEFINE(DISABLE_WTMP)
2461 if test -n "$conf_wtmp_location"; then
2462 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2466 dnl utmpx detection - I don't know any system so perverse as to require
2467 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2469 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2471 #include <sys/types.h>
2480 [ char *utmpx = UTMPX_FILE; ],
2481 [ AC_MSG_RESULT(yes) ],
2483 system_utmpx_path=no ]
2485 if test -z "$conf_utmpx_location"; then
2486 if test x"$system_utmpx_path" = x"no" ; then
2487 AC_DEFINE(DISABLE_UTMPX)
2490 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2494 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2496 #include <sys/types.h>
2505 [ char *wtmpx = WTMPX_FILE; ],
2506 [ AC_MSG_RESULT(yes) ],
2508 system_wtmpx_path=no ]
2510 if test -z "$conf_wtmpx_location"; then
2511 if test x"$system_wtmpx_path" = x"no" ; then
2512 AC_DEFINE(DISABLE_WTMPX)
2515 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2519 if test ! -z "$blibpath" ; then
2520 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2521 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2524 dnl remove pam and dl because they are in $LIBPAM
2525 if test "$PAM_MSG" = yes ; then
2526 LIBS=`echo $LIBS | sed 's/-lpam //'`
2528 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2529 LIBS=`echo $LIBS | sed 's/-ldl //'`
2533 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2536 # Print summary of options
2538 # Someone please show me a better way :)
2539 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2540 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2541 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2542 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2543 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2544 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2545 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2546 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2547 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2548 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2551 echo "OpenSSH has been configured with the following options:"
2552 echo " User binaries: $B"
2553 echo " System binaries: $C"
2554 echo " Configuration files: $D"
2555 echo " Askpass program: $E"
2556 echo " Manual pages: $F"
2557 echo " PID file: $G"
2558 echo " Privilege separation chroot path: $H"
2559 if test "$USES_LOGIN_CONF" = "yes" ; then
2560 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2562 echo " sshd default user PATH: $I"
2564 if test ! -z "$superuser_path" ; then
2565 echo " sshd superuser user PATH: $J"
2567 echo " Manpage format: $MANTYPE"
2568 echo " DNS support: $DNS_MSG"
2569 echo " PAM support: $PAM_MSG"
2570 echo " KerberosV support: $KRB5_MSG"
2571 echo " Smartcard support: $SCARD_MSG"
2572 echo " S/KEY support: $SKEY_MSG"
2573 echo " TCP Wrappers support: $TCPW_MSG"
2574 echo " MD5 password support: $MD5_MSG"
2575 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2576 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2577 echo " BSD Auth support: $BSD_AUTH_MSG"
2578 echo " Random number source: $RAND_MSG"
2579 if test ! -z "$USE_RAND_HELPER" ; then
2580 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2585 echo " Host: ${host}"
2586 echo " Compiler: ${CC}"
2587 echo " Compiler flags: ${CFLAGS}"
2588 echo "Preprocessor flags: ${CPPFLAGS}"
2589 echo " Linker flags: ${LDFLAGS}"
2590 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2594 if test "x$PAM_MSG" = "xyes" ; then
2595 echo "PAM is enabled. You may need to install a PAM control file "
2596 echo "for sshd, otherwise password authentication may fail. "
2597 echo "Example PAM control files can be found in the contrib/ "
2602 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2603 echo "WARNING: you are using the builtin random number collection "
2604 echo "service. Please read WARNING.RNG and request that your OS "
2605 echo "vendor includes kernel-based random number collection in "
2606 echo "future versions of your OS."