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 dnl Check for authenticate. Might be in libs.a on older AIXes
79 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
80 [AC_CHECK_LIB(s,authenticate,
81 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
85 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
86 AC_CHECK_DECL(loginfailed,
87 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
89 [#include <usersec.h>],
90 [(void)loginfailed("user","host","tty",0);],
92 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
96 [#include <usersec.h>]
98 AC_CHECK_FUNCS(setauthdb)
99 AC_DEFINE(BROKEN_GETADDRINFO)
100 AC_DEFINE(BROKEN_REALPATH)
101 dnl AIX handles lastlog as part of its login message
102 AC_DEFINE(DISABLE_LASTLOG)
103 AC_DEFINE(LOGIN_NEEDS_UTMPX)
104 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
107 check_for_libcrypt_later=1
108 LIBS="$LIBS /usr/lib/textmode.o"
109 AC_DEFINE(HAVE_CYGWIN)
111 AC_DEFINE(DISABLE_SHADOW)
112 AC_DEFINE(IP_TOS_IS_BROKEN)
113 AC_DEFINE(NO_X11_UNIX_SOCKETS)
114 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
115 AC_DEFINE(DISABLE_FD_PASSING)
116 AC_DEFINE(SETGROUPS_NOOP)
119 AC_DEFINE(IP_TOS_IS_BROKEN)
122 AC_MSG_CHECKING(if we have working getaddrinfo)
123 AC_TRY_RUN([#include <mach-o/dyld.h>
124 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
128 }], [AC_MSG_RESULT(working)],
129 [AC_MSG_RESULT(buggy)
130 AC_DEFINE(BROKEN_GETADDRINFO)],
131 [AC_MSG_RESULT(assume it is working)])
134 if test -z "$GCC"; then
137 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
138 IPADDR_IN_DISPLAY=yes
139 AC_DEFINE(HAVE_SECUREWARE)
141 AC_DEFINE(LOGIN_NO_ENDOPT)
142 AC_DEFINE(LOGIN_NEEDS_UTMPX)
143 AC_DEFINE(DISABLE_SHADOW)
144 AC_DEFINE(DISABLE_UTMP)
145 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
146 LIBS="$LIBS -lsec -lsecpw"
147 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
148 disable_ptmx_check=yes
151 if test -z "$GCC"; then
154 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
155 IPADDR_IN_DISPLAY=yes
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(SPT_TYPE,SPT_PSTAT)
163 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
166 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
167 IPADDR_IN_DISPLAY=yes
168 AC_DEFINE(PAM_SUN_CODEBASE)
170 AC_DEFINE(LOGIN_NO_ENDOPT)
171 AC_DEFINE(LOGIN_NEEDS_UTMPX)
172 AC_DEFINE(DISABLE_SHADOW)
173 AC_DEFINE(DISABLE_UTMP)
174 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
176 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
179 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
181 PATH="$PATH:/usr/etc"
182 AC_DEFINE(BROKEN_INET_NTOA)
183 AC_DEFINE(WITH_ABBREV_NO_TTY)
186 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
188 PATH="$PATH:/usr/etc"
189 AC_DEFINE(WITH_IRIX_ARRAY)
190 AC_DEFINE(WITH_IRIX_PROJECT)
191 AC_DEFINE(WITH_IRIX_AUDIT)
192 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
193 AC_DEFINE(BROKEN_INET_NTOA)
194 AC_DEFINE(WITH_ABBREV_NO_TTY)
198 check_for_libcrypt_later=1
199 AC_DEFINE(DONT_TRY_OTHER_AF)
200 AC_DEFINE(PAM_TTY_KLUDGE)
201 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
202 inet6_default_4in6=yes
203 # openpty can be in libutil, needed for controlling tty test
204 AC_SEARCH_LIBS(openpty, util)
205 # make sure that openpty does not reacquire controlling terminal
206 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
210 #include <sys/fcntl.h>
211 #include <sys/types.h>
212 #include <sys/wait.h>
218 int fd, ptyfd, ttyfd, status;
221 if (pid < 0) { /* failed */
223 } else if (pid > 0) { /* parent */
224 waitpid(pid, &status, 0);
225 if (WIFEXITED(status))
226 exit(WEXITSTATUS(status));
230 close(0); close(1); close(2);
232 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
233 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
235 exit(3); /* Acquired ctty: broken */
237 exit(0); /* Did not acquire ctty: OK */
246 AC_DEFINE(SSHD_ACQUIRES_CTTY)
251 AC_DEFINE(BROKEN_CMSG_TYPE)
255 mips-sony-bsd|mips-sony-newsos4)
256 AC_DEFINE(HAVE_NEWS4)
260 check_for_libcrypt_before=1
264 check_for_libcrypt_later=1
267 conf_lastlog_location="/usr/adm/lastlog"
268 conf_utmp_location=/etc/utmp
269 conf_wtmp_location=/usr/adm/wtmp
272 AC_DEFINE(BROKEN_REALPATH)
274 AC_DEFINE(BROKEN_SAVED_UIDS)
275 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
279 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
280 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
282 AC_DEFINE(PAM_SUN_CODEBASE)
283 AC_DEFINE(LOGIN_NEEDS_UTMPX)
284 AC_DEFINE(LOGIN_NEEDS_TERM)
285 AC_DEFINE(PAM_TTY_KLUDGE)
286 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
287 AC_DEFINE(SSHD_ACQUIRES_CTTY)
288 # hardwire lastlog location (can't detect it on some versions)
289 conf_lastlog_location="/var/adm/lastlog"
290 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
291 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
292 if test "$sol2ver" -ge 8; then
294 AC_DEFINE(DISABLE_UTMP)
295 AC_DEFINE(DISABLE_WTMP)
301 CPPFLAGS="$CPPFLAGS -DSUNOS4"
302 AC_CHECK_FUNCS(getpwanam)
303 AC_DEFINE(PAM_SUN_CODEBASE)
304 conf_utmp_location=/etc/utmp
305 conf_wtmp_location=/var/adm/wtmp
306 conf_lastlog_location=/var/adm/lastlog
310 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
311 LDFLAGS="$LDFLAGS -L/usr/local/lib"
314 AC_DEFINE(SSHD_ACQUIRES_CTTY)
317 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
318 # /usr/ucblib MUST NOT be searched on ReliantUNIX
319 LDFLAGS="$LDFLAGS -L/usr/local/lib"
320 IPADDR_IN_DISPLAY=yes
322 AC_DEFINE(IP_TOS_IS_BROKEN)
323 AC_DEFINE(SSHD_ACQUIRES_CTTY)
324 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
325 # Attention: always take care to bind libsocket and libnsl before libc,
326 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
329 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
330 LDFLAGS="$LDFLAGS -L/usr/local/lib"
334 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
335 LDFLAGS="$LDFLAGS -L/usr/local/lib"
339 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
340 LDFLAGS="$LDFLAGS -L/usr/local/lib"
343 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
344 LDFLAGS="$LDFLAGS -L/usr/local/lib"
345 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
348 AC_DEFINE(BROKEN_SYS_TERMIO_H)
350 AC_DEFINE(HAVE_SECUREWARE)
351 AC_DEFINE(DISABLE_SHADOW)
352 AC_DEFINE(BROKEN_SAVED_UIDS)
353 AC_CHECK_FUNCS(getluid setluid)
355 do_sco3_extra_lib_check=yes
358 if test -z "$GCC"; then
359 CFLAGS="$CFLAGS -belf"
361 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
362 LDFLAGS="$LDFLAGS -L/usr/local/lib"
363 LIBS="$LIBS -lprot -lx -ltinfo -lm"
366 AC_DEFINE(HAVE_SECUREWARE)
367 AC_DEFINE(DISABLE_SHADOW)
368 AC_DEFINE(DISABLE_FD_PASSING)
369 AC_CHECK_FUNCS(getluid setluid)
374 AC_DEFINE(DISABLE_FD_PASSING)
376 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
381 AC_DEFINE(DISABLE_FD_PASSING)
382 AC_DEFINE(NO_SSH_LASTLOG)
383 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
384 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
388 AC_MSG_CHECKING(for Digital Unix SIA)
391 [ --with-osfsia Enable Digital Unix SIA],
393 if test "x$withval" = "xno" ; then
394 AC_MSG_RESULT(disabled)
399 if test -z "$no_osfsia" ; then
400 if test -f /etc/sia/matrix.conf; then
402 AC_DEFINE(HAVE_OSF_SIA)
403 AC_DEFINE(DISABLE_LOGIN)
404 AC_DEFINE(DISABLE_FD_PASSING)
405 LIBS="$LIBS -lsecurity -ldb -lm -laud"
410 AC_DEFINE(DISABLE_FD_PASSING)
415 AC_DEFINE(NO_X11_UNIX_SOCKETS)
416 AC_DEFINE(MISSING_NFDBITS)
417 AC_DEFINE(MISSING_HOWMANY)
418 AC_DEFINE(MISSING_FD_MASK)
422 # Allow user to specify flags
424 [ --with-cflags Specify additional flags to pass to compiler],
426 if test "x$withval" != "xno" ; then
427 CFLAGS="$CFLAGS $withval"
431 AC_ARG_WITH(cppflags,
432 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
434 if test "x$withval" != "xno"; then
435 CPPFLAGS="$CPPFLAGS $withval"
440 [ --with-ldflags Specify additional flags to pass to linker],
442 if test "x$withval" != "xno" ; then
443 LDFLAGS="$LDFLAGS $withval"
448 [ --with-libs Specify additional libraries to link with],
450 if test "x$withval" != "xno" ; then
451 LIBS="$LIBS $withval"
456 AC_MSG_CHECKING(compiler and flags for sanity)
461 [ AC_MSG_RESULT(yes) ],
464 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
468 # Checks for header files.
469 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
470 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
471 login_cap.h maillock.h netdb.h netgroup.h \
472 netinet/in_systm.h paths.h pty.h readpassphrase.h \
473 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
474 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
475 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
476 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
477 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
478 util.h utime.h utmp.h utmpx.h)
480 # Checks for libraries.
481 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
482 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
484 dnl SCO OS3 needs this for libwrap
485 if test "x$with_tcp_wrappers" != "xno" ; then
486 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
487 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
491 AC_CHECK_FUNC(getspnam, ,
492 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
495 [ --without-rpath Disable auto-added -R linker paths],
497 if test "x$withval" = "xno" ; then
500 if test "x$withval" = "xyes" ; then
508 [ --with-zlib=PATH Use zlib in PATH],
510 if test "x$withval" = "xno" ; then
511 AC_MSG_ERROR([*** zlib is required ***])
513 if test -d "$withval/lib"; then
514 if test -n "${need_dash_r}"; then
515 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
517 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
520 if test -n "${need_dash_r}"; then
521 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
523 LDFLAGS="-L${withval} ${LDFLAGS}"
526 if test -d "$withval/include"; then
527 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
529 CPPFLAGS="-I${withval} ${CPPFLAGS}"
534 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
537 AC_CHECK_FUNC(strcasecmp,
538 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
540 AC_CHECK_FUNC(utimes,
541 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
542 LIBS="$LIBS -lc89"]) ]
545 dnl Checks for libutil functions
546 AC_CHECK_HEADERS(libutil.h)
547 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
548 AC_CHECK_FUNCS(logout updwtmp logwtmp)
552 # Check for ALTDIRFUNC glob() extension
553 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
554 AC_EGREP_CPP(FOUNDIT,
557 #ifdef GLOB_ALTDIRFUNC
562 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
570 # Check for g.gl_matchc glob() extension
571 AC_MSG_CHECKING(for gl_matchc field in glob_t)
572 AC_EGREP_CPP(FOUNDIT,
575 int main(void){glob_t g; g.gl_matchc = 1;}
578 AC_DEFINE(GLOB_HAS_GL_MATCHC)
586 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
589 #include <sys/types.h>
591 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
593 [AC_MSG_RESULT(yes)],
596 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
600 # Check whether user wants S/Key support
603 [ --with-skey[[=PATH]] Enable S/Key support
604 (optionally in PATH)],
606 if test "x$withval" != "xno" ; then
608 if test "x$withval" != "xyes" ; then
609 CPPFLAGS="$CPPFLAGS -I${withval}/include"
610 LDFLAGS="$LDFLAGS -L${withval}/lib"
617 AC_MSG_CHECKING([for s/key support])
622 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
624 [AC_MSG_RESULT(yes)],
627 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
633 # Check whether user wants TCP wrappers support
635 AC_ARG_WITH(tcp-wrappers,
636 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
637 (optionally in PATH)],
639 if test "x$withval" != "xno" ; then
641 saved_LDFLAGS="$LDFLAGS"
642 saved_CPPFLAGS="$CPPFLAGS"
643 if test -n "${withval}" -a "${withval}" != "yes"; then
644 if test -d "${withval}/lib"; then
645 if test -n "${need_dash_r}"; then
646 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
648 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
651 if test -n "${need_dash_r}"; then
652 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
654 LDFLAGS="-L${withval} ${LDFLAGS}"
657 if test -d "${withval}/include"; then
658 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
660 CPPFLAGS="-I${withval} ${CPPFLAGS}"
664 LIBS="$LIBWRAP $LIBS"
665 AC_MSG_CHECKING(for libwrap)
669 int deny_severity = 0, allow_severity = 0;
679 AC_MSG_ERROR([*** libwrap missing])
687 dnl Checks for library functions. Please keep in alphabetical order
689 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
690 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
691 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
692 getpeereid _getpty getrlimit getttyent glob inet_aton \
693 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
694 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
695 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
696 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
697 setproctitle setregid setresgid setresuid setreuid setrlimit \
698 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
699 strlcat strlcpy strmode strnvis sysconf tcgetpgrp truncate utimes \
700 vhangup vsnprintf waitpid \
703 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
704 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
706 dnl Make sure prototypes are defined for these before using them.
707 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
708 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
710 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
711 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
712 AC_CHECK_LIB(gen, dirname,[
713 AC_CACHE_CHECK([for broken dirname],
714 ac_cv_have_broken_dirname, [
722 int main(int argc, char **argv) {
725 strncpy(buf,"/etc", 32);
727 if (!s || strncmp(s, "/", 32) != 0) {
734 [ ac_cv_have_broken_dirname="no" ],
735 [ ac_cv_have_broken_dirname="yes" ]
739 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
741 AC_DEFINE(HAVE_DIRNAME)
742 AC_CHECK_HEADERS(libgen.h)
747 dnl Checks for time functions
748 AC_CHECK_FUNCS(gettimeofday time)
749 dnl Checks for utmp functions
750 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
751 AC_CHECK_FUNCS(utmpname)
752 dnl Checks for utmpx functions
753 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
754 AC_CHECK_FUNCS(setutxent utmpxname)
756 AC_CHECK_FUNC(daemon,
757 [AC_DEFINE(HAVE_DAEMON)],
758 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
761 AC_CHECK_FUNC(getpagesize,
762 [AC_DEFINE(HAVE_GETPAGESIZE)],
763 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
766 # Check for broken snprintf
767 if test "x$ac_cv_func_snprintf" = "xyes" ; then
768 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
772 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
774 [AC_MSG_RESULT(yes)],
777 AC_DEFINE(BROKEN_SNPRINTF)
778 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
783 dnl see whether mkstemp() requires XXXXXX
784 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
785 AC_MSG_CHECKING([for (overly) strict mkstemp])
789 main() { char template[]="conftest.mkstemp-test";
790 if (mkstemp(template) == -1)
792 unlink(template); exit(0);
800 AC_DEFINE(HAVE_STRICT_MKSTEMP)
804 AC_DEFINE(HAVE_STRICT_MKSTEMP)
814 [ --with-pam Enable PAM support ],
816 if test "x$withval" != "xno" ; then
817 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
818 AC_MSG_ERROR([PAM headers not found])
821 AC_CHECK_LIB(dl, dlopen, , )
822 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
823 AC_CHECK_FUNCS(pam_getenvlist)
829 if test $ac_cv_lib_dl_dlopen = yes; then
839 # Check for older PAM
840 if test "x$PAM_MSG" = "xyes" ; then
841 # Check PAM strerror arguments (old PAM)
842 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
846 #include <security/pam_appl.h>
848 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
851 AC_DEFINE(HAVE_OLD_PAM)
853 PAM_MSG="yes (old library)"
858 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
859 # because the system crypt() is more featureful.
860 if test "x$check_for_libcrypt_before" = "x1"; then
861 AC_CHECK_LIB(crypt, crypt)
865 saved_CPPFLAGS="$CPPFLAGS"
866 saved_LDFLAGS="$LDFLAGS"
868 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
870 if test "x$withval" != "xno" ; then
871 if test -d "$withval/lib"; then
872 if test -n "${need_dash_r}"; then
873 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
875 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
878 if test -n "${need_dash_r}"; then
879 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
881 LDFLAGS="-L${withval} ${LDFLAGS}"
884 if test -d "$withval/include"; then
885 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
887 CPPFLAGS="-I${withval} ${CPPFLAGS}"
892 LIBS="$LIBS -lcrypto"
893 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
895 dnl Check default openssl install dir
896 if test -n "${need_dash_r}"; then
897 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
899 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
901 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
902 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
904 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
910 # Determine OpenSSL header version
911 AC_MSG_CHECKING([OpenSSL header version])
916 #include <openssl/opensslv.h>
917 #define DATA "conftest.sslincver"
922 fd = fopen(DATA,"w");
926 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
933 ssl_header_ver=`cat conftest.sslincver`
934 AC_MSG_RESULT($ssl_header_ver)
937 AC_MSG_RESULT(not found)
938 AC_MSG_ERROR(OpenSSL version header not found.)
942 # Determine OpenSSL library version
943 AC_MSG_CHECKING([OpenSSL library version])
948 #include <openssl/opensslv.h>
949 #include <openssl/crypto.h>
950 #define DATA "conftest.ssllibver"
955 fd = fopen(DATA,"w");
959 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
966 ssl_library_ver=`cat conftest.ssllibver`
967 AC_MSG_RESULT($ssl_library_ver)
970 AC_MSG_RESULT(not found)
971 AC_MSG_ERROR(OpenSSL library not found.)
975 # Sanity check OpenSSL headers
976 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
980 #include <openssl/opensslv.h>
981 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
988 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
989 Check config.log for details.
990 Also see contrib/findssl.sh for help identifying header/library mismatches.])
994 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
995 # version in OpenSSL. Skip this for PAM
996 if test "x$check_for_libcrypt_later" = "x1"; then
997 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1001 ### Configure cryptographic random number support
1003 # Check wheter OpenSSL seeds itself
1004 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1008 #include <openssl/rand.h>
1009 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1012 OPENSSL_SEEDS_ITSELF=yes
1017 # Default to use of the rand helper if OpenSSL doesn't
1024 # Do we want to force the use of the rand helper?
1025 AC_ARG_WITH(rand-helper,
1026 [ --with-rand-helper Use subprocess to gather strong randomness ],
1028 if test "x$withval" = "xno" ; then
1029 # Force use of OpenSSL's internal RNG, even if
1030 # the previous test showed it to be unseeded.
1031 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1032 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1033 OPENSSL_SEEDS_ITSELF=yes
1042 # Which randomness source do we use?
1043 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1045 AC_DEFINE(OPENSSL_PRNG_ONLY)
1046 RAND_MSG="OpenSSL internal ONLY"
1047 INSTALL_SSH_RAND_HELPER=""
1048 elif test ! -z "$USE_RAND_HELPER" ; then
1049 # install rand helper
1050 RAND_MSG="ssh-rand-helper"
1051 INSTALL_SSH_RAND_HELPER="yes"
1053 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1055 ### Configuration of ssh-rand-helper
1058 AC_ARG_WITH(prngd-port,
1059 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1068 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1071 if test ! -z "$withval" ; then
1072 PRNGD_PORT="$withval"
1073 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1078 # PRNGD Unix domain socket
1079 AC_ARG_WITH(prngd-socket,
1080 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1084 withval="/var/run/egd-pool"
1092 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1096 if test ! -z "$withval" ; then
1097 if test ! -z "$PRNGD_PORT" ; then
1098 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1100 if test ! -r "$withval" ; then
1101 AC_MSG_WARN(Entropy socket is not readable)
1103 PRNGD_SOCKET="$withval"
1104 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1108 # Check for existing socket only if we don't have a random device already
1109 if test "$USE_RAND_HELPER" = yes ; then
1110 AC_MSG_CHECKING(for PRNGD/EGD socket)
1111 # Insert other locations here
1112 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1113 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1114 PRNGD_SOCKET="$sock"
1115 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1119 if test ! -z "$PRNGD_SOCKET" ; then
1120 AC_MSG_RESULT($PRNGD_SOCKET)
1122 AC_MSG_RESULT(not found)
1128 # Change default command timeout for hashing entropy source
1130 AC_ARG_WITH(entropy-timeout,
1131 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1133 if test "x$withval" != "xno" ; then
1134 entropy_timeout=$withval
1138 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1140 SSH_PRIVSEP_USER=sshd
1141 AC_ARG_WITH(privsep-user,
1142 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1144 if test -n "$withval"; then
1145 SSH_PRIVSEP_USER=$withval
1149 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1150 AC_SUBST(SSH_PRIVSEP_USER)
1152 # We do this little dance with the search path to insure
1153 # that programs that we select for use by installed programs
1154 # (which may be run by the super-user) come from trusted
1155 # locations before they come from the user's private area.
1156 # This should help avoid accidentally configuring some
1157 # random version of a program in someone's personal bin.
1161 test -h /bin 2> /dev/null && PATH=/usr/bin
1162 test -d /sbin && PATH=$PATH:/sbin
1163 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1164 PATH=$PATH:/etc:$OPATH
1166 # These programs are used by the command hashing source to gather entropy
1167 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1168 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1169 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1170 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1171 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1172 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1173 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1174 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1175 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1176 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1177 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1178 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1179 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1180 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1181 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1182 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1186 # Where does ssh-rand-helper get its randomness from?
1187 INSTALL_SSH_PRNG_CMDS=""
1188 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1189 if test ! -z "$PRNGD_PORT" ; then
1190 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1191 elif test ! -z "$PRNGD_SOCKET" ; then
1192 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1194 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1195 RAND_HELPER_CMDHASH=yes
1196 INSTALL_SSH_PRNG_CMDS="yes"
1199 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1202 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1203 if test ! -z "$SONY" ; then
1204 LIBS="$LIBS -liberty";
1207 # Checks for data types
1208 AC_CHECK_SIZEOF(char, 1)
1209 AC_CHECK_SIZEOF(short int, 2)
1210 AC_CHECK_SIZEOF(int, 4)
1211 AC_CHECK_SIZEOF(long int, 4)
1212 AC_CHECK_SIZEOF(long long int, 8)
1214 # Sanity check long long for some platforms (AIX)
1215 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1216 ac_cv_sizeof_long_long_int=0
1219 # More checks for data types
1220 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1222 [ #include <sys/types.h> ],
1224 [ ac_cv_have_u_int="yes" ],
1225 [ ac_cv_have_u_int="no" ]
1228 if test "x$ac_cv_have_u_int" = "xyes" ; then
1229 AC_DEFINE(HAVE_U_INT)
1233 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1235 [ #include <sys/types.h> ],
1236 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1237 [ ac_cv_have_intxx_t="yes" ],
1238 [ ac_cv_have_intxx_t="no" ]
1241 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1242 AC_DEFINE(HAVE_INTXX_T)
1246 if (test -z "$have_intxx_t" && \
1247 test "x$ac_cv_header_stdint_h" = "xyes")
1249 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1251 [ #include <stdint.h> ],
1252 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1254 AC_DEFINE(HAVE_INTXX_T)
1257 [ AC_MSG_RESULT(no) ]
1261 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1264 #include <sys/types.h>
1265 #ifdef HAVE_STDINT_H
1266 # include <stdint.h>
1268 #include <sys/socket.h>
1269 #ifdef HAVE_SYS_BITYPES_H
1270 # include <sys/bitypes.h>
1273 [ int64_t a; a = 1;],
1274 [ ac_cv_have_int64_t="yes" ],
1275 [ ac_cv_have_int64_t="no" ]
1278 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1279 AC_DEFINE(HAVE_INT64_T)
1282 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1284 [ #include <sys/types.h> ],
1285 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1286 [ ac_cv_have_u_intxx_t="yes" ],
1287 [ ac_cv_have_u_intxx_t="no" ]
1290 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1291 AC_DEFINE(HAVE_U_INTXX_T)
1295 if test -z "$have_u_intxx_t" ; then
1296 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1298 [ #include <sys/socket.h> ],
1299 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1301 AC_DEFINE(HAVE_U_INTXX_T)
1304 [ AC_MSG_RESULT(no) ]
1308 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1310 [ #include <sys/types.h> ],
1311 [ u_int64_t a; a = 1;],
1312 [ ac_cv_have_u_int64_t="yes" ],
1313 [ ac_cv_have_u_int64_t="no" ]
1316 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1317 AC_DEFINE(HAVE_U_INT64_T)
1321 if test -z "$have_u_int64_t" ; then
1322 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1324 [ #include <sys/bitypes.h> ],
1325 [ u_int64_t a; a = 1],
1327 AC_DEFINE(HAVE_U_INT64_T)
1330 [ AC_MSG_RESULT(no) ]
1334 if test -z "$have_u_intxx_t" ; then
1335 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1338 #include <sys/types.h>
1340 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1341 [ ac_cv_have_uintxx_t="yes" ],
1342 [ ac_cv_have_uintxx_t="no" ]
1345 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1346 AC_DEFINE(HAVE_UINTXX_T)
1350 if test -z "$have_uintxx_t" ; then
1351 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1353 [ #include <stdint.h> ],
1354 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1356 AC_DEFINE(HAVE_UINTXX_T)
1359 [ AC_MSG_RESULT(no) ]
1363 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1364 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1366 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1369 #include <sys/bitypes.h>
1372 int8_t a; int16_t b; int32_t c;
1373 u_int8_t e; u_int16_t f; u_int32_t g;
1374 a = b = c = e = f = g = 1;
1377 AC_DEFINE(HAVE_U_INTXX_T)
1378 AC_DEFINE(HAVE_INTXX_T)
1386 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1389 #include <sys/types.h>
1391 [ u_char foo; foo = 125; ],
1392 [ ac_cv_have_u_char="yes" ],
1393 [ ac_cv_have_u_char="no" ]
1396 if test "x$ac_cv_have_u_char" = "xyes" ; then
1397 AC_DEFINE(HAVE_U_CHAR)
1402 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1404 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1407 #include <sys/types.h>
1409 [ size_t foo; foo = 1235; ],
1410 [ ac_cv_have_size_t="yes" ],
1411 [ ac_cv_have_size_t="no" ]
1414 if test "x$ac_cv_have_size_t" = "xyes" ; then
1415 AC_DEFINE(HAVE_SIZE_T)
1418 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1421 #include <sys/types.h>
1423 [ ssize_t foo; foo = 1235; ],
1424 [ ac_cv_have_ssize_t="yes" ],
1425 [ ac_cv_have_ssize_t="no" ]
1428 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1429 AC_DEFINE(HAVE_SSIZE_T)
1432 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1437 [ clock_t foo; foo = 1235; ],
1438 [ ac_cv_have_clock_t="yes" ],
1439 [ ac_cv_have_clock_t="no" ]
1442 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1443 AC_DEFINE(HAVE_CLOCK_T)
1446 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1449 #include <sys/types.h>
1450 #include <sys/socket.h>
1452 [ sa_family_t foo; foo = 1235; ],
1453 [ ac_cv_have_sa_family_t="yes" ],
1456 #include <sys/types.h>
1457 #include <sys/socket.h>
1458 #include <netinet/in.h>
1460 [ sa_family_t foo; foo = 1235; ],
1461 [ ac_cv_have_sa_family_t="yes" ],
1463 [ ac_cv_have_sa_family_t="no" ]
1467 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1468 AC_DEFINE(HAVE_SA_FAMILY_T)
1471 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1474 #include <sys/types.h>
1476 [ pid_t foo; foo = 1235; ],
1477 [ ac_cv_have_pid_t="yes" ],
1478 [ ac_cv_have_pid_t="no" ]
1481 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1482 AC_DEFINE(HAVE_PID_T)
1485 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1488 #include <sys/types.h>
1490 [ mode_t foo; foo = 1235; ],
1491 [ ac_cv_have_mode_t="yes" ],
1492 [ ac_cv_have_mode_t="no" ]
1495 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1496 AC_DEFINE(HAVE_MODE_T)
1500 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1503 #include <sys/types.h>
1504 #include <sys/socket.h>
1506 [ struct sockaddr_storage s; ],
1507 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1508 [ ac_cv_have_struct_sockaddr_storage="no" ]
1511 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1512 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1515 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1518 #include <sys/types.h>
1519 #include <netinet/in.h>
1521 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1522 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1523 [ ac_cv_have_struct_sockaddr_in6="no" ]
1526 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1527 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1530 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1533 #include <sys/types.h>
1534 #include <netinet/in.h>
1536 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1537 [ ac_cv_have_struct_in6_addr="yes" ],
1538 [ ac_cv_have_struct_in6_addr="no" ]
1541 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1542 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1545 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1548 #include <sys/types.h>
1549 #include <sys/socket.h>
1552 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1553 [ ac_cv_have_struct_addrinfo="yes" ],
1554 [ ac_cv_have_struct_addrinfo="no" ]
1557 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1558 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1561 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1563 [ #include <sys/time.h> ],
1564 [ struct timeval tv; tv.tv_sec = 1;],
1565 [ ac_cv_have_struct_timeval="yes" ],
1566 [ ac_cv_have_struct_timeval="no" ]
1569 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1570 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1571 have_struct_timeval=1
1574 AC_CHECK_TYPES(struct timespec)
1576 # We need int64_t or else certian parts of the compile will fail.
1577 if test "x$ac_cv_have_int64_t" = "xno" -a \
1578 "x$ac_cv_sizeof_long_int" != "x8" -a \
1579 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1580 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1581 echo "an alternative compiler (I.E., GCC) before continuing."
1585 dnl test snprintf (broken on SCO w/gcc)
1590 #ifdef HAVE_SNPRINTF
1594 char expected_out[50];
1596 #if (SIZEOF_LONG_INT == 8)
1597 long int num = 0x7fffffffffffffff;
1599 long long num = 0x7fffffffffffffffll;
1601 strcpy(expected_out, "9223372036854775807");
1602 snprintf(buf, mazsize, "%lld", num);
1603 if(strcmp(buf, expected_out) != 0)
1610 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1614 dnl Checks for structure members
1615 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1616 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1617 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1618 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1619 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1620 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1621 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1622 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1623 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1624 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1625 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1626 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1627 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1628 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1629 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1630 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1631 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1633 AC_CHECK_MEMBERS([struct stat.st_blksize])
1635 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1636 ac_cv_have_ss_family_in_struct_ss, [
1639 #include <sys/types.h>
1640 #include <sys/socket.h>
1642 [ struct sockaddr_storage s; s.ss_family = 1; ],
1643 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1644 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1647 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1648 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1651 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1652 ac_cv_have___ss_family_in_struct_ss, [
1655 #include <sys/types.h>
1656 #include <sys/socket.h>
1658 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1659 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1660 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1663 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1664 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1667 AC_CACHE_CHECK([for pw_class field in struct passwd],
1668 ac_cv_have_pw_class_in_struct_passwd, [
1673 [ struct passwd p; p.pw_class = 0; ],
1674 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1675 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1678 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1679 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1682 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1683 ac_cv_have_pw_expire_in_struct_passwd, [
1688 [ struct passwd p; p.pw_expire = 0; ],
1689 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1690 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1693 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1694 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1697 AC_CACHE_CHECK([for pw_change field in struct passwd],
1698 ac_cv_have_pw_change_in_struct_passwd, [
1703 [ struct passwd p; p.pw_change = 0; ],
1704 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1705 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1708 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1709 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1712 dnl make sure we're using the real structure members and not defines
1713 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1714 ac_cv_have_accrights_in_msghdr, [
1717 #include <sys/types.h>
1718 #include <sys/socket.h>
1719 #include <sys/uio.h>
1721 #ifdef msg_accrights
1725 m.msg_accrights = 0;
1729 [ ac_cv_have_accrights_in_msghdr="yes" ],
1730 [ ac_cv_have_accrights_in_msghdr="no" ]
1733 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1734 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1737 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1738 ac_cv_have_control_in_msghdr, [
1741 #include <sys/types.h>
1742 #include <sys/socket.h>
1743 #include <sys/uio.h>
1753 [ ac_cv_have_control_in_msghdr="yes" ],
1754 [ ac_cv_have_control_in_msghdr="no" ]
1757 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1758 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1761 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1763 [ extern char *__progname; printf("%s", __progname); ],
1764 [ ac_cv_libc_defines___progname="yes" ],
1765 [ ac_cv_libc_defines___progname="no" ]
1768 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1769 AC_DEFINE(HAVE___PROGNAME)
1772 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1776 [ printf("%s", __FUNCTION__); ],
1777 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1778 [ ac_cv_cc_implements___FUNCTION__="no" ]
1781 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1782 AC_DEFINE(HAVE___FUNCTION__)
1785 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1789 [ printf("%s", __func__); ],
1790 [ ac_cv_cc_implements___func__="yes" ],
1791 [ ac_cv_cc_implements___func__="no" ]
1794 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1795 AC_DEFINE(HAVE___func__)
1798 AC_CACHE_CHECK([whether getopt has optreset support],
1799 ac_cv_have_getopt_optreset, [
1804 [ extern int optreset; optreset = 0; ],
1805 [ ac_cv_have_getopt_optreset="yes" ],
1806 [ ac_cv_have_getopt_optreset="no" ]
1809 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1810 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1813 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1815 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1816 [ ac_cv_libc_defines_sys_errlist="yes" ],
1817 [ ac_cv_libc_defines_sys_errlist="no" ]
1820 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1821 AC_DEFINE(HAVE_SYS_ERRLIST)
1825 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1827 [ extern int sys_nerr; printf("%i", sys_nerr);],
1828 [ ac_cv_libc_defines_sys_nerr="yes" ],
1829 [ ac_cv_libc_defines_sys_nerr="no" ]
1832 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1833 AC_DEFINE(HAVE_SYS_NERR)
1837 # Check whether user wants sectok support
1839 [ --with-sectok Enable smartcard support using libsectok],
1841 if test "x$withval" != "xno" ; then
1842 if test "x$withval" != "xyes" ; then
1843 CPPFLAGS="$CPPFLAGS -I${withval}"
1844 LDFLAGS="$LDFLAGS -L${withval}"
1845 if test ! -z "$need_dash_r" ; then
1846 LDFLAGS="$LDFLAGS -R${withval}"
1848 if test ! -z "$blibpath" ; then
1849 blibpath="$blibpath:${withval}"
1852 AC_CHECK_HEADERS(sectok.h)
1853 if test "$ac_cv_header_sectok_h" != yes; then
1854 AC_MSG_ERROR(Can't find sectok.h)
1856 AC_CHECK_LIB(sectok, sectok_open)
1857 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1858 AC_MSG_ERROR(Can't find libsectok)
1860 AC_DEFINE(SMARTCARD)
1861 AC_DEFINE(USE_SECTOK)
1862 SCARD_MSG="yes, using sectok"
1867 # Check whether user wants OpenSC support
1869 AC_HELP_STRING([--with-opensc=PFX],
1870 [Enable smartcard support using OpenSC]),
1871 opensc_config_prefix="$withval", opensc_config_prefix="")
1872 if test x$opensc_config_prefix != x ; then
1873 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1874 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1875 if test "$OPENSC_CONFIG" != "no"; then
1876 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1877 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1878 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1879 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1880 AC_DEFINE(SMARTCARD)
1881 AC_DEFINE(USE_OPENSC)
1882 SCARD_MSG="yes, using OpenSC"
1886 # Check whether user wants DNS support
1889 [ --with-dns Support for fetching keys from DNS (experimental)],
1891 if test "x$withval" != "xno" ; then
1894 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1895 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1897 # Needed by our getrrsetbyname()
1898 AC_SEARCH_LIBS(res_query, resolv)
1899 AC_SEARCH_LIBS(dn_expand, resolv)
1905 # Check whether user wants Kerberos 5 support
1907 AC_ARG_WITH(kerberos5,
1908 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1910 if test "x$withval" != "xno" ; then
1911 if test "x$withval" = "xyes" ; then
1912 KRB5ROOT="/usr/local"
1916 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1917 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1920 AC_MSG_CHECKING(whether we are using Heimdal)
1921 AC_TRY_COMPILE([ #include <krb5.h> ],
1922 [ char *tmp = heimdal_version; ],
1923 [ AC_MSG_RESULT(yes)
1925 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1928 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1931 if test ! -z "$need_dash_r" ; then
1932 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1934 if test ! -z "$blibpath" ; then
1935 blibpath="$blibpath:${KRB5ROOT}/lib"
1937 AC_SEARCH_LIBS(dn_expand, resolv)
1943 # Check whether user wants Kerberos 4 support
1945 AC_ARG_WITH(kerberos4,
1946 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1948 if test "x$withval" != "xno" ; then
1949 if test "x$withval" != "xyes" ; then
1950 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1951 LDFLAGS="$LDFLAGS -L${withval}/lib"
1952 if test ! -z "$need_dash_r" ; then
1953 LDFLAGS="$LDFLAGS -R${withval}/lib"
1955 if test ! -z "$blibpath" ; then
1956 blibpath="$blibpath:${withval}/lib"
1959 if test -d /usr/include/kerberosIV ; then
1960 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1964 AC_CHECK_HEADERS(krb.h)
1965 if test "$ac_cv_header_krb_h" != yes; then
1966 AC_MSG_WARN([Cannot find krb.h, build may fail])
1968 AC_CHECK_LIB(krb, main)
1969 if test "$ac_cv_lib_krb_main" != yes; then
1970 AC_CHECK_LIB(krb4, main)
1971 if test "$ac_cv_lib_krb4_main" != yes; then
1972 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1979 AC_CHECK_LIB(des, des_cbc_encrypt)
1980 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1981 AC_CHECK_LIB(des425, des_cbc_encrypt)
1982 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1983 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1990 AC_CHECK_LIB(resolv, dn_expand, , )
1998 # Check whether user wants AFS support
2001 [ --with-afs=PATH Enable AFS support],
2003 if test "x$withval" != "xno" ; then
2005 if test "x$withval" != "xyes" ; then
2006 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2007 LDFLAGS="$LDFLAGS -L${withval}/lib"
2010 if test -z "$KRB4" ; then
2011 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
2015 if test ! -z "$AFS_LIBS" ; then
2016 LIBS="$LIBS $AFS_LIBS"
2023 LIBS="$LIBS $KLIBS $K5LIBS"
2025 # Looking for programs, paths and files
2027 PRIVSEP_PATH=/var/empty
2028 AC_ARG_WITH(privsep-path,
2029 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2031 if test "x$withval" != "$no" ; then
2032 PRIVSEP_PATH=$withval
2036 AC_SUBST(PRIVSEP_PATH)
2039 [ --with-xauth=PATH Specify path to xauth program ],
2041 if test "x$withval" != "xno" ; then
2047 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2048 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2049 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2050 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2051 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2052 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2053 xauth_path="/usr/openwin/bin/xauth"
2059 AC_ARG_ENABLE(strip,
2060 [ --disable-strip Disable calling strip(1) on install],
2062 if test "x$enableval" = "xno" ; then
2069 if test -z "$xauth_path" ; then
2070 XAUTH_PATH="undefined"
2071 AC_SUBST(XAUTH_PATH)
2073 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2074 XAUTH_PATH=$xauth_path
2075 AC_SUBST(XAUTH_PATH)
2078 # Check for mail directory (last resort if we cannot get it from headers)
2079 if test ! -z "$MAIL" ; then
2080 maildir=`dirname $MAIL`
2081 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2084 if test -z "$no_dev_ptmx" ; then
2085 if test "x$disable_ptmx_check" != "xyes" ; then
2086 AC_CHECK_FILE("/dev/ptmx",
2088 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2094 AC_CHECK_FILE("/dev/ptc",
2096 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2101 # Options from here on. Some of these are preset by platform above
2102 AC_ARG_WITH(mantype,
2103 [ --with-mantype=man|cat|doc Set man page type],
2110 AC_MSG_ERROR(invalid man type: $withval)
2115 if test -z "$MANTYPE"; then
2116 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2117 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2118 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2120 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2127 if test "$MANTYPE" = "doc"; then
2134 # Check whether to enable MD5 passwords
2136 AC_ARG_WITH(md5-passwords,
2137 [ --with-md5-passwords Enable use of MD5 passwords],
2139 if test "x$withval" != "xno" ; then
2140 AC_DEFINE(HAVE_MD5_PASSWORDS)
2146 # Whether to disable shadow password support
2148 [ --without-shadow Disable shadow password support],
2150 if test "x$withval" = "xno" ; then
2151 AC_DEFINE(DISABLE_SHADOW)
2157 if test -z "$disable_shadow" ; then
2158 AC_MSG_CHECKING([if the systems has expire shadow information])
2161 #include <sys/types.h>
2164 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2165 [ sp_expire_available=yes ], []
2168 if test "x$sp_expire_available" = "xyes" ; then
2170 AC_DEFINE(HAS_SHADOW_EXPIRE)
2176 # Use ip address instead of hostname in $DISPLAY
2177 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2178 DISPLAY_HACK_MSG="yes"
2179 AC_DEFINE(IPADDR_IN_DISPLAY)
2181 DISPLAY_HACK_MSG="no"
2182 AC_ARG_WITH(ipaddr-display,
2183 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2185 if test "x$withval" != "xno" ; then
2186 AC_DEFINE(IPADDR_IN_DISPLAY)
2187 DISPLAY_HACK_MSG="yes"
2193 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2194 if test $ac_cv_func_login_getcapbool = "yes" -a \
2195 $ac_cv_header_login_cap_h = "yes" ; then
2198 # Whether to mess with the default path
2199 SERVER_PATH_MSG="(default)"
2200 AC_ARG_WITH(default-path,
2201 [ --with-default-path= Specify default \$PATH environment for server],
2203 if test "$USES_LOGIN_CONF" = "yes" ; then
2205 --with-default-path=PATH has no effect on this system.
2206 Edit /etc/login.conf instead.])
2207 elif test "x$withval" != "xno" ; then
2208 user_path="$withval"
2209 SERVER_PATH_MSG="$withval"
2212 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2213 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2217 /* find out what STDPATH is */
2222 #ifndef _PATH_STDPATH
2223 # ifdef _PATH_USERPATH /* Irix */
2224 # define _PATH_STDPATH _PATH_USERPATH
2226 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2229 #include <sys/types.h>
2230 #include <sys/stat.h>
2232 #define DATA "conftest.stdpath"
2239 fd = fopen(DATA,"w");
2243 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2248 ], [ user_path=`cat conftest.stdpath` ],
2249 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2250 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2252 # make sure $bindir is in USER_PATH so scp will work
2253 t_bindir=`eval echo ${bindir}`
2255 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2258 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2260 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2261 if test $? -ne 0 ; then
2262 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2263 if test $? -ne 0 ; then
2264 user_path=$user_path:$t_bindir
2265 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2270 if test "$USES_LOGIN_CONF" != "yes" ; then
2271 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2275 # Set superuser path separately to user path
2276 AC_ARG_WITH(superuser-path,
2277 [ --with-superuser-path= Specify different path for super-user],
2279 if test "x$withval" != "xno" ; then
2280 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2281 superuser_path=$withval
2287 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2288 IPV4_IN6_HACK_MSG="no"
2290 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2292 if test "x$withval" != "xno" ; then
2294 AC_DEFINE(IPV4_IN_IPV6)
2295 IPV4_IN6_HACK_MSG="yes"
2300 if test "x$inet6_default_4in6" = "xyes"; then
2301 AC_MSG_RESULT([yes (default)])
2302 AC_DEFINE(IPV4_IN_IPV6)
2303 IPV4_IN6_HACK_MSG="yes"
2305 AC_MSG_RESULT([no (default)])
2310 # Whether to enable BSD auth support
2312 AC_ARG_WITH(bsd-auth,
2313 [ --with-bsd-auth Enable BSD auth support],
2315 if test "x$withval" != "xno" ; then
2322 # Where to place sshd.pid
2324 # make sure the directory exists
2325 if test ! -d $piddir ; then
2326 piddir=`eval echo ${sysconfdir}`
2328 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2332 AC_ARG_WITH(pid-dir,
2333 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2335 if test "x$withval" != "xno" ; then
2337 if test ! -d $piddir ; then
2338 AC_MSG_WARN([** no $piddir directory on this system **])
2344 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2347 dnl allow user to disable some login recording features
2348 AC_ARG_ENABLE(lastlog,
2349 [ --disable-lastlog disable use of lastlog even if detected [no]],
2351 if test "x$enableval" = "xno" ; then
2352 AC_DEFINE(DISABLE_LASTLOG)
2357 [ --disable-utmp disable use of utmp even if detected [no]],
2359 if test "x$enableval" = "xno" ; then
2360 AC_DEFINE(DISABLE_UTMP)
2364 AC_ARG_ENABLE(utmpx,
2365 [ --disable-utmpx disable use of utmpx even if detected [no]],
2367 if test "x$enableval" = "xno" ; then
2368 AC_DEFINE(DISABLE_UTMPX)
2373 [ --disable-wtmp disable use of wtmp even if detected [no]],
2375 if test "x$enableval" = "xno" ; then
2376 AC_DEFINE(DISABLE_WTMP)
2380 AC_ARG_ENABLE(wtmpx,
2381 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2383 if test "x$enableval" = "xno" ; then
2384 AC_DEFINE(DISABLE_WTMPX)
2388 AC_ARG_ENABLE(libutil,
2389 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2391 if test "x$enableval" = "xno" ; then
2392 AC_DEFINE(DISABLE_LOGIN)
2396 AC_ARG_ENABLE(pututline,
2397 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2399 if test "x$enableval" = "xno" ; then
2400 AC_DEFINE(DISABLE_PUTUTLINE)
2404 AC_ARG_ENABLE(pututxline,
2405 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2407 if test "x$enableval" = "xno" ; then
2408 AC_DEFINE(DISABLE_PUTUTXLINE)
2412 AC_ARG_WITH(lastlog,
2413 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2415 if test "x$withval" = "xno" ; then
2416 AC_DEFINE(DISABLE_LASTLOG)
2418 conf_lastlog_location=$withval
2423 dnl lastlog, [uw]tmpx? detection
2424 dnl NOTE: set the paths in the platform section to avoid the
2425 dnl need for command-line parameters
2426 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2428 dnl lastlog detection
2429 dnl NOTE: the code itself will detect if lastlog is a directory
2430 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2432 #include <sys/types.h>
2434 #ifdef HAVE_LASTLOG_H
2435 # include <lastlog.h>
2444 [ char *lastlog = LASTLOG_FILE; ],
2445 [ AC_MSG_RESULT(yes) ],
2448 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2450 #include <sys/types.h>
2452 #ifdef HAVE_LASTLOG_H
2453 # include <lastlog.h>
2459 [ char *lastlog = _PATH_LASTLOG; ],
2460 [ AC_MSG_RESULT(yes) ],
2463 system_lastlog_path=no
2468 if test -z "$conf_lastlog_location"; then
2469 if test x"$system_lastlog_path" = x"no" ; then
2470 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2471 if (test -d "$f" || test -f "$f") ; then
2472 conf_lastlog_location=$f
2475 if test -z "$conf_lastlog_location"; then
2476 AC_MSG_WARN([** Cannot find lastlog **])
2477 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2482 if test -n "$conf_lastlog_location"; then
2483 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2487 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2489 #include <sys/types.h>
2495 [ char *utmp = UTMP_FILE; ],
2496 [ AC_MSG_RESULT(yes) ],
2498 system_utmp_path=no ]
2500 if test -z "$conf_utmp_location"; then
2501 if test x"$system_utmp_path" = x"no" ; then
2502 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2503 if test -f $f ; then
2504 conf_utmp_location=$f
2507 if test -z "$conf_utmp_location"; then
2508 AC_DEFINE(DISABLE_UTMP)
2512 if test -n "$conf_utmp_location"; then
2513 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2517 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2519 #include <sys/types.h>
2525 [ char *wtmp = WTMP_FILE; ],
2526 [ AC_MSG_RESULT(yes) ],
2528 system_wtmp_path=no ]
2530 if test -z "$conf_wtmp_location"; then
2531 if test x"$system_wtmp_path" = x"no" ; then
2532 for f in /usr/adm/wtmp /var/log/wtmp; do
2533 if test -f $f ; then
2534 conf_wtmp_location=$f
2537 if test -z "$conf_wtmp_location"; then
2538 AC_DEFINE(DISABLE_WTMP)
2542 if test -n "$conf_wtmp_location"; then
2543 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2547 dnl utmpx detection - I don't know any system so perverse as to require
2548 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2550 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2552 #include <sys/types.h>
2561 [ char *utmpx = UTMPX_FILE; ],
2562 [ AC_MSG_RESULT(yes) ],
2564 system_utmpx_path=no ]
2566 if test -z "$conf_utmpx_location"; then
2567 if test x"$system_utmpx_path" = x"no" ; then
2568 AC_DEFINE(DISABLE_UTMPX)
2571 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2575 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2577 #include <sys/types.h>
2586 [ char *wtmpx = WTMPX_FILE; ],
2587 [ AC_MSG_RESULT(yes) ],
2589 system_wtmpx_path=no ]
2591 if test -z "$conf_wtmpx_location"; then
2592 if test x"$system_wtmpx_path" = x"no" ; then
2593 AC_DEFINE(DISABLE_WTMPX)
2596 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2600 if test ! -z "$blibpath" ; then
2601 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2602 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2605 dnl remove pam and dl because they are in $LIBPAM
2606 if test "$PAM_MSG" = yes ; then
2607 LIBS=`echo $LIBS | sed 's/-lpam //'`
2609 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2610 LIBS=`echo $LIBS | sed 's/-ldl //'`
2614 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2617 # Print summary of options
2619 # Someone please show me a better way :)
2620 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2621 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2622 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2623 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2624 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2625 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2626 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2627 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2628 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2629 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2632 echo "OpenSSH has been configured with the following options:"
2633 echo " User binaries: $B"
2634 echo " System binaries: $C"
2635 echo " Configuration files: $D"
2636 echo " Askpass program: $E"
2637 echo " Manual pages: $F"
2638 echo " PID file: $G"
2639 echo " Privilege separation chroot path: $H"
2640 if test "$USES_LOGIN_CONF" = "yes" ; then
2641 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2643 echo " sshd default user PATH: $I"
2645 if test ! -z "$superuser_path" ; then
2646 echo " sshd superuser user PATH: $J"
2648 echo " Manpage format: $MANTYPE"
2649 echo " DNS support: $DNS_MSG"
2650 echo " PAM support: $PAM_MSG"
2651 echo " KerberosIV support: $KRB4_MSG"
2652 echo " KerberosV support: $KRB5_MSG"
2653 echo " Smartcard support: $SCARD_MSG"
2654 echo " AFS support: $AFS_MSG"
2655 echo " S/KEY support: $SKEY_MSG"
2656 echo " TCP Wrappers support: $TCPW_MSG"
2657 echo " MD5 password support: $MD5_MSG"
2658 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2659 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2660 echo " BSD Auth support: $BSD_AUTH_MSG"
2661 echo " Random number source: $RAND_MSG"
2662 if test ! -z "$USE_RAND_HELPER" ; then
2663 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2668 echo " Host: ${host}"
2669 echo " Compiler: ${CC}"
2670 echo " Compiler flags: ${CFLAGS}"
2671 echo "Preprocessor flags: ${CPPFLAGS}"
2672 echo " Linker flags: ${LDFLAGS}"
2673 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2677 if test "x$PAM_MSG" = "xyes" ; then
2678 echo "PAM is enabled. You may need to install a PAM control file "
2679 echo "for sshd, otherwise password authentication may fail. "
2680 echo "Example PAM control files can be found in the contrib/ "
2685 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2686 echo "WARNING: you are using the builtin random number collection "
2687 echo "service. Please read WARNING.RNG and request that your OS "
2688 echo "vendor includes kernel-based random number collection in "
2689 echo "future versions of your OS."