4 AC_CONFIG_SRCDIR([ssh.c])
6 AC_CONFIG_HEADER(config.h)
11 # Checks for programs.
16 AC_PATH_PROGS(PERL, perl5 perl)
18 AC_PATH_PROG(ENT, ent)
20 AC_PATH_PROGS(FILEPRIV, filepriv, true, /sbin:/usr/sbin)
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)
28 if test -z "$AR" ; then
29 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
32 # Use LOGIN_PROGRAM from environment if possible
33 if test ! -z "$LOGIN_PROGRAM" ; then
34 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
37 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
38 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
39 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
43 if test -z "$LD" ; then
49 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
50 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
53 # Check for some target-specific stuff
57 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
58 LDFLAGS="$LDFLAGS -L/usr/local/lib"
59 if (test "$LD" != "gcc" && test -z "$blibpath"); then
60 blibpath="/usr/lib:/lib:/usr/local/lib"
62 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
63 AC_DEFINE(BROKEN_GETADDRINFO)
64 dnl AIX handles lastlog as part of its login message
65 AC_DEFINE(DISABLE_LASTLOG)
68 LIBS="$LIBS -lregex /usr/lib/textmode.o"
69 AC_DEFINE(HAVE_CYGWIN)
71 AC_DEFINE(DISABLE_SHADOW)
72 AC_DEFINE(IPV4_DEFAULT)
73 AC_DEFINE(IP_TOS_IS_BROKEN)
74 AC_DEFINE(NO_X11_UNIX_SOCKETS)
77 AC_DEFINE(IP_TOS_IS_BROKEN)
80 AC_DEFINE(BROKEN_GETADDRINFO)
83 if test -z "$GCC"; then
86 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
89 AC_DEFINE(DISABLE_SHADOW)
90 AC_DEFINE(DISABLE_UTMP)
91 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
92 LIBS="$LIBS -lxnet -lsec"
95 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
97 AC_DEFINE(PAM_SUN_CODEBASE)
99 AC_DEFINE(DISABLE_SHADOW)
100 AC_DEFINE(DISABLE_UTMP)
101 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
102 LIBS="$LIBS -lxnet -lsec"
105 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
107 PATH="$PATH:/usr/etc"
108 AC_DEFINE(BROKEN_INET_NTOA)
111 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
113 PATH="$PATH:/usr/etc"
114 AC_DEFINE(WITH_IRIX_ARRAY)
115 AC_DEFINE(WITH_IRIX_PROJECT)
116 AC_DEFINE(WITH_IRIX_AUDIT)
117 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
118 AC_DEFINE(BROKEN_INET_NTOA)
122 check_for_libcrypt_later=1
123 AC_DEFINE(DONT_TRY_OTHER_AF)
124 AC_DEFINE(PAM_TTY_KLUDGE)
125 inet6_default_4in6=yes
127 mips-sony-bsd|mips-sony-newsos4)
128 AC_DEFINE(HAVE_NEWS4)
130 AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT),
131 AC_MSG_ERROR([*** libiberty missing - please install first or check config.log ***])
138 check_for_libcrypt_later=1
141 conf_lastlog_location="/usr/adm/lastlog"
142 conf_utmp_location=/etc/utmp
143 conf_wtmp_location=/usr/adm/wtmp
146 AC_DEFINE(BROKEN_REALPATH)
148 AC_DEFINE(BROKEN_SAVED_UIDS)
149 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
153 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
154 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
156 AC_DEFINE(PAM_SUN_CODEBASE)
157 AC_DEFINE(LOGIN_NEEDS_UTMPX)
158 AC_DEFINE(LOGIN_NEEDS_TERM)
159 AC_DEFINE(PAM_TTY_KLUDGE)
160 # hardwire lastlog location (can't detect it on some versions)
161 conf_lastlog_location="/var/adm/lastlog"
162 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
163 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
164 if test "$sol2ver" -ge 8; then
166 AC_DEFINE(DISABLE_UTMP)
167 AC_DEFINE(DISABLE_WTMP)
173 CPPFLAGS="$CPPFLAGS -DSUNOS4"
174 AC_CHECK_FUNCS(getpwanam)
175 AC_DEFINE(PAM_SUN_CODEBASE)
176 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
177 conf_utmp_location=/etc/utmp
178 conf_wtmp_location=/var/adm/wtmp
179 conf_lastlog_location=/var/adm/lastlog
183 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
184 LDFLAGS="$LDFLAGS -L/usr/local/lib"
186 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
189 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
190 # /usr/ucblib MUST NOT be searched on ReliantUNIX
191 LDFLAGS="$LDFLAGS -L/usr/local/lib"
192 IPADDR_IN_DISPLAY=yes
194 AC_DEFINE(IP_TOS_IS_BROKEN)
195 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
196 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
197 # Attention: always take care to bind libsocket and libnsl before libc,
198 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
201 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
202 LDFLAGS="$LDFLAGS -L/usr/local/lib"
207 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
208 LDFLAGS="$LDFLAGS -L/usr/local/lib"
213 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
214 LDFLAGS="$LDFLAGS -L/usr/local/lib"
217 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
218 LDFLAGS="$LDFLAGS -L/usr/local/lib"
219 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
220 rsh_path="/usr/bin/rcmd"
223 AC_DEFINE(BROKEN_SYS_TERMIO_H)
225 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
226 AC_DEFINE(DISABLE_SHADOW)
227 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
228 AC_DEFINE(BROKEN_SAVED_UIDS)
229 AC_CHECK_FUNCS(getluid setluid)
231 do_sco3_extra_lib_check=yes
234 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
235 LDFLAGS="$LDFLAGS -L/usr/local/lib"
236 LIBS="$LIBS -lprot -lx -ltinfo -lm"
238 rsh_path="/usr/bin/rcmd"
240 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
241 AC_DEFINE(DISABLE_SHADOW)
242 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
243 AC_CHECK_FUNCS(getluid setluid)
250 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
251 LIBS="$LIBS -lgen -lrsc"
254 AC_MSG_CHECKING(for Digital Unix SIA)
257 [ --with-osfsia Enable Digital Unix SIA],
259 if test "x$withval" = "xno" ; then
260 AC_MSG_RESULT(disabled)
265 if test -z "$no_osfsia" ; then
266 if test -f /etc/sia/matrix.conf; then
268 AC_DEFINE(HAVE_OSF_SIA)
269 AC_DEFINE(DISABLE_LOGIN)
270 LIBS="$LIBS -lsecurity -ldb -lm -laud"
279 AC_DEFINE(NO_X11_UNIX_SOCKETS)
280 AC_DEFINE(MISSING_NFDBITS)
281 AC_DEFINE(MISSING_HOWMANY)
282 AC_DEFINE(MISSING_FD_MASK)
286 # Allow user to specify flags
288 [ --with-cflags Specify additional flags to pass to compiler],
290 if test "x$withval" != "xno" ; then
291 CFLAGS="$CFLAGS $withval"
295 AC_ARG_WITH(cppflags,
296 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
298 if test "x$withval" != "xno"; then
299 CPPFLAGS="$CPPFLAGS $withval"
304 [ --with-ldflags Specify additional flags to pass to linker],
306 if test "x$withval" != "xno" ; then
307 LDFLAGS="$LDFLAGS $withval"
312 [ --with-libs Specify additional libraries to link with],
314 if test "x$withval" != "xno" ; then
315 LIBS="$LIBS $withval"
321 [ --with-pcre[[=PATH]] Override built in regex library with pcre
322 (optionally in PATH)],
327 if test "x$withval" != "xyes"; then
328 if test -d "$withval/lib"; then
329 if test -n "${need_dash_r}"; then
330 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
332 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
335 if test -n "${need_dash_r}"; then
336 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
338 LDFLAGS="-L${withval} ${LDFLAGS}"
341 if test -d "$withval/include"; then
342 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
344 CPPFLAGS="-I${withval} ${CPPFLAGS}"
348 AC_CHECK_HEADER(pcreposix.h,
349 AC_CHECK_LIB(pcre, pcre_info,[
350 AC_DEFINE(HAVE_LIBPCRE)
351 LIBS="$LIBS -lpcreposix -lpcre"
353 AC_MSG_ERROR([*** unable to locate pcre library ***])),
354 AC_MSG_ERROR([*** unable to locate pcreposix.h include file ***]))
360 # Checks for libraries.
361 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
362 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
364 dnl SCO OS3 needs this for libwrap
365 if test "x$with_tcp_wrappers" != "xno" ; then
366 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
367 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
371 AC_CHECK_FUNC(getspnam, ,
372 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
376 [ --with-zlib=PATH Use zlib in PATH],
378 if test -d "$withval/lib"; then
379 if test -n "${need_dash_r}"; then
380 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
382 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
385 if test -n "${need_dash_r}"; then
386 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
388 LDFLAGS="-L${withval} ${LDFLAGS}"
391 if test -d "$withval/include"; then
392 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
394 CPPFLAGS="-I${withval} ${CPPFLAGS}"
399 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
401 # We don't want to check if we did an pcre override.
402 if test -z "$no_comp_check" ; then
403 AC_CHECK_FUNC(regcomp,
404 [ AC_DEFINE(HAVE_REGCOMP)],
406 AC_CHECK_LIB(pcre, pcre_info,
408 AC_DEFINE(HAVE_LIBPCRE)
409 LIBS="$LIBS -lpcreposix -lpcre"
412 AC_MSG_ERROR([*** No regex library found.])
419 AC_CHECK_FUNC(strcasecmp,
420 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
422 AC_CHECK_FUNC(utimes,
423 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
426 dnl Checks for libutil functions
427 AC_CHECK_HEADERS(libutil.h)
428 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
429 AC_CHECK_FUNCS(logout updwtmp logwtmp)
433 # Checks for header files.
434 AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
435 getopt.h glob.h lastlog.h limits.h login.h \
436 login_cap.h maillock.h netdb.h netgroup.h \
437 netinet/in_systm.h paths.h poll.h pty.h regex.h \
438 security/pam_appl.h shadow.h stddef.h stdint.h \
439 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
440 sys/poll.h sys/queue.h sys/select.h sys/stat.h \
441 sys/stropts.h sys/sysmacros.h sys/time.h \
442 sys/ttcompat.h sys/un.h time.h ttyent.h usersec.h \
443 util.h utime.h utmp.h utmpx.h)
445 # Check for ALTDIRFUNC glob() extension
446 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
447 AC_EGREP_CPP(FOUNDIT,
450 #ifdef GLOB_ALTDIRFUNC
455 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
463 # Check for g.gl_matchc glob() extension
464 AC_MSG_CHECKING(for gl_matchc field in glob_t)
465 AC_EGREP_CPP(FOUNDIT,
468 int main(void){glob_t g; g.gl_matchc = 1;}
471 AC_DEFINE(GLOB_HAS_GL_MATCHC)
479 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
482 #include <sys/types.h>
484 int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
486 [AC_MSG_RESULT(yes)],
489 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
493 # Check whether user wants S/Key support
496 [ --with-skey[[=PATH]] Enable S/Key support
497 (optionally in PATH)],
499 if test "x$withval" != "xno" ; then
501 if test "x$withval" != "xyes" ; then
502 CPPFLAGS="$CPPFLAGS -I${withval}/include"
503 LDFLAGS="$LDFLAGS -L${withval}/lib"
510 AC_CHECK_FUNC(skey_keyinfo,
513 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
519 # Check whether user wants TCP wrappers support
521 AC_ARG_WITH(tcp-wrappers,
522 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
523 (optionally in PATH)],
525 if test "x$withval" != "xno" ; then
527 saved_LDFLAGS="$LDFLAGS"
528 saved_CPPFLAGS="$CPPFLAGS"
529 if test -n "${withval}" -a "${withval}" != "yes"; then
530 if test -d "${withval}/lib"; then
531 if test -n "${need_dash_r}"; then
532 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
534 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
537 if test -n "${need_dash_r}"; then
538 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
540 LDFLAGS="-L${withval} ${LDFLAGS}"
543 if test -d "${withval}/include"; then
544 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
546 CPPFLAGS="-I${withval} ${CPPFLAGS}"
550 AC_MSG_CHECKING(for libwrap)
554 int deny_severity = 0, allow_severity = 0;
563 AC_MSG_ERROR([*** libwrap missing])
570 dnl Checks for library functions.
571 AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa \
572 clock fchmod fchown freeaddrinfo futimes gai_strerror \
573 getaddrinfo getcwd getgrouplist getnameinfo getopt \
574 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
575 inet_ntop innetgr login_getcapbool md5_crypt memmove \
576 mkdtemp on_exit openpty readpassphrase realpath \
577 rresvport_af setdtablesize setegid setenv seteuid \
578 setlogin setproctitle setresgid setreuid setrlimit \
579 setsid setvbuf sigaction sigvec snprintf strerror \
580 strlcat strlcpy strmode strsep sysconf tcgetpgrp utimes \
581 vhangup vsnprintf waitpid __b64_ntop _getpty)
583 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
584 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
585 AC_CHECK_LIB(gen, dirname,[
586 AC_CACHE_CHECK([for broken dirname],
587 ac_cv_have_broken_dirname, [
595 int main(int argc, char **argv) {
598 strncpy(buf,"/etc", 32);
600 if (!s || strncmp(s, "/", 32) != 0) {
607 [ ac_cv_have_broken_dirname="no" ],
608 [ ac_cv_have_broken_dirname="yes" ]
612 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
614 AC_DEFINE(HAVE_DIRNAME)
615 AC_CHECK_HEADERS(libgen.h)
620 dnl Checks for time functions
621 AC_CHECK_FUNCS(gettimeofday time)
622 dnl Checks for utmp functions
623 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
624 AC_CHECK_FUNCS(utmpname)
625 dnl Checks for utmpx functions
626 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
627 AC_CHECK_FUNCS(setutxent utmpxname)
629 AC_CHECK_FUNC(getuserattr,
630 [AC_DEFINE(HAVE_GETUSERATTR)],
631 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
634 AC_CHECK_FUNC(daemon,
635 [AC_DEFINE(HAVE_DAEMON)],
636 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
639 AC_CHECK_FUNC(getpagesize,
640 [AC_DEFINE(HAVE_GETPAGESIZE)],
641 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
644 # Check for broken snprintf
645 if test "x$ac_cv_func_snprintf" = "xyes" ; then
646 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
650 int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
652 [AC_MSG_RESULT(yes)],
655 AC_DEFINE(BROKEN_SNPRINTF)
656 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
666 [ --with-pam Enable PAM support ],
668 if test "x$withval" != "xno" ; then
669 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
670 AC_MSG_ERROR([PAM headers not found])
673 AC_CHECK_LIB(dl, dlopen, , )
674 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
675 AC_CHECK_FUNCS(pam_getenvlist)
685 # Check for older PAM
686 if test "x$PAM_MSG" = "xyes" ; then
687 # Check PAM strerror arguments (old PAM)
688 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
692 #include <security/pam_appl.h>
694 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
697 AC_DEFINE(HAVE_OLD_PAM)
699 PAM_MSG="yes (old library)"
704 # The big search for OpenSSL
706 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
708 if test "x$withval" != "xno" ; then
715 saved_LDFLAGS="$LDFLAGS"
716 saved_CPPFLAGS="$CPPFLAGS"
717 if test "x$prefix" != "xNONE" ; then
718 tryssldir="$tryssldir $prefix"
720 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
721 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
722 CPPFLAGS="$saved_CPPFLAGS"
723 LDFLAGS="$saved_LDFLAGS"
724 LIBS="$saved_LIBS -lcrypto"
726 # Skip directories if they don't exist
727 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
730 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
731 # Try to use $ssldir/lib if it exists, otherwise
733 if test -d "$ssldir/lib" ; then
734 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
735 if test ! -z "$need_dash_r" ; then
736 LDFLAGS="-R$ssldir/lib $LDFLAGS"
739 LDFLAGS="-L$ssldir $saved_LDFLAGS"
740 if test ! -z "$need_dash_r" ; then
741 LDFLAGS="-R$ssldir $LDFLAGS"
744 # Try to use $ssldir/include if it exists, otherwise
746 if test -d "$ssldir/include" ; then
747 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
749 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
753 # Basic test to check for compatible version and correct linking
754 # *does not* test for RSA - that comes later.
758 #include <openssl/rand.h>
762 memset(a, 0, sizeof(a));
763 RAND_add(a, sizeof(a), sizeof(a));
764 return(RAND_status() <= 0);
773 if test ! -z "$found_crypto" ; then
778 if test -z "$found_crypto" ; then
779 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
781 if test -z "$ssldir" ; then
785 ac_cv_openssldir=$ssldir
788 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
789 AC_DEFINE(HAVE_OPENSSL)
790 dnl Need to recover ssldir - test above runs in subshell
791 ssldir=$ac_cv_openssldir
792 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
793 # Try to use $ssldir/lib if it exists, otherwise
795 if test -d "$ssldir/lib" ; then
796 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
797 if test ! -z "$need_dash_r" ; then
798 LDFLAGS="-R$ssldir/lib $LDFLAGS"
801 LDFLAGS="-L$ssldir $saved_LDFLAGS"
802 if test ! -z "$need_dash_r" ; then
803 LDFLAGS="-R$ssldir $LDFLAGS"
806 # Try to use $ssldir/include if it exists, otherwise
808 if test -d "$ssldir/include" ; then
809 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
811 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
815 LIBS="$saved_LIBS -lcrypto"
817 # Now test RSA support
819 AC_MSG_CHECKING([for RSA support])
820 for WANTS_RSAREF in "" 1 ; do
821 if test -z "$WANTS_RSAREF" ; then
824 LIBS="$saved_LIBS -lRSAglue -lrsaref"
828 #include <openssl/rand.h>
829 #include <openssl/rsa.h>
830 #include <openssl/bn.h>
831 #include <openssl/sha.h>
834 int num; RSA *key; static unsigned char p_in[] = "blahblah";
835 unsigned char c[256], p[256];
836 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
837 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
838 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
839 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
849 if test ! -z "$no_rsa" ; then
850 AC_MSG_RESULT(disabled)
853 if test -z "$rsa_works" ; then
854 AC_MSG_WARN([*** No RSA support found *** ])
857 if test -z "$WANTS_RSAREF" ; then
861 RSA_MSG="yes (using RSAref)"
862 AC_MSG_RESULT(using RSAref)
863 LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
868 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
869 # version in OpenSSL. Skip this for PAM
870 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
871 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
874 # Cheap hack to ensure NEWS-OS libraries are arranged right.
875 if test ! -z "$SONY" ; then
876 LIBS="$LIBS -liberty";
879 # Checks for data types
880 AC_CHECK_SIZEOF(char, 1)
881 AC_CHECK_SIZEOF(short int, 2)
882 AC_CHECK_SIZEOF(int, 4)
883 AC_CHECK_SIZEOF(long int, 4)
884 AC_CHECK_SIZEOF(long long int, 8)
886 # More checks for data types
887 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
889 [ #include <sys/types.h> ],
891 [ ac_cv_have_u_int="yes" ],
892 [ ac_cv_have_u_int="no" ]
895 if test "x$ac_cv_have_u_int" = "xyes" ; then
896 AC_DEFINE(HAVE_U_INT)
900 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
902 [ #include <sys/types.h> ],
903 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
904 [ ac_cv_have_intxx_t="yes" ],
905 [ ac_cv_have_intxx_t="no" ]
908 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
909 AC_DEFINE(HAVE_INTXX_T)
913 if (test -z "$have_intxx_t" && \
914 test "x$ac_cv_header_stdint_h" = "xyes")
916 AC_MSG_CHECKING([for intXX_t types in stdint.h])
918 [ #include <stdint.h> ],
919 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
921 AC_DEFINE(HAVE_INTXX_T)
924 [ AC_MSG_RESULT(no) ]
928 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
930 [ #include <sys/types.h> ],
931 [ int64_t a; a = 1;],
932 [ ac_cv_have_int64_t="yes" ],
933 [ ac_cv_have_int64_t="no" ]
936 if test "x$ac_cv_have_int64_t" = "xyes" ; then
937 AC_DEFINE(HAVE_INT64_T)
941 if test -z "$have_int64_t" ; then
942 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
944 [ #include <sys/socket.h> ],
947 AC_DEFINE(HAVE_INT64_T)
950 [ AC_MSG_RESULT(no) ]
954 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
956 [ #include <sys/types.h> ],
957 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
958 [ ac_cv_have_u_intxx_t="yes" ],
959 [ ac_cv_have_u_intxx_t="no" ]
962 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
963 AC_DEFINE(HAVE_U_INTXX_T)
967 if test -z "$have_u_intxx_t" ; then
968 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
970 [ #include <sys/socket.h> ],
971 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
973 AC_DEFINE(HAVE_U_INTXX_T)
976 [ AC_MSG_RESULT(no) ]
980 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
982 [ #include <sys/types.h> ],
983 [ u_int64_t a; a = 1;],
984 [ ac_cv_have_u_int64_t="yes" ],
985 [ ac_cv_have_u_int64_t="no" ]
988 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
989 AC_DEFINE(HAVE_U_INT64_T)
993 if test -z "$have_u_intxx_t" ; then
994 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
997 #include <sys/types.h>
999 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1000 [ ac_cv_have_uintxx_t="yes" ],
1001 [ ac_cv_have_uintxx_t="no" ]
1004 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1005 AC_DEFINE(HAVE_UINTXX_T)
1009 if test -z "$have_uintxx_t" ; then
1010 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1012 [ #include <stdint.h> ],
1013 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1015 AC_DEFINE(HAVE_UINTXX_T)
1018 [ AC_MSG_RESULT(no) ]
1022 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1023 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1025 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1028 #include <sys/bitypes.h>
1031 int8_t a; int16_t b; int32_t c;
1032 u_int8_t e; u_int16_t f; u_int32_t g;
1033 a = b = c = e = f = g = 1;
1036 AC_DEFINE(HAVE_U_INTXX_T)
1037 AC_DEFINE(HAVE_INTXX_T)
1045 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1048 #include <sys/types.h>
1050 [ u_char foo; foo = 125; ],
1051 [ ac_cv_have_u_char="yes" ],
1052 [ ac_cv_have_u_char="no" ]
1055 if test "x$ac_cv_have_u_char" = "xyes" ; then
1056 AC_DEFINE(HAVE_U_CHAR)
1061 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1064 #include <sys/types.h>
1066 [ size_t foo; foo = 1235; ],
1067 [ ac_cv_have_size_t="yes" ],
1068 [ ac_cv_have_size_t="no" ]
1071 if test "x$ac_cv_have_size_t" = "xyes" ; then
1072 AC_DEFINE(HAVE_SIZE_T)
1075 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1078 #include <sys/types.h>
1080 [ ssize_t foo; foo = 1235; ],
1081 [ ac_cv_have_ssize_t="yes" ],
1082 [ ac_cv_have_ssize_t="no" ]
1085 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1086 AC_DEFINE(HAVE_SSIZE_T)
1089 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1094 [ clock_t foo; foo = 1235; ],
1095 [ ac_cv_have_clock_t="yes" ],
1096 [ ac_cv_have_clock_t="no" ]
1099 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1100 AC_DEFINE(HAVE_CLOCK_T)
1103 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1106 #include <sys/types.h>
1107 #include <sys/socket.h>
1109 [ sa_family_t foo; foo = 1235; ],
1110 [ ac_cv_have_sa_family_t="yes" ],
1113 #include <sys/types.h>
1114 #include <sys/socket.h>
1115 #include <netinet/in.h>
1117 [ sa_family_t foo; foo = 1235; ],
1118 [ ac_cv_have_sa_family_t="yes" ],
1120 [ ac_cv_have_sa_family_t="no" ]
1124 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1125 AC_DEFINE(HAVE_SA_FAMILY_T)
1128 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1131 #include <sys/types.h>
1133 [ pid_t foo; foo = 1235; ],
1134 [ ac_cv_have_pid_t="yes" ],
1135 [ ac_cv_have_pid_t="no" ]
1138 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1139 AC_DEFINE(HAVE_PID_T)
1142 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1145 #include <sys/types.h>
1147 [ mode_t foo; foo = 1235; ],
1148 [ ac_cv_have_mode_t="yes" ],
1149 [ ac_cv_have_mode_t="no" ]
1152 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1153 AC_DEFINE(HAVE_MODE_T)
1157 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1160 #include <sys/types.h>
1161 #include <sys/socket.h>
1163 [ struct sockaddr_storage s; ],
1164 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1165 [ ac_cv_have_struct_sockaddr_storage="no" ]
1168 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1169 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1172 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1175 #include <sys/types.h>
1176 #include <netinet/in.h>
1178 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1179 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1180 [ ac_cv_have_struct_sockaddr_in6="no" ]
1183 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1184 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1187 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1190 #include <sys/types.h>
1191 #include <netinet/in.h>
1193 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1194 [ ac_cv_have_struct_in6_addr="yes" ],
1195 [ ac_cv_have_struct_in6_addr="no" ]
1198 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1199 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1202 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1205 #include <sys/types.h>
1206 #include <sys/socket.h>
1209 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1210 [ ac_cv_have_struct_addrinfo="yes" ],
1211 [ ac_cv_have_struct_addrinfo="no" ]
1214 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1215 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1218 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1220 [ #include <sys/time.h> ],
1221 [ struct timeval tv; tv.tv_sec = 1;],
1222 [ ac_cv_have_struct_timeval="yes" ],
1223 [ ac_cv_have_struct_timeval="no" ]
1226 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1227 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1228 have_struct_timeval=1
1231 # If we don't have int64_t then we can't compile sftp-server. So don't
1232 # even attempt to do it.
1233 if test "x$ac_cv_have_int64_t" = "xno" -a \
1234 "x$ac_cv_sizeof_long_int" != "x8" -a \
1235 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1238 dnl test snprintf (broken on SCO w/gcc)
1243 #ifdef HAVE_SNPRINTF
1247 char expected_out[50];
1249 #if (SIZEOF_LONG_INT == 8)
1250 long int num = 0x7fffffffffffffff;
1252 long long num = 0x7fffffffffffffffll;
1254 strcpy(expected_out, "9223372036854775807");
1255 snprintf(buf, mazsize, "%lld", num);
1256 if(strcmp(buf, expected_out) != 0)
1263 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1268 dnl Checks for structure members
1269 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1270 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1271 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1272 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1273 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1274 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1275 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1276 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1277 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1278 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1279 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1280 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1281 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1282 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1283 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1284 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1285 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1287 AC_CHECK_MEMBERS([struct stat.st_blksize])
1289 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1290 ac_cv_have_ss_family_in_struct_ss, [
1293 #include <sys/types.h>
1294 #include <sys/socket.h>
1296 [ struct sockaddr_storage s; s.ss_family = 1; ],
1297 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1298 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1301 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1302 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1305 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1306 ac_cv_have___ss_family_in_struct_ss, [
1309 #include <sys/types.h>
1310 #include <sys/socket.h>
1312 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1313 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1314 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1317 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1318 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1321 AC_CACHE_CHECK([for pw_class field in struct passwd],
1322 ac_cv_have_pw_class_in_struct_passwd, [
1327 [ struct passwd p; p.pw_class = 0; ],
1328 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1329 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1332 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1333 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1336 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1337 ac_cv_have_pw_expire_in_struct_passwd, [
1342 [ struct passwd p; p.pw_expire = 0; ],
1343 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1344 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1347 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1348 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1351 AC_CACHE_CHECK([for pw_change field in struct passwd],
1352 ac_cv_have_pw_change_in_struct_passwd, [
1357 [ struct passwd p; p.pw_change = 0; ],
1358 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1359 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1362 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1363 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1366 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1368 [ extern char *__progname; printf("%s", __progname); ],
1369 [ ac_cv_libc_defines___progname="yes" ],
1370 [ ac_cv_libc_defines___progname="no" ]
1373 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1374 AC_DEFINE(HAVE___PROGNAME)
1377 AC_CACHE_CHECK([whether getopt has optreset support],
1378 ac_cv_have_getopt_optreset, [
1383 [ extern int optreset; optreset = 0; ],
1384 [ ac_cv_have_getopt_optreset="yes" ],
1385 [ ac_cv_have_getopt_optreset="no" ]
1388 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1389 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1392 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1394 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1395 [ ac_cv_libc_defines_sys_errlist="yes" ],
1396 [ ac_cv_libc_defines_sys_errlist="no" ]
1399 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1400 AC_DEFINE(HAVE_SYS_ERRLIST)
1404 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1406 [ extern int sys_nerr; printf("%i", sys_nerr);],
1407 [ ac_cv_libc_defines_sys_nerr="yes" ],
1408 [ ac_cv_libc_defines_sys_nerr="no" ]
1411 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1412 AC_DEFINE(HAVE_SYS_NERR)
1416 # Check whether user wants Kerberos support
1418 AC_ARG_WITH(smartcard,
1419 [ --with-smartcard Enable smartcard support],
1421 if test "x$withval" != "xno" ; then
1422 if test "x$withval" != "xyes" ; then
1423 CPPFLAGS="$CPPFLAGS -I${withval}"
1424 LDFLAGS="$LDFLAGS -L${withval}"
1425 if test ! -z "$need_dash_r" ; then
1426 LDFLAGS="$LDFLAGS -R${withval}"
1428 if test ! -z "$blibpath" ; then
1429 blibpath="$blibpath:${withval}"
1432 AC_CHECK_HEADERS(sectok.h)
1433 if test "$ac_cv_header_sectok_h" != yes; then
1434 AC_MSG_ERROR(Can't find sectok.h)
1436 AC_CHECK_LIB(sectok, sectok_open)
1437 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1438 AC_MSG_ERROR(Can't find libsectok)
1440 AC_DEFINE(SMARTCARD)
1446 # Check whether user wants Kerberos support
1448 AC_ARG_WITH(kerberos4,
1449 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1451 if test "x$withval" != "xno" ; then
1452 if test "x$withval" != "xyes" ; then
1453 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1454 LDFLAGS="$LDFLAGS -L${withval}/lib"
1455 if test ! -z "$need_dash_r" ; then
1456 LDFLAGS="$LDFLAGS -R${withval}/lib"
1458 if test ! -z "$blibpath" ; then
1459 blibpath="$blibpath:${withval}/lib"
1462 if test -d /usr/include/kerberosIV ; then
1463 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1467 AC_CHECK_HEADERS(krb.h)
1468 if test "$ac_cv_header_krb_h" != yes; then
1469 AC_MSG_WARN([Cannot find krb.h, build may fail])
1471 AC_CHECK_LIB(krb, main)
1472 if test "$ac_cv_lib_krb_main" != yes; then
1473 AC_CHECK_LIB(krb4, main)
1474 if test "$ac_cv_lib_krb4_main" != yes; then
1475 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1482 AC_CHECK_LIB(des, des_cbc_encrypt)
1483 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1484 AC_CHECK_LIB(des425, des_cbc_encrypt)
1485 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1486 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1493 AC_CHECK_LIB(resolv, dn_expand, , )
1501 # Check whether user wants AFS support
1504 [ --with-afs=PATH Enable AFS support],
1506 if test "x$withval" != "xno" ; then
1508 if test "x$withval" != "xyes" ; then
1509 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1510 LDFLAGS="$LDFLAGS -L${withval}/lib"
1513 if test -z "$KRB4" ; then
1514 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1518 if test ! -z "$AFS_LIBS" ; then
1519 LIBS="$LIBS $AFS_LIBS"
1528 # Looking for programs, paths and files
1530 [ --with-rsh=PATH Specify path to remote shell program ],
1532 if test "x$withval" != "$no" ; then
1537 AC_PATH_PROG(rsh_path, rsh)
1542 [ --with-xauth=PATH Specify path to xauth program ],
1544 if test "x$withval" != "xno" ; then
1549 AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin)
1550 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
1551 xauth_path="/usr/openwin/bin/xauth"
1556 if test -z "$xauth_path" ; then
1557 XAUTH_PATH="undefined"
1558 AC_SUBST(XAUTH_PATH)
1560 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
1561 XAUTH_PATH=$xauth_path
1562 AC_SUBST(XAUTH_PATH)
1564 if test ! -z "$rsh_path" ; then
1565 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1568 # Check for mail directory (last resort if we cannot get it from headers)
1569 if test ! -z "$MAIL" ; then
1570 maildir=`dirname $MAIL`
1571 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1574 if test -z "$no_dev_ptmx" ; then
1575 AC_CHECK_FILE("/dev/ptmx",
1577 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1582 AC_CHECK_FILE("/dev/ptc",
1584 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1589 # Options from here on. Some of these are preset by platform above
1591 # Check for user-specified random device, otherwise check /dev/urandom
1593 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
1595 if test "x$withval" != "xno" ; then
1596 RANDOM_POOL="$withval";
1597 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1601 # Check for random device
1602 AC_CHECK_FILE("/dev/urandom",
1604 RANDOM_POOL="/dev/urandom";
1605 AC_SUBST(RANDOM_POOL)
1606 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1612 # Check for PRNGD/EGD pool file
1613 AC_ARG_WITH(prngd-port,
1614 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1616 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1617 PRNGD_PORT="$withval"
1618 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1623 # Check for PRNGD/EGD pool file
1624 AC_ARG_WITH(prngd-socket,
1625 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1627 if test "x$withval" != "xno" ; then
1628 PRNGD_SOCKET="$withval"
1629 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1633 # Check for existing socket only if we don't have a random device already
1634 if test -z "$RANDOM_POOL" ; then
1635 AC_MSG_CHECKING(for PRNGD/EGD socket)
1636 # Insert other locations here
1637 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1638 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1639 PRNGD_SOCKET="$sock"
1640 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1644 if test ! -z "$PRNGD_SOCKET" ; then
1645 AC_MSG_RESULT($PRNGD_SOCKET)
1647 AC_MSG_RESULT(not found)
1654 # detect pathnames for entropy gathering commands, if we need them
1655 INSTALL_SSH_PRNG_CMDS=""
1657 if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
1658 # Use these commands to collect entropy
1659 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1660 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1661 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1662 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1663 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1664 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1665 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1666 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1667 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1668 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1669 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1670 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1671 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1672 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1673 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1674 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1676 INSTALL_SSH_PRNG_CMDS="yes"
1678 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1681 AC_ARG_WITH(mantype,
1682 [ --with-mantype=man|cat|doc Set man page type],
1689 AC_MSG_ERROR(invalid man type: $withval)
1694 if test -z "$MANTYPE"; then
1695 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
1696 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1698 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1705 if test "$MANTYPE" = "doc"; then
1712 # Check whether to enable MD5 passwords
1714 AC_ARG_WITH(md5-passwords,
1715 [ --with-md5-passwords Enable use of MD5 passwords],
1717 if test "x$withval" != "xno" ; then
1718 AC_DEFINE(HAVE_MD5_PASSWORDS)
1724 # Whether to disable shadow password support
1726 [ --without-shadow Disable shadow password support],
1728 if test "x$withval" = "xno" ; then
1729 AC_DEFINE(DISABLE_SHADOW)
1735 if test -z "$disable_shadow" ; then
1736 AC_MSG_CHECKING([if the systems has expire shadow information])
1739 #include <sys/types.h>
1742 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1743 [ sp_expire_available=yes ], []
1746 if test "x$sp_expire_available" = "xyes" ; then
1748 AC_DEFINE(HAS_SHADOW_EXPIRE)
1754 # Use ip address instead of hostname in $DISPLAY
1755 if test ! -z "$IPADDR_IN_DISPLAY" ; then
1756 DISPLAY_HACK_MSG="yes"
1757 AC_DEFINE(IPADDR_IN_DISPLAY)
1759 DISPLAY_HACK_MSG="no"
1760 AC_ARG_WITH(ipaddr-display,
1761 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1763 if test "x$withval" != "xno" ; then
1764 AC_DEFINE(IPADDR_IN_DISPLAY)
1765 DISPLAY_HACK_MSG="yes"
1771 # Whether to mess with the default path
1772 SERVER_PATH_MSG="(default)"
1773 AC_ARG_WITH(default-path,
1774 [ --with-default-path=PATH Specify default \$PATH environment for server],
1776 if test "x$withval" != "xno" ; then
1777 user_path="$withval"
1778 SERVER_PATH_MSG="$withval"
1784 /* find out what STDPATH is */
1789 #ifndef _PATH_STDPATH
1790 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1792 #include <sys/types.h>
1793 #include <sys/stat.h>
1795 #define DATA "conftest.stdpath"
1802 fd = fopen(DATA,"w");
1806 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1811 ], [ user_path=`cat conftest.stdpath` ],
1812 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1813 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1815 # make sure $bindir is in USER_PATH so scp will work
1816 t_bindir=`eval echo ${bindir}`
1818 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1821 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1823 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1824 if test $? -ne 0 ; then
1825 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1826 if test $? -ne 0 ; then
1827 user_path=$user_path:$t_bindir
1828 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1833 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1836 # Whether to force IPv4 by default (needed on broken glibc Linux)
1838 AC_ARG_WITH(ipv4-default,
1839 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1841 if test "x$withval" != "xno" ; then
1842 AC_DEFINE(IPV4_DEFAULT)
1848 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
1849 IPV4_IN6_HACK_MSG="no"
1851 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1853 if test "x$withval" != "xno" ; then
1855 AC_DEFINE(IPV4_IN_IPV6)
1856 IPV4_IN6_HACK_MSG="yes"
1861 if test "x$inet6_default_4in6" = "xyes"; then
1862 AC_MSG_RESULT([yes (default)])
1863 AC_DEFINE(IPV4_IN_IPV6)
1864 IPV4_IN6_HACK_MSG="yes"
1866 AC_MSG_RESULT([no (default)])
1871 # Whether to enable BSD auth support
1872 AC_ARG_WITH(bsd-auth,
1873 [ --with-bsd-auth Enable BSD auth support],
1875 if test "x$withval" != "xno" ; then
1882 AC_MSG_CHECKING(whether to install ssh as suid root)
1883 AC_ARG_ENABLE(suid-ssh,
1884 [ --enable-suid-ssh Install ssh as suid root (default)
1885 --disable-suid-ssh Install ssh without suid bit],
1886 [ case "$enableval" in
1891 *) AC_MSG_RESULT(yes)
1901 # Where to place sshd.pid
1903 AC_ARG_WITH(pid-dir,
1904 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1906 if test "x$withval" != "xno" ; then
1912 # make sure the directory exists
1913 if test ! -d $piddir ; then
1914 piddir=`eval echo ${sysconfdir}`
1916 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1920 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
1923 dnl allow user to disable some login recording features
1924 AC_ARG_ENABLE(lastlog,
1925 [ --disable-lastlog disable use of lastlog even if detected [no]],
1926 [ AC_DEFINE(DISABLE_LASTLOG) ]
1929 [ --disable-utmp disable use of utmp even if detected [no]],
1930 [ AC_DEFINE(DISABLE_UTMP) ]
1932 AC_ARG_ENABLE(utmpx,
1933 [ --disable-utmpx disable use of utmpx even if detected [no]],
1934 [ AC_DEFINE(DISABLE_UTMPX) ]
1937 [ --disable-wtmp disable use of wtmp even if detected [no]],
1938 [ AC_DEFINE(DISABLE_WTMP) ]
1940 AC_ARG_ENABLE(wtmpx,
1941 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
1942 [ AC_DEFINE(DISABLE_WTMPX) ]
1944 AC_ARG_ENABLE(libutil,
1945 [ --disable-libutil disable use of libutil (login() etc.) [no]],
1946 [ AC_DEFINE(DISABLE_LOGIN) ]
1948 AC_ARG_ENABLE(pututline,
1949 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
1950 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1952 AC_ARG_ENABLE(pututxline,
1953 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
1954 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1956 AC_ARG_WITH(lastlog,
1957 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
1959 if test "x$withval" = "xno" ; then
1960 AC_DEFINE(DISABLE_LASTLOG)
1962 conf_lastlog_location=$withval
1967 dnl lastlog, [uw]tmpx? detection
1968 dnl NOTE: set the paths in the platform section to avoid the
1969 dnl need for command-line parameters
1970 dnl lastlog and [uw]tmp are subject to a file search if all else fails
1972 dnl lastlog detection
1973 dnl NOTE: the code itself will detect if lastlog is a directory
1974 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1976 #include <sys/types.h>
1978 #ifdef HAVE_LASTLOG_H
1979 # include <lastlog.h>
1988 [ char *lastlog = LASTLOG_FILE; ],
1989 [ AC_MSG_RESULT(yes) ],
1992 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1994 #include <sys/types.h>
1996 #ifdef HAVE_LASTLOG_H
1997 # include <lastlog.h>
2003 [ char *lastlog = _PATH_LASTLOG; ],
2004 [ AC_MSG_RESULT(yes) ],
2007 system_lastlog_path=no
2012 if test -z "$conf_lastlog_location"; then
2013 if test x"$system_lastlog_path" = x"no" ; then
2014 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2015 if (test -d "$f" || test -f "$f") ; then
2016 conf_lastlog_location=$f
2019 if test -z "$conf_lastlog_location"; then
2020 AC_MSG_WARN([** Cannot find lastlog **])
2021 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2026 if test -n "$conf_lastlog_location"; then
2027 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2031 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2033 #include <sys/types.h>
2039 [ char *utmp = UTMP_FILE; ],
2040 [ AC_MSG_RESULT(yes) ],
2042 system_utmp_path=no ]
2044 if test -z "$conf_utmp_location"; then
2045 if test x"$system_utmp_path" = x"no" ; then
2046 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2047 if test -f $f ; then
2048 conf_utmp_location=$f
2051 if test -z "$conf_utmp_location"; then
2052 AC_DEFINE(DISABLE_UTMP)
2056 if test -n "$conf_utmp_location"; then
2057 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2061 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2063 #include <sys/types.h>
2069 [ char *wtmp = WTMP_FILE; ],
2070 [ AC_MSG_RESULT(yes) ],
2072 system_wtmp_path=no ]
2074 if test -z "$conf_wtmp_location"; then
2075 if test x"$system_wtmp_path" = x"no" ; then
2076 for f in /usr/adm/wtmp /var/log/wtmp; do
2077 if test -f $f ; then
2078 conf_wtmp_location=$f
2081 if test -z "$conf_wtmp_location"; then
2082 AC_DEFINE(DISABLE_WTMP)
2086 if test -n "$conf_wtmp_location"; then
2087 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2091 dnl utmpx detection - I don't know any system so perverse as to require
2092 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2094 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2096 #include <sys/types.h>
2105 [ char *utmpx = UTMPX_FILE; ],
2106 [ AC_MSG_RESULT(yes) ],
2108 system_utmpx_path=no ]
2110 if test -z "$conf_utmpx_location"; then
2111 if test x"$system_utmpx_path" = x"no" ; then
2112 AC_DEFINE(DISABLE_UTMPX)
2115 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2119 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2121 #include <sys/types.h>
2130 [ char *wtmpx = WTMPX_FILE; ],
2131 [ AC_MSG_RESULT(yes) ],
2133 system_wtmpx_path=no ]
2135 if test -z "$conf_wtmpx_location"; then
2136 if test x"$system_wtmpx_path" = x"no" ; then
2137 AC_DEFINE(DISABLE_WTMPX)
2140 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2144 # Change default command timeout for builtin PRNG
2146 AC_ARG_WITH(entropy-timeout,
2147 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2149 if test "x$withval" != "xno" ; then
2150 entropy_timeout=$withval
2154 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
2157 if test ! -z "$blibpath" ; then
2158 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2159 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2164 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2167 # Print summary of options
2169 if test ! -z "$RANDOM_POOL" ; then
2170 RAND_MSG="Device ($RANDOM_POOL)"
2172 if test ! -z "$PRNGD_PORT" ; then
2173 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
2174 elif test ! -z "$PRNGD_SOCKET" ; then
2175 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
2177 RAND_MSG="Builtin (timeout $entropy_timeout)"
2182 # Someone please show me a better way :)
2183 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2184 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2185 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2186 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2187 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2188 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2189 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2190 H=`eval echo ${user_path}` ; H=`eval echo ${H}`
2193 echo "OpenSSH has been configured with the following options:"
2194 echo " User binaries: $B"
2195 echo " System binaries: $C"
2196 echo " Configuration files: $D"
2197 echo " Askpass program: $E"
2198 echo " Manual pages: $F"
2199 echo " PID file: $G"
2200 echo " sshd default user PATH: $H"
2201 echo " Random number collection: $RAND_MSG"
2202 echo " Manpage format: $MANTYPE"
2203 echo " PAM support: ${PAM_MSG}"
2204 echo " KerberosIV support: $KRB4_MSG"
2205 echo " Smartcard support: $SCARD_MSG"
2206 echo " AFS support: $AFS_MSG"
2207 echo " S/KEY support: $SKEY_MSG"
2208 echo " TCP Wrappers support: $TCPW_MSG"
2209 echo " MD5 password support: $MD5_MSG"
2210 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2211 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2212 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2214 if test ! -z "$bsd_auth"; then
2215 echo " BSD Auth support: yes"
2220 echo " Host: ${host}"
2221 echo " Compiler: ${CC}"
2222 echo " Compiler flags: ${CFLAGS}"
2223 echo "Preprocessor flags: ${CPPFLAGS}"
2224 echo " Linker flags: ${LDFLAGS}"
2225 echo " Libraries: ${LIBS}"
2229 if test "x$PAM_MSG" = "xyes" ; then
2230 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
2231 echo "otherwise password authentication may fail. Example PAM control files"
2232 echo "can be found in the contrib/ subdirectory"
2236 if test ! -z "$BUILTIN_RNG" ; then
2237 echo "WARNING: you are using the builtin random number collection service."
2238 echo "Please read WARNING.RNG and request that your OS vendor includes"
2239 echo "/dev/random in future versions of their OS."
2243 if test ! -z "$NO_SFTP"; then
2244 echo "sftp-server will be disabled. Your compiler does not support"
2245 echo "64bit integers."