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 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
191 IPADDR_IN_DISPLAY=yes
193 AC_DEFINE(IP_TOS_IS_BROKEN)
194 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
195 LIBS="$LIBS -lgen -lnsl -lucb"
198 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
199 LDFLAGS="$LDFLAGS -L/usr/local/lib"
204 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
205 LDFLAGS="$LDFLAGS -L/usr/local/lib"
210 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
211 LDFLAGS="$LDFLAGS -L/usr/local/lib"
214 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
215 LDFLAGS="$LDFLAGS -L/usr/local/lib"
216 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
217 rsh_path="/usr/bin/rcmd"
220 AC_DEFINE(BROKEN_SYS_TERMIO_H)
222 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
223 AC_DEFINE(DISABLE_SHADOW)
224 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
225 AC_DEFINE(BROKEN_SAVED_UIDS)
226 AC_CHECK_FUNCS(getluid setluid)
228 do_sco3_extra_lib_check=yes
231 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
232 LDFLAGS="$LDFLAGS -L/usr/local/lib"
233 LIBS="$LIBS -lprot -lx -ltinfo -lm"
235 rsh_path="/usr/bin/rcmd"
237 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
238 AC_DEFINE(DISABLE_SHADOW)
239 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
240 AC_CHECK_FUNCS(getluid setluid)
247 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
248 LIBS="$LIBS -lgen -lrsc"
251 AC_MSG_CHECKING(for Digital Unix SIA)
254 [ --with-osfsia Enable Digital Unix SIA],
256 if test "x$withval" = "xno" ; then
257 AC_MSG_RESULT(disabled)
262 if test -z "$no_osfsia" ; then
263 if test -f /etc/sia/matrix.conf; then
265 AC_DEFINE(HAVE_OSF_SIA)
266 AC_DEFINE(DISABLE_LOGIN)
267 LIBS="$LIBS -lsecurity -ldb -lm -laud"
276 AC_DEFINE(NO_X11_UNIX_SOCKETS)
277 AC_DEFINE(MISSING_NFDBITS)
278 AC_DEFINE(MISSING_HOWMANY)
279 AC_DEFINE(MISSING_FD_MASK)
283 # Allow user to specify flags
285 [ --with-cflags Specify additional flags to pass to compiler],
287 if test "x$withval" != "xno" ; then
288 CFLAGS="$CFLAGS $withval"
292 AC_ARG_WITH(cppflags,
293 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
295 if test "x$withval" != "xno"; then
296 CPPFLAGS="$CPPFLAGS $withval"
301 [ --with-ldflags Specify additional flags to pass to linker],
303 if test "x$withval" != "xno" ; then
304 LDFLAGS="$LDFLAGS $withval"
309 [ --with-libs Specify additional libraries to link with],
311 if test "x$withval" != "xno" ; then
312 LIBS="$LIBS $withval"
318 [ --with-pcre[[=PATH]] Override built in regex library with pcre
319 (optionally in PATH)],
324 if test "x$withval" != "xyes"; then
325 if test -d "$withval/lib"; then
326 if test -n "${need_dash_r}"; then
327 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
329 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
332 if test -n "${need_dash_r}"; then
333 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
335 LDFLAGS="-L${withval} ${LDFLAGS}"
338 if test -d "$withval/include"; then
339 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
341 CPPFLAGS="-I${withval} ${CPPFLAGS}"
345 AC_CHECK_HEADER(pcreposix.h,
346 AC_CHECK_LIB(pcre, pcre_info,[
347 AC_DEFINE(HAVE_LIBPCRE)
348 LIBS="$LIBS -lpcreposix -lpcre"
350 AC_MSG_ERROR([*** unable to locate pcre library ***])),
351 AC_MSG_ERROR([*** unable to locate pcreposix.h include file ***]))
357 # Checks for libraries.
358 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
359 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
361 dnl SCO OS3 needs this for libwrap
362 if test "x$with_tcp_wrappers" != "xno" ; then
363 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
364 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
368 AC_CHECK_FUNC(getspnam, ,
369 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
370 AC_CHECK_FUNC(login, ,
371 AC_CHECK_LIB(util, login,
372 AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil"))
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") ]
428 # Checks for header files.
429 AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
430 getopt.h glob.h lastlog.h limits.h login.h \
431 login_cap.h maillock.h netdb.h netgroup.h \
432 netinet/in_systm.h paths.h poll.h pty.h regex.h \
433 security/pam_appl.h shadow.h stddef.h stdint.h \
434 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
435 sys/poll.h sys/queue.h sys/select.h sys/stat.h \
436 sys/stropts.h sys/sysmacros.h sys/time.h \
437 sys/ttcompat.h sys/un.h time.h ttyent.h usersec.h \
438 util.h utime.h utmp.h utmpx.h)
440 # Check for ALTDIRFUNC glob() extension
441 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
442 AC_EGREP_CPP(FOUNDIT,
445 #ifdef GLOB_ALTDIRFUNC
450 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
458 # Check for g.gl_matchc glob() extension
459 AC_MSG_CHECKING(for gl_matchc field in glob_t)
460 AC_EGREP_CPP(FOUNDIT,
463 int main(void){glob_t g; g.gl_matchc = 1;}
466 AC_DEFINE(GLOB_HAS_GL_MATCHC)
474 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
477 #include <sys/types.h>
479 int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
481 [AC_MSG_RESULT(yes)],
484 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
488 # Check whether user wants S/Key support
491 [ --with-skey[[=PATH]] Enable S/Key support
492 (optionally in PATH)],
494 if test "x$withval" != "xno" ; then
496 if test "x$withval" != "xyes" ; then
497 CPPFLAGS="$CPPFLAGS -I${withval}/include"
498 LDFLAGS="$LDFLAGS -L${withval}/lib"
505 AC_CHECK_FUNC(skey_keyinfo,
508 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
514 # Check whether user wants TCP wrappers support
516 AC_ARG_WITH(tcp-wrappers,
517 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
518 (optionally in PATH)],
520 if test "x$withval" != "xno" ; then
522 saved_LDFLAGS="$LDFLAGS"
523 saved_CPPFLAGS="$CPPFLAGS"
524 if test -n "${withval}" -a "${withval}" != "yes"; then
525 if test -d "${withval}/lib"; then
526 if test -n "${need_dash_r}"; then
527 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
529 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
532 if test -n "${need_dash_r}"; then
533 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
535 LDFLAGS="-L${withval} ${LDFLAGS}"
538 if test -d "${withval}/include"; then
539 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
541 CPPFLAGS="-I${withval} ${CPPFLAGS}"
545 AC_MSG_CHECKING(for libwrap)
549 int deny_severity = 0, allow_severity = 0;
558 AC_MSG_ERROR([*** libwrap missing])
565 dnl Checks for library functions.
566 AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa \
567 clock fchmod fchown freeaddrinfo futimes gai_strerror \
568 getaddrinfo getcwd getgrouplist getnameinfo getopt \
569 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
570 inet_ntop innetgr login_getcapbool md5_crypt memmove \
571 mkdtemp on_exit openpty readpassphrase realpath \
572 rresvport_af setdtablesize setegid setenv seteuid \
573 setlogin setproctitle setresgid setreuid setrlimit \
574 setsid setvbuf sigaction sigvec snprintf strerror \
575 strlcat strlcpy strmode strsep sysconf tcgetpgrp utimes \
576 vhangup vsnprintf waitpid __b64_ntop _getpty)
578 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
579 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
580 AC_CHECK_LIB(gen, dirname,[
581 AC_CACHE_CHECK([for broken dirname],
582 ac_cv_have_broken_dirname, [
590 int main(int argc, char **argv) {
593 strncpy(buf,"/etc", 32);
595 if (!s || strncmp(s, "/", 32) != 0) {
602 [ ac_cv_have_broken_dirname="no" ],
603 [ ac_cv_have_broken_dirname="yes" ]
607 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
609 AC_DEFINE(HAVE_DIRNAME)
610 AC_CHECK_HEADERS(libgen.h)
615 dnl Checks for time functions
616 AC_CHECK_FUNCS(gettimeofday time)
617 dnl Checks for libutil functions
618 AC_CHECK_HEADERS(libutil.h)
619 AC_CHECK_FUNCS(login logout updwtmp logwtmp)
620 dnl Checks for utmp functions
621 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
622 AC_CHECK_FUNCS(utmpname)
623 dnl Checks for utmpx functions
624 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
625 AC_CHECK_FUNCS(setutxent utmpxname)
627 AC_CHECK_FUNC(getuserattr,
628 [AC_DEFINE(HAVE_GETUSERATTR)],
629 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
633 [AC_DEFINE(HAVE_LOGIN)],
634 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
637 AC_CHECK_FUNC(daemon,
638 [AC_DEFINE(HAVE_DAEMON)],
639 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
642 AC_CHECK_FUNC(getpagesize,
643 [AC_DEFINE(HAVE_GETPAGESIZE)],
644 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
647 # Check for broken snprintf
648 if test "x$ac_cv_func_snprintf" = "xyes" ; then
649 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
653 int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
655 [AC_MSG_RESULT(yes)],
658 AC_DEFINE(BROKEN_SNPRINTF)
659 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
669 [ --with-pam Enable PAM support ],
671 if test "x$withval" != "xno" ; then
672 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
673 AC_MSG_ERROR([PAM headers not found])
676 AC_CHECK_LIB(dl, dlopen, , )
677 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
678 AC_CHECK_FUNCS(pam_getenvlist)
688 # Check for older PAM
689 if test "x$PAM_MSG" = "xyes" ; then
690 # Check PAM strerror arguments (old PAM)
691 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
695 #include <security/pam_appl.h>
697 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
700 AC_DEFINE(HAVE_OLD_PAM)
702 PAM_MSG="yes (old library)"
707 # The big search for OpenSSL
709 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
711 if test "x$withval" != "xno" ; then
718 saved_LDFLAGS="$LDFLAGS"
719 saved_CPPFLAGS="$CPPFLAGS"
720 if test "x$prefix" != "xNONE" ; then
721 tryssldir="$tryssldir $prefix"
723 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
724 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
725 CPPFLAGS="$saved_CPPFLAGS"
726 LDFLAGS="$saved_LDFLAGS"
727 LIBS="$saved_LIBS -lcrypto"
729 # Skip directories if they don't exist
730 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
733 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
734 # Try to use $ssldir/lib if it exists, otherwise
736 if test -d "$ssldir/lib" ; then
737 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
738 if test ! -z "$need_dash_r" ; then
739 LDFLAGS="-R$ssldir/lib $LDFLAGS"
742 LDFLAGS="-L$ssldir $saved_LDFLAGS"
743 if test ! -z "$need_dash_r" ; then
744 LDFLAGS="-R$ssldir $LDFLAGS"
747 # Try to use $ssldir/include if it exists, otherwise
749 if test -d "$ssldir/include" ; then
750 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
752 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
756 # Basic test to check for compatible version and correct linking
757 # *does not* test for RSA - that comes later.
761 #include <openssl/rand.h>
765 memset(a, 0, sizeof(a));
766 RAND_add(a, sizeof(a), sizeof(a));
767 return(RAND_status() <= 0);
776 if test ! -z "$found_crypto" ; then
781 if test -z "$found_crypto" ; then
782 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
784 if test -z "$ssldir" ; then
788 ac_cv_openssldir=$ssldir
791 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
792 AC_DEFINE(HAVE_OPENSSL)
793 dnl Need to recover ssldir - test above runs in subshell
794 ssldir=$ac_cv_openssldir
795 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
796 # Try to use $ssldir/lib if it exists, otherwise
798 if test -d "$ssldir/lib" ; then
799 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
800 if test ! -z "$need_dash_r" ; then
801 LDFLAGS="-R$ssldir/lib $LDFLAGS"
804 LDFLAGS="-L$ssldir $saved_LDFLAGS"
805 if test ! -z "$need_dash_r" ; then
806 LDFLAGS="-R$ssldir $LDFLAGS"
809 # Try to use $ssldir/include if it exists, otherwise
811 if test -d "$ssldir/include" ; then
812 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
814 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
818 LIBS="$saved_LIBS -lcrypto"
820 # Now test RSA support
822 AC_MSG_CHECKING([for RSA support])
823 for WANTS_RSAREF in "" 1 ; do
824 if test -z "$WANTS_RSAREF" ; then
827 LIBS="$saved_LIBS -lRSAglue -lrsaref"
831 #include <openssl/rand.h>
832 #include <openssl/rsa.h>
833 #include <openssl/bn.h>
834 #include <openssl/sha.h>
837 int num; RSA *key; static unsigned char p_in[] = "blahblah";
838 unsigned char c[256], p[256];
839 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
840 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
841 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
842 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
852 if test ! -z "$no_rsa" ; then
853 AC_MSG_RESULT(disabled)
856 if test -z "$rsa_works" ; then
857 AC_MSG_WARN([*** No RSA support found *** ])
860 if test -z "$WANTS_RSAREF" ; then
864 RSA_MSG="yes (using RSAref)"
865 AC_MSG_RESULT(using RSAref)
866 LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
871 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
872 # version in OpenSSL. Skip this for PAM
873 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
874 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
877 # Cheap hack to ensure NEWS-OS libraries are arranged right.
878 if test ! -z "$SONY" ; then
879 LIBS="$LIBS -liberty";
882 # Checks for data types
883 AC_CHECK_SIZEOF(char, 1)
884 AC_CHECK_SIZEOF(short int, 2)
885 AC_CHECK_SIZEOF(int, 4)
886 AC_CHECK_SIZEOF(long int, 4)
887 AC_CHECK_SIZEOF(long long int, 8)
889 # More checks for data types
890 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
892 [ #include <sys/types.h> ],
894 [ ac_cv_have_u_int="yes" ],
895 [ ac_cv_have_u_int="no" ]
898 if test "x$ac_cv_have_u_int" = "xyes" ; then
899 AC_DEFINE(HAVE_U_INT)
903 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
905 [ #include <sys/types.h> ],
906 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
907 [ ac_cv_have_intxx_t="yes" ],
908 [ ac_cv_have_intxx_t="no" ]
911 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
912 AC_DEFINE(HAVE_INTXX_T)
916 if (test -z "$have_intxx_t" && \
917 test "x$ac_cv_header_stdint_h" = "xyes")
919 AC_MSG_CHECKING([for intXX_t types in stdint.h])
921 [ #include <stdint.h> ],
922 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
924 AC_DEFINE(HAVE_INTXX_T)
927 [ AC_MSG_RESULT(no) ]
931 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
933 [ #include <sys/types.h> ],
934 [ int64_t a; a = 1;],
935 [ ac_cv_have_int64_t="yes" ],
936 [ ac_cv_have_int64_t="no" ]
939 if test "x$ac_cv_have_int64_t" = "xyes" ; then
940 AC_DEFINE(HAVE_INT64_T)
944 if test -z "$have_int64_t" ; then
945 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
947 [ #include <sys/socket.h> ],
950 AC_DEFINE(HAVE_INT64_T)
953 [ AC_MSG_RESULT(no) ]
957 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
959 [ #include <sys/types.h> ],
960 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
961 [ ac_cv_have_u_intxx_t="yes" ],
962 [ ac_cv_have_u_intxx_t="no" ]
965 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
966 AC_DEFINE(HAVE_U_INTXX_T)
970 if test -z "$have_u_intxx_t" ; then
971 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
973 [ #include <sys/socket.h> ],
974 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
976 AC_DEFINE(HAVE_U_INTXX_T)
979 [ AC_MSG_RESULT(no) ]
983 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
985 [ #include <sys/types.h> ],
986 [ u_int64_t a; a = 1;],
987 [ ac_cv_have_u_int64_t="yes" ],
988 [ ac_cv_have_u_int64_t="no" ]
991 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
992 AC_DEFINE(HAVE_U_INT64_T)
996 if test -z "$have_u_intxx_t" ; then
997 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1000 #include <sys/types.h>
1002 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1003 [ ac_cv_have_uintxx_t="yes" ],
1004 [ ac_cv_have_uintxx_t="no" ]
1007 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1008 AC_DEFINE(HAVE_UINTXX_T)
1012 if test -z "$have_uintxx_t" ; then
1013 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1015 [ #include <stdint.h> ],
1016 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1018 AC_DEFINE(HAVE_UINTXX_T)
1021 [ AC_MSG_RESULT(no) ]
1025 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1026 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1028 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1031 #include <sys/bitypes.h>
1034 int8_t a; int16_t b; int32_t c;
1035 u_int8_t e; u_int16_t f; u_int32_t g;
1036 a = b = c = e = f = g = 1;
1039 AC_DEFINE(HAVE_U_INTXX_T)
1040 AC_DEFINE(HAVE_INTXX_T)
1048 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1051 #include <sys/types.h>
1053 [ u_char foo; foo = 125; ],
1054 [ ac_cv_have_u_char="yes" ],
1055 [ ac_cv_have_u_char="no" ]
1058 if test "x$ac_cv_have_u_char" = "xyes" ; then
1059 AC_DEFINE(HAVE_U_CHAR)
1064 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1067 #include <sys/types.h>
1069 [ size_t foo; foo = 1235; ],
1070 [ ac_cv_have_size_t="yes" ],
1071 [ ac_cv_have_size_t="no" ]
1074 if test "x$ac_cv_have_size_t" = "xyes" ; then
1075 AC_DEFINE(HAVE_SIZE_T)
1078 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1081 #include <sys/types.h>
1083 [ ssize_t foo; foo = 1235; ],
1084 [ ac_cv_have_ssize_t="yes" ],
1085 [ ac_cv_have_ssize_t="no" ]
1088 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1089 AC_DEFINE(HAVE_SSIZE_T)
1092 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1097 [ clock_t foo; foo = 1235; ],
1098 [ ac_cv_have_clock_t="yes" ],
1099 [ ac_cv_have_clock_t="no" ]
1102 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1103 AC_DEFINE(HAVE_CLOCK_T)
1106 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1109 #include <sys/types.h>
1110 #include <sys/socket.h>
1112 [ sa_family_t foo; foo = 1235; ],
1113 [ ac_cv_have_sa_family_t="yes" ],
1116 #include <sys/types.h>
1117 #include <sys/socket.h>
1118 #include <netinet/in.h>
1120 [ sa_family_t foo; foo = 1235; ],
1121 [ ac_cv_have_sa_family_t="yes" ],
1123 [ ac_cv_have_sa_family_t="no" ]
1127 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1128 AC_DEFINE(HAVE_SA_FAMILY_T)
1131 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1134 #include <sys/types.h>
1136 [ pid_t foo; foo = 1235; ],
1137 [ ac_cv_have_pid_t="yes" ],
1138 [ ac_cv_have_pid_t="no" ]
1141 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1142 AC_DEFINE(HAVE_PID_T)
1145 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1148 #include <sys/types.h>
1150 [ mode_t foo; foo = 1235; ],
1151 [ ac_cv_have_mode_t="yes" ],
1152 [ ac_cv_have_mode_t="no" ]
1155 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1156 AC_DEFINE(HAVE_MODE_T)
1160 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1163 #include <sys/types.h>
1164 #include <sys/socket.h>
1166 [ struct sockaddr_storage s; ],
1167 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1168 [ ac_cv_have_struct_sockaddr_storage="no" ]
1171 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1172 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1175 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1178 #include <sys/types.h>
1179 #include <netinet/in.h>
1181 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1182 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1183 [ ac_cv_have_struct_sockaddr_in6="no" ]
1186 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1187 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1190 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1193 #include <sys/types.h>
1194 #include <netinet/in.h>
1196 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1197 [ ac_cv_have_struct_in6_addr="yes" ],
1198 [ ac_cv_have_struct_in6_addr="no" ]
1201 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1202 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1205 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1208 #include <sys/types.h>
1209 #include <sys/socket.h>
1212 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1213 [ ac_cv_have_struct_addrinfo="yes" ],
1214 [ ac_cv_have_struct_addrinfo="no" ]
1217 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1218 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1221 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1223 [ #include <sys/time.h> ],
1224 [ struct timeval tv; tv.tv_sec = 1;],
1225 [ ac_cv_have_struct_timeval="yes" ],
1226 [ ac_cv_have_struct_timeval="no" ]
1229 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1230 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1231 have_struct_timeval=1
1234 # If we don't have int64_t then we can't compile sftp-server. So don't
1235 # even attempt to do it.
1236 if test "x$ac_cv_have_int64_t" = "xno" -a \
1237 "x$ac_cv_sizeof_long_int" != "x8" -a \
1238 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1241 dnl test snprintf (broken on SCO w/gcc)
1246 #ifdef HAVE_SNPRINTF
1250 char expected_out[50];
1252 #if (SIZEOF_LONG_INT == 8)
1253 long int num = 0x7fffffffffffffff;
1255 long long num = 0x7fffffffffffffffll;
1257 strcpy(expected_out, "9223372036854775807");
1258 snprintf(buf, mazsize, "%lld", num);
1259 if(strcmp(buf, expected_out) != 0)
1266 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1271 dnl Checks for structure members
1272 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1273 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1274 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1275 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1276 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1277 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1278 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1279 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1280 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1281 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1282 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1283 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1284 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1285 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1286 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1287 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1288 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1290 AC_CHECK_MEMBERS([struct stat.st_blksize])
1292 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1293 ac_cv_have_ss_family_in_struct_ss, [
1296 #include <sys/types.h>
1297 #include <sys/socket.h>
1299 [ struct sockaddr_storage s; s.ss_family = 1; ],
1300 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1301 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1304 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1305 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1308 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1309 ac_cv_have___ss_family_in_struct_ss, [
1312 #include <sys/types.h>
1313 #include <sys/socket.h>
1315 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1316 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1317 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1320 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1321 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1324 AC_CACHE_CHECK([for pw_class field in struct passwd],
1325 ac_cv_have_pw_class_in_struct_passwd, [
1330 [ struct passwd p; p.pw_class = 0; ],
1331 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1332 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1335 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1336 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1339 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1340 ac_cv_have_pw_expire_in_struct_passwd, [
1345 [ struct passwd p; p.pw_expire = 0; ],
1346 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1347 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1350 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1351 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1354 AC_CACHE_CHECK([for pw_change field in struct passwd],
1355 ac_cv_have_pw_change_in_struct_passwd, [
1360 [ struct passwd p; p.pw_change = 0; ],
1361 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1362 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1365 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1366 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1369 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1371 [ extern char *__progname; printf("%s", __progname); ],
1372 [ ac_cv_libc_defines___progname="yes" ],
1373 [ ac_cv_libc_defines___progname="no" ]
1376 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1377 AC_DEFINE(HAVE___PROGNAME)
1380 AC_CACHE_CHECK([whether getopt has optreset support],
1381 ac_cv_have_getopt_optreset, [
1386 [ extern int optreset; optreset = 0; ],
1387 [ ac_cv_have_getopt_optreset="yes" ],
1388 [ ac_cv_have_getopt_optreset="no" ]
1391 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1392 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1395 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1397 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1398 [ ac_cv_libc_defines_sys_errlist="yes" ],
1399 [ ac_cv_libc_defines_sys_errlist="no" ]
1402 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1403 AC_DEFINE(HAVE_SYS_ERRLIST)
1407 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1409 [ extern int sys_nerr; printf("%i", sys_nerr);],
1410 [ ac_cv_libc_defines_sys_nerr="yes" ],
1411 [ ac_cv_libc_defines_sys_nerr="no" ]
1414 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1415 AC_DEFINE(HAVE_SYS_NERR)
1419 # Check whether user wants Kerberos support
1421 AC_ARG_WITH(smartcard,
1422 [ --with-smartcard Enable smartcard support],
1424 if test "x$withval" != "xno" ; then
1425 if test "x$withval" != "xyes" ; then
1426 CPPFLAGS="$CPPFLAGS -I${withval}"
1427 LDFLAGS="$LDFLAGS -L${withval}"
1428 if test ! -z "$need_dash_r" ; then
1429 LDFLAGS="$LDFLAGS -R${withval}"
1431 if test ! -z "$blibpath" ; then
1432 blibpath="$blibpath:${withval}"
1435 AC_CHECK_HEADERS(sectok.h)
1436 if test "$ac_cv_header_sectok_h" != yes; then
1437 AC_MSG_ERROR(Can't find sectok.h)
1439 AC_CHECK_LIB(sectok, sectok_open)
1440 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1441 AC_MSG_ERROR(Can't find libsectok)
1443 AC_DEFINE(SMARTCARD)
1449 # Check whether user wants Kerberos support
1451 AC_ARG_WITH(kerberos4,
1452 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1454 if test "x$withval" != "xno" ; then
1455 if test "x$withval" != "xyes" ; then
1456 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1457 LDFLAGS="$LDFLAGS -L${withval}/lib"
1458 if test ! -z "$need_dash_r" ; then
1459 LDFLAGS="$LDFLAGS -R${withval}/lib"
1461 if test ! -z "$blibpath" ; then
1462 blibpath="$blibpath:${withval}/lib"
1465 if test -d /usr/include/kerberosIV ; then
1466 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1470 AC_CHECK_HEADERS(krb.h)
1471 if test "$ac_cv_header_krb_h" != yes; then
1472 AC_MSG_WARN([Cannot find krb.h, build may fail])
1474 AC_CHECK_LIB(krb, main)
1475 if test "$ac_cv_lib_krb_main" != yes; then
1476 AC_CHECK_LIB(krb4, main)
1477 if test "$ac_cv_lib_krb4_main" != yes; then
1478 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1485 AC_CHECK_LIB(des, des_cbc_encrypt)
1486 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1487 AC_CHECK_LIB(des425, des_cbc_encrypt)
1488 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1489 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1496 AC_CHECK_LIB(resolv, dn_expand, , )
1504 # Check whether user wants AFS support
1507 [ --with-afs=PATH Enable AFS support],
1509 if test "x$withval" != "xno" ; then
1511 if test "x$withval" != "xyes" ; then
1512 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1513 LDFLAGS="$LDFLAGS -L${withval}/lib"
1516 if test -z "$KRB4" ; then
1517 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1521 if test ! -z "$AFS_LIBS" ; then
1522 LIBS="$LIBS $AFS_LIBS"
1531 # Looking for programs, paths and files
1533 [ --with-rsh=PATH Specify path to remote shell program ],
1535 if test "x$withval" != "$no" ; then
1540 AC_PATH_PROG(rsh_path, rsh)
1545 [ --with-xauth=PATH Specify path to xauth program ],
1547 if test "x$withval" != "xno" ; then
1552 AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin)
1553 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
1554 xauth_path="/usr/openwin/bin/xauth"
1559 if test -z "$xauth_path" ; then
1560 XAUTH_PATH="undefined"
1561 AC_SUBST(XAUTH_PATH)
1563 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
1564 XAUTH_PATH=$xauth_path
1565 AC_SUBST(XAUTH_PATH)
1567 if test ! -z "$rsh_path" ; then
1568 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1571 # Check for mail directory (last resort if we cannot get it from headers)
1572 if test ! -z "$MAIL" ; then
1573 maildir=`dirname $MAIL`
1574 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1577 if test -z "$no_dev_ptmx" ; then
1578 AC_CHECK_FILE("/dev/ptmx",
1580 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1585 AC_CHECK_FILE("/dev/ptc",
1587 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1592 # Options from here on. Some of these are preset by platform above
1594 # Check for user-specified random device, otherwise check /dev/urandom
1596 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
1598 if test "x$withval" != "xno" ; then
1599 RANDOM_POOL="$withval";
1600 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1604 # Check for random device
1605 AC_CHECK_FILE("/dev/urandom",
1607 RANDOM_POOL="/dev/urandom";
1608 AC_SUBST(RANDOM_POOL)
1609 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1615 # Check for PRNGD/EGD pool file
1616 AC_ARG_WITH(prngd-port,
1617 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1619 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1620 PRNGD_PORT="$withval"
1621 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1626 # Check for PRNGD/EGD pool file
1627 AC_ARG_WITH(prngd-socket,
1628 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1630 if test "x$withval" != "xno" ; then
1631 PRNGD_SOCKET="$withval"
1632 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1636 # Check for existing socket only if we don't have a random device already
1637 if test -z "$RANDOM_POOL" ; then
1638 AC_MSG_CHECKING(for PRNGD/EGD socket)
1639 # Insert other locations here
1640 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1641 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1642 PRNGD_SOCKET="$sock"
1643 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1647 if test ! -z "$PRNGD_SOCKET" ; then
1648 AC_MSG_RESULT($PRNGD_SOCKET)
1650 AC_MSG_RESULT(not found)
1657 # detect pathnames for entropy gathering commands, if we need them
1658 INSTALL_SSH_PRNG_CMDS=""
1660 if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
1661 # Use these commands to collect entropy
1662 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1663 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1664 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1665 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1666 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1667 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1668 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1669 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1670 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1671 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1672 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1673 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1674 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1675 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1676 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1677 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1679 INSTALL_SSH_PRNG_CMDS="yes"
1681 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1684 AC_ARG_WITH(mantype,
1685 [ --with-mantype=man|cat|doc Set man page type],
1692 AC_MSG_ERROR(invalid man type: $withval)
1697 if test -z "$MANTYPE"; then
1698 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
1699 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1701 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1708 if test "$MANTYPE" = "doc"; then
1715 # Check whether to enable MD5 passwords
1717 AC_ARG_WITH(md5-passwords,
1718 [ --with-md5-passwords Enable use of MD5 passwords],
1720 if test "x$withval" != "xno" ; then
1721 AC_DEFINE(HAVE_MD5_PASSWORDS)
1727 # Whether to disable shadow password support
1729 [ --without-shadow Disable shadow password support],
1731 if test "x$withval" = "xno" ; then
1732 AC_DEFINE(DISABLE_SHADOW)
1738 if test -z "$disable_shadow" ; then
1739 AC_MSG_CHECKING([if the systems has expire shadow information])
1742 #include <sys/types.h>
1745 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1746 [ sp_expire_available=yes ], []
1749 if test "x$sp_expire_available" = "xyes" ; then
1751 AC_DEFINE(HAS_SHADOW_EXPIRE)
1757 # Use ip address instead of hostname in $DISPLAY
1758 if test ! -z "$IPADDR_IN_DISPLAY" ; then
1759 DISPLAY_HACK_MSG="yes"
1760 AC_DEFINE(IPADDR_IN_DISPLAY)
1762 DISPLAY_HACK_MSG="no"
1763 AC_ARG_WITH(ipaddr-display,
1764 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1766 if test "x$withval" != "xno" ; then
1767 AC_DEFINE(IPADDR_IN_DISPLAY)
1768 DISPLAY_HACK_MSG="yes"
1774 # Whether to mess with the default path
1775 SERVER_PATH_MSG="(default)"
1776 AC_ARG_WITH(default-path,
1777 [ --with-default-path=PATH Specify default \$PATH environment for server],
1779 if test "x$withval" != "xno" ; then
1780 user_path="$withval"
1781 SERVER_PATH_MSG="$withval"
1787 /* find out what STDPATH is */
1792 #ifndef _PATH_STDPATH
1793 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1795 #include <sys/types.h>
1796 #include <sys/stat.h>
1798 #define DATA "conftest.stdpath"
1805 fd = fopen(DATA,"w");
1809 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1814 ], [ user_path=`cat conftest.stdpath` ],
1815 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1816 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1818 # make sure $bindir is in USER_PATH so scp will work
1819 t_bindir=`eval echo ${bindir}`
1821 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1824 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1826 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1827 if test $? -ne 0 ; then
1828 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1829 if test $? -ne 0 ; then
1830 user_path=$user_path:$t_bindir
1831 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1836 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1839 # Whether to force IPv4 by default (needed on broken glibc Linux)
1841 AC_ARG_WITH(ipv4-default,
1842 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1844 if test "x$withval" != "xno" ; then
1845 AC_DEFINE(IPV4_DEFAULT)
1851 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
1852 IPV4_IN6_HACK_MSG="no"
1854 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1856 if test "x$withval" != "xno" ; then
1858 AC_DEFINE(IPV4_IN_IPV6)
1859 IPV4_IN6_HACK_MSG="yes"
1864 if test "x$inet6_default_4in6" = "xyes"; then
1865 AC_MSG_RESULT([yes (default)])
1866 AC_DEFINE(IPV4_IN_IPV6)
1867 IPV4_IN6_HACK_MSG="yes"
1869 AC_MSG_RESULT([no (default)])
1874 # Whether to enable BSD auth support
1875 AC_ARG_WITH(bsd-auth,
1876 [ --with-bsd-auth Enable BSD auth support],
1878 if test "x$withval" != "xno" ; then
1885 AC_MSG_CHECKING(whether to install ssh as suid root)
1886 AC_ARG_ENABLE(suid-ssh,
1887 [ --enable-suid-ssh Install ssh as suid root (default)
1888 --disable-suid-ssh Install ssh without suid bit],
1889 [ case "$enableval" in
1894 *) AC_MSG_RESULT(yes)
1904 # Where to place sshd.pid
1906 AC_ARG_WITH(pid-dir,
1907 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1909 if test "x$withval" != "xno" ; then
1915 # make sure the directory exists
1916 if test ! -d $piddir ; then
1917 piddir=`eval echo ${sysconfdir}`
1919 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1923 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
1926 dnl allow user to disable some login recording features
1927 AC_ARG_ENABLE(lastlog,
1928 [ --disable-lastlog disable use of lastlog even if detected [no]],
1929 [ AC_DEFINE(DISABLE_LASTLOG) ]
1932 [ --disable-utmp disable use of utmp even if detected [no]],
1933 [ AC_DEFINE(DISABLE_UTMP) ]
1935 AC_ARG_ENABLE(utmpx,
1936 [ --disable-utmpx disable use of utmpx even if detected [no]],
1937 [ AC_DEFINE(DISABLE_UTMPX) ]
1940 [ --disable-wtmp disable use of wtmp even if detected [no]],
1941 [ AC_DEFINE(DISABLE_WTMP) ]
1943 AC_ARG_ENABLE(wtmpx,
1944 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
1945 [ AC_DEFINE(DISABLE_WTMPX) ]
1947 AC_ARG_ENABLE(libutil,
1948 [ --disable-libutil disable use of libutil (login() etc.) [no]],
1949 [ AC_DEFINE(DISABLE_LOGIN) ]
1951 AC_ARG_ENABLE(pututline,
1952 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
1953 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1955 AC_ARG_ENABLE(pututxline,
1956 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
1957 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1959 AC_ARG_WITH(lastlog,
1960 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
1962 if test "x$withval" = "xno" ; then
1963 AC_DEFINE(DISABLE_LASTLOG)
1965 conf_lastlog_location=$withval
1970 dnl lastlog, [uw]tmpx? detection
1971 dnl NOTE: set the paths in the platform section to avoid the
1972 dnl need for command-line parameters
1973 dnl lastlog and [uw]tmp are subject to a file search if all else fails
1975 dnl lastlog detection
1976 dnl NOTE: the code itself will detect if lastlog is a directory
1977 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1979 #include <sys/types.h>
1981 #ifdef HAVE_LASTLOG_H
1982 # include <lastlog.h>
1991 [ char *lastlog = LASTLOG_FILE; ],
1992 [ AC_MSG_RESULT(yes) ],
1995 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1997 #include <sys/types.h>
1999 #ifdef HAVE_LASTLOG_H
2000 # include <lastlog.h>
2006 [ char *lastlog = _PATH_LASTLOG; ],
2007 [ AC_MSG_RESULT(yes) ],
2010 system_lastlog_path=no
2015 if test -z "$conf_lastlog_location"; then
2016 if test x"$system_lastlog_path" = x"no" ; then
2017 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2018 if (test -d "$f" || test -f "$f") ; then
2019 conf_lastlog_location=$f
2022 if test -z "$conf_lastlog_location"; then
2023 AC_MSG_WARN([** Cannot find lastlog **])
2024 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2029 if test -n "$conf_lastlog_location"; then
2030 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2034 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2036 #include <sys/types.h>
2042 [ char *utmp = UTMP_FILE; ],
2043 [ AC_MSG_RESULT(yes) ],
2045 system_utmp_path=no ]
2047 if test -z "$conf_utmp_location"; then
2048 if test x"$system_utmp_path" = x"no" ; then
2049 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2050 if test -f $f ; then
2051 conf_utmp_location=$f
2054 if test -z "$conf_utmp_location"; then
2055 AC_DEFINE(DISABLE_UTMP)
2059 if test -n "$conf_utmp_location"; then
2060 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2064 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2066 #include <sys/types.h>
2072 [ char *wtmp = WTMP_FILE; ],
2073 [ AC_MSG_RESULT(yes) ],
2075 system_wtmp_path=no ]
2077 if test -z "$conf_wtmp_location"; then
2078 if test x"$system_wtmp_path" = x"no" ; then
2079 for f in /usr/adm/wtmp /var/log/wtmp; do
2080 if test -f $f ; then
2081 conf_wtmp_location=$f
2084 if test -z "$conf_wtmp_location"; then
2085 AC_DEFINE(DISABLE_WTMP)
2089 if test -n "$conf_wtmp_location"; then
2090 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2094 dnl utmpx detection - I don't know any system so perverse as to require
2095 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2097 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2099 #include <sys/types.h>
2108 [ char *utmpx = UTMPX_FILE; ],
2109 [ AC_MSG_RESULT(yes) ],
2111 system_utmpx_path=no ]
2113 if test -z "$conf_utmpx_location"; then
2114 if test x"$system_utmpx_path" = x"no" ; then
2115 AC_DEFINE(DISABLE_UTMPX)
2118 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2122 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2124 #include <sys/types.h>
2133 [ char *wtmpx = WTMPX_FILE; ],
2134 [ AC_MSG_RESULT(yes) ],
2136 system_wtmpx_path=no ]
2138 if test -z "$conf_wtmpx_location"; then
2139 if test x"$system_wtmpx_path" = x"no" ; then
2140 AC_DEFINE(DISABLE_WTMPX)
2143 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2147 # Change default command timeout for builtin PRNG
2149 AC_ARG_WITH(entropy-timeout,
2150 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2152 if test "x$withval" != "xno" ; then
2153 entropy_timeout=$withval
2157 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
2160 if test ! -z "$blibpath" ; then
2161 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2162 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2167 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2170 # Print summary of options
2172 if test ! -z "$RANDOM_POOL" ; then
2173 RAND_MSG="Device ($RANDOM_POOL)"
2175 if test ! -z "$PRNGD_PORT" ; then
2176 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
2177 elif test ! -z "$PRNGD_SOCKET" ; then
2178 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
2180 RAND_MSG="Builtin (timeout $entropy_timeout)"
2185 # Someone please show me a better way :)
2186 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2187 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2188 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2189 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2190 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2191 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2192 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2193 H=`eval echo ${user_path}` ; H=`eval echo ${H}`
2196 echo "OpenSSH has been configured with the following options:"
2197 echo " User binaries: $B"
2198 echo " System binaries: $C"
2199 echo " Configuration files: $D"
2200 echo " Askpass program: $E"
2201 echo " Manual pages: $F"
2202 echo " PID file: $G"
2203 echo " sshd default user PATH: $H"
2204 echo " Random number collection: $RAND_MSG"
2205 echo " Manpage format: $MANTYPE"
2206 echo " PAM support: ${PAM_MSG}"
2207 echo " KerberosIV support: $KRB4_MSG"
2208 echo " Smartcard support: $SCARD_MSG"
2209 echo " AFS support: $AFS_MSG"
2210 echo " S/KEY support: $SKEY_MSG"
2211 echo " TCP Wrappers support: $TCPW_MSG"
2212 echo " MD5 password support: $MD5_MSG"
2213 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2214 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2215 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2217 if test ! -z "$bsd_auth"; then
2218 echo " BSD Auth support: yes"
2223 echo " Host: ${host}"
2224 echo " Compiler: ${CC}"
2225 echo " Compiler flags: ${CFLAGS}"
2226 echo "Preprocessor flags: ${CPPFLAGS}"
2227 echo " Linker flags: ${LDFLAGS}"
2228 echo " Libraries: ${LIBS}"
2232 if test "x$PAM_MSG" = "xyes" ; then
2233 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
2234 echo "otherwise password authentication may fail. Example PAM control files"
2235 echo "can be found in the contrib/ subdirectory"
2239 if test ! -z "$BUILTIN_RNG" ; then
2240 echo "WARNING: you are using the builtin random number collection service."
2241 echo "Please read WARNING.RNG and request that your OS vendor includes"
2242 echo "/dev/random in future versions of their OS."
2246 if test ! -z "$NO_SFTP"; then
2247 echo "sftp-server will be disabled. Your compiler does not support"
2248 echo "64bit integers."