4 AC_CONFIG_SRCDIR([ssh.c])
6 AC_CONFIG_HEADER(config.h)
11 # Checks for programs.
17 AC_PATH_PROGS(PERL, perl5 perl)
18 AC_PATH_PROG(SED, sed)
20 AC_PATH_PROG(ENT, ent)
22 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
23 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
24 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
30 if test -z "$AR" ; then
31 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
34 # Use LOGIN_PROGRAM from environment if possible
35 if test ! -z "$LOGIN_PROGRAM" ; then
36 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
39 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
40 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
41 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
45 if test -z "$LD" ; then
51 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
52 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
55 # 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 AC_DEFINE(SETEUID_BREAKS_SETUID)
102 AC_DEFINE(BROKEN_SETREUID)
103 AC_DEFINE(BROKEN_SETREGID)
104 dnl AIX handles lastlog as part of its login message
105 AC_DEFINE(DISABLE_LASTLOG)
106 AC_DEFINE(LOGIN_NEEDS_UTMPX)
107 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
110 check_for_libcrypt_later=1
111 LIBS="$LIBS /usr/lib/textmode.o"
112 AC_DEFINE(HAVE_CYGWIN)
114 AC_DEFINE(DISABLE_SHADOW)
115 AC_DEFINE(IP_TOS_IS_BROKEN)
116 AC_DEFINE(NO_X11_UNIX_SOCKETS)
117 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
118 AC_DEFINE(DISABLE_FD_PASSING)
119 AC_DEFINE(SETGROUPS_NOOP)
122 AC_DEFINE(IP_TOS_IS_BROKEN)
125 AC_MSG_CHECKING(if we have working getaddrinfo)
126 AC_TRY_RUN([#include <mach-o/dyld.h>
127 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
131 }], [AC_MSG_RESULT(working)],
132 [AC_MSG_RESULT(buggy)
133 AC_DEFINE(BROKEN_GETADDRINFO)],
134 [AC_MSG_RESULT(assume it is working)])
137 if test -z "$GCC"; then
140 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
141 IPADDR_IN_DISPLAY=yes
142 AC_DEFINE(HAVE_SECUREWARE)
144 AC_DEFINE(LOGIN_NO_ENDOPT)
145 AC_DEFINE(LOGIN_NEEDS_UTMPX)
146 AC_DEFINE(DISABLE_SHADOW)
147 AC_DEFINE(DISABLE_UTMP)
148 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
149 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
150 LIBS="$LIBS -lsec -lsecpw"
151 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
152 disable_ptmx_check=yes
155 if test -z "$GCC"; then
158 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
159 IPADDR_IN_DISPLAY=yes
161 AC_DEFINE(LOGIN_NO_ENDOPT)
162 AC_DEFINE(LOGIN_NEEDS_UTMPX)
163 AC_DEFINE(DISABLE_SHADOW)
164 AC_DEFINE(DISABLE_UTMP)
165 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
166 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
168 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
171 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
172 IPADDR_IN_DISPLAY=yes
173 AC_DEFINE(PAM_SUN_CODEBASE)
175 AC_DEFINE(LOGIN_NO_ENDOPT)
176 AC_DEFINE(LOGIN_NEEDS_UTMPX)
177 AC_DEFINE(DISABLE_SHADOW)
178 AC_DEFINE(DISABLE_UTMP)
179 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
180 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
182 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
185 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
187 PATH="$PATH:/usr/etc"
188 AC_DEFINE(BROKEN_INET_NTOA)
189 AC_DEFINE(WITH_ABBREV_NO_TTY)
190 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
193 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
195 PATH="$PATH:/usr/etc"
196 AC_DEFINE(WITH_IRIX_ARRAY)
197 AC_DEFINE(WITH_IRIX_PROJECT)
198 AC_DEFINE(WITH_IRIX_AUDIT)
199 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
200 AC_DEFINE(BROKEN_INET_NTOA)
201 AC_DEFINE(WITH_ABBREV_NO_TTY)
202 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
206 check_for_libcrypt_later=1
207 check_for_openpty_ctty_bug=1
208 AC_DEFINE(DONT_TRY_OTHER_AF)
209 AC_DEFINE(PAM_TTY_KLUDGE)
210 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
211 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
212 inet6_default_4in6=yes
215 AC_DEFINE(BROKEN_CMSG_TYPE)
219 mips-sony-bsd|mips-sony-newsos4)
220 AC_DEFINE(HAVE_NEWS4)
224 check_for_libcrypt_before=1
228 check_for_libcrypt_later=1
231 conf_lastlog_location="/usr/adm/lastlog"
232 conf_utmp_location=/etc/utmp
233 conf_wtmp_location=/usr/adm/wtmp
236 AC_DEFINE(BROKEN_REALPATH)
238 AC_DEFINE(BROKEN_SAVED_UIDS)
239 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
243 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
244 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
246 AC_DEFINE(PAM_SUN_CODEBASE)
247 AC_DEFINE(LOGIN_NEEDS_UTMPX)
248 AC_DEFINE(LOGIN_NEEDS_TERM)
249 AC_DEFINE(PAM_TTY_KLUDGE)
250 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
251 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
252 AC_DEFINE(SSHD_ACQUIRES_CTTY)
253 # hardwire lastlog location (can't detect it on some versions)
254 conf_lastlog_location="/var/adm/lastlog"
255 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
256 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
257 if test "$sol2ver" -ge 8; then
259 AC_DEFINE(DISABLE_UTMP)
260 AC_DEFINE(DISABLE_WTMP)
266 CPPFLAGS="$CPPFLAGS -DSUNOS4"
267 AC_CHECK_FUNCS(getpwanam)
268 AC_DEFINE(PAM_SUN_CODEBASE)
269 conf_utmp_location=/etc/utmp
270 conf_wtmp_location=/var/adm/wtmp
271 conf_lastlog_location=/var/adm/lastlog
275 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
276 LDFLAGS="$LDFLAGS -L/usr/local/lib"
279 AC_DEFINE(SSHD_ACQUIRES_CTTY)
282 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
283 # /usr/ucblib MUST NOT be searched on ReliantUNIX
284 LDFLAGS="$LDFLAGS -L/usr/local/lib"
285 IPADDR_IN_DISPLAY=yes
287 AC_DEFINE(IP_TOS_IS_BROKEN)
288 AC_DEFINE(SSHD_ACQUIRES_CTTY)
289 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
290 # Attention: always take care to bind libsocket and libnsl before libc,
291 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
294 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
295 LDFLAGS="$LDFLAGS -L/usr/local/lib"
299 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
300 LDFLAGS="$LDFLAGS -L/usr/local/lib"
304 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
305 LDFLAGS="$LDFLAGS -L/usr/local/lib"
308 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
309 LDFLAGS="$LDFLAGS -L/usr/local/lib"
310 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
313 AC_DEFINE(BROKEN_SYS_TERMIO_H)
315 AC_DEFINE(HAVE_SECUREWARE)
316 AC_DEFINE(DISABLE_SHADOW)
317 AC_DEFINE(BROKEN_SAVED_UIDS)
318 AC_CHECK_FUNCS(getluid setluid)
320 do_sco3_extra_lib_check=yes
323 if test -z "$GCC"; then
324 CFLAGS="$CFLAGS -belf"
326 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
327 LDFLAGS="$LDFLAGS -L/usr/local/lib"
328 LIBS="$LIBS -lprot -lx -ltinfo -lm"
331 AC_DEFINE(HAVE_SECUREWARE)
332 AC_DEFINE(DISABLE_SHADOW)
333 AC_DEFINE(DISABLE_FD_PASSING)
334 AC_CHECK_FUNCS(getluid setluid)
339 AC_DEFINE(DISABLE_FD_PASSING)
341 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
345 AC_DEFINE(WITH_ABBREV_NO_TTY)
347 AC_DEFINE(DISABLE_FD_PASSING)
349 LIBS="$LIBS -lgen -lacid"
354 AC_DEFINE(DISABLE_FD_PASSING)
355 AC_DEFINE(NO_SSH_LASTLOG)
356 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
357 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
361 AC_MSG_CHECKING(for Digital Unix SIA)
364 [ --with-osfsia Enable Digital Unix SIA],
366 if test "x$withval" = "xno" ; then
367 AC_MSG_RESULT(disabled)
372 if test -z "$no_osfsia" ; then
373 if test -f /etc/sia/matrix.conf; then
375 AC_DEFINE(HAVE_OSF_SIA)
376 AC_DEFINE(DISABLE_LOGIN)
377 AC_DEFINE(DISABLE_FD_PASSING)
378 LIBS="$LIBS -lsecurity -ldb -lm -laud"
383 AC_DEFINE(DISABLE_FD_PASSING)
384 AC_DEFINE(BROKEN_GETADDRINFO)
385 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
390 AC_DEFINE(NO_X11_UNIX_SOCKETS)
391 AC_DEFINE(MISSING_NFDBITS)
392 AC_DEFINE(MISSING_HOWMANY)
393 AC_DEFINE(MISSING_FD_MASK)
397 # Allow user to specify flags
399 [ --with-cflags Specify additional flags to pass to compiler],
401 if test "x$withval" != "xno" ; then
402 CFLAGS="$CFLAGS $withval"
406 AC_ARG_WITH(cppflags,
407 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
409 if test "x$withval" != "xno"; then
410 CPPFLAGS="$CPPFLAGS $withval"
415 [ --with-ldflags Specify additional flags to pass to linker],
417 if test "x$withval" != "xno" ; then
418 LDFLAGS="$LDFLAGS $withval"
423 [ --with-libs Specify additional libraries to link with],
425 if test "x$withval" != "xno" ; then
426 LIBS="$LIBS $withval"
431 AC_MSG_CHECKING(compiler and flags for sanity)
436 [ AC_MSG_RESULT(yes) ],
439 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
443 # Checks for header files.
444 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
445 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
446 login_cap.h maillock.h netdb.h netgroup.h \
447 netinet/in_systm.h paths.h pty.h readpassphrase.h \
448 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
449 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
450 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
451 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
452 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
453 util.h utime.h utmp.h utmpx.h)
455 # Checks for libraries.
456 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
457 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
459 dnl SCO OS3 needs this for libwrap
460 if test "x$with_tcp_wrappers" != "xno" ; then
461 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
462 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
466 AC_CHECK_FUNC(getspnam, ,
467 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
470 [ --without-rpath Disable auto-added -R linker paths],
472 if test "x$withval" = "xno" ; then
475 if test "x$withval" = "xyes" ; then
483 [ --with-zlib=PATH Use zlib in PATH],
485 if test "x$withval" = "xno" ; then
486 AC_MSG_ERROR([*** zlib is required ***])
488 if test -d "$withval/lib"; then
489 if test -n "${need_dash_r}"; then
490 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
492 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
495 if test -n "${need_dash_r}"; then
496 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
498 LDFLAGS="-L${withval} ${LDFLAGS}"
501 if test -d "$withval/include"; then
502 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
504 CPPFLAGS="-I${withval} ${CPPFLAGS}"
509 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
512 AC_CHECK_FUNC(strcasecmp,
513 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
515 AC_CHECK_FUNC(utimes,
516 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
517 LIBS="$LIBS -lc89"]) ]
520 dnl Checks for libutil functions
521 AC_CHECK_HEADERS(libutil.h)
522 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
523 AC_CHECK_FUNCS(logout updwtmp logwtmp)
527 # Check for ALTDIRFUNC glob() extension
528 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
529 AC_EGREP_CPP(FOUNDIT,
532 #ifdef GLOB_ALTDIRFUNC
537 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
545 # Check for g.gl_matchc glob() extension
546 AC_MSG_CHECKING(for gl_matchc field in glob_t)
547 AC_EGREP_CPP(FOUNDIT,
550 int main(void){glob_t g; g.gl_matchc = 1;}
553 AC_DEFINE(GLOB_HAS_GL_MATCHC)
561 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
564 #include <sys/types.h>
566 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
568 [AC_MSG_RESULT(yes)],
571 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
575 # Check whether user wants S/Key support
578 [ --with-skey[[=PATH]] Enable S/Key support
579 (optionally in PATH)],
581 if test "x$withval" != "xno" ; then
583 if test "x$withval" != "xyes" ; then
584 CPPFLAGS="$CPPFLAGS -I${withval}/include"
585 LDFLAGS="$LDFLAGS -L${withval}/lib"
592 AC_MSG_CHECKING([for s/key support])
597 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
599 [AC_MSG_RESULT(yes)],
602 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
608 # Check whether user wants TCP wrappers support
610 AC_ARG_WITH(tcp-wrappers,
611 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
612 (optionally in PATH)],
614 if test "x$withval" != "xno" ; then
616 saved_LDFLAGS="$LDFLAGS"
617 saved_CPPFLAGS="$CPPFLAGS"
618 if test -n "${withval}" -a "${withval}" != "yes"; then
619 if test -d "${withval}/lib"; then
620 if test -n "${need_dash_r}"; then
621 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
623 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
626 if test -n "${need_dash_r}"; then
627 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
629 LDFLAGS="-L${withval} ${LDFLAGS}"
632 if test -d "${withval}/include"; then
633 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
635 CPPFLAGS="-I${withval} ${CPPFLAGS}"
639 LIBS="$LIBWRAP $LIBS"
640 AC_MSG_CHECKING(for libwrap)
644 int deny_severity = 0, allow_severity = 0;
654 AC_MSG_ERROR([*** libwrap missing])
662 dnl Checks for library functions. Please keep in alphabetical order
664 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
665 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
666 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
667 getpeereid _getpty getrlimit getttyent glob inet_aton \
668 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
669 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
670 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
671 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
672 setproctitle setregid setresgid setresuid setreuid setrlimit \
673 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
674 strlcat strlcpy strmode strnvis sysconf tcgetpgrp tcsendbreak \
675 truncate utimes vhangup vsnprintf waitpid \
678 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
679 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
681 dnl Make sure prototypes are defined for these before using them.
682 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
683 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
685 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
686 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
687 AC_CHECK_LIB(gen, dirname,[
688 AC_CACHE_CHECK([for broken dirname],
689 ac_cv_have_broken_dirname, [
697 int main(int argc, char **argv) {
700 strncpy(buf,"/etc", 32);
702 if (!s || strncmp(s, "/", 32) != 0) {
709 [ ac_cv_have_broken_dirname="no" ],
710 [ ac_cv_have_broken_dirname="yes" ]
714 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
716 AC_DEFINE(HAVE_DIRNAME)
717 AC_CHECK_HEADERS(libgen.h)
722 dnl Checks for time functions
723 AC_CHECK_FUNCS(gettimeofday time)
724 dnl Checks for utmp functions
725 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
726 AC_CHECK_FUNCS(utmpname)
727 dnl Checks for utmpx functions
728 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
729 AC_CHECK_FUNCS(setutxent utmpxname)
731 AC_CHECK_FUNC(daemon,
732 [AC_DEFINE(HAVE_DAEMON)],
733 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
736 AC_CHECK_FUNC(getpagesize,
737 [AC_DEFINE(HAVE_GETPAGESIZE)],
738 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
741 # Check for broken snprintf
742 if test "x$ac_cv_func_snprintf" = "xyes" ; then
743 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
747 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
749 [AC_MSG_RESULT(yes)],
752 AC_DEFINE(BROKEN_SNPRINTF)
753 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
758 dnl see whether mkstemp() requires XXXXXX
759 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
760 AC_MSG_CHECKING([for (overly) strict mkstemp])
764 main() { char template[]="conftest.mkstemp-test";
765 if (mkstemp(template) == -1)
767 unlink(template); exit(0);
775 AC_DEFINE(HAVE_STRICT_MKSTEMP)
779 AC_DEFINE(HAVE_STRICT_MKSTEMP)
784 dnl make sure that openpty does not reacquire controlling terminal
785 if test ! -z "$check_for_openpty_ctty_bug"; then
786 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
790 #include <sys/fcntl.h>
791 #include <sys/types.h>
792 #include <sys/wait.h>
798 int fd, ptyfd, ttyfd, status;
801 if (pid < 0) { /* failed */
803 } else if (pid > 0) { /* parent */
804 waitpid(pid, &status, 0);
805 if (WIFEXITED(status))
806 exit(WEXITSTATUS(status));
810 close(0); close(1); close(2);
812 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
813 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
815 exit(3); /* Acquired ctty: broken */
817 exit(0); /* Did not acquire ctty: OK */
826 AC_DEFINE(SSHD_ACQUIRES_CTTY)
836 [ --with-pam Enable PAM support ],
838 if test "x$withval" != "xno" ; then
839 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
840 AC_MSG_ERROR([PAM headers not found])
843 AC_CHECK_LIB(dl, dlopen, , )
844 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
845 AC_CHECK_FUNCS(pam_getenvlist)
846 AC_CHECK_FUNCS(pam_putenv)
852 if test $ac_cv_lib_dl_dlopen = yes; then
862 # Check for older PAM
863 if test "x$PAM_MSG" = "xyes" ; then
864 # Check PAM strerror arguments (old PAM)
865 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
869 #include <security/pam_appl.h>
871 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
874 AC_DEFINE(HAVE_OLD_PAM)
876 PAM_MSG="yes (old library)"
881 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
882 # because the system crypt() is more featureful.
883 if test "x$check_for_libcrypt_before" = "x1"; then
884 AC_CHECK_LIB(crypt, crypt)
888 saved_CPPFLAGS="$CPPFLAGS"
889 saved_LDFLAGS="$LDFLAGS"
891 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
893 if test "x$withval" != "xno" ; then
894 if test -d "$withval/lib"; then
895 if test -n "${need_dash_r}"; then
896 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
898 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
901 if test -n "${need_dash_r}"; then
902 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
904 LDFLAGS="-L${withval} ${LDFLAGS}"
907 if test -d "$withval/include"; then
908 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
910 CPPFLAGS="-I${withval} ${CPPFLAGS}"
915 LIBS="$LIBS -lcrypto"
916 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
918 dnl Check default openssl install dir
919 if test -n "${need_dash_r}"; then
920 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
922 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
924 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
925 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
927 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
933 # Determine OpenSSL header version
934 AC_MSG_CHECKING([OpenSSL header version])
939 #include <openssl/opensslv.h>
940 #define DATA "conftest.sslincver"
945 fd = fopen(DATA,"w");
949 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
956 ssl_header_ver=`cat conftest.sslincver`
957 AC_MSG_RESULT($ssl_header_ver)
960 AC_MSG_RESULT(not found)
961 AC_MSG_ERROR(OpenSSL version header not found.)
965 # Determine OpenSSL library version
966 AC_MSG_CHECKING([OpenSSL library version])
971 #include <openssl/opensslv.h>
972 #include <openssl/crypto.h>
973 #define DATA "conftest.ssllibver"
978 fd = fopen(DATA,"w");
982 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
989 ssl_library_ver=`cat conftest.ssllibver`
990 AC_MSG_RESULT($ssl_library_ver)
993 AC_MSG_RESULT(not found)
994 AC_MSG_ERROR(OpenSSL library not found.)
998 # Sanity check OpenSSL headers
999 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1003 #include <openssl/opensslv.h>
1004 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1011 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1012 Check config.log for details.
1013 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1017 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1018 # version in OpenSSL. Skip this for PAM
1019 if test "x$check_for_libcrypt_later" = "x1"; then
1020 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1024 ### Configure cryptographic random number support
1026 # Check wheter OpenSSL seeds itself
1027 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1031 #include <openssl/rand.h>
1032 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1035 OPENSSL_SEEDS_ITSELF=yes
1040 # Default to use of the rand helper if OpenSSL doesn't
1047 # Do we want to force the use of the rand helper?
1048 AC_ARG_WITH(rand-helper,
1049 [ --with-rand-helper Use subprocess to gather strong randomness ],
1051 if test "x$withval" = "xno" ; then
1052 # Force use of OpenSSL's internal RNG, even if
1053 # the previous test showed it to be unseeded.
1054 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1055 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1056 OPENSSL_SEEDS_ITSELF=yes
1065 # Which randomness source do we use?
1066 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1068 AC_DEFINE(OPENSSL_PRNG_ONLY)
1069 RAND_MSG="OpenSSL internal ONLY"
1070 INSTALL_SSH_RAND_HELPER=""
1071 elif test ! -z "$USE_RAND_HELPER" ; then
1072 # install rand helper
1073 RAND_MSG="ssh-rand-helper"
1074 INSTALL_SSH_RAND_HELPER="yes"
1076 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1078 ### Configuration of ssh-rand-helper
1081 AC_ARG_WITH(prngd-port,
1082 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1091 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1094 if test ! -z "$withval" ; then
1095 PRNGD_PORT="$withval"
1096 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1101 # PRNGD Unix domain socket
1102 AC_ARG_WITH(prngd-socket,
1103 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1107 withval="/var/run/egd-pool"
1115 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1119 if test ! -z "$withval" ; then
1120 if test ! -z "$PRNGD_PORT" ; then
1121 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1123 if test ! -r "$withval" ; then
1124 AC_MSG_WARN(Entropy socket is not readable)
1126 PRNGD_SOCKET="$withval"
1127 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1131 # Check for existing socket only if we don't have a random device already
1132 if test "$USE_RAND_HELPER" = yes ; then
1133 AC_MSG_CHECKING(for PRNGD/EGD socket)
1134 # Insert other locations here
1135 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1136 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1137 PRNGD_SOCKET="$sock"
1138 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1142 if test ! -z "$PRNGD_SOCKET" ; then
1143 AC_MSG_RESULT($PRNGD_SOCKET)
1145 AC_MSG_RESULT(not found)
1151 # Change default command timeout for hashing entropy source
1153 AC_ARG_WITH(entropy-timeout,
1154 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1156 if test "x$withval" != "xno" ; then
1157 entropy_timeout=$withval
1161 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1163 SSH_PRIVSEP_USER=sshd
1164 AC_ARG_WITH(privsep-user,
1165 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1167 if test -n "$withval"; then
1168 SSH_PRIVSEP_USER=$withval
1172 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1173 AC_SUBST(SSH_PRIVSEP_USER)
1175 # We do this little dance with the search path to insure
1176 # that programs that we select for use by installed programs
1177 # (which may be run by the super-user) come from trusted
1178 # locations before they come from the user's private area.
1179 # This should help avoid accidentally configuring some
1180 # random version of a program in someone's personal bin.
1184 test -h /bin 2> /dev/null && PATH=/usr/bin
1185 test -d /sbin && PATH=$PATH:/sbin
1186 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1187 PATH=$PATH:/etc:$OPATH
1189 # These programs are used by the command hashing source to gather entropy
1190 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1191 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1192 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1193 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1194 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1195 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1196 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1197 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1198 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1199 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1200 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1201 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1202 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1203 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1204 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1205 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1209 # Where does ssh-rand-helper get its randomness from?
1210 INSTALL_SSH_PRNG_CMDS=""
1211 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1212 if test ! -z "$PRNGD_PORT" ; then
1213 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1214 elif test ! -z "$PRNGD_SOCKET" ; then
1215 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1217 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1218 RAND_HELPER_CMDHASH=yes
1219 INSTALL_SSH_PRNG_CMDS="yes"
1222 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1225 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1226 if test ! -z "$SONY" ; then
1227 LIBS="$LIBS -liberty";
1230 # Checks for data types
1231 AC_CHECK_SIZEOF(char, 1)
1232 AC_CHECK_SIZEOF(short int, 2)
1233 AC_CHECK_SIZEOF(int, 4)
1234 AC_CHECK_SIZEOF(long int, 4)
1235 AC_CHECK_SIZEOF(long long int, 8)
1237 # Sanity check long long for some platforms (AIX)
1238 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1239 ac_cv_sizeof_long_long_int=0
1242 # More checks for data types
1243 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1245 [ #include <sys/types.h> ],
1247 [ ac_cv_have_u_int="yes" ],
1248 [ ac_cv_have_u_int="no" ]
1251 if test "x$ac_cv_have_u_int" = "xyes" ; then
1252 AC_DEFINE(HAVE_U_INT)
1256 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1258 [ #include <sys/types.h> ],
1259 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1260 [ ac_cv_have_intxx_t="yes" ],
1261 [ ac_cv_have_intxx_t="no" ]
1264 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1265 AC_DEFINE(HAVE_INTXX_T)
1269 if (test -z "$have_intxx_t" && \
1270 test "x$ac_cv_header_stdint_h" = "xyes")
1272 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1274 [ #include <stdint.h> ],
1275 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1277 AC_DEFINE(HAVE_INTXX_T)
1280 [ AC_MSG_RESULT(no) ]
1284 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1287 #include <sys/types.h>
1288 #ifdef HAVE_STDINT_H
1289 # include <stdint.h>
1291 #include <sys/socket.h>
1292 #ifdef HAVE_SYS_BITYPES_H
1293 # include <sys/bitypes.h>
1296 [ int64_t a; a = 1;],
1297 [ ac_cv_have_int64_t="yes" ],
1298 [ ac_cv_have_int64_t="no" ]
1301 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1302 AC_DEFINE(HAVE_INT64_T)
1305 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1307 [ #include <sys/types.h> ],
1308 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1309 [ ac_cv_have_u_intxx_t="yes" ],
1310 [ ac_cv_have_u_intxx_t="no" ]
1313 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1314 AC_DEFINE(HAVE_U_INTXX_T)
1318 if test -z "$have_u_intxx_t" ; then
1319 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1321 [ #include <sys/socket.h> ],
1322 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1324 AC_DEFINE(HAVE_U_INTXX_T)
1327 [ AC_MSG_RESULT(no) ]
1331 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1333 [ #include <sys/types.h> ],
1334 [ u_int64_t a; a = 1;],
1335 [ ac_cv_have_u_int64_t="yes" ],
1336 [ ac_cv_have_u_int64_t="no" ]
1339 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1340 AC_DEFINE(HAVE_U_INT64_T)
1344 if test -z "$have_u_int64_t" ; then
1345 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1347 [ #include <sys/bitypes.h> ],
1348 [ u_int64_t a; a = 1],
1350 AC_DEFINE(HAVE_U_INT64_T)
1353 [ AC_MSG_RESULT(no) ]
1357 if test -z "$have_u_intxx_t" ; then
1358 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1361 #include <sys/types.h>
1363 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1364 [ ac_cv_have_uintxx_t="yes" ],
1365 [ ac_cv_have_uintxx_t="no" ]
1368 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1369 AC_DEFINE(HAVE_UINTXX_T)
1373 if test -z "$have_uintxx_t" ; then
1374 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1376 [ #include <stdint.h> ],
1377 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1379 AC_DEFINE(HAVE_UINTXX_T)
1382 [ AC_MSG_RESULT(no) ]
1386 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1387 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1389 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1392 #include <sys/bitypes.h>
1395 int8_t a; int16_t b; int32_t c;
1396 u_int8_t e; u_int16_t f; u_int32_t g;
1397 a = b = c = e = f = g = 1;
1400 AC_DEFINE(HAVE_U_INTXX_T)
1401 AC_DEFINE(HAVE_INTXX_T)
1409 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1412 #include <sys/types.h>
1414 [ u_char foo; foo = 125; ],
1415 [ ac_cv_have_u_char="yes" ],
1416 [ ac_cv_have_u_char="no" ]
1419 if test "x$ac_cv_have_u_char" = "xyes" ; then
1420 AC_DEFINE(HAVE_U_CHAR)
1425 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1427 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1430 #include <sys/types.h>
1432 [ size_t foo; foo = 1235; ],
1433 [ ac_cv_have_size_t="yes" ],
1434 [ ac_cv_have_size_t="no" ]
1437 if test "x$ac_cv_have_size_t" = "xyes" ; then
1438 AC_DEFINE(HAVE_SIZE_T)
1441 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1444 #include <sys/types.h>
1446 [ ssize_t foo; foo = 1235; ],
1447 [ ac_cv_have_ssize_t="yes" ],
1448 [ ac_cv_have_ssize_t="no" ]
1451 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1452 AC_DEFINE(HAVE_SSIZE_T)
1455 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1460 [ clock_t foo; foo = 1235; ],
1461 [ ac_cv_have_clock_t="yes" ],
1462 [ ac_cv_have_clock_t="no" ]
1465 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1466 AC_DEFINE(HAVE_CLOCK_T)
1469 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1472 #include <sys/types.h>
1473 #include <sys/socket.h>
1475 [ sa_family_t foo; foo = 1235; ],
1476 [ ac_cv_have_sa_family_t="yes" ],
1479 #include <sys/types.h>
1480 #include <sys/socket.h>
1481 #include <netinet/in.h>
1483 [ sa_family_t foo; foo = 1235; ],
1484 [ ac_cv_have_sa_family_t="yes" ],
1486 [ ac_cv_have_sa_family_t="no" ]
1490 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1491 AC_DEFINE(HAVE_SA_FAMILY_T)
1494 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1497 #include <sys/types.h>
1499 [ pid_t foo; foo = 1235; ],
1500 [ ac_cv_have_pid_t="yes" ],
1501 [ ac_cv_have_pid_t="no" ]
1504 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1505 AC_DEFINE(HAVE_PID_T)
1508 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1511 #include <sys/types.h>
1513 [ mode_t foo; foo = 1235; ],
1514 [ ac_cv_have_mode_t="yes" ],
1515 [ ac_cv_have_mode_t="no" ]
1518 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1519 AC_DEFINE(HAVE_MODE_T)
1523 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1526 #include <sys/types.h>
1527 #include <sys/socket.h>
1529 [ struct sockaddr_storage s; ],
1530 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1531 [ ac_cv_have_struct_sockaddr_storage="no" ]
1534 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1535 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1538 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1541 #include <sys/types.h>
1542 #include <netinet/in.h>
1544 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1545 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1546 [ ac_cv_have_struct_sockaddr_in6="no" ]
1549 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1550 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1553 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1556 #include <sys/types.h>
1557 #include <netinet/in.h>
1559 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1560 [ ac_cv_have_struct_in6_addr="yes" ],
1561 [ ac_cv_have_struct_in6_addr="no" ]
1564 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1565 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1568 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1571 #include <sys/types.h>
1572 #include <sys/socket.h>
1575 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1576 [ ac_cv_have_struct_addrinfo="yes" ],
1577 [ ac_cv_have_struct_addrinfo="no" ]
1580 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1581 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1584 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1586 [ #include <sys/time.h> ],
1587 [ struct timeval tv; tv.tv_sec = 1;],
1588 [ ac_cv_have_struct_timeval="yes" ],
1589 [ ac_cv_have_struct_timeval="no" ]
1592 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1593 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1594 have_struct_timeval=1
1597 AC_CHECK_TYPES(struct timespec)
1599 # We need int64_t or else certian parts of the compile will fail.
1600 if test "x$ac_cv_have_int64_t" = "xno" -a \
1601 "x$ac_cv_sizeof_long_int" != "x8" -a \
1602 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1603 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1604 echo "an alternative compiler (I.E., GCC) before continuing."
1608 dnl test snprintf (broken on SCO w/gcc)
1613 #ifdef HAVE_SNPRINTF
1617 char expected_out[50];
1619 #if (SIZEOF_LONG_INT == 8)
1620 long int num = 0x7fffffffffffffff;
1622 long long num = 0x7fffffffffffffffll;
1624 strcpy(expected_out, "9223372036854775807");
1625 snprintf(buf, mazsize, "%lld", num);
1626 if(strcmp(buf, expected_out) != 0)
1633 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1637 dnl Checks for structure members
1638 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1639 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1640 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1641 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1642 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1643 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1644 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1645 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1646 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1647 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1648 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1649 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1650 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1651 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1652 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1653 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1654 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1656 AC_CHECK_MEMBERS([struct stat.st_blksize])
1658 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1659 ac_cv_have_ss_family_in_struct_ss, [
1662 #include <sys/types.h>
1663 #include <sys/socket.h>
1665 [ struct sockaddr_storage s; s.ss_family = 1; ],
1666 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1667 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1670 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1671 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1674 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1675 ac_cv_have___ss_family_in_struct_ss, [
1678 #include <sys/types.h>
1679 #include <sys/socket.h>
1681 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1682 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1683 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1686 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1687 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1690 AC_CACHE_CHECK([for pw_class field in struct passwd],
1691 ac_cv_have_pw_class_in_struct_passwd, [
1696 [ struct passwd p; p.pw_class = 0; ],
1697 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1698 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1701 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1702 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1705 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1706 ac_cv_have_pw_expire_in_struct_passwd, [
1711 [ struct passwd p; p.pw_expire = 0; ],
1712 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1713 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1716 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1717 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1720 AC_CACHE_CHECK([for pw_change field in struct passwd],
1721 ac_cv_have_pw_change_in_struct_passwd, [
1726 [ struct passwd p; p.pw_change = 0; ],
1727 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1728 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1731 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1732 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1735 dnl make sure we're using the real structure members and not defines
1736 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1737 ac_cv_have_accrights_in_msghdr, [
1740 #include <sys/types.h>
1741 #include <sys/socket.h>
1742 #include <sys/uio.h>
1744 #ifdef msg_accrights
1748 m.msg_accrights = 0;
1752 [ ac_cv_have_accrights_in_msghdr="yes" ],
1753 [ ac_cv_have_accrights_in_msghdr="no" ]
1756 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1757 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1760 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1761 ac_cv_have_control_in_msghdr, [
1764 #include <sys/types.h>
1765 #include <sys/socket.h>
1766 #include <sys/uio.h>
1776 [ ac_cv_have_control_in_msghdr="yes" ],
1777 [ ac_cv_have_control_in_msghdr="no" ]
1780 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1781 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1784 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1786 [ extern char *__progname; printf("%s", __progname); ],
1787 [ ac_cv_libc_defines___progname="yes" ],
1788 [ ac_cv_libc_defines___progname="no" ]
1791 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1792 AC_DEFINE(HAVE___PROGNAME)
1795 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1799 [ printf("%s", __FUNCTION__); ],
1800 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1801 [ ac_cv_cc_implements___FUNCTION__="no" ]
1804 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1805 AC_DEFINE(HAVE___FUNCTION__)
1808 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1812 [ printf("%s", __func__); ],
1813 [ ac_cv_cc_implements___func__="yes" ],
1814 [ ac_cv_cc_implements___func__="no" ]
1817 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1818 AC_DEFINE(HAVE___func__)
1821 AC_CACHE_CHECK([whether getopt has optreset support],
1822 ac_cv_have_getopt_optreset, [
1827 [ extern int optreset; optreset = 0; ],
1828 [ ac_cv_have_getopt_optreset="yes" ],
1829 [ ac_cv_have_getopt_optreset="no" ]
1832 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1833 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1836 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1838 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1839 [ ac_cv_libc_defines_sys_errlist="yes" ],
1840 [ ac_cv_libc_defines_sys_errlist="no" ]
1843 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1844 AC_DEFINE(HAVE_SYS_ERRLIST)
1848 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1850 [ extern int sys_nerr; printf("%i", sys_nerr);],
1851 [ ac_cv_libc_defines_sys_nerr="yes" ],
1852 [ ac_cv_libc_defines_sys_nerr="no" ]
1855 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1856 AC_DEFINE(HAVE_SYS_NERR)
1860 # Check whether user wants sectok support
1862 [ --with-sectok Enable smartcard support using libsectok],
1864 if test "x$withval" != "xno" ; then
1865 if test "x$withval" != "xyes" ; then
1866 CPPFLAGS="$CPPFLAGS -I${withval}"
1867 LDFLAGS="$LDFLAGS -L${withval}"
1868 if test ! -z "$need_dash_r" ; then
1869 LDFLAGS="$LDFLAGS -R${withval}"
1871 if test ! -z "$blibpath" ; then
1872 blibpath="$blibpath:${withval}"
1875 AC_CHECK_HEADERS(sectok.h)
1876 if test "$ac_cv_header_sectok_h" != yes; then
1877 AC_MSG_ERROR(Can't find sectok.h)
1879 AC_CHECK_LIB(sectok, sectok_open)
1880 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1881 AC_MSG_ERROR(Can't find libsectok)
1883 AC_DEFINE(SMARTCARD)
1884 AC_DEFINE(USE_SECTOK)
1885 SCARD_MSG="yes, using sectok"
1890 # Check whether user wants OpenSC support
1892 AC_HELP_STRING([--with-opensc=PFX],
1893 [Enable smartcard support using OpenSC]),
1894 opensc_config_prefix="$withval", opensc_config_prefix="")
1895 if test x$opensc_config_prefix != x ; then
1896 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1897 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1898 if test "$OPENSC_CONFIG" != "no"; then
1899 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1900 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1901 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1902 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1903 AC_DEFINE(SMARTCARD)
1904 AC_DEFINE(USE_OPENSC)
1905 SCARD_MSG="yes, using OpenSC"
1909 # Check whether user wants DNS support
1912 [ --with-dns Support for fetching keys from DNS (experimental)],
1914 if test "x$withval" != "xno" ; then
1917 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1918 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1920 # Needed by our getrrsetbyname()
1921 AC_SEARCH_LIBS(res_query, resolv)
1922 AC_SEARCH_LIBS(dn_expand, resolv)
1923 AC_CHECK_FUNCS(_getshort _getlong)
1924 AC_CHECK_MEMBER(HEADER.ad,
1925 [AC_DEFINE(HAVE_HEADER_AD)],,
1926 [#include <arpa/nameser.h>])
1932 # Check whether user wants Kerberos 5 support
1934 AC_ARG_WITH(kerberos5,
1935 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1937 if test "x$withval" != "xno" ; then
1938 if test "x$withval" = "xyes" ; then
1939 KRB5ROOT="/usr/local"
1943 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1944 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1947 AC_MSG_CHECKING(whether we are using Heimdal)
1948 AC_TRY_COMPILE([ #include <krb5.h> ],
1949 [ char *tmp = heimdal_version; ],
1950 [ AC_MSG_RESULT(yes)
1952 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1955 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1958 if test ! -z "$need_dash_r" ; then
1959 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1961 if test ! -z "$blibpath" ; then
1962 blibpath="$blibpath:${KRB5ROOT}/lib"
1964 AC_SEARCH_LIBS(dn_expand, resolv)
1966 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1968 K5LIBS="-lgssapi $K5LIBS" ],
1969 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1971 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
1972 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
1977 AC_CHECK_HEADER(gssapi.h, ,
1978 [ unset ac_cv_header_gssapi_h
1979 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1980 AC_CHECK_HEADERS(gssapi.h, ,
1981 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
1987 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1988 AC_CHECK_HEADER(gssapi_krb5.h, ,
1989 [ CPPFLAGS="$oldCPP" ])
1995 LIBS="$LIBS $K5LIBS"
1997 # Looking for programs, paths and files
1999 PRIVSEP_PATH=/var/empty
2000 AC_ARG_WITH(privsep-path,
2001 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2003 if test "x$withval" != "$no" ; then
2004 PRIVSEP_PATH=$withval
2008 AC_SUBST(PRIVSEP_PATH)
2011 [ --with-xauth=PATH Specify path to xauth program ],
2013 if test "x$withval" != "xno" ; then
2019 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2020 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2021 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2022 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2023 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2024 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2025 xauth_path="/usr/openwin/bin/xauth"
2031 AC_ARG_ENABLE(strip,
2032 [ --disable-strip Disable calling strip(1) on install],
2034 if test "x$enableval" = "xno" ; then
2041 if test -z "$xauth_path" ; then
2042 XAUTH_PATH="undefined"
2043 AC_SUBST(XAUTH_PATH)
2045 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2046 XAUTH_PATH=$xauth_path
2047 AC_SUBST(XAUTH_PATH)
2050 # Check for mail directory (last resort if we cannot get it from headers)
2051 if test ! -z "$MAIL" ; then
2052 maildir=`dirname $MAIL`
2053 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2056 if test -z "$no_dev_ptmx" ; then
2057 if test "x$disable_ptmx_check" != "xyes" ; then
2058 AC_CHECK_FILE("/dev/ptmx",
2060 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2066 AC_CHECK_FILE("/dev/ptc",
2068 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2073 # Options from here on. Some of these are preset by platform above
2074 AC_ARG_WITH(mantype,
2075 [ --with-mantype=man|cat|doc Set man page type],
2082 AC_MSG_ERROR(invalid man type: $withval)
2087 if test -z "$MANTYPE"; then
2088 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2089 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2090 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2092 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2099 if test "$MANTYPE" = "doc"; then
2106 # Check whether to enable MD5 passwords
2108 AC_ARG_WITH(md5-passwords,
2109 [ --with-md5-passwords Enable use of MD5 passwords],
2111 if test "x$withval" != "xno" ; then
2112 AC_DEFINE(HAVE_MD5_PASSWORDS)
2118 # Whether to disable shadow password support
2120 [ --without-shadow Disable shadow password support],
2122 if test "x$withval" = "xno" ; then
2123 AC_DEFINE(DISABLE_SHADOW)
2129 if test -z "$disable_shadow" ; then
2130 AC_MSG_CHECKING([if the systems has expire shadow information])
2133 #include <sys/types.h>
2136 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2137 [ sp_expire_available=yes ], []
2140 if test "x$sp_expire_available" = "xyes" ; then
2142 AC_DEFINE(HAS_SHADOW_EXPIRE)
2148 # Use ip address instead of hostname in $DISPLAY
2149 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2150 DISPLAY_HACK_MSG="yes"
2151 AC_DEFINE(IPADDR_IN_DISPLAY)
2153 DISPLAY_HACK_MSG="no"
2154 AC_ARG_WITH(ipaddr-display,
2155 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2157 if test "x$withval" != "xno" ; then
2158 AC_DEFINE(IPADDR_IN_DISPLAY)
2159 DISPLAY_HACK_MSG="yes"
2165 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2166 if test $ac_cv_func_login_getcapbool = "yes" -a \
2167 $ac_cv_header_login_cap_h = "yes" ; then
2170 # Whether to mess with the default path
2171 SERVER_PATH_MSG="(default)"
2172 AC_ARG_WITH(default-path,
2173 [ --with-default-path= Specify default \$PATH environment for server],
2175 if test "$USES_LOGIN_CONF" = "yes" ; then
2177 --with-default-path=PATH has no effect on this system.
2178 Edit /etc/login.conf instead.])
2179 elif test "x$withval" != "xno" ; then
2180 user_path="$withval"
2181 SERVER_PATH_MSG="$withval"
2184 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2185 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2189 /* find out what STDPATH is */
2194 #ifndef _PATH_STDPATH
2195 # ifdef _PATH_USERPATH /* Irix */
2196 # define _PATH_STDPATH _PATH_USERPATH
2198 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2201 #include <sys/types.h>
2202 #include <sys/stat.h>
2204 #define DATA "conftest.stdpath"
2211 fd = fopen(DATA,"w");
2215 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2220 ], [ user_path=`cat conftest.stdpath` ],
2221 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2222 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2224 # make sure $bindir is in USER_PATH so scp will work
2225 t_bindir=`eval echo ${bindir}`
2227 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2230 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2232 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2233 if test $? -ne 0 ; then
2234 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2235 if test $? -ne 0 ; then
2236 user_path=$user_path:$t_bindir
2237 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2242 if test "$USES_LOGIN_CONF" != "yes" ; then
2243 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2247 # Set superuser path separately to user path
2248 AC_ARG_WITH(superuser-path,
2249 [ --with-superuser-path= Specify different path for super-user],
2251 if test "x$withval" != "xno" ; then
2252 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2253 superuser_path=$withval
2259 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2260 IPV4_IN6_HACK_MSG="no"
2262 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2264 if test "x$withval" != "xno" ; then
2266 AC_DEFINE(IPV4_IN_IPV6)
2267 IPV4_IN6_HACK_MSG="yes"
2272 if test "x$inet6_default_4in6" = "xyes"; then
2273 AC_MSG_RESULT([yes (default)])
2274 AC_DEFINE(IPV4_IN_IPV6)
2275 IPV4_IN6_HACK_MSG="yes"
2277 AC_MSG_RESULT([no (default)])
2282 # Whether to enable BSD auth support
2284 AC_ARG_WITH(bsd-auth,
2285 [ --with-bsd-auth Enable BSD auth support],
2287 if test "x$withval" != "xno" ; then
2294 # Where to place sshd.pid
2296 # make sure the directory exists
2297 if test ! -d $piddir ; then
2298 piddir=`eval echo ${sysconfdir}`
2300 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2304 AC_ARG_WITH(pid-dir,
2305 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2307 if test "x$withval" != "xno" ; then
2309 if test ! -d $piddir ; then
2310 AC_MSG_WARN([** no $piddir directory on this system **])
2316 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2319 dnl allow user to disable some login recording features
2320 AC_ARG_ENABLE(lastlog,
2321 [ --disable-lastlog disable use of lastlog even if detected [no]],
2323 if test "x$enableval" = "xno" ; then
2324 AC_DEFINE(DISABLE_LASTLOG)
2329 [ --disable-utmp disable use of utmp even if detected [no]],
2331 if test "x$enableval" = "xno" ; then
2332 AC_DEFINE(DISABLE_UTMP)
2336 AC_ARG_ENABLE(utmpx,
2337 [ --disable-utmpx disable use of utmpx even if detected [no]],
2339 if test "x$enableval" = "xno" ; then
2340 AC_DEFINE(DISABLE_UTMPX)
2345 [ --disable-wtmp disable use of wtmp even if detected [no]],
2347 if test "x$enableval" = "xno" ; then
2348 AC_DEFINE(DISABLE_WTMP)
2352 AC_ARG_ENABLE(wtmpx,
2353 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2355 if test "x$enableval" = "xno" ; then
2356 AC_DEFINE(DISABLE_WTMPX)
2360 AC_ARG_ENABLE(libutil,
2361 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2363 if test "x$enableval" = "xno" ; then
2364 AC_DEFINE(DISABLE_LOGIN)
2368 AC_ARG_ENABLE(pututline,
2369 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2371 if test "x$enableval" = "xno" ; then
2372 AC_DEFINE(DISABLE_PUTUTLINE)
2376 AC_ARG_ENABLE(pututxline,
2377 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2379 if test "x$enableval" = "xno" ; then
2380 AC_DEFINE(DISABLE_PUTUTXLINE)
2384 AC_ARG_WITH(lastlog,
2385 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2387 if test "x$withval" = "xno" ; then
2388 AC_DEFINE(DISABLE_LASTLOG)
2390 conf_lastlog_location=$withval
2395 dnl lastlog, [uw]tmpx? detection
2396 dnl NOTE: set the paths in the platform section to avoid the
2397 dnl need for command-line parameters
2398 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2400 dnl lastlog detection
2401 dnl NOTE: the code itself will detect if lastlog is a directory
2402 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2404 #include <sys/types.h>
2406 #ifdef HAVE_LASTLOG_H
2407 # include <lastlog.h>
2416 [ char *lastlog = LASTLOG_FILE; ],
2417 [ AC_MSG_RESULT(yes) ],
2420 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2422 #include <sys/types.h>
2424 #ifdef HAVE_LASTLOG_H
2425 # include <lastlog.h>
2431 [ char *lastlog = _PATH_LASTLOG; ],
2432 [ AC_MSG_RESULT(yes) ],
2435 system_lastlog_path=no
2440 if test -z "$conf_lastlog_location"; then
2441 if test x"$system_lastlog_path" = x"no" ; then
2442 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2443 if (test -d "$f" || test -f "$f") ; then
2444 conf_lastlog_location=$f
2447 if test -z "$conf_lastlog_location"; then
2448 AC_MSG_WARN([** Cannot find lastlog **])
2449 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2454 if test -n "$conf_lastlog_location"; then
2455 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2459 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2461 #include <sys/types.h>
2467 [ char *utmp = UTMP_FILE; ],
2468 [ AC_MSG_RESULT(yes) ],
2470 system_utmp_path=no ]
2472 if test -z "$conf_utmp_location"; then
2473 if test x"$system_utmp_path" = x"no" ; then
2474 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2475 if test -f $f ; then
2476 conf_utmp_location=$f
2479 if test -z "$conf_utmp_location"; then
2480 AC_DEFINE(DISABLE_UTMP)
2484 if test -n "$conf_utmp_location"; then
2485 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2489 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2491 #include <sys/types.h>
2497 [ char *wtmp = WTMP_FILE; ],
2498 [ AC_MSG_RESULT(yes) ],
2500 system_wtmp_path=no ]
2502 if test -z "$conf_wtmp_location"; then
2503 if test x"$system_wtmp_path" = x"no" ; then
2504 for f in /usr/adm/wtmp /var/log/wtmp; do
2505 if test -f $f ; then
2506 conf_wtmp_location=$f
2509 if test -z "$conf_wtmp_location"; then
2510 AC_DEFINE(DISABLE_WTMP)
2514 if test -n "$conf_wtmp_location"; then
2515 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2519 dnl utmpx detection - I don't know any system so perverse as to require
2520 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2522 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2524 #include <sys/types.h>
2533 [ char *utmpx = UTMPX_FILE; ],
2534 [ AC_MSG_RESULT(yes) ],
2536 system_utmpx_path=no ]
2538 if test -z "$conf_utmpx_location"; then
2539 if test x"$system_utmpx_path" = x"no" ; then
2540 AC_DEFINE(DISABLE_UTMPX)
2543 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2547 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2549 #include <sys/types.h>
2558 [ char *wtmpx = WTMPX_FILE; ],
2559 [ AC_MSG_RESULT(yes) ],
2561 system_wtmpx_path=no ]
2563 if test -z "$conf_wtmpx_location"; then
2564 if test x"$system_wtmpx_path" = x"no" ; then
2565 AC_DEFINE(DISABLE_WTMPX)
2568 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2572 if test ! -z "$blibpath" ; then
2573 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2574 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2577 dnl remove pam and dl because they are in $LIBPAM
2578 if test "$PAM_MSG" = yes ; then
2579 LIBS=`echo $LIBS | sed 's/-lpam //'`
2581 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2582 LIBS=`echo $LIBS | sed 's/-ldl //'`
2586 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2589 # Print summary of options
2591 # Someone please show me a better way :)
2592 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2593 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2594 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2595 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2596 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2597 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2598 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2599 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2600 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2601 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2604 echo "OpenSSH has been configured with the following options:"
2605 echo " User binaries: $B"
2606 echo " System binaries: $C"
2607 echo " Configuration files: $D"
2608 echo " Askpass program: $E"
2609 echo " Manual pages: $F"
2610 echo " PID file: $G"
2611 echo " Privilege separation chroot path: $H"
2612 if test "$USES_LOGIN_CONF" = "yes" ; then
2613 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2615 echo " sshd default user PATH: $I"
2617 if test ! -z "$superuser_path" ; then
2618 echo " sshd superuser user PATH: $J"
2620 echo " Manpage format: $MANTYPE"
2621 echo " DNS support: $DNS_MSG"
2622 echo " PAM support: $PAM_MSG"
2623 echo " KerberosV support: $KRB5_MSG"
2624 echo " Smartcard support: $SCARD_MSG"
2625 echo " S/KEY support: $SKEY_MSG"
2626 echo " TCP Wrappers support: $TCPW_MSG"
2627 echo " MD5 password support: $MD5_MSG"
2628 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2629 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2630 echo " BSD Auth support: $BSD_AUTH_MSG"
2631 echo " Random number source: $RAND_MSG"
2632 if test ! -z "$USE_RAND_HELPER" ; then
2633 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2638 echo " Host: ${host}"
2639 echo " Compiler: ${CC}"
2640 echo " Compiler flags: ${CFLAGS}"
2641 echo "Preprocessor flags: ${CPPFLAGS}"
2642 echo " Linker flags: ${LDFLAGS}"
2643 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2647 if test "x$PAM_MSG" = "xyes" ; then
2648 echo "PAM is enabled. You may need to install a PAM control file "
2649 echo "for sshd, otherwise password authentication may fail. "
2650 echo "Example PAM control files can be found in the contrib/ "
2655 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2656 echo "WARNING: you are using the builtin random number collection "
2657 echo "service. Please read WARNING.RNG and request that your OS "
2658 echo "vendor includes kernel-based random number collection in "
2659 echo "future versions of your OS."