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(LOCKED_PASSWD_STRING, "*")
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(LOCKED_PASSWD_STRING, "*")
162 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
164 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
167 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
168 IPADDR_IN_DISPLAY=yes
169 AC_DEFINE(PAM_SUN_CODEBASE)
171 AC_DEFINE(LOGIN_NO_ENDOPT)
172 AC_DEFINE(LOGIN_NEEDS_UTMPX)
173 AC_DEFINE(DISABLE_SHADOW)
174 AC_DEFINE(DISABLE_UTMP)
175 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
176 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
178 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
181 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
183 PATH="$PATH:/usr/etc"
184 AC_DEFINE(BROKEN_INET_NTOA)
185 AC_DEFINE(WITH_ABBREV_NO_TTY)
186 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
189 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
191 PATH="$PATH:/usr/etc"
192 AC_DEFINE(WITH_IRIX_ARRAY)
193 AC_DEFINE(WITH_IRIX_PROJECT)
194 AC_DEFINE(WITH_IRIX_AUDIT)
195 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
196 AC_DEFINE(BROKEN_INET_NTOA)
197 AC_DEFINE(WITH_ABBREV_NO_TTY)
198 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
202 check_for_libcrypt_later=1
203 check_for_openpty_ctty_bug=1
204 AC_DEFINE(DONT_TRY_OTHER_AF)
205 AC_DEFINE(PAM_TTY_KLUDGE)
206 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
207 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
208 inet6_default_4in6=yes
211 AC_DEFINE(BROKEN_CMSG_TYPE)
215 mips-sony-bsd|mips-sony-newsos4)
216 AC_DEFINE(HAVE_NEWS4)
220 check_for_libcrypt_before=1
224 check_for_libcrypt_later=1
227 conf_lastlog_location="/usr/adm/lastlog"
228 conf_utmp_location=/etc/utmp
229 conf_wtmp_location=/usr/adm/wtmp
232 AC_DEFINE(BROKEN_REALPATH)
234 AC_DEFINE(BROKEN_SAVED_UIDS)
235 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
239 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
240 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
242 AC_DEFINE(PAM_SUN_CODEBASE)
243 AC_DEFINE(LOGIN_NEEDS_UTMPX)
244 AC_DEFINE(LOGIN_NEEDS_TERM)
245 AC_DEFINE(PAM_TTY_KLUDGE)
246 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
247 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
248 AC_DEFINE(SSHD_ACQUIRES_CTTY)
249 # hardwire lastlog location (can't detect it on some versions)
250 conf_lastlog_location="/var/adm/lastlog"
251 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
252 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
253 if test "$sol2ver" -ge 8; then
255 AC_DEFINE(DISABLE_UTMP)
256 AC_DEFINE(DISABLE_WTMP)
262 CPPFLAGS="$CPPFLAGS -DSUNOS4"
263 AC_CHECK_FUNCS(getpwanam)
264 AC_DEFINE(PAM_SUN_CODEBASE)
265 conf_utmp_location=/etc/utmp
266 conf_wtmp_location=/var/adm/wtmp
267 conf_lastlog_location=/var/adm/lastlog
271 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
272 LDFLAGS="$LDFLAGS -L/usr/local/lib"
275 AC_DEFINE(SSHD_ACQUIRES_CTTY)
278 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
279 # /usr/ucblib MUST NOT be searched on ReliantUNIX
280 LDFLAGS="$LDFLAGS -L/usr/local/lib"
281 IPADDR_IN_DISPLAY=yes
283 AC_DEFINE(IP_TOS_IS_BROKEN)
284 AC_DEFINE(SSHD_ACQUIRES_CTTY)
285 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
286 # Attention: always take care to bind libsocket and libnsl before libc,
287 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
290 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
291 LDFLAGS="$LDFLAGS -L/usr/local/lib"
295 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
296 LDFLAGS="$LDFLAGS -L/usr/local/lib"
300 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
301 LDFLAGS="$LDFLAGS -L/usr/local/lib"
304 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
305 LDFLAGS="$LDFLAGS -L/usr/local/lib"
306 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
309 AC_DEFINE(BROKEN_SYS_TERMIO_H)
311 AC_DEFINE(HAVE_SECUREWARE)
312 AC_DEFINE(DISABLE_SHADOW)
313 AC_DEFINE(BROKEN_SAVED_UIDS)
314 AC_CHECK_FUNCS(getluid setluid)
316 do_sco3_extra_lib_check=yes
319 if test -z "$GCC"; then
320 CFLAGS="$CFLAGS -belf"
322 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
323 LDFLAGS="$LDFLAGS -L/usr/local/lib"
324 LIBS="$LIBS -lprot -lx -ltinfo -lm"
327 AC_DEFINE(HAVE_SECUREWARE)
328 AC_DEFINE(DISABLE_SHADOW)
329 AC_DEFINE(DISABLE_FD_PASSING)
330 AC_CHECK_FUNCS(getluid setluid)
335 AC_DEFINE(DISABLE_FD_PASSING)
337 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
342 AC_DEFINE(DISABLE_FD_PASSING)
343 AC_DEFINE(NO_SSH_LASTLOG)
344 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
345 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
349 AC_MSG_CHECKING(for Digital Unix SIA)
352 [ --with-osfsia Enable Digital Unix SIA],
354 if test "x$withval" = "xno" ; then
355 AC_MSG_RESULT(disabled)
360 if test -z "$no_osfsia" ; then
361 if test -f /etc/sia/matrix.conf; then
363 AC_DEFINE(HAVE_OSF_SIA)
364 AC_DEFINE(DISABLE_LOGIN)
365 AC_DEFINE(DISABLE_FD_PASSING)
366 LIBS="$LIBS -lsecurity -ldb -lm -laud"
371 AC_DEFINE(DISABLE_FD_PASSING)
372 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
377 AC_DEFINE(NO_X11_UNIX_SOCKETS)
378 AC_DEFINE(MISSING_NFDBITS)
379 AC_DEFINE(MISSING_HOWMANY)
380 AC_DEFINE(MISSING_FD_MASK)
384 # Allow user to specify flags
386 [ --with-cflags Specify additional flags to pass to compiler],
388 if test "x$withval" != "xno" ; then
389 CFLAGS="$CFLAGS $withval"
393 AC_ARG_WITH(cppflags,
394 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
396 if test "x$withval" != "xno"; then
397 CPPFLAGS="$CPPFLAGS $withval"
402 [ --with-ldflags Specify additional flags to pass to linker],
404 if test "x$withval" != "xno" ; then
405 LDFLAGS="$LDFLAGS $withval"
410 [ --with-libs Specify additional libraries to link with],
412 if test "x$withval" != "xno" ; then
413 LIBS="$LIBS $withval"
418 AC_MSG_CHECKING(compiler and flags for sanity)
423 [ AC_MSG_RESULT(yes) ],
426 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
430 # Checks for header files.
431 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
432 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
433 login_cap.h maillock.h netdb.h netgroup.h \
434 netinet/in_systm.h paths.h pty.h readpassphrase.h \
435 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
436 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
437 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
438 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
439 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
440 util.h utime.h utmp.h utmpx.h)
442 # Checks for libraries.
443 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
444 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
446 dnl SCO OS3 needs this for libwrap
447 if test "x$with_tcp_wrappers" != "xno" ; then
448 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
449 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
453 AC_CHECK_FUNC(getspnam, ,
454 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
457 [ --without-rpath Disable auto-added -R linker paths],
459 if test "x$withval" = "xno" ; then
462 if test "x$withval" = "xyes" ; then
470 [ --with-zlib=PATH Use zlib in PATH],
472 if test "x$withval" = "xno" ; then
473 AC_MSG_ERROR([*** zlib is required ***])
475 if test -d "$withval/lib"; then
476 if test -n "${need_dash_r}"; then
477 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
479 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
482 if test -n "${need_dash_r}"; then
483 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
485 LDFLAGS="-L${withval} ${LDFLAGS}"
488 if test -d "$withval/include"; then
489 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
491 CPPFLAGS="-I${withval} ${CPPFLAGS}"
496 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
499 AC_CHECK_FUNC(strcasecmp,
500 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
502 AC_CHECK_FUNC(utimes,
503 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
504 LIBS="$LIBS -lc89"]) ]
507 dnl Checks for libutil functions
508 AC_CHECK_HEADERS(libutil.h)
509 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
510 AC_CHECK_FUNCS(logout updwtmp logwtmp)
514 # Check for ALTDIRFUNC glob() extension
515 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
516 AC_EGREP_CPP(FOUNDIT,
519 #ifdef GLOB_ALTDIRFUNC
524 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
532 # Check for g.gl_matchc glob() extension
533 AC_MSG_CHECKING(for gl_matchc field in glob_t)
534 AC_EGREP_CPP(FOUNDIT,
537 int main(void){glob_t g; g.gl_matchc = 1;}
540 AC_DEFINE(GLOB_HAS_GL_MATCHC)
548 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
551 #include <sys/types.h>
553 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
555 [AC_MSG_RESULT(yes)],
558 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
562 # Check whether user wants S/Key support
565 [ --with-skey[[=PATH]] Enable S/Key support
566 (optionally in PATH)],
568 if test "x$withval" != "xno" ; then
570 if test "x$withval" != "xyes" ; then
571 CPPFLAGS="$CPPFLAGS -I${withval}/include"
572 LDFLAGS="$LDFLAGS -L${withval}/lib"
579 AC_MSG_CHECKING([for s/key support])
584 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
586 [AC_MSG_RESULT(yes)],
589 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
595 # Check whether user wants TCP wrappers support
597 AC_ARG_WITH(tcp-wrappers,
598 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
599 (optionally in PATH)],
601 if test "x$withval" != "xno" ; then
603 saved_LDFLAGS="$LDFLAGS"
604 saved_CPPFLAGS="$CPPFLAGS"
605 if test -n "${withval}" -a "${withval}" != "yes"; then
606 if test -d "${withval}/lib"; then
607 if test -n "${need_dash_r}"; then
608 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
610 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
613 if test -n "${need_dash_r}"; then
614 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
616 LDFLAGS="-L${withval} ${LDFLAGS}"
619 if test -d "${withval}/include"; then
620 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
622 CPPFLAGS="-I${withval} ${CPPFLAGS}"
626 LIBS="$LIBWRAP $LIBS"
627 AC_MSG_CHECKING(for libwrap)
631 int deny_severity = 0, allow_severity = 0;
641 AC_MSG_ERROR([*** libwrap missing])
649 dnl Checks for library functions. Please keep in alphabetical order
651 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
652 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
653 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
654 getpeereid _getpty getrlimit getttyent glob inet_aton \
655 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
656 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
657 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
658 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
659 setproctitle setregid setresgid setresuid setreuid setrlimit \
660 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
661 strlcat strlcpy strmode strnvis sysconf tcgetpgrp tcsendbreak \
662 truncate utimes vhangup vsnprintf waitpid \
665 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
666 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
668 dnl Make sure prototypes are defined for these before using them.
669 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
670 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
672 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
673 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
674 AC_CHECK_LIB(gen, dirname,[
675 AC_CACHE_CHECK([for broken dirname],
676 ac_cv_have_broken_dirname, [
684 int main(int argc, char **argv) {
687 strncpy(buf,"/etc", 32);
689 if (!s || strncmp(s, "/", 32) != 0) {
696 [ ac_cv_have_broken_dirname="no" ],
697 [ ac_cv_have_broken_dirname="yes" ]
701 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
703 AC_DEFINE(HAVE_DIRNAME)
704 AC_CHECK_HEADERS(libgen.h)
709 dnl Checks for time functions
710 AC_CHECK_FUNCS(gettimeofday time)
711 dnl Checks for utmp functions
712 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
713 AC_CHECK_FUNCS(utmpname)
714 dnl Checks for utmpx functions
715 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
716 AC_CHECK_FUNCS(setutxent utmpxname)
718 AC_CHECK_FUNC(daemon,
719 [AC_DEFINE(HAVE_DAEMON)],
720 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
723 AC_CHECK_FUNC(getpagesize,
724 [AC_DEFINE(HAVE_GETPAGESIZE)],
725 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
728 # Check for broken snprintf
729 if test "x$ac_cv_func_snprintf" = "xyes" ; then
730 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
734 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
736 [AC_MSG_RESULT(yes)],
739 AC_DEFINE(BROKEN_SNPRINTF)
740 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
745 dnl see whether mkstemp() requires XXXXXX
746 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
747 AC_MSG_CHECKING([for (overly) strict mkstemp])
751 main() { char template[]="conftest.mkstemp-test";
752 if (mkstemp(template) == -1)
754 unlink(template); exit(0);
762 AC_DEFINE(HAVE_STRICT_MKSTEMP)
766 AC_DEFINE(HAVE_STRICT_MKSTEMP)
771 dnl make sure that openpty does not reacquire controlling terminal
772 if test ! -z "$check_for_openpty_ctty_bug"; then
773 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
777 #include <sys/fcntl.h>
778 #include <sys/types.h>
779 #include <sys/wait.h>
785 int fd, ptyfd, ttyfd, status;
788 if (pid < 0) { /* failed */
790 } else if (pid > 0) { /* parent */
791 waitpid(pid, &status, 0);
792 if (WIFEXITED(status))
793 exit(WEXITSTATUS(status));
797 close(0); close(1); close(2);
799 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
800 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
802 exit(3); /* Acquired ctty: broken */
804 exit(0); /* Did not acquire ctty: OK */
813 AC_DEFINE(SSHD_ACQUIRES_CTTY)
823 [ --with-pam Enable PAM support ],
825 if test "x$withval" != "xno" ; then
826 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
827 AC_MSG_ERROR([PAM headers not found])
830 AC_CHECK_LIB(dl, dlopen, , )
831 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
832 AC_CHECK_FUNCS(pam_getenvlist)
838 if test $ac_cv_lib_dl_dlopen = yes; then
848 # Check for older PAM
849 if test "x$PAM_MSG" = "xyes" ; then
850 # Check PAM strerror arguments (old PAM)
851 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
855 #include <security/pam_appl.h>
857 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
860 AC_DEFINE(HAVE_OLD_PAM)
862 PAM_MSG="yes (old library)"
867 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
868 # because the system crypt() is more featureful.
869 if test "x$check_for_libcrypt_before" = "x1"; then
870 AC_CHECK_LIB(crypt, crypt)
874 saved_CPPFLAGS="$CPPFLAGS"
875 saved_LDFLAGS="$LDFLAGS"
877 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
879 if test "x$withval" != "xno" ; then
880 if test -d "$withval/lib"; then
881 if test -n "${need_dash_r}"; then
882 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
884 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
887 if test -n "${need_dash_r}"; then
888 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
890 LDFLAGS="-L${withval} ${LDFLAGS}"
893 if test -d "$withval/include"; then
894 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
896 CPPFLAGS="-I${withval} ${CPPFLAGS}"
901 LIBS="$LIBS -lcrypto"
902 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
904 dnl Check default openssl install dir
905 if test -n "${need_dash_r}"; then
906 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
908 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
910 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
911 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
913 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
919 # Determine OpenSSL header version
920 AC_MSG_CHECKING([OpenSSL header version])
925 #include <openssl/opensslv.h>
926 #define DATA "conftest.sslincver"
931 fd = fopen(DATA,"w");
935 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
942 ssl_header_ver=`cat conftest.sslincver`
943 AC_MSG_RESULT($ssl_header_ver)
946 AC_MSG_RESULT(not found)
947 AC_MSG_ERROR(OpenSSL version header not found.)
951 # Determine OpenSSL library version
952 AC_MSG_CHECKING([OpenSSL library version])
957 #include <openssl/opensslv.h>
958 #include <openssl/crypto.h>
959 #define DATA "conftest.ssllibver"
964 fd = fopen(DATA,"w");
968 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
975 ssl_library_ver=`cat conftest.ssllibver`
976 AC_MSG_RESULT($ssl_library_ver)
979 AC_MSG_RESULT(not found)
980 AC_MSG_ERROR(OpenSSL library not found.)
984 # Sanity check OpenSSL headers
985 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
989 #include <openssl/opensslv.h>
990 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
997 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
998 Check config.log for details.
999 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1003 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1004 # version in OpenSSL. Skip this for PAM
1005 if test "x$check_for_libcrypt_later" = "x1"; then
1006 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1010 ### Configure cryptographic random number support
1012 # Check wheter OpenSSL seeds itself
1013 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1017 #include <openssl/rand.h>
1018 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1021 OPENSSL_SEEDS_ITSELF=yes
1026 # Default to use of the rand helper if OpenSSL doesn't
1033 # Do we want to force the use of the rand helper?
1034 AC_ARG_WITH(rand-helper,
1035 [ --with-rand-helper Use subprocess to gather strong randomness ],
1037 if test "x$withval" = "xno" ; then
1038 # Force use of OpenSSL's internal RNG, even if
1039 # the previous test showed it to be unseeded.
1040 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1041 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1042 OPENSSL_SEEDS_ITSELF=yes
1051 # Which randomness source do we use?
1052 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1054 AC_DEFINE(OPENSSL_PRNG_ONLY)
1055 RAND_MSG="OpenSSL internal ONLY"
1056 INSTALL_SSH_RAND_HELPER=""
1057 elif test ! -z "$USE_RAND_HELPER" ; then
1058 # install rand helper
1059 RAND_MSG="ssh-rand-helper"
1060 INSTALL_SSH_RAND_HELPER="yes"
1062 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1064 ### Configuration of ssh-rand-helper
1067 AC_ARG_WITH(prngd-port,
1068 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1077 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1080 if test ! -z "$withval" ; then
1081 PRNGD_PORT="$withval"
1082 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1087 # PRNGD Unix domain socket
1088 AC_ARG_WITH(prngd-socket,
1089 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1093 withval="/var/run/egd-pool"
1101 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1105 if test ! -z "$withval" ; then
1106 if test ! -z "$PRNGD_PORT" ; then
1107 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1109 if test ! -r "$withval" ; then
1110 AC_MSG_WARN(Entropy socket is not readable)
1112 PRNGD_SOCKET="$withval"
1113 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1117 # Check for existing socket only if we don't have a random device already
1118 if test "$USE_RAND_HELPER" = yes ; then
1119 AC_MSG_CHECKING(for PRNGD/EGD socket)
1120 # Insert other locations here
1121 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1122 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1123 PRNGD_SOCKET="$sock"
1124 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1128 if test ! -z "$PRNGD_SOCKET" ; then
1129 AC_MSG_RESULT($PRNGD_SOCKET)
1131 AC_MSG_RESULT(not found)
1137 # Change default command timeout for hashing entropy source
1139 AC_ARG_WITH(entropy-timeout,
1140 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1142 if test "x$withval" != "xno" ; then
1143 entropy_timeout=$withval
1147 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1149 SSH_PRIVSEP_USER=sshd
1150 AC_ARG_WITH(privsep-user,
1151 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1153 if test -n "$withval"; then
1154 SSH_PRIVSEP_USER=$withval
1158 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1159 AC_SUBST(SSH_PRIVSEP_USER)
1161 # We do this little dance with the search path to insure
1162 # that programs that we select for use by installed programs
1163 # (which may be run by the super-user) come from trusted
1164 # locations before they come from the user's private area.
1165 # This should help avoid accidentally configuring some
1166 # random version of a program in someone's personal bin.
1170 test -h /bin 2> /dev/null && PATH=/usr/bin
1171 test -d /sbin && PATH=$PATH:/sbin
1172 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1173 PATH=$PATH:/etc:$OPATH
1175 # These programs are used by the command hashing source to gather entropy
1176 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1177 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1178 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1179 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1180 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1181 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1182 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1183 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1184 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1185 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1186 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1187 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1188 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1189 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1190 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1191 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1195 # Where does ssh-rand-helper get its randomness from?
1196 INSTALL_SSH_PRNG_CMDS=""
1197 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1198 if test ! -z "$PRNGD_PORT" ; then
1199 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1200 elif test ! -z "$PRNGD_SOCKET" ; then
1201 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1203 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1204 RAND_HELPER_CMDHASH=yes
1205 INSTALL_SSH_PRNG_CMDS="yes"
1208 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1211 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1212 if test ! -z "$SONY" ; then
1213 LIBS="$LIBS -liberty";
1216 # Checks for data types
1217 AC_CHECK_SIZEOF(char, 1)
1218 AC_CHECK_SIZEOF(short int, 2)
1219 AC_CHECK_SIZEOF(int, 4)
1220 AC_CHECK_SIZEOF(long int, 4)
1221 AC_CHECK_SIZEOF(long long int, 8)
1223 # Sanity check long long for some platforms (AIX)
1224 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1225 ac_cv_sizeof_long_long_int=0
1228 # More checks for data types
1229 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1231 [ #include <sys/types.h> ],
1233 [ ac_cv_have_u_int="yes" ],
1234 [ ac_cv_have_u_int="no" ]
1237 if test "x$ac_cv_have_u_int" = "xyes" ; then
1238 AC_DEFINE(HAVE_U_INT)
1242 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1244 [ #include <sys/types.h> ],
1245 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1246 [ ac_cv_have_intxx_t="yes" ],
1247 [ ac_cv_have_intxx_t="no" ]
1250 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1251 AC_DEFINE(HAVE_INTXX_T)
1255 if (test -z "$have_intxx_t" && \
1256 test "x$ac_cv_header_stdint_h" = "xyes")
1258 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1260 [ #include <stdint.h> ],
1261 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1263 AC_DEFINE(HAVE_INTXX_T)
1266 [ AC_MSG_RESULT(no) ]
1270 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1273 #include <sys/types.h>
1274 #ifdef HAVE_STDINT_H
1275 # include <stdint.h>
1277 #include <sys/socket.h>
1278 #ifdef HAVE_SYS_BITYPES_H
1279 # include <sys/bitypes.h>
1282 [ int64_t a; a = 1;],
1283 [ ac_cv_have_int64_t="yes" ],
1284 [ ac_cv_have_int64_t="no" ]
1287 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1288 AC_DEFINE(HAVE_INT64_T)
1291 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1293 [ #include <sys/types.h> ],
1294 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1295 [ ac_cv_have_u_intxx_t="yes" ],
1296 [ ac_cv_have_u_intxx_t="no" ]
1299 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1300 AC_DEFINE(HAVE_U_INTXX_T)
1304 if test -z "$have_u_intxx_t" ; then
1305 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1307 [ #include <sys/socket.h> ],
1308 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1310 AC_DEFINE(HAVE_U_INTXX_T)
1313 [ AC_MSG_RESULT(no) ]
1317 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1319 [ #include <sys/types.h> ],
1320 [ u_int64_t a; a = 1;],
1321 [ ac_cv_have_u_int64_t="yes" ],
1322 [ ac_cv_have_u_int64_t="no" ]
1325 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1326 AC_DEFINE(HAVE_U_INT64_T)
1330 if test -z "$have_u_int64_t" ; then
1331 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1333 [ #include <sys/bitypes.h> ],
1334 [ u_int64_t a; a = 1],
1336 AC_DEFINE(HAVE_U_INT64_T)
1339 [ AC_MSG_RESULT(no) ]
1343 if test -z "$have_u_intxx_t" ; then
1344 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1347 #include <sys/types.h>
1349 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1350 [ ac_cv_have_uintxx_t="yes" ],
1351 [ ac_cv_have_uintxx_t="no" ]
1354 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1355 AC_DEFINE(HAVE_UINTXX_T)
1359 if test -z "$have_uintxx_t" ; then
1360 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1362 [ #include <stdint.h> ],
1363 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1365 AC_DEFINE(HAVE_UINTXX_T)
1368 [ AC_MSG_RESULT(no) ]
1372 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1373 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1375 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1378 #include <sys/bitypes.h>
1381 int8_t a; int16_t b; int32_t c;
1382 u_int8_t e; u_int16_t f; u_int32_t g;
1383 a = b = c = e = f = g = 1;
1386 AC_DEFINE(HAVE_U_INTXX_T)
1387 AC_DEFINE(HAVE_INTXX_T)
1395 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1398 #include <sys/types.h>
1400 [ u_char foo; foo = 125; ],
1401 [ ac_cv_have_u_char="yes" ],
1402 [ ac_cv_have_u_char="no" ]
1405 if test "x$ac_cv_have_u_char" = "xyes" ; then
1406 AC_DEFINE(HAVE_U_CHAR)
1411 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1413 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1416 #include <sys/types.h>
1418 [ size_t foo; foo = 1235; ],
1419 [ ac_cv_have_size_t="yes" ],
1420 [ ac_cv_have_size_t="no" ]
1423 if test "x$ac_cv_have_size_t" = "xyes" ; then
1424 AC_DEFINE(HAVE_SIZE_T)
1427 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1430 #include <sys/types.h>
1432 [ ssize_t foo; foo = 1235; ],
1433 [ ac_cv_have_ssize_t="yes" ],
1434 [ ac_cv_have_ssize_t="no" ]
1437 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1438 AC_DEFINE(HAVE_SSIZE_T)
1441 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1446 [ clock_t foo; foo = 1235; ],
1447 [ ac_cv_have_clock_t="yes" ],
1448 [ ac_cv_have_clock_t="no" ]
1451 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1452 AC_DEFINE(HAVE_CLOCK_T)
1455 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1458 #include <sys/types.h>
1459 #include <sys/socket.h>
1461 [ sa_family_t foo; foo = 1235; ],
1462 [ ac_cv_have_sa_family_t="yes" ],
1465 #include <sys/types.h>
1466 #include <sys/socket.h>
1467 #include <netinet/in.h>
1469 [ sa_family_t foo; foo = 1235; ],
1470 [ ac_cv_have_sa_family_t="yes" ],
1472 [ ac_cv_have_sa_family_t="no" ]
1476 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1477 AC_DEFINE(HAVE_SA_FAMILY_T)
1480 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1483 #include <sys/types.h>
1485 [ pid_t foo; foo = 1235; ],
1486 [ ac_cv_have_pid_t="yes" ],
1487 [ ac_cv_have_pid_t="no" ]
1490 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1491 AC_DEFINE(HAVE_PID_T)
1494 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1497 #include <sys/types.h>
1499 [ mode_t foo; foo = 1235; ],
1500 [ ac_cv_have_mode_t="yes" ],
1501 [ ac_cv_have_mode_t="no" ]
1504 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1505 AC_DEFINE(HAVE_MODE_T)
1509 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1512 #include <sys/types.h>
1513 #include <sys/socket.h>
1515 [ struct sockaddr_storage s; ],
1516 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1517 [ ac_cv_have_struct_sockaddr_storage="no" ]
1520 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1521 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1524 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1527 #include <sys/types.h>
1528 #include <netinet/in.h>
1530 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1531 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1532 [ ac_cv_have_struct_sockaddr_in6="no" ]
1535 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1536 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1539 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1542 #include <sys/types.h>
1543 #include <netinet/in.h>
1545 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1546 [ ac_cv_have_struct_in6_addr="yes" ],
1547 [ ac_cv_have_struct_in6_addr="no" ]
1550 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1551 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1554 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1557 #include <sys/types.h>
1558 #include <sys/socket.h>
1561 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1562 [ ac_cv_have_struct_addrinfo="yes" ],
1563 [ ac_cv_have_struct_addrinfo="no" ]
1566 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1567 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1570 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1572 [ #include <sys/time.h> ],
1573 [ struct timeval tv; tv.tv_sec = 1;],
1574 [ ac_cv_have_struct_timeval="yes" ],
1575 [ ac_cv_have_struct_timeval="no" ]
1578 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1579 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1580 have_struct_timeval=1
1583 AC_CHECK_TYPES(struct timespec)
1585 # We need int64_t or else certian parts of the compile will fail.
1586 if test "x$ac_cv_have_int64_t" = "xno" -a \
1587 "x$ac_cv_sizeof_long_int" != "x8" -a \
1588 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1589 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1590 echo "an alternative compiler (I.E., GCC) before continuing."
1594 dnl test snprintf (broken on SCO w/gcc)
1599 #ifdef HAVE_SNPRINTF
1603 char expected_out[50];
1605 #if (SIZEOF_LONG_INT == 8)
1606 long int num = 0x7fffffffffffffff;
1608 long long num = 0x7fffffffffffffffll;
1610 strcpy(expected_out, "9223372036854775807");
1611 snprintf(buf, mazsize, "%lld", num);
1612 if(strcmp(buf, expected_out) != 0)
1619 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1623 dnl Checks for structure members
1624 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1625 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1626 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1627 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1628 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1629 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1630 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1631 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1632 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1633 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1634 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1635 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1636 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1637 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1638 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1639 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1640 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1642 AC_CHECK_MEMBERS([struct stat.st_blksize])
1644 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1645 ac_cv_have_ss_family_in_struct_ss, [
1648 #include <sys/types.h>
1649 #include <sys/socket.h>
1651 [ struct sockaddr_storage s; s.ss_family = 1; ],
1652 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1653 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1656 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1657 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1660 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1661 ac_cv_have___ss_family_in_struct_ss, [
1664 #include <sys/types.h>
1665 #include <sys/socket.h>
1667 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1668 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1669 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1672 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1673 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1676 AC_CACHE_CHECK([for pw_class field in struct passwd],
1677 ac_cv_have_pw_class_in_struct_passwd, [
1682 [ struct passwd p; p.pw_class = 0; ],
1683 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1684 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1687 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1688 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1691 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1692 ac_cv_have_pw_expire_in_struct_passwd, [
1697 [ struct passwd p; p.pw_expire = 0; ],
1698 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1699 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1702 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1703 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1706 AC_CACHE_CHECK([for pw_change field in struct passwd],
1707 ac_cv_have_pw_change_in_struct_passwd, [
1712 [ struct passwd p; p.pw_change = 0; ],
1713 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1714 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1717 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1718 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1721 dnl make sure we're using the real structure members and not defines
1722 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1723 ac_cv_have_accrights_in_msghdr, [
1726 #include <sys/types.h>
1727 #include <sys/socket.h>
1728 #include <sys/uio.h>
1730 #ifdef msg_accrights
1734 m.msg_accrights = 0;
1738 [ ac_cv_have_accrights_in_msghdr="yes" ],
1739 [ ac_cv_have_accrights_in_msghdr="no" ]
1742 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1743 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1746 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1747 ac_cv_have_control_in_msghdr, [
1750 #include <sys/types.h>
1751 #include <sys/socket.h>
1752 #include <sys/uio.h>
1762 [ ac_cv_have_control_in_msghdr="yes" ],
1763 [ ac_cv_have_control_in_msghdr="no" ]
1766 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1767 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1770 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1772 [ extern char *__progname; printf("%s", __progname); ],
1773 [ ac_cv_libc_defines___progname="yes" ],
1774 [ ac_cv_libc_defines___progname="no" ]
1777 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1778 AC_DEFINE(HAVE___PROGNAME)
1781 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1785 [ printf("%s", __FUNCTION__); ],
1786 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1787 [ ac_cv_cc_implements___FUNCTION__="no" ]
1790 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1791 AC_DEFINE(HAVE___FUNCTION__)
1794 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1798 [ printf("%s", __func__); ],
1799 [ ac_cv_cc_implements___func__="yes" ],
1800 [ ac_cv_cc_implements___func__="no" ]
1803 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1804 AC_DEFINE(HAVE___func__)
1807 AC_CACHE_CHECK([whether getopt has optreset support],
1808 ac_cv_have_getopt_optreset, [
1813 [ extern int optreset; optreset = 0; ],
1814 [ ac_cv_have_getopt_optreset="yes" ],
1815 [ ac_cv_have_getopt_optreset="no" ]
1818 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1819 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1822 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1824 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1825 [ ac_cv_libc_defines_sys_errlist="yes" ],
1826 [ ac_cv_libc_defines_sys_errlist="no" ]
1829 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1830 AC_DEFINE(HAVE_SYS_ERRLIST)
1834 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1836 [ extern int sys_nerr; printf("%i", sys_nerr);],
1837 [ ac_cv_libc_defines_sys_nerr="yes" ],
1838 [ ac_cv_libc_defines_sys_nerr="no" ]
1841 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1842 AC_DEFINE(HAVE_SYS_NERR)
1846 # Check whether user wants sectok support
1848 [ --with-sectok Enable smartcard support using libsectok],
1850 if test "x$withval" != "xno" ; then
1851 if test "x$withval" != "xyes" ; then
1852 CPPFLAGS="$CPPFLAGS -I${withval}"
1853 LDFLAGS="$LDFLAGS -L${withval}"
1854 if test ! -z "$need_dash_r" ; then
1855 LDFLAGS="$LDFLAGS -R${withval}"
1857 if test ! -z "$blibpath" ; then
1858 blibpath="$blibpath:${withval}"
1861 AC_CHECK_HEADERS(sectok.h)
1862 if test "$ac_cv_header_sectok_h" != yes; then
1863 AC_MSG_ERROR(Can't find sectok.h)
1865 AC_CHECK_LIB(sectok, sectok_open)
1866 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1867 AC_MSG_ERROR(Can't find libsectok)
1869 AC_DEFINE(SMARTCARD)
1870 AC_DEFINE(USE_SECTOK)
1871 SCARD_MSG="yes, using sectok"
1876 # Check whether user wants OpenSC support
1878 AC_HELP_STRING([--with-opensc=PFX],
1879 [Enable smartcard support using OpenSC]),
1880 opensc_config_prefix="$withval", opensc_config_prefix="")
1881 if test x$opensc_config_prefix != x ; then
1882 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1883 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1884 if test "$OPENSC_CONFIG" != "no"; then
1885 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1886 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1887 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1888 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1889 AC_DEFINE(SMARTCARD)
1890 AC_DEFINE(USE_OPENSC)
1891 SCARD_MSG="yes, using OpenSC"
1895 # Check whether user wants DNS support
1898 [ --with-dns Support for fetching keys from DNS (experimental)],
1900 if test "x$withval" != "xno" ; then
1903 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1904 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1906 # Needed by our getrrsetbyname()
1907 AC_SEARCH_LIBS(res_query, resolv)
1908 AC_SEARCH_LIBS(dn_expand, resolv)
1914 # Check whether user wants Kerberos 5 support
1916 AC_ARG_WITH(kerberos5,
1917 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1919 if test "x$withval" != "xno" ; then
1920 if test "x$withval" = "xyes" ; then
1921 KRB5ROOT="/usr/local"
1925 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1926 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1929 AC_MSG_CHECKING(whether we are using Heimdal)
1930 AC_TRY_COMPILE([ #include <krb5.h> ],
1931 [ char *tmp = heimdal_version; ],
1932 [ AC_MSG_RESULT(yes)
1934 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1937 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1940 if test ! -z "$need_dash_r" ; then
1941 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1943 if test ! -z "$blibpath" ; then
1944 blibpath="$blibpath:${KRB5ROOT}/lib"
1946 AC_SEARCH_LIBS(dn_expand, resolv)
1952 LIBS="$LIBS $K5LIBS"
1954 # Looking for programs, paths and files
1956 PRIVSEP_PATH=/var/empty
1957 AC_ARG_WITH(privsep-path,
1958 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
1960 if test "x$withval" != "$no" ; then
1961 PRIVSEP_PATH=$withval
1965 AC_SUBST(PRIVSEP_PATH)
1968 [ --with-xauth=PATH Specify path to xauth program ],
1970 if test "x$withval" != "xno" ; then
1976 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
1977 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
1978 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
1979 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
1980 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
1981 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
1982 xauth_path="/usr/openwin/bin/xauth"
1988 AC_ARG_ENABLE(strip,
1989 [ --disable-strip Disable calling strip(1) on install],
1991 if test "x$enableval" = "xno" ; then
1998 if test -z "$xauth_path" ; then
1999 XAUTH_PATH="undefined"
2000 AC_SUBST(XAUTH_PATH)
2002 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2003 XAUTH_PATH=$xauth_path
2004 AC_SUBST(XAUTH_PATH)
2007 # Check for mail directory (last resort if we cannot get it from headers)
2008 if test ! -z "$MAIL" ; then
2009 maildir=`dirname $MAIL`
2010 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2013 if test -z "$no_dev_ptmx" ; then
2014 if test "x$disable_ptmx_check" != "xyes" ; then
2015 AC_CHECK_FILE("/dev/ptmx",
2017 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2023 AC_CHECK_FILE("/dev/ptc",
2025 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2030 # Options from here on. Some of these are preset by platform above
2031 AC_ARG_WITH(mantype,
2032 [ --with-mantype=man|cat|doc Set man page type],
2039 AC_MSG_ERROR(invalid man type: $withval)
2044 if test -z "$MANTYPE"; then
2045 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2046 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2047 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2049 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2056 if test "$MANTYPE" = "doc"; then
2063 # Check whether to enable MD5 passwords
2065 AC_ARG_WITH(md5-passwords,
2066 [ --with-md5-passwords Enable use of MD5 passwords],
2068 if test "x$withval" != "xno" ; then
2069 AC_DEFINE(HAVE_MD5_PASSWORDS)
2075 # Whether to disable shadow password support
2077 [ --without-shadow Disable shadow password support],
2079 if test "x$withval" = "xno" ; then
2080 AC_DEFINE(DISABLE_SHADOW)
2086 if test -z "$disable_shadow" ; then
2087 AC_MSG_CHECKING([if the systems has expire shadow information])
2090 #include <sys/types.h>
2093 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2094 [ sp_expire_available=yes ], []
2097 if test "x$sp_expire_available" = "xyes" ; then
2099 AC_DEFINE(HAS_SHADOW_EXPIRE)
2105 # Use ip address instead of hostname in $DISPLAY
2106 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2107 DISPLAY_HACK_MSG="yes"
2108 AC_DEFINE(IPADDR_IN_DISPLAY)
2110 DISPLAY_HACK_MSG="no"
2111 AC_ARG_WITH(ipaddr-display,
2112 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2114 if test "x$withval" != "xno" ; then
2115 AC_DEFINE(IPADDR_IN_DISPLAY)
2116 DISPLAY_HACK_MSG="yes"
2122 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2123 if test $ac_cv_func_login_getcapbool = "yes" -a \
2124 $ac_cv_header_login_cap_h = "yes" ; then
2127 # Whether to mess with the default path
2128 SERVER_PATH_MSG="(default)"
2129 AC_ARG_WITH(default-path,
2130 [ --with-default-path= Specify default \$PATH environment for server],
2132 if test "$USES_LOGIN_CONF" = "yes" ; then
2134 --with-default-path=PATH has no effect on this system.
2135 Edit /etc/login.conf instead.])
2136 elif test "x$withval" != "xno" ; then
2137 user_path="$withval"
2138 SERVER_PATH_MSG="$withval"
2141 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2142 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2146 /* find out what STDPATH is */
2151 #ifndef _PATH_STDPATH
2152 # ifdef _PATH_USERPATH /* Irix */
2153 # define _PATH_STDPATH _PATH_USERPATH
2155 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2158 #include <sys/types.h>
2159 #include <sys/stat.h>
2161 #define DATA "conftest.stdpath"
2168 fd = fopen(DATA,"w");
2172 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2177 ], [ user_path=`cat conftest.stdpath` ],
2178 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2179 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2181 # make sure $bindir is in USER_PATH so scp will work
2182 t_bindir=`eval echo ${bindir}`
2184 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2187 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2189 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2190 if test $? -ne 0 ; then
2191 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2192 if test $? -ne 0 ; then
2193 user_path=$user_path:$t_bindir
2194 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2199 if test "$USES_LOGIN_CONF" != "yes" ; then
2200 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2204 # Set superuser path separately to user path
2205 AC_ARG_WITH(superuser-path,
2206 [ --with-superuser-path= Specify different path for super-user],
2208 if test "x$withval" != "xno" ; then
2209 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2210 superuser_path=$withval
2216 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2217 IPV4_IN6_HACK_MSG="no"
2219 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2221 if test "x$withval" != "xno" ; then
2223 AC_DEFINE(IPV4_IN_IPV6)
2224 IPV4_IN6_HACK_MSG="yes"
2229 if test "x$inet6_default_4in6" = "xyes"; then
2230 AC_MSG_RESULT([yes (default)])
2231 AC_DEFINE(IPV4_IN_IPV6)
2232 IPV4_IN6_HACK_MSG="yes"
2234 AC_MSG_RESULT([no (default)])
2239 # Whether to enable BSD auth support
2241 AC_ARG_WITH(bsd-auth,
2242 [ --with-bsd-auth Enable BSD auth support],
2244 if test "x$withval" != "xno" ; then
2251 # Where to place sshd.pid
2253 # make sure the directory exists
2254 if test ! -d $piddir ; then
2255 piddir=`eval echo ${sysconfdir}`
2257 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2261 AC_ARG_WITH(pid-dir,
2262 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2264 if test "x$withval" != "xno" ; then
2266 if test ! -d $piddir ; then
2267 AC_MSG_WARN([** no $piddir directory on this system **])
2273 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2276 dnl allow user to disable some login recording features
2277 AC_ARG_ENABLE(lastlog,
2278 [ --disable-lastlog disable use of lastlog even if detected [no]],
2280 if test "x$enableval" = "xno" ; then
2281 AC_DEFINE(DISABLE_LASTLOG)
2286 [ --disable-utmp disable use of utmp even if detected [no]],
2288 if test "x$enableval" = "xno" ; then
2289 AC_DEFINE(DISABLE_UTMP)
2293 AC_ARG_ENABLE(utmpx,
2294 [ --disable-utmpx disable use of utmpx even if detected [no]],
2296 if test "x$enableval" = "xno" ; then
2297 AC_DEFINE(DISABLE_UTMPX)
2302 [ --disable-wtmp disable use of wtmp even if detected [no]],
2304 if test "x$enableval" = "xno" ; then
2305 AC_DEFINE(DISABLE_WTMP)
2309 AC_ARG_ENABLE(wtmpx,
2310 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2312 if test "x$enableval" = "xno" ; then
2313 AC_DEFINE(DISABLE_WTMPX)
2317 AC_ARG_ENABLE(libutil,
2318 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2320 if test "x$enableval" = "xno" ; then
2321 AC_DEFINE(DISABLE_LOGIN)
2325 AC_ARG_ENABLE(pututline,
2326 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2328 if test "x$enableval" = "xno" ; then
2329 AC_DEFINE(DISABLE_PUTUTLINE)
2333 AC_ARG_ENABLE(pututxline,
2334 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2336 if test "x$enableval" = "xno" ; then
2337 AC_DEFINE(DISABLE_PUTUTXLINE)
2341 AC_ARG_WITH(lastlog,
2342 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2344 if test "x$withval" = "xno" ; then
2345 AC_DEFINE(DISABLE_LASTLOG)
2347 conf_lastlog_location=$withval
2352 dnl lastlog, [uw]tmpx? detection
2353 dnl NOTE: set the paths in the platform section to avoid the
2354 dnl need for command-line parameters
2355 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2357 dnl lastlog detection
2358 dnl NOTE: the code itself will detect if lastlog is a directory
2359 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2361 #include <sys/types.h>
2363 #ifdef HAVE_LASTLOG_H
2364 # include <lastlog.h>
2373 [ char *lastlog = LASTLOG_FILE; ],
2374 [ AC_MSG_RESULT(yes) ],
2377 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2379 #include <sys/types.h>
2381 #ifdef HAVE_LASTLOG_H
2382 # include <lastlog.h>
2388 [ char *lastlog = _PATH_LASTLOG; ],
2389 [ AC_MSG_RESULT(yes) ],
2392 system_lastlog_path=no
2397 if test -z "$conf_lastlog_location"; then
2398 if test x"$system_lastlog_path" = x"no" ; then
2399 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2400 if (test -d "$f" || test -f "$f") ; then
2401 conf_lastlog_location=$f
2404 if test -z "$conf_lastlog_location"; then
2405 AC_MSG_WARN([** Cannot find lastlog **])
2406 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2411 if test -n "$conf_lastlog_location"; then
2412 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2416 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2418 #include <sys/types.h>
2424 [ char *utmp = UTMP_FILE; ],
2425 [ AC_MSG_RESULT(yes) ],
2427 system_utmp_path=no ]
2429 if test -z "$conf_utmp_location"; then
2430 if test x"$system_utmp_path" = x"no" ; then
2431 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2432 if test -f $f ; then
2433 conf_utmp_location=$f
2436 if test -z "$conf_utmp_location"; then
2437 AC_DEFINE(DISABLE_UTMP)
2441 if test -n "$conf_utmp_location"; then
2442 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2446 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2448 #include <sys/types.h>
2454 [ char *wtmp = WTMP_FILE; ],
2455 [ AC_MSG_RESULT(yes) ],
2457 system_wtmp_path=no ]
2459 if test -z "$conf_wtmp_location"; then
2460 if test x"$system_wtmp_path" = x"no" ; then
2461 for f in /usr/adm/wtmp /var/log/wtmp; do
2462 if test -f $f ; then
2463 conf_wtmp_location=$f
2466 if test -z "$conf_wtmp_location"; then
2467 AC_DEFINE(DISABLE_WTMP)
2471 if test -n "$conf_wtmp_location"; then
2472 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2476 dnl utmpx detection - I don't know any system so perverse as to require
2477 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2479 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2481 #include <sys/types.h>
2490 [ char *utmpx = UTMPX_FILE; ],
2491 [ AC_MSG_RESULT(yes) ],
2493 system_utmpx_path=no ]
2495 if test -z "$conf_utmpx_location"; then
2496 if test x"$system_utmpx_path" = x"no" ; then
2497 AC_DEFINE(DISABLE_UTMPX)
2500 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2504 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2506 #include <sys/types.h>
2515 [ char *wtmpx = WTMPX_FILE; ],
2516 [ AC_MSG_RESULT(yes) ],
2518 system_wtmpx_path=no ]
2520 if test -z "$conf_wtmpx_location"; then
2521 if test x"$system_wtmpx_path" = x"no" ; then
2522 AC_DEFINE(DISABLE_WTMPX)
2525 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2529 if test ! -z "$blibpath" ; then
2530 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2531 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2534 dnl remove pam and dl because they are in $LIBPAM
2535 if test "$PAM_MSG" = yes ; then
2536 LIBS=`echo $LIBS | sed 's/-lpam //'`
2538 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2539 LIBS=`echo $LIBS | sed 's/-ldl //'`
2543 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2546 # Print summary of options
2548 # Someone please show me a better way :)
2549 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2550 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2551 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2552 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2553 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2554 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2555 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2556 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2557 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2558 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2561 echo "OpenSSH has been configured with the following options:"
2562 echo " User binaries: $B"
2563 echo " System binaries: $C"
2564 echo " Configuration files: $D"
2565 echo " Askpass program: $E"
2566 echo " Manual pages: $F"
2567 echo " PID file: $G"
2568 echo " Privilege separation chroot path: $H"
2569 if test "$USES_LOGIN_CONF" = "yes" ; then
2570 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2572 echo " sshd default user PATH: $I"
2574 if test ! -z "$superuser_path" ; then
2575 echo " sshd superuser user PATH: $J"
2577 echo " Manpage format: $MANTYPE"
2578 echo " DNS support: $DNS_MSG"
2579 echo " PAM support: $PAM_MSG"
2580 echo " KerberosV support: $KRB5_MSG"
2581 echo " Smartcard support: $SCARD_MSG"
2582 echo " S/KEY support: $SKEY_MSG"
2583 echo " TCP Wrappers support: $TCPW_MSG"
2584 echo " MD5 password support: $MD5_MSG"
2585 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2586 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2587 echo " BSD Auth support: $BSD_AUTH_MSG"
2588 echo " Random number source: $RAND_MSG"
2589 if test ! -z "$USE_RAND_HELPER" ; then
2590 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2595 echo " Host: ${host}"
2596 echo " Compiler: ${CC}"
2597 echo " Compiler flags: ${CFLAGS}"
2598 echo "Preprocessor flags: ${CPPFLAGS}"
2599 echo " Linker flags: ${LDFLAGS}"
2600 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2604 if test "x$PAM_MSG" = "xyes" ; then
2605 echo "PAM is enabled. You may need to install a PAM control file "
2606 echo "for sshd, otherwise password authentication may fail. "
2607 echo "Example PAM control files can be found in the contrib/ "
2612 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2613 echo "WARNING: you are using the builtin random number collection "
2614 echo "service. Please read WARNING.RNG and request that your OS "
2615 echo "vendor includes kernel-based random number collection in "
2616 echo "future versions of your OS."