4 AC_CONFIG_SRCDIR([ssh.c])
6 AC_CONFIG_HEADER(config.h)
11 # Checks for programs.
16 AC_PATH_PROGS(PERL, perl5 perl)
17 AC_PATH_PROG(SED, sed)
19 AC_PATH_PROG(ENT, ent)
21 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
22 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
23 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
29 if test -z "$AR" ; then
30 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
33 # Use LOGIN_PROGRAM from environment if possible
34 if test ! -z "$LOGIN_PROGRAM" ; then
35 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
38 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
39 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
40 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
44 if test -z "$LD" ; then
50 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
51 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
54 # Check for some target-specific stuff
58 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
59 LDFLAGS="$LDFLAGS -L/usr/local/lib"
60 if (test "$LD" != "gcc" && test -z "$blibpath"); then
61 AC_MSG_CHECKING([if linkage editor ($LD) accepts -blibpath])
62 saved_LDFLAGS="$LDFLAGS"
63 LDFLAGS="$LDFLAGS -blibpath:/usr/lib:/lib:/usr/local/lib"
68 blibpath="/usr/lib:/lib:/usr/local/lib"
72 LDFLAGS="$saved_LDFLAGS"
74 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
75 [AC_CHECK_LIB(s,authenticate,
76 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
80 AC_DEFINE(BROKEN_GETADDRINFO)
81 AC_DEFINE(BROKEN_REALPATH)
82 dnl AIX handles lastlog as part of its login message
83 AC_DEFINE(DISABLE_LASTLOG)
84 AC_DEFINE(LOGIN_NEEDS_UTMPX)
87 LIBS="$LIBS /usr/lib/textmode.o"
88 AC_DEFINE(HAVE_CYGWIN)
90 AC_DEFINE(DISABLE_SHADOW)
91 AC_DEFINE(IPV4_DEFAULT)
92 AC_DEFINE(IP_TOS_IS_BROKEN)
93 AC_DEFINE(NO_X11_UNIX_SOCKETS)
94 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
95 AC_DEFINE(DISABLE_FD_PASSING)
96 AC_DEFINE(SETGROUPS_NOOP)
99 AC_DEFINE(IP_TOS_IS_BROKEN)
102 AC_MSG_CHECKING(if we have working getaddrinfo)
103 AC_TRY_RUN([#include <mach-o/dyld.h>
104 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
108 }], [AC_MSG_RESULT(working)],
109 [AC_MSG_RESULT(buggy)
110 AC_DEFINE(BROKEN_GETADDRINFO)],
111 [AC_MSG_RESULT(assume it is working)])
114 if test -z "$GCC"; then
117 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
118 IPADDR_IN_DISPLAY=yes
119 AC_DEFINE(HAVE_SECUREWARE)
121 AC_DEFINE(LOGIN_NO_ENDOPT)
122 AC_DEFINE(LOGIN_NEEDS_UTMPX)
123 AC_DEFINE(DISABLE_SHADOW)
124 AC_DEFINE(DISABLE_UTMP)
125 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
126 LIBS="$LIBS -lsec -lsecpw"
127 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
128 disable_ptmx_check=yes
131 if test -z "$GCC"; then
134 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
135 IPADDR_IN_DISPLAY=yes
137 AC_DEFINE(LOGIN_NO_ENDOPT)
138 AC_DEFINE(LOGIN_NEEDS_UTMPX)
139 AC_DEFINE(DISABLE_SHADOW)
140 AC_DEFINE(DISABLE_UTMP)
141 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
143 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
146 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
147 IPADDR_IN_DISPLAY=yes
148 AC_DEFINE(PAM_SUN_CODEBASE)
150 AC_DEFINE(LOGIN_NO_ENDOPT)
151 AC_DEFINE(LOGIN_NEEDS_UTMPX)
152 AC_DEFINE(DISABLE_SHADOW)
153 AC_DEFINE(DISABLE_UTMP)
154 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
156 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
159 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
161 PATH="$PATH:/usr/etc"
162 AC_DEFINE(BROKEN_INET_NTOA)
163 AC_DEFINE(WITH_ABBREV_NO_TTY)
166 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
168 PATH="$PATH:/usr/etc"
169 AC_DEFINE(WITH_IRIX_ARRAY)
170 AC_DEFINE(WITH_IRIX_PROJECT)
171 AC_DEFINE(WITH_IRIX_AUDIT)
172 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
173 AC_DEFINE(BROKEN_INET_NTOA)
174 AC_DEFINE(WITH_ABBREV_NO_TTY)
178 check_for_libcrypt_later=1
179 AC_DEFINE(DONT_TRY_OTHER_AF)
180 AC_DEFINE(PAM_TTY_KLUDGE)
181 inet6_default_4in6=yes
183 mips-sony-bsd|mips-sony-newsos4)
184 AC_DEFINE(HAVE_NEWS4)
188 check_for_libcrypt_before=1
192 check_for_libcrypt_later=1
195 conf_lastlog_location="/usr/adm/lastlog"
196 conf_utmp_location=/etc/utmp
197 conf_wtmp_location=/usr/adm/wtmp
200 AC_DEFINE(BROKEN_REALPATH)
202 AC_DEFINE(BROKEN_SAVED_UIDS)
203 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
207 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
208 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
210 AC_DEFINE(PAM_SUN_CODEBASE)
211 AC_DEFINE(LOGIN_NEEDS_UTMPX)
212 AC_DEFINE(LOGIN_NEEDS_TERM)
213 AC_DEFINE(PAM_TTY_KLUDGE)
214 # hardwire lastlog location (can't detect it on some versions)
215 conf_lastlog_location="/var/adm/lastlog"
216 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
217 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
218 if test "$sol2ver" -ge 8; then
220 AC_DEFINE(DISABLE_UTMP)
221 AC_DEFINE(DISABLE_WTMP)
227 CPPFLAGS="$CPPFLAGS -DSUNOS4"
228 AC_CHECK_FUNCS(getpwanam)
229 AC_DEFINE(PAM_SUN_CODEBASE)
230 conf_utmp_location=/etc/utmp
231 conf_wtmp_location=/var/adm/wtmp
232 conf_lastlog_location=/var/adm/lastlog
236 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
237 LDFLAGS="$LDFLAGS -L/usr/local/lib"
242 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
243 # /usr/ucblib MUST NOT be searched on ReliantUNIX
244 LDFLAGS="$LDFLAGS -L/usr/local/lib"
245 IPADDR_IN_DISPLAY=yes
247 AC_DEFINE(IP_TOS_IS_BROKEN)
248 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
249 # Attention: always take care to bind libsocket and libnsl before libc,
250 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
253 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
254 LDFLAGS="$LDFLAGS -L/usr/local/lib"
258 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
259 LDFLAGS="$LDFLAGS -L/usr/local/lib"
263 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
264 LDFLAGS="$LDFLAGS -L/usr/local/lib"
267 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
268 LDFLAGS="$LDFLAGS -L/usr/local/lib"
269 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
272 AC_DEFINE(BROKEN_SYS_TERMIO_H)
274 AC_DEFINE(HAVE_SECUREWARE)
275 AC_DEFINE(DISABLE_SHADOW)
276 AC_DEFINE(BROKEN_SAVED_UIDS)
277 AC_CHECK_FUNCS(getluid setluid)
279 do_sco3_extra_lib_check=yes
282 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
283 LDFLAGS="$LDFLAGS -L/usr/local/lib"
284 LIBS="$LIBS -lprot -lx -ltinfo -lm"
287 AC_DEFINE(HAVE_SECUREWARE)
288 AC_DEFINE(DISABLE_SHADOW)
289 AC_DEFINE(DISABLE_FD_PASSING)
290 AC_CHECK_FUNCS(getluid setluid)
295 AC_DEFINE(DISABLE_FD_PASSING)
297 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
302 AC_DEFINE(DISABLE_FD_PASSING)
303 AC_DEFINE(NO_SSH_LASTLOG)
304 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
305 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
309 AC_MSG_CHECKING(for Digital Unix SIA)
312 [ --with-osfsia Enable Digital Unix SIA],
314 if test "x$withval" = "xno" ; then
315 AC_MSG_RESULT(disabled)
320 if test -z "$no_osfsia" ; then
321 if test -f /etc/sia/matrix.conf; then
323 AC_DEFINE(HAVE_OSF_SIA)
324 AC_DEFINE(DISABLE_LOGIN)
325 LIBS="$LIBS -lsecurity -ldb -lm -laud"
330 AC_DEFINE(DISABLE_FD_PASSING)
335 AC_DEFINE(NO_X11_UNIX_SOCKETS)
336 AC_DEFINE(MISSING_NFDBITS)
337 AC_DEFINE(MISSING_HOWMANY)
338 AC_DEFINE(MISSING_FD_MASK)
342 # Allow user to specify flags
344 [ --with-cflags Specify additional flags to pass to compiler],
346 if test "x$withval" != "xno" ; then
347 CFLAGS="$CFLAGS $withval"
351 AC_ARG_WITH(cppflags,
352 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
354 if test "x$withval" != "xno"; then
355 CPPFLAGS="$CPPFLAGS $withval"
360 [ --with-ldflags Specify additional flags to pass to linker],
362 if test "x$withval" != "xno" ; then
363 LDFLAGS="$LDFLAGS $withval"
368 [ --with-libs Specify additional libraries to link with],
370 if test "x$withval" != "xno" ; then
371 LIBS="$LIBS $withval"
376 # Checks for header files.
377 AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
378 getopt.h glob.h ia.h lastlog.h limits.h login.h \
379 login_cap.h maillock.h netdb.h netgroup.h \
380 netinet/in_systm.h paths.h pty.h readpassphrase.h \
381 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
382 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
383 sys/mman.h sys/select.h sys/stat.h \
384 sys/stropts.h sys/sysmacros.h sys/time.h \
385 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
386 util.h utime.h utmp.h utmpx.h)
388 # Checks for libraries.
389 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
390 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
392 dnl SCO OS3 needs this for libwrap
393 if test "x$with_tcp_wrappers" != "xno" ; then
394 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
395 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
399 AC_CHECK_FUNC(getspnam, ,
400 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
403 [ --without-rpath Disable auto-added -R linker paths],
405 if test "x$withval" = "xno" ; then
408 if test "x$withval" = "xyes" ; then
416 [ --with-zlib=PATH Use zlib in PATH],
418 if test "x$withval" = "xno" ; then
419 AC_MSG_ERROR([*** zlib is required ***])
421 if test -d "$withval/lib"; then
422 if test -n "${need_dash_r}"; then
423 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
425 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
428 if test -n "${need_dash_r}"; then
429 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
431 LDFLAGS="-L${withval} ${LDFLAGS}"
434 if test -d "$withval/include"; then
435 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
437 CPPFLAGS="-I${withval} ${CPPFLAGS}"
442 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
445 AC_CHECK_FUNC(strcasecmp,
446 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
448 AC_CHECK_FUNC(utimes,
449 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
450 LIBS="$LIBS -lc89"]) ]
453 dnl Checks for libutil functions
454 AC_CHECK_HEADERS(libutil.h)
455 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
456 AC_CHECK_FUNCS(logout updwtmp logwtmp)
460 # Check for ALTDIRFUNC glob() extension
461 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
462 AC_EGREP_CPP(FOUNDIT,
465 #ifdef GLOB_ALTDIRFUNC
470 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
478 # Check for g.gl_matchc glob() extension
479 AC_MSG_CHECKING(for gl_matchc field in glob_t)
480 AC_EGREP_CPP(FOUNDIT,
483 int main(void){glob_t g; g.gl_matchc = 1;}
486 AC_DEFINE(GLOB_HAS_GL_MATCHC)
494 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
497 #include <sys/types.h>
499 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
501 [AC_MSG_RESULT(yes)],
504 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
508 # Check whether user wants S/Key support
511 [ --with-skey[[=PATH]] Enable S/Key support
512 (optionally in PATH)],
514 if test "x$withval" != "xno" ; then
516 if test "x$withval" != "xyes" ; then
517 CPPFLAGS="$CPPFLAGS -I${withval}/include"
518 LDFLAGS="$LDFLAGS -L${withval}/lib"
525 AC_MSG_CHECKING([for s/key support])
530 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
532 [AC_MSG_RESULT(yes)],
535 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
541 # Check whether user wants TCP wrappers support
543 AC_ARG_WITH(tcp-wrappers,
544 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
545 (optionally in PATH)],
547 if test "x$withval" != "xno" ; then
549 saved_LDFLAGS="$LDFLAGS"
550 saved_CPPFLAGS="$CPPFLAGS"
551 if test -n "${withval}" -a "${withval}" != "yes"; then
552 if test -d "${withval}/lib"; then
553 if test -n "${need_dash_r}"; then
554 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
556 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
559 if test -n "${need_dash_r}"; then
560 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
562 LDFLAGS="-L${withval} ${LDFLAGS}"
565 if test -d "${withval}/include"; then
566 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
568 CPPFLAGS="-I${withval} ${CPPFLAGS}"
572 LIBS="$LIBWRAP $LIBS"
573 AC_MSG_CHECKING(for libwrap)
577 int deny_severity = 0, allow_severity = 0;
587 AC_MSG_ERROR([*** libwrap missing])
595 dnl Checks for library functions.
596 AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
597 clock fchmod fchown freeaddrinfo futimes gai_strerror \
598 getaddrinfo getcwd getgrouplist getnameinfo getopt getpeereid\
599 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
600 inet_ntop innetgr login_getcapbool md5_crypt memmove \
601 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
602 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
603 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
604 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
605 socketpair strerror strlcat strlcpy strmode strvis sysconf \
606 tcgetpgrp truncate utimes vhangup vsnprintf waitpid __b64_ntop \
609 dnl Make sure strsep prototype is defined before defining HAVE_STRSEP
610 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
612 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
613 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
614 AC_CHECK_LIB(gen, dirname,[
615 AC_CACHE_CHECK([for broken dirname],
616 ac_cv_have_broken_dirname, [
624 int main(int argc, char **argv) {
627 strncpy(buf,"/etc", 32);
629 if (!s || strncmp(s, "/", 32) != 0) {
636 [ ac_cv_have_broken_dirname="no" ],
637 [ ac_cv_have_broken_dirname="yes" ]
641 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
643 AC_DEFINE(HAVE_DIRNAME)
644 AC_CHECK_HEADERS(libgen.h)
649 dnl Checks for time functions
650 AC_CHECK_FUNCS(gettimeofday time)
651 dnl Checks for utmp functions
652 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
653 AC_CHECK_FUNCS(utmpname)
654 dnl Checks for utmpx functions
655 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
656 AC_CHECK_FUNCS(setutxent utmpxname)
658 AC_CHECK_FUNC(daemon,
659 [AC_DEFINE(HAVE_DAEMON)],
660 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
663 AC_CHECK_FUNC(getpagesize,
664 [AC_DEFINE(HAVE_GETPAGESIZE)],
665 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
668 # Check for broken snprintf
669 if test "x$ac_cv_func_snprintf" = "xyes" ; then
670 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
674 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
676 [AC_MSG_RESULT(yes)],
679 AC_DEFINE(BROKEN_SNPRINTF)
680 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
685 dnl see whether mkstemp() requires XXXXXX
686 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
687 AC_MSG_CHECKING([for (overly) strict mkstemp])
691 main() { char template[]="conftest.mkstemp-test";
692 if (mkstemp(template) == -1)
694 unlink(template); exit(0);
702 AC_DEFINE(HAVE_STRICT_MKSTEMP)
706 AC_DEFINE(HAVE_STRICT_MKSTEMP)
716 [ --with-pam Enable PAM support ],
718 if test "x$withval" != "xno" ; then
719 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
720 AC_MSG_ERROR([PAM headers not found])
723 AC_CHECK_LIB(dl, dlopen, , )
724 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
725 AC_CHECK_FUNCS(pam_getenvlist)
731 if test $ac_cv_lib_dl_dlopen = yes; then
741 # Check for older PAM
742 if test "x$PAM_MSG" = "xyes" ; then
743 # Check PAM strerror arguments (old PAM)
744 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
748 #include <security/pam_appl.h>
750 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
753 AC_DEFINE(HAVE_OLD_PAM)
755 PAM_MSG="yes (old library)"
760 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
761 # because the system crypt() is more featureful.
762 if test "x$check_for_libcrypt_before" = "x1"; then
763 AC_CHECK_LIB(crypt, crypt)
767 saved_CPPFLAGS="$CPPFLAGS"
768 saved_LDFLAGS="$LDFLAGS"
770 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
772 if test "x$withval" != "xno" ; then
773 if test -d "$withval/lib"; then
774 if test -n "${need_dash_r}"; then
775 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
777 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
780 if test -n "${need_dash_r}"; then
781 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
783 LDFLAGS="-L${withval} ${LDFLAGS}"
786 if test -d "$withval/include"; then
787 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
789 CPPFLAGS="-I${withval} ${CPPFLAGS}"
794 LIBS="$LIBS -lcrypto"
795 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
797 dnl Check default openssl install dir
798 if test -n "${need_dash_r}"; then
799 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
801 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
803 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
804 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
806 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
812 # Determine OpenSSL header version
813 AC_MSG_CHECKING([OpenSSL header version])
818 #include <openssl/opensslv.h>
819 #define DATA "conftest.sslincver"
824 fd = fopen(DATA,"w");
828 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
835 ssl_header_ver=`cat conftest.sslincver`
836 AC_MSG_RESULT($ssl_header_ver)
839 AC_MSG_RESULT(not found)
840 AC_MSG_ERROR(OpenSSL version header not found.)
844 # Determine OpenSSL library version
845 AC_MSG_CHECKING([OpenSSL library version])
850 #include <openssl/opensslv.h>
851 #include <openssl/crypto.h>
852 #define DATA "conftest.ssllibver"
857 fd = fopen(DATA,"w");
861 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
868 ssl_library_ver=`cat conftest.ssllibver`
869 AC_MSG_RESULT($ssl_library_ver)
872 AC_MSG_RESULT(not found)
873 AC_MSG_ERROR(OpenSSL library not found.)
877 # Sanity check OpenSSL headers
878 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
882 #include <openssl/opensslv.h>
883 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
890 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
894 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
895 # version in OpenSSL. Skip this for PAM
896 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
897 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
901 ### Configure cryptographic random number support
903 # Check wheter OpenSSL seeds itself
904 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
908 #include <openssl/rand.h>
909 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
912 OPENSSL_SEEDS_ITSELF=yes
917 # Default to use of the rand helper if OpenSSL doesn't
924 # Do we want to force the use of the rand helper?
925 AC_ARG_WITH(rand-helper,
926 [ --with-rand-helper Use subprocess to gather strong randomness ],
928 if test "x$withval" = "xno" ; then
929 # Force use of OpenSSL's internal RNG, even if
930 # the previous test showed it to be unseeded.
931 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
932 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
933 OPENSSL_SEEDS_ITSELF=yes
942 # Which randomness source do we use?
943 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
945 AC_DEFINE(OPENSSL_PRNG_ONLY)
946 RAND_MSG="OpenSSL internal ONLY"
947 INSTALL_SSH_RAND_HELPER=""
948 elif test ! -z "$USE_RAND_HELPER" ; then
949 # install rand helper
950 RAND_MSG="ssh-rand-helper"
951 INSTALL_SSH_RAND_HELPER="yes"
953 AC_SUBST(INSTALL_SSH_RAND_HELPER)
955 ### Configuration of ssh-rand-helper
958 AC_ARG_WITH(prngd-port,
959 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
968 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
971 if test ! -z "$withval" ; then
972 PRNGD_PORT="$withval"
973 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
978 # PRNGD Unix domain socket
979 AC_ARG_WITH(prngd-socket,
980 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
984 withval="/var/run/egd-pool"
992 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
996 if test ! -z "$withval" ; then
997 if test ! -z "$PRNGD_PORT" ; then
998 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1000 if test ! -r "$withval" ; then
1001 AC_MSG_WARN(Entropy socket is not readable)
1003 PRNGD_SOCKET="$withval"
1004 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1008 # Check for existing socket only if we don't have a random device already
1009 if test "$USE_RAND_HELPER" = yes ; then
1010 AC_MSG_CHECKING(for PRNGD/EGD socket)
1011 # Insert other locations here
1012 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1013 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1014 PRNGD_SOCKET="$sock"
1015 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1019 if test ! -z "$PRNGD_SOCKET" ; then
1020 AC_MSG_RESULT($PRNGD_SOCKET)
1022 AC_MSG_RESULT(not found)
1028 # Change default command timeout for hashing entropy source
1030 AC_ARG_WITH(entropy-timeout,
1031 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1033 if test "x$withval" != "xno" ; then
1034 entropy_timeout=$withval
1038 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1040 SSH_PRIVSEP_USER=sshd
1041 AC_ARG_WITH(privsep-user,
1042 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1044 if test -n "$withval"; then
1045 SSH_PRIVSEP_USER=$withval
1049 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1050 AC_SUBST(SSH_PRIVSEP_USER)
1052 # We do this little dance with the search path to insure
1053 # that programs that we select for use by installed programs
1054 # (which may be run by the super-user) come from trusted
1055 # locations before they come from the user's private area.
1056 # This should help avoid accidentally configuring some
1057 # random version of a program in someone's personal bin.
1061 test -h /bin 2> /dev/null && PATH=/usr/bin
1062 test -d /sbin && PATH=$PATH:/sbin
1063 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1064 PATH=$PATH:/etc:$OPATH
1066 # These programs are used by the command hashing source to gather entropy
1067 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1068 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1069 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1070 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1071 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1072 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1073 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1074 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1075 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1076 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1077 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1078 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1079 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1080 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1081 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1082 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1086 # Where does ssh-rand-helper get its randomness from?
1087 INSTALL_SSH_PRNG_CMDS=""
1088 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1089 if test ! -z "$PRNGD_PORT" ; then
1090 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1091 elif test ! -z "$PRNGD_SOCKET" ; then
1092 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1094 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1095 RAND_HELPER_CMDHASH=yes
1096 INSTALL_SSH_PRNG_CMDS="yes"
1099 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1102 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1103 if test ! -z "$SONY" ; then
1104 LIBS="$LIBS -liberty";
1107 # Checks for data types
1108 AC_CHECK_SIZEOF(char, 1)
1109 AC_CHECK_SIZEOF(short int, 2)
1110 AC_CHECK_SIZEOF(int, 4)
1111 AC_CHECK_SIZEOF(long int, 4)
1112 AC_CHECK_SIZEOF(long long int, 8)
1114 # Sanity check long long for some platforms (AIX)
1115 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1116 ac_cv_sizeof_long_long_int=0
1119 # More checks for data types
1120 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1122 [ #include <sys/types.h> ],
1124 [ ac_cv_have_u_int="yes" ],
1125 [ ac_cv_have_u_int="no" ]
1128 if test "x$ac_cv_have_u_int" = "xyes" ; then
1129 AC_DEFINE(HAVE_U_INT)
1133 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1135 [ #include <sys/types.h> ],
1136 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1137 [ ac_cv_have_intxx_t="yes" ],
1138 [ ac_cv_have_intxx_t="no" ]
1141 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1142 AC_DEFINE(HAVE_INTXX_T)
1146 if (test -z "$have_intxx_t" && \
1147 test "x$ac_cv_header_stdint_h" = "xyes")
1149 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1151 [ #include <stdint.h> ],
1152 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1154 AC_DEFINE(HAVE_INTXX_T)
1157 [ AC_MSG_RESULT(no) ]
1161 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1164 #include <sys/types.h>
1165 #ifdef HAVE_STDINT_H
1166 # include <stdint.h>
1168 #include <sys/socket.h>
1169 #ifdef HAVE_SYS_BITYPES_H
1170 # include <sys/bitypes.h>
1173 [ int64_t a; a = 1;],
1174 [ ac_cv_have_int64_t="yes" ],
1175 [ ac_cv_have_int64_t="no" ]
1178 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1179 AC_DEFINE(HAVE_INT64_T)
1182 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1184 [ #include <sys/types.h> ],
1185 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1186 [ ac_cv_have_u_intxx_t="yes" ],
1187 [ ac_cv_have_u_intxx_t="no" ]
1190 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1191 AC_DEFINE(HAVE_U_INTXX_T)
1195 if test -z "$have_u_intxx_t" ; then
1196 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1198 [ #include <sys/socket.h> ],
1199 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1201 AC_DEFINE(HAVE_U_INTXX_T)
1204 [ AC_MSG_RESULT(no) ]
1208 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1210 [ #include <sys/types.h> ],
1211 [ u_int64_t a; a = 1;],
1212 [ ac_cv_have_u_int64_t="yes" ],
1213 [ ac_cv_have_u_int64_t="no" ]
1216 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1217 AC_DEFINE(HAVE_U_INT64_T)
1221 if test -z "$have_u_int64_t" ; then
1222 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1224 [ #include <sys/bitypes.h> ],
1225 [ u_int64_t a; a = 1],
1227 AC_DEFINE(HAVE_U_INT64_T)
1230 [ AC_MSG_RESULT(no) ]
1234 if test -z "$have_u_intxx_t" ; then
1235 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1238 #include <sys/types.h>
1240 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1241 [ ac_cv_have_uintxx_t="yes" ],
1242 [ ac_cv_have_uintxx_t="no" ]
1245 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1246 AC_DEFINE(HAVE_UINTXX_T)
1250 if test -z "$have_uintxx_t" ; then
1251 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1253 [ #include <stdint.h> ],
1254 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1256 AC_DEFINE(HAVE_UINTXX_T)
1259 [ AC_MSG_RESULT(no) ]
1263 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1264 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1266 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1269 #include <sys/bitypes.h>
1272 int8_t a; int16_t b; int32_t c;
1273 u_int8_t e; u_int16_t f; u_int32_t g;
1274 a = b = c = e = f = g = 1;
1277 AC_DEFINE(HAVE_U_INTXX_T)
1278 AC_DEFINE(HAVE_INTXX_T)
1286 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1289 #include <sys/types.h>
1291 [ u_char foo; foo = 125; ],
1292 [ ac_cv_have_u_char="yes" ],
1293 [ ac_cv_have_u_char="no" ]
1296 if test "x$ac_cv_have_u_char" = "xyes" ; then
1297 AC_DEFINE(HAVE_U_CHAR)
1302 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1304 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1307 #include <sys/types.h>
1309 [ size_t foo; foo = 1235; ],
1310 [ ac_cv_have_size_t="yes" ],
1311 [ ac_cv_have_size_t="no" ]
1314 if test "x$ac_cv_have_size_t" = "xyes" ; then
1315 AC_DEFINE(HAVE_SIZE_T)
1318 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1321 #include <sys/types.h>
1323 [ ssize_t foo; foo = 1235; ],
1324 [ ac_cv_have_ssize_t="yes" ],
1325 [ ac_cv_have_ssize_t="no" ]
1328 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1329 AC_DEFINE(HAVE_SSIZE_T)
1332 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1337 [ clock_t foo; foo = 1235; ],
1338 [ ac_cv_have_clock_t="yes" ],
1339 [ ac_cv_have_clock_t="no" ]
1342 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1343 AC_DEFINE(HAVE_CLOCK_T)
1346 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1349 #include <sys/types.h>
1350 #include <sys/socket.h>
1352 [ sa_family_t foo; foo = 1235; ],
1353 [ ac_cv_have_sa_family_t="yes" ],
1356 #include <sys/types.h>
1357 #include <sys/socket.h>
1358 #include <netinet/in.h>
1360 [ sa_family_t foo; foo = 1235; ],
1361 [ ac_cv_have_sa_family_t="yes" ],
1363 [ ac_cv_have_sa_family_t="no" ]
1367 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1368 AC_DEFINE(HAVE_SA_FAMILY_T)
1371 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1374 #include <sys/types.h>
1376 [ pid_t foo; foo = 1235; ],
1377 [ ac_cv_have_pid_t="yes" ],
1378 [ ac_cv_have_pid_t="no" ]
1381 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1382 AC_DEFINE(HAVE_PID_T)
1385 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1388 #include <sys/types.h>
1390 [ mode_t foo; foo = 1235; ],
1391 [ ac_cv_have_mode_t="yes" ],
1392 [ ac_cv_have_mode_t="no" ]
1395 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1396 AC_DEFINE(HAVE_MODE_T)
1400 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1403 #include <sys/types.h>
1404 #include <sys/socket.h>
1406 [ struct sockaddr_storage s; ],
1407 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1408 [ ac_cv_have_struct_sockaddr_storage="no" ]
1411 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1412 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1415 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1418 #include <sys/types.h>
1419 #include <netinet/in.h>
1421 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1422 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1423 [ ac_cv_have_struct_sockaddr_in6="no" ]
1426 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1427 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1430 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1433 #include <sys/types.h>
1434 #include <netinet/in.h>
1436 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1437 [ ac_cv_have_struct_in6_addr="yes" ],
1438 [ ac_cv_have_struct_in6_addr="no" ]
1441 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1442 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1445 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1448 #include <sys/types.h>
1449 #include <sys/socket.h>
1452 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1453 [ ac_cv_have_struct_addrinfo="yes" ],
1454 [ ac_cv_have_struct_addrinfo="no" ]
1457 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1458 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1461 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1463 [ #include <sys/time.h> ],
1464 [ struct timeval tv; tv.tv_sec = 1;],
1465 [ ac_cv_have_struct_timeval="yes" ],
1466 [ ac_cv_have_struct_timeval="no" ]
1469 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1470 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1471 have_struct_timeval=1
1474 # If we don't have int64_t then we can't compile sftp-server. So don't
1475 # even attempt to do it.
1476 if test "x$ac_cv_have_int64_t" = "xno" -a \
1477 "x$ac_cv_sizeof_long_int" != "x8" -a \
1478 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1481 dnl test snprintf (broken on SCO w/gcc)
1486 #ifdef HAVE_SNPRINTF
1490 char expected_out[50];
1492 #if (SIZEOF_LONG_INT == 8)
1493 long int num = 0x7fffffffffffffff;
1495 long long num = 0x7fffffffffffffffll;
1497 strcpy(expected_out, "9223372036854775807");
1498 snprintf(buf, mazsize, "%lld", num);
1499 if(strcmp(buf, expected_out) != 0)
1506 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1511 dnl Checks for structure members
1512 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1513 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1514 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1515 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1516 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1517 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1518 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1519 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1520 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1521 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1522 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1523 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1524 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1525 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1526 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1527 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1528 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1530 AC_CHECK_MEMBERS([struct stat.st_blksize])
1532 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1533 ac_cv_have_ss_family_in_struct_ss, [
1536 #include <sys/types.h>
1537 #include <sys/socket.h>
1539 [ struct sockaddr_storage s; s.ss_family = 1; ],
1540 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1541 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1544 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1545 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1548 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1549 ac_cv_have___ss_family_in_struct_ss, [
1552 #include <sys/types.h>
1553 #include <sys/socket.h>
1555 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1556 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1557 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1560 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1561 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1564 AC_CACHE_CHECK([for pw_class field in struct passwd],
1565 ac_cv_have_pw_class_in_struct_passwd, [
1570 [ struct passwd p; p.pw_class = 0; ],
1571 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1572 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1575 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1576 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1579 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1580 ac_cv_have_pw_expire_in_struct_passwd, [
1585 [ struct passwd p; p.pw_expire = 0; ],
1586 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1587 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1590 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1591 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1594 AC_CACHE_CHECK([for pw_change field in struct passwd],
1595 ac_cv_have_pw_change_in_struct_passwd, [
1600 [ struct passwd p; p.pw_change = 0; ],
1601 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1602 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1605 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1606 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1609 dnl make sure we're using the real structure members and not defines
1610 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1611 ac_cv_have_accrights_in_msghdr, [
1614 #include <sys/types.h>
1615 #include <sys/socket.h>
1616 #include <sys/uio.h>
1618 #ifdef msg_accrights
1622 m.msg_accrights = 0;
1626 [ ac_cv_have_accrights_in_msghdr="yes" ],
1627 [ ac_cv_have_accrights_in_msghdr="no" ]
1630 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1631 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1634 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1635 ac_cv_have_control_in_msghdr, [
1638 #include <sys/types.h>
1639 #include <sys/socket.h>
1640 #include <sys/uio.h>
1650 [ ac_cv_have_control_in_msghdr="yes" ],
1651 [ ac_cv_have_control_in_msghdr="no" ]
1654 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1655 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1658 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1660 [ extern char *__progname; printf("%s", __progname); ],
1661 [ ac_cv_libc_defines___progname="yes" ],
1662 [ ac_cv_libc_defines___progname="no" ]
1665 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1666 AC_DEFINE(HAVE___PROGNAME)
1669 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1673 [ printf("%s", __FUNCTION__); ],
1674 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1675 [ ac_cv_cc_implements___FUNCTION__="no" ]
1678 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1679 AC_DEFINE(HAVE___FUNCTION__)
1682 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1686 [ printf("%s", __func__); ],
1687 [ ac_cv_cc_implements___func__="yes" ],
1688 [ ac_cv_cc_implements___func__="no" ]
1691 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1692 AC_DEFINE(HAVE___func__)
1695 AC_CACHE_CHECK([whether getopt has optreset support],
1696 ac_cv_have_getopt_optreset, [
1701 [ extern int optreset; optreset = 0; ],
1702 [ ac_cv_have_getopt_optreset="yes" ],
1703 [ ac_cv_have_getopt_optreset="no" ]
1706 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1707 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1710 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1712 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1713 [ ac_cv_libc_defines_sys_errlist="yes" ],
1714 [ ac_cv_libc_defines_sys_errlist="no" ]
1717 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1718 AC_DEFINE(HAVE_SYS_ERRLIST)
1722 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1724 [ extern int sys_nerr; printf("%i", sys_nerr);],
1725 [ ac_cv_libc_defines_sys_nerr="yes" ],
1726 [ ac_cv_libc_defines_sys_nerr="no" ]
1729 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1730 AC_DEFINE(HAVE_SYS_NERR)
1735 # Check whether user wants sectok support
1737 [ --with-sectok Enable smartcard support using libsectok],
1739 if test "x$withval" != "xno" ; then
1740 if test "x$withval" != "xyes" ; then
1741 CPPFLAGS="$CPPFLAGS -I${withval}"
1742 LDFLAGS="$LDFLAGS -L${withval}"
1743 if test ! -z "$need_dash_r" ; then
1744 LDFLAGS="$LDFLAGS -R${withval}"
1746 if test ! -z "$blibpath" ; then
1747 blibpath="$blibpath:${withval}"
1750 AC_CHECK_HEADERS(sectok.h)
1751 if test "$ac_cv_header_sectok_h" != yes; then
1752 AC_MSG_ERROR(Can't find sectok.h)
1754 AC_CHECK_LIB(sectok, sectok_open)
1755 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1756 AC_MSG_ERROR(Can't find libsectok)
1758 AC_DEFINE(SMARTCARD)
1759 AC_DEFINE(USE_SECTOK)
1760 SCARD_MSG="yes, using sectok"
1765 # Check whether user wants OpenSC support
1767 AC_HELP_STRING([--with-opensc=PFX],
1768 [Enable smartcard support using OpenSC]),
1769 opensc_config_prefix="$withval", opensc_config_prefix="")
1770 if test x$opensc_config_prefix != x ; then
1771 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1772 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1773 if test "$OPENSC_CONFIG" != "no"; then
1774 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1775 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1776 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1777 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1778 AC_DEFINE(SMARTCARD)
1779 AC_DEFINE(USE_OPENSC)
1780 SCARD_MSG="yes, using OpenSC"
1784 # Check whether user wants Kerberos 5 support
1786 AC_ARG_WITH(kerberos5,
1787 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1789 if test "x$withval" != "xno" ; then
1790 if test "x$withval" = "xyes" ; then
1791 KRB5ROOT="/usr/local"
1795 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1796 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1799 AC_MSG_CHECKING(whether we are using Heimdal)
1800 AC_TRY_COMPILE([ #include <krb5.h> ],
1801 [ char *tmp = heimdal_version; ],
1802 [ AC_MSG_RESULT(yes)
1804 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1807 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1810 if test ! -z "$need_dash_r" ; then
1811 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1813 if test ! -z "$blibpath" ; then
1814 blibpath="$blibpath:${KRB5ROOT}/lib"
1816 AC_CHECK_LIB(resolv, dn_expand, , )
1822 # Check whether user wants Kerberos 4 support
1824 AC_ARG_WITH(kerberos4,
1825 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1827 if test "x$withval" != "xno" ; then
1828 if test "x$withval" != "xyes" ; then
1829 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1830 LDFLAGS="$LDFLAGS -L${withval}/lib"
1831 if test ! -z "$need_dash_r" ; then
1832 LDFLAGS="$LDFLAGS -R${withval}/lib"
1834 if test ! -z "$blibpath" ; then
1835 blibpath="$blibpath:${withval}/lib"
1838 if test -d /usr/include/kerberosIV ; then
1839 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1843 AC_CHECK_HEADERS(krb.h)
1844 if test "$ac_cv_header_krb_h" != yes; then
1845 AC_MSG_WARN([Cannot find krb.h, build may fail])
1847 AC_CHECK_LIB(krb, main)
1848 if test "$ac_cv_lib_krb_main" != yes; then
1849 AC_CHECK_LIB(krb4, main)
1850 if test "$ac_cv_lib_krb4_main" != yes; then
1851 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1858 AC_CHECK_LIB(des, des_cbc_encrypt)
1859 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1860 AC_CHECK_LIB(des425, des_cbc_encrypt)
1861 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1862 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1869 AC_CHECK_LIB(resolv, dn_expand, , )
1877 # Check whether user wants AFS support
1880 [ --with-afs=PATH Enable AFS support],
1882 if test "x$withval" != "xno" ; then
1884 if test "x$withval" != "xyes" ; then
1885 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1886 LDFLAGS="$LDFLAGS -L${withval}/lib"
1889 if test -z "$KRB4" ; then
1890 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1894 if test ! -z "$AFS_LIBS" ; then
1895 LIBS="$LIBS $AFS_LIBS"
1902 LIBS="$LIBS $KLIBS $K5LIBS"
1904 # Looking for programs, paths and files
1906 PRIVSEP_PATH=/var/empty
1907 AC_ARG_WITH(privsep-path,
1908 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
1910 if test "x$withval" != "$no" ; then
1911 PRIVSEP_PATH=$withval
1915 AC_SUBST(PRIVSEP_PATH)
1918 [ --with-xauth=PATH Specify path to xauth program ],
1920 if test "x$withval" != "xno" ; then
1926 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
1927 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
1928 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
1929 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
1930 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
1931 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
1932 xauth_path="/usr/openwin/bin/xauth"
1937 if test -z "$xauth_path" ; then
1938 XAUTH_PATH="undefined"
1939 AC_SUBST(XAUTH_PATH)
1941 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
1942 XAUTH_PATH=$xauth_path
1943 AC_SUBST(XAUTH_PATH)
1946 # Check for mail directory (last resort if we cannot get it from headers)
1947 if test ! -z "$MAIL" ; then
1948 maildir=`dirname $MAIL`
1949 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1952 if test -z "$no_dev_ptmx" ; then
1953 if test "x$disable_ptmx_check" != "xyes" ; then
1954 AC_CHECK_FILE("/dev/ptmx",
1956 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1962 AC_CHECK_FILE("/dev/ptc",
1964 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1969 # Options from here on. Some of these are preset by platform above
1970 AC_ARG_WITH(mantype,
1971 [ --with-mantype=man|cat|doc Set man page type],
1978 AC_MSG_ERROR(invalid man type: $withval)
1983 if test -z "$MANTYPE"; then
1984 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
1985 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
1986 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1988 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1995 if test "$MANTYPE" = "doc"; then
2002 # Check whether to enable MD5 passwords
2004 AC_ARG_WITH(md5-passwords,
2005 [ --with-md5-passwords Enable use of MD5 passwords],
2007 if test "x$withval" != "xno" ; then
2008 AC_DEFINE(HAVE_MD5_PASSWORDS)
2014 # Whether to disable shadow password support
2016 [ --without-shadow Disable shadow password support],
2018 if test "x$withval" = "xno" ; then
2019 AC_DEFINE(DISABLE_SHADOW)
2025 if test -z "$disable_shadow" ; then
2026 AC_MSG_CHECKING([if the systems has expire shadow information])
2029 #include <sys/types.h>
2032 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2033 [ sp_expire_available=yes ], []
2036 if test "x$sp_expire_available" = "xyes" ; then
2038 AC_DEFINE(HAS_SHADOW_EXPIRE)
2044 # Use ip address instead of hostname in $DISPLAY
2045 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2046 DISPLAY_HACK_MSG="yes"
2047 AC_DEFINE(IPADDR_IN_DISPLAY)
2049 DISPLAY_HACK_MSG="no"
2050 AC_ARG_WITH(ipaddr-display,
2051 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2053 if test "x$withval" != "xno" ; then
2054 AC_DEFINE(IPADDR_IN_DISPLAY)
2055 DISPLAY_HACK_MSG="yes"
2061 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2062 if test $ac_cv_func_login_getcapbool = "yes" -a \
2063 $ac_cv_header_login_cap_h = "yes" ; then
2066 # Whether to mess with the default path
2067 SERVER_PATH_MSG="(default)"
2068 AC_ARG_WITH(default-path,
2069 [ --with-default-path= Specify default \$PATH environment for server],
2071 if test "$USES_LOGIN_CONF" = "yes" ; then
2073 --with-default-path=PATH has no effect on this system.
2074 Edit /etc/login.conf instead.])
2075 elif test "x$withval" != "xno" ; then
2076 user_path="$withval"
2077 SERVER_PATH_MSG="$withval"
2080 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2081 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2085 /* find out what STDPATH is */
2090 #ifndef _PATH_STDPATH
2091 # ifdef _PATH_USERPATH /* Irix */
2092 # define _PATH_STDPATH _PATH_USERPATH
2094 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2097 #include <sys/types.h>
2098 #include <sys/stat.h>
2100 #define DATA "conftest.stdpath"
2107 fd = fopen(DATA,"w");
2111 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2116 ], [ user_path=`cat conftest.stdpath` ],
2117 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2118 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2120 # make sure $bindir is in USER_PATH so scp will work
2121 t_bindir=`eval echo ${bindir}`
2123 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2126 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2128 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2129 if test $? -ne 0 ; then
2130 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2131 if test $? -ne 0 ; then
2132 user_path=$user_path:$t_bindir
2133 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2138 if test "$USES_LOGIN_CONF" != "yes" ; then
2139 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2143 # Set superuser path separately to user path
2144 AC_ARG_WITH(superuser-path,
2145 [ --with-superuser-path= Specify different path for super-user],
2147 if test "x$withval" != "xno" ; then
2148 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2149 superuser_path=$withval
2155 # Whether to force IPv4 by default (needed on broken glibc Linux)
2157 AC_ARG_WITH(ipv4-default,
2158 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2160 if test "x$withval" != "xno" ; then
2161 AC_DEFINE(IPV4_DEFAULT)
2167 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2168 IPV4_IN6_HACK_MSG="no"
2170 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2172 if test "x$withval" != "xno" ; then
2174 AC_DEFINE(IPV4_IN_IPV6)
2175 IPV4_IN6_HACK_MSG="yes"
2180 if test "x$inet6_default_4in6" = "xyes"; then
2181 AC_MSG_RESULT([yes (default)])
2182 AC_DEFINE(IPV4_IN_IPV6)
2183 IPV4_IN6_HACK_MSG="yes"
2185 AC_MSG_RESULT([no (default)])
2190 # Whether to enable BSD auth support
2192 AC_ARG_WITH(bsd-auth,
2193 [ --with-bsd-auth Enable BSD auth support],
2195 if test "x$withval" != "xno" ; then
2202 # Where to place sshd.pid
2204 # make sure the directory exists
2205 if test ! -d $piddir ; then
2206 piddir=`eval echo ${sysconfdir}`
2208 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2212 AC_ARG_WITH(pid-dir,
2213 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2215 if test "x$withval" != "xno" ; then
2217 if test ! -d $piddir ; then
2218 AC_MSG_WARN([** no $piddir directory on this system **])
2224 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2227 dnl allow user to disable some login recording features
2228 AC_ARG_ENABLE(lastlog,
2229 [ --disable-lastlog disable use of lastlog even if detected [no]],
2230 [ AC_DEFINE(DISABLE_LASTLOG) ]
2233 [ --disable-utmp disable use of utmp even if detected [no]],
2234 [ AC_DEFINE(DISABLE_UTMP) ]
2236 AC_ARG_ENABLE(utmpx,
2237 [ --disable-utmpx disable use of utmpx even if detected [no]],
2238 [ AC_DEFINE(DISABLE_UTMPX) ]
2241 [ --disable-wtmp disable use of wtmp even if detected [no]],
2242 [ AC_DEFINE(DISABLE_WTMP) ]
2244 AC_ARG_ENABLE(wtmpx,
2245 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2246 [ AC_DEFINE(DISABLE_WTMPX) ]
2248 AC_ARG_ENABLE(libutil,
2249 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2250 [ AC_DEFINE(DISABLE_LOGIN) ]
2252 AC_ARG_ENABLE(pututline,
2253 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2254 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2256 AC_ARG_ENABLE(pututxline,
2257 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2258 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2260 AC_ARG_WITH(lastlog,
2261 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2263 if test "x$withval" = "xno" ; then
2264 AC_DEFINE(DISABLE_LASTLOG)
2266 conf_lastlog_location=$withval
2271 dnl lastlog, [uw]tmpx? detection
2272 dnl NOTE: set the paths in the platform section to avoid the
2273 dnl need for command-line parameters
2274 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2276 dnl lastlog detection
2277 dnl NOTE: the code itself will detect if lastlog is a directory
2278 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2280 #include <sys/types.h>
2282 #ifdef HAVE_LASTLOG_H
2283 # include <lastlog.h>
2292 [ char *lastlog = LASTLOG_FILE; ],
2293 [ AC_MSG_RESULT(yes) ],
2296 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2298 #include <sys/types.h>
2300 #ifdef HAVE_LASTLOG_H
2301 # include <lastlog.h>
2307 [ char *lastlog = _PATH_LASTLOG; ],
2308 [ AC_MSG_RESULT(yes) ],
2311 system_lastlog_path=no
2316 if test -z "$conf_lastlog_location"; then
2317 if test x"$system_lastlog_path" = x"no" ; then
2318 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2319 if (test -d "$f" || test -f "$f") ; then
2320 conf_lastlog_location=$f
2323 if test -z "$conf_lastlog_location"; then
2324 AC_MSG_WARN([** Cannot find lastlog **])
2325 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2330 if test -n "$conf_lastlog_location"; then
2331 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2335 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2337 #include <sys/types.h>
2343 [ char *utmp = UTMP_FILE; ],
2344 [ AC_MSG_RESULT(yes) ],
2346 system_utmp_path=no ]
2348 if test -z "$conf_utmp_location"; then
2349 if test x"$system_utmp_path" = x"no" ; then
2350 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2351 if test -f $f ; then
2352 conf_utmp_location=$f
2355 if test -z "$conf_utmp_location"; then
2356 AC_DEFINE(DISABLE_UTMP)
2360 if test -n "$conf_utmp_location"; then
2361 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2365 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2367 #include <sys/types.h>
2373 [ char *wtmp = WTMP_FILE; ],
2374 [ AC_MSG_RESULT(yes) ],
2376 system_wtmp_path=no ]
2378 if test -z "$conf_wtmp_location"; then
2379 if test x"$system_wtmp_path" = x"no" ; then
2380 for f in /usr/adm/wtmp /var/log/wtmp; do
2381 if test -f $f ; then
2382 conf_wtmp_location=$f
2385 if test -z "$conf_wtmp_location"; then
2386 AC_DEFINE(DISABLE_WTMP)
2390 if test -n "$conf_wtmp_location"; then
2391 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2395 dnl utmpx detection - I don't know any system so perverse as to require
2396 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2398 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2400 #include <sys/types.h>
2409 [ char *utmpx = UTMPX_FILE; ],
2410 [ AC_MSG_RESULT(yes) ],
2412 system_utmpx_path=no ]
2414 if test -z "$conf_utmpx_location"; then
2415 if test x"$system_utmpx_path" = x"no" ; then
2416 AC_DEFINE(DISABLE_UTMPX)
2419 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2423 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2425 #include <sys/types.h>
2434 [ char *wtmpx = WTMPX_FILE; ],
2435 [ AC_MSG_RESULT(yes) ],
2437 system_wtmpx_path=no ]
2439 if test -z "$conf_wtmpx_location"; then
2440 if test x"$system_wtmpx_path" = x"no" ; then
2441 AC_DEFINE(DISABLE_WTMPX)
2444 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2448 if test ! -z "$blibpath" ; then
2449 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2450 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2453 dnl remove pam and dl because they are in $LIBPAM
2454 if test "$PAM_MSG" = yes ; then
2455 LIBS=`echo $LIBS | sed 's/-lpam //'`
2457 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2458 LIBS=`echo $LIBS | sed 's/-ldl //'`
2462 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2465 # Print summary of options
2467 # Someone please show me a better way :)
2468 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2469 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2470 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2471 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2472 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2473 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2474 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2475 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2476 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2477 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2480 echo "OpenSSH has been configured with the following options:"
2481 echo " User binaries: $B"
2482 echo " System binaries: $C"
2483 echo " Configuration files: $D"
2484 echo " Askpass program: $E"
2485 echo " Manual pages: $F"
2486 echo " PID file: $G"
2487 echo " Privilege separation chroot path: $H"
2488 if test "$USES_LOGIN_CONF" = "yes" ; then
2489 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2491 echo " sshd default user PATH: $I"
2493 if test ! -z "$superuser_path" ; then
2494 echo " sshd superuser user PATH: $J"
2496 echo " Manpage format: $MANTYPE"
2497 echo " PAM support: ${PAM_MSG}"
2498 echo " KerberosIV support: $KRB4_MSG"
2499 echo " KerberosV support: $KRB5_MSG"
2500 echo " Smartcard support: $SCARD_MSG"
2501 echo " AFS support: $AFS_MSG"
2502 echo " S/KEY support: $SKEY_MSG"
2503 echo " TCP Wrappers support: $TCPW_MSG"
2504 echo " MD5 password support: $MD5_MSG"
2505 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2506 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2507 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2508 echo " BSD Auth support: $BSD_AUTH_MSG"
2509 echo " Random number source: $RAND_MSG"
2510 if test ! -z "$USE_RAND_HELPER" ; then
2511 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2516 echo " Host: ${host}"
2517 echo " Compiler: ${CC}"
2518 echo " Compiler flags: ${CFLAGS}"
2519 echo "Preprocessor flags: ${CPPFLAGS}"
2520 echo " Linker flags: ${LDFLAGS}"
2521 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2525 if test "x$PAM_MSG" = "xyes" ; then
2526 echo "PAM is enabled. You may need to install a PAM control file "
2527 echo "for sshd, otherwise password authentication may fail. "
2528 echo "Example PAM control files can be found in the contrib/ "
2533 if test ! -z "$NO_SFTP"; then
2534 echo "sftp-server will be disabled. Your compiler does not "
2535 echo "support 64bit integers."
2539 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2540 echo "WARNING: you are using the builtin random number collection "
2541 echo "service. Please read WARNING.RNG and request that your OS "
2542 echo "vendor includes kernel-based random number collection in "
2543 echo "future versions of your OS."