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 /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"
320 # Checks for libraries.
321 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
322 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
324 dnl SCO OS3 needs this for libwrap
325 if test "x$with_tcp_wrappers" != "xno" ; then
326 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
327 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
331 AC_CHECK_FUNC(getspnam, ,
332 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
336 [ --with-zlib=PATH Use zlib in PATH],
338 if test -d "$withval/lib"; then
339 if test -n "${need_dash_r}"; then
340 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
342 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
345 if test -n "${need_dash_r}"; then
346 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
348 LDFLAGS="-L${withval} ${LDFLAGS}"
351 if test -d "$withval/include"; then
352 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
354 CPPFLAGS="-I${withval} ${CPPFLAGS}"
359 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
362 AC_CHECK_FUNC(strcasecmp,
363 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
365 AC_CHECK_FUNC(utimes,
366 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
369 dnl Checks for libutil functions
370 AC_CHECK_HEADERS(libutil.h)
371 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
372 AC_CHECK_FUNCS(logout updwtmp logwtmp)
376 # Checks for header files.
377 AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
378 getopt.h glob.h lastlog.h limits.h login.h \
379 login_cap.h maillock.h netdb.h netgroup.h \
380 netinet/in_systm.h paths.h poll.h pty.h \
381 security/pam_appl.h shadow.h stddef.h stdint.h \
382 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
383 sys/poll.h sys/queue.h sys/select.h sys/stat.h \
384 sys/stropts.h sys/sysmacros.h sys/time.h \
385 sys/ttcompat.h sys/un.h time.h ttyent.h usersec.h \
386 util.h utime.h utmp.h utmpx.h)
388 # Check for ALTDIRFUNC glob() extension
389 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
390 AC_EGREP_CPP(FOUNDIT,
393 #ifdef GLOB_ALTDIRFUNC
398 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
406 # Check for g.gl_matchc glob() extension
407 AC_MSG_CHECKING(for gl_matchc field in glob_t)
408 AC_EGREP_CPP(FOUNDIT,
411 int main(void){glob_t g; g.gl_matchc = 1;}
414 AC_DEFINE(GLOB_HAS_GL_MATCHC)
422 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
425 #include <sys/types.h>
427 int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
429 [AC_MSG_RESULT(yes)],
432 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
436 # Check whether user wants S/Key support
439 [ --with-skey[[=PATH]] Enable S/Key support
440 (optionally in PATH)],
442 if test "x$withval" != "xno" ; then
444 if test "x$withval" != "xyes" ; then
445 CPPFLAGS="$CPPFLAGS -I${withval}/include"
446 LDFLAGS="$LDFLAGS -L${withval}/lib"
453 AC_CHECK_FUNC(skey_keyinfo,
456 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
462 # Check whether user wants TCP wrappers support
464 AC_ARG_WITH(tcp-wrappers,
465 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
466 (optionally in PATH)],
468 if test "x$withval" != "xno" ; then
470 saved_LDFLAGS="$LDFLAGS"
471 saved_CPPFLAGS="$CPPFLAGS"
472 if test -n "${withval}" -a "${withval}" != "yes"; then
473 if test -d "${withval}/lib"; then
474 if test -n "${need_dash_r}"; then
475 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
477 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
480 if test -n "${need_dash_r}"; then
481 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
483 LDFLAGS="-L${withval} ${LDFLAGS}"
486 if test -d "${withval}/include"; then
487 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
489 CPPFLAGS="-I${withval} ${CPPFLAGS}"
493 AC_MSG_CHECKING(for libwrap)
497 int deny_severity = 0, allow_severity = 0;
506 AC_MSG_ERROR([*** libwrap missing])
513 dnl Checks for library functions.
514 AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa \
515 clock fchmod fchown freeaddrinfo futimes gai_strerror \
516 getaddrinfo getcwd getgrouplist getnameinfo getopt \
517 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
518 inet_ntop innetgr login_getcapbool md5_crypt memmove \
519 mkdtemp on_exit openpty readpassphrase realpath \
520 rresvport_af setdtablesize setegid setenv seteuid \
521 setlogin setproctitle setresgid setreuid setrlimit \
522 setsid setvbuf sigaction sigvec snprintf strerror \
523 strlcat strlcpy strmode strsep sysconf tcgetpgrp utimes \
524 vhangup vsnprintf waitpid __b64_ntop _getpty)
526 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
527 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
528 AC_CHECK_LIB(gen, dirname,[
529 AC_CACHE_CHECK([for broken dirname],
530 ac_cv_have_broken_dirname, [
538 int main(int argc, char **argv) {
541 strncpy(buf,"/etc", 32);
543 if (!s || strncmp(s, "/", 32) != 0) {
550 [ ac_cv_have_broken_dirname="no" ],
551 [ ac_cv_have_broken_dirname="yes" ]
555 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
557 AC_DEFINE(HAVE_DIRNAME)
558 AC_CHECK_HEADERS(libgen.h)
563 dnl Checks for time functions
564 AC_CHECK_FUNCS(gettimeofday time)
565 dnl Checks for utmp functions
566 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
567 AC_CHECK_FUNCS(utmpname)
568 dnl Checks for utmpx functions
569 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
570 AC_CHECK_FUNCS(setutxent utmpxname)
572 AC_CHECK_FUNC(getuserattr,
573 [AC_DEFINE(HAVE_GETUSERATTR)],
574 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
577 AC_CHECK_FUNC(daemon,
578 [AC_DEFINE(HAVE_DAEMON)],
579 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
582 AC_CHECK_FUNC(getpagesize,
583 [AC_DEFINE(HAVE_GETPAGESIZE)],
584 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
587 # Check for broken snprintf
588 if test "x$ac_cv_func_snprintf" = "xyes" ; then
589 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
593 int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
595 [AC_MSG_RESULT(yes)],
598 AC_DEFINE(BROKEN_SNPRINTF)
599 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
609 [ --with-pam Enable PAM support ],
611 if test "x$withval" != "xno" ; then
612 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
613 AC_MSG_ERROR([PAM headers not found])
616 AC_CHECK_LIB(dl, dlopen, , )
617 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
618 AC_CHECK_FUNCS(pam_getenvlist)
628 # Check for older PAM
629 if test "x$PAM_MSG" = "xyes" ; then
630 # Check PAM strerror arguments (old PAM)
631 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
635 #include <security/pam_appl.h>
637 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
640 AC_DEFINE(HAVE_OLD_PAM)
642 PAM_MSG="yes (old library)"
647 # The big search for OpenSSL
649 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
651 if test "x$withval" != "xno" ; then
658 saved_LDFLAGS="$LDFLAGS"
659 saved_CPPFLAGS="$CPPFLAGS"
660 if test "x$prefix" != "xNONE" ; then
661 tryssldir="$tryssldir $prefix"
663 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
664 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
665 CPPFLAGS="$saved_CPPFLAGS"
666 LDFLAGS="$saved_LDFLAGS"
667 LIBS="$saved_LIBS -lcrypto"
669 # Skip directories if they don't exist
670 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
673 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
674 # Try to use $ssldir/lib if it exists, otherwise
676 if test -d "$ssldir/lib" ; then
677 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
678 if test ! -z "$need_dash_r" ; then
679 LDFLAGS="-R$ssldir/lib $LDFLAGS"
682 LDFLAGS="-L$ssldir $saved_LDFLAGS"
683 if test ! -z "$need_dash_r" ; then
684 LDFLAGS="-R$ssldir $LDFLAGS"
687 # Try to use $ssldir/include if it exists, otherwise
689 if test -d "$ssldir/include" ; then
690 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
692 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
696 # Basic test to check for compatible version and correct linking
697 # *does not* test for RSA - that comes later.
701 #include <openssl/rand.h>
705 memset(a, 0, sizeof(a));
706 RAND_add(a, sizeof(a), sizeof(a));
707 return(RAND_status() <= 0);
716 if test ! -z "$found_crypto" ; then
721 if test -z "$found_crypto" ; then
722 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
724 if test -z "$ssldir" ; then
728 ac_cv_openssldir=$ssldir
731 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
732 AC_DEFINE(HAVE_OPENSSL)
733 dnl Need to recover ssldir - test above runs in subshell
734 ssldir=$ac_cv_openssldir
735 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
736 # Try to use $ssldir/lib if it exists, otherwise
738 if test -d "$ssldir/lib" ; then
739 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
740 if test ! -z "$need_dash_r" ; then
741 LDFLAGS="-R$ssldir/lib $LDFLAGS"
744 LDFLAGS="-L$ssldir $saved_LDFLAGS"
745 if test ! -z "$need_dash_r" ; then
746 LDFLAGS="-R$ssldir $LDFLAGS"
749 # Try to use $ssldir/include if it exists, otherwise
751 if test -d "$ssldir/include" ; then
752 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
754 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
758 LIBS="$saved_LIBS -lcrypto"
760 # Now test RSA support
762 AC_MSG_CHECKING([for RSA support])
763 for WANTS_RSAREF in "" 1 ; do
764 if test -z "$WANTS_RSAREF" ; then
767 LIBS="$saved_LIBS -lRSAglue -lrsaref"
771 #include <openssl/rand.h>
772 #include <openssl/rsa.h>
773 #include <openssl/bn.h>
774 #include <openssl/sha.h>
777 int num; RSA *key; static unsigned char p_in[] = "blahblah";
778 unsigned char c[256], p[256];
779 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
780 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
781 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
782 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
792 if test ! -z "$no_rsa" ; then
793 AC_MSG_RESULT(disabled)
796 if test -z "$rsa_works" ; then
797 AC_MSG_WARN([*** No RSA support found *** ])
800 if test -z "$WANTS_RSAREF" ; then
804 RSA_MSG="yes (using RSAref)"
805 AC_MSG_RESULT(using RSAref)
806 LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
811 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
812 # version in OpenSSL. Skip this for PAM
813 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
814 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
817 # Cheap hack to ensure NEWS-OS libraries are arranged right.
818 if test ! -z "$SONY" ; then
819 LIBS="$LIBS -liberty";
822 # Checks for data types
823 AC_CHECK_SIZEOF(char, 1)
824 AC_CHECK_SIZEOF(short int, 2)
825 AC_CHECK_SIZEOF(int, 4)
826 AC_CHECK_SIZEOF(long int, 4)
827 AC_CHECK_SIZEOF(long long int, 8)
829 # More checks for data types
830 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
832 [ #include <sys/types.h> ],
834 [ ac_cv_have_u_int="yes" ],
835 [ ac_cv_have_u_int="no" ]
838 if test "x$ac_cv_have_u_int" = "xyes" ; then
839 AC_DEFINE(HAVE_U_INT)
843 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
845 [ #include <sys/types.h> ],
846 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
847 [ ac_cv_have_intxx_t="yes" ],
848 [ ac_cv_have_intxx_t="no" ]
851 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
852 AC_DEFINE(HAVE_INTXX_T)
856 if (test -z "$have_intxx_t" && \
857 test "x$ac_cv_header_stdint_h" = "xyes")
859 AC_MSG_CHECKING([for intXX_t types in stdint.h])
861 [ #include <stdint.h> ],
862 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
864 AC_DEFINE(HAVE_INTXX_T)
867 [ AC_MSG_RESULT(no) ]
871 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
873 [ #include <sys/types.h> ],
874 [ int64_t a; a = 1;],
875 [ ac_cv_have_int64_t="yes" ],
876 [ ac_cv_have_int64_t="no" ]
879 if test "x$ac_cv_have_int64_t" = "xyes" ; then
880 AC_DEFINE(HAVE_INT64_T)
884 if test -z "$have_int64_t" ; then
885 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
887 [ #include <sys/socket.h> ],
890 AC_DEFINE(HAVE_INT64_T)
893 [ AC_MSG_RESULT(no) ]
897 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
899 [ #include <sys/types.h> ],
900 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
901 [ ac_cv_have_u_intxx_t="yes" ],
902 [ ac_cv_have_u_intxx_t="no" ]
905 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
906 AC_DEFINE(HAVE_U_INTXX_T)
910 if test -z "$have_u_intxx_t" ; then
911 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
913 [ #include <sys/socket.h> ],
914 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
916 AC_DEFINE(HAVE_U_INTXX_T)
919 [ AC_MSG_RESULT(no) ]
923 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
925 [ #include <sys/types.h> ],
926 [ u_int64_t a; a = 1;],
927 [ ac_cv_have_u_int64_t="yes" ],
928 [ ac_cv_have_u_int64_t="no" ]
931 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
932 AC_DEFINE(HAVE_U_INT64_T)
936 if test -z "$have_u_intxx_t" ; then
937 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
940 #include <sys/types.h>
942 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
943 [ ac_cv_have_uintxx_t="yes" ],
944 [ ac_cv_have_uintxx_t="no" ]
947 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
948 AC_DEFINE(HAVE_UINTXX_T)
952 if test -z "$have_uintxx_t" ; then
953 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
955 [ #include <stdint.h> ],
956 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
958 AC_DEFINE(HAVE_UINTXX_T)
961 [ AC_MSG_RESULT(no) ]
965 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
966 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
968 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
971 #include <sys/bitypes.h>
974 int8_t a; int16_t b; int32_t c;
975 u_int8_t e; u_int16_t f; u_int32_t g;
976 a = b = c = e = f = g = 1;
979 AC_DEFINE(HAVE_U_INTXX_T)
980 AC_DEFINE(HAVE_INTXX_T)
988 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
991 #include <sys/types.h>
993 [ u_char foo; foo = 125; ],
994 [ ac_cv_have_u_char="yes" ],
995 [ ac_cv_have_u_char="no" ]
998 if test "x$ac_cv_have_u_char" = "xyes" ; then
999 AC_DEFINE(HAVE_U_CHAR)
1004 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1007 #include <sys/types.h>
1009 [ size_t foo; foo = 1235; ],
1010 [ ac_cv_have_size_t="yes" ],
1011 [ ac_cv_have_size_t="no" ]
1014 if test "x$ac_cv_have_size_t" = "xyes" ; then
1015 AC_DEFINE(HAVE_SIZE_T)
1018 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1021 #include <sys/types.h>
1023 [ ssize_t foo; foo = 1235; ],
1024 [ ac_cv_have_ssize_t="yes" ],
1025 [ ac_cv_have_ssize_t="no" ]
1028 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1029 AC_DEFINE(HAVE_SSIZE_T)
1032 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1037 [ clock_t foo; foo = 1235; ],
1038 [ ac_cv_have_clock_t="yes" ],
1039 [ ac_cv_have_clock_t="no" ]
1042 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1043 AC_DEFINE(HAVE_CLOCK_T)
1046 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1049 #include <sys/types.h>
1050 #include <sys/socket.h>
1052 [ sa_family_t foo; foo = 1235; ],
1053 [ ac_cv_have_sa_family_t="yes" ],
1056 #include <sys/types.h>
1057 #include <sys/socket.h>
1058 #include <netinet/in.h>
1060 [ sa_family_t foo; foo = 1235; ],
1061 [ ac_cv_have_sa_family_t="yes" ],
1063 [ ac_cv_have_sa_family_t="no" ]
1067 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1068 AC_DEFINE(HAVE_SA_FAMILY_T)
1071 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1074 #include <sys/types.h>
1076 [ pid_t foo; foo = 1235; ],
1077 [ ac_cv_have_pid_t="yes" ],
1078 [ ac_cv_have_pid_t="no" ]
1081 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1082 AC_DEFINE(HAVE_PID_T)
1085 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1088 #include <sys/types.h>
1090 [ mode_t foo; foo = 1235; ],
1091 [ ac_cv_have_mode_t="yes" ],
1092 [ ac_cv_have_mode_t="no" ]
1095 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1096 AC_DEFINE(HAVE_MODE_T)
1100 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1103 #include <sys/types.h>
1104 #include <sys/socket.h>
1106 [ struct sockaddr_storage s; ],
1107 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1108 [ ac_cv_have_struct_sockaddr_storage="no" ]
1111 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1112 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1115 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1118 #include <sys/types.h>
1119 #include <netinet/in.h>
1121 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1122 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1123 [ ac_cv_have_struct_sockaddr_in6="no" ]
1126 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1127 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1130 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1133 #include <sys/types.h>
1134 #include <netinet/in.h>
1136 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1137 [ ac_cv_have_struct_in6_addr="yes" ],
1138 [ ac_cv_have_struct_in6_addr="no" ]
1141 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1142 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1145 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1148 #include <sys/types.h>
1149 #include <sys/socket.h>
1152 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1153 [ ac_cv_have_struct_addrinfo="yes" ],
1154 [ ac_cv_have_struct_addrinfo="no" ]
1157 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1158 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1161 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1163 [ #include <sys/time.h> ],
1164 [ struct timeval tv; tv.tv_sec = 1;],
1165 [ ac_cv_have_struct_timeval="yes" ],
1166 [ ac_cv_have_struct_timeval="no" ]
1169 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1170 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1171 have_struct_timeval=1
1174 # If we don't have int64_t then we can't compile sftp-server. So don't
1175 # even attempt to do it.
1176 if test "x$ac_cv_have_int64_t" = "xno" -a \
1177 "x$ac_cv_sizeof_long_int" != "x8" -a \
1178 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1181 dnl test snprintf (broken on SCO w/gcc)
1186 #ifdef HAVE_SNPRINTF
1190 char expected_out[50];
1192 #if (SIZEOF_LONG_INT == 8)
1193 long int num = 0x7fffffffffffffff;
1195 long long num = 0x7fffffffffffffffll;
1197 strcpy(expected_out, "9223372036854775807");
1198 snprintf(buf, mazsize, "%lld", num);
1199 if(strcmp(buf, expected_out) != 0)
1206 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1211 dnl Checks for structure members
1212 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1213 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1214 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1215 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1216 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1217 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1218 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1219 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1220 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1221 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1222 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1223 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1224 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1225 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1226 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1227 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1228 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1230 AC_CHECK_MEMBERS([struct stat.st_blksize])
1232 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1233 ac_cv_have_ss_family_in_struct_ss, [
1236 #include <sys/types.h>
1237 #include <sys/socket.h>
1239 [ struct sockaddr_storage s; s.ss_family = 1; ],
1240 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1241 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1244 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1245 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1248 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1249 ac_cv_have___ss_family_in_struct_ss, [
1252 #include <sys/types.h>
1253 #include <sys/socket.h>
1255 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1256 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1257 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1260 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1261 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1264 AC_CACHE_CHECK([for pw_class field in struct passwd],
1265 ac_cv_have_pw_class_in_struct_passwd, [
1270 [ struct passwd p; p.pw_class = 0; ],
1271 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1272 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1275 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1276 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1279 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1280 ac_cv_have_pw_expire_in_struct_passwd, [
1285 [ struct passwd p; p.pw_expire = 0; ],
1286 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1287 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1290 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1291 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1294 AC_CACHE_CHECK([for pw_change field in struct passwd],
1295 ac_cv_have_pw_change_in_struct_passwd, [
1300 [ struct passwd p; p.pw_change = 0; ],
1301 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1302 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1305 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1306 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1309 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1311 [ extern char *__progname; printf("%s", __progname); ],
1312 [ ac_cv_libc_defines___progname="yes" ],
1313 [ ac_cv_libc_defines___progname="no" ]
1316 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1317 AC_DEFINE(HAVE___PROGNAME)
1320 AC_CACHE_CHECK([whether getopt has optreset support],
1321 ac_cv_have_getopt_optreset, [
1326 [ extern int optreset; optreset = 0; ],
1327 [ ac_cv_have_getopt_optreset="yes" ],
1328 [ ac_cv_have_getopt_optreset="no" ]
1331 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1332 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1335 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1337 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1338 [ ac_cv_libc_defines_sys_errlist="yes" ],
1339 [ ac_cv_libc_defines_sys_errlist="no" ]
1342 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1343 AC_DEFINE(HAVE_SYS_ERRLIST)
1347 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1349 [ extern int sys_nerr; printf("%i", sys_nerr);],
1350 [ ac_cv_libc_defines_sys_nerr="yes" ],
1351 [ ac_cv_libc_defines_sys_nerr="no" ]
1354 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1355 AC_DEFINE(HAVE_SYS_NERR)
1359 # Check whether user wants Kerberos support
1361 AC_ARG_WITH(smartcard,
1362 [ --with-smartcard Enable smartcard support],
1364 if test "x$withval" != "xno" ; then
1365 if test "x$withval" != "xyes" ; then
1366 CPPFLAGS="$CPPFLAGS -I${withval}"
1367 LDFLAGS="$LDFLAGS -L${withval}"
1368 if test ! -z "$need_dash_r" ; then
1369 LDFLAGS="$LDFLAGS -R${withval}"
1371 if test ! -z "$blibpath" ; then
1372 blibpath="$blibpath:${withval}"
1375 AC_CHECK_HEADERS(sectok.h)
1376 if test "$ac_cv_header_sectok_h" != yes; then
1377 AC_MSG_ERROR(Can't find sectok.h)
1379 AC_CHECK_LIB(sectok, sectok_open)
1380 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1381 AC_MSG_ERROR(Can't find libsectok)
1383 AC_DEFINE(SMARTCARD)
1389 # Check whether user wants Kerberos support
1391 AC_ARG_WITH(kerberos4,
1392 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1394 if test "x$withval" != "xno" ; then
1395 if test "x$withval" != "xyes" ; then
1396 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1397 LDFLAGS="$LDFLAGS -L${withval}/lib"
1398 if test ! -z "$need_dash_r" ; then
1399 LDFLAGS="$LDFLAGS -R${withval}/lib"
1401 if test ! -z "$blibpath" ; then
1402 blibpath="$blibpath:${withval}/lib"
1405 if test -d /usr/include/kerberosIV ; then
1406 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1410 AC_CHECK_HEADERS(krb.h)
1411 if test "$ac_cv_header_krb_h" != yes; then
1412 AC_MSG_WARN([Cannot find krb.h, build may fail])
1414 AC_CHECK_LIB(krb, main)
1415 if test "$ac_cv_lib_krb_main" != yes; then
1416 AC_CHECK_LIB(krb4, main)
1417 if test "$ac_cv_lib_krb4_main" != yes; then
1418 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1425 AC_CHECK_LIB(des, des_cbc_encrypt)
1426 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1427 AC_CHECK_LIB(des425, des_cbc_encrypt)
1428 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1429 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1436 AC_CHECK_LIB(resolv, dn_expand, , )
1444 # Check whether user wants AFS support
1447 [ --with-afs=PATH Enable AFS support],
1449 if test "x$withval" != "xno" ; then
1451 if test "x$withval" != "xyes" ; then
1452 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1453 LDFLAGS="$LDFLAGS -L${withval}/lib"
1456 if test -z "$KRB4" ; then
1457 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1461 if test ! -z "$AFS_LIBS" ; then
1462 LIBS="$LIBS $AFS_LIBS"
1471 # Looking for programs, paths and files
1473 [ --with-rsh=PATH Specify path to remote shell program ],
1475 if test "x$withval" != "$no" ; then
1480 AC_PATH_PROG(rsh_path, rsh)
1485 [ --with-xauth=PATH Specify path to xauth program ],
1487 if test "x$withval" != "xno" ; then
1492 AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin)
1493 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
1494 xauth_path="/usr/openwin/bin/xauth"
1499 if test -z "$xauth_path" ; then
1500 XAUTH_PATH="undefined"
1501 AC_SUBST(XAUTH_PATH)
1503 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
1504 XAUTH_PATH=$xauth_path
1505 AC_SUBST(XAUTH_PATH)
1507 if test ! -z "$rsh_path" ; then
1508 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1511 # Check for mail directory (last resort if we cannot get it from headers)
1512 if test ! -z "$MAIL" ; then
1513 maildir=`dirname $MAIL`
1514 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1517 if test -z "$no_dev_ptmx" ; then
1518 AC_CHECK_FILE("/dev/ptmx",
1520 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1525 AC_CHECK_FILE("/dev/ptc",
1527 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1532 # Options from here on. Some of these are preset by platform above
1534 # Check for user-specified random device, otherwise check /dev/urandom
1536 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
1538 if test "x$withval" != "xno" ; then
1539 RANDOM_POOL="$withval";
1540 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1544 # Check for random device
1545 AC_CHECK_FILE("/dev/urandom",
1547 RANDOM_POOL="/dev/urandom";
1548 AC_SUBST(RANDOM_POOL)
1549 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1555 # Check for PRNGD/EGD pool file
1556 AC_ARG_WITH(prngd-port,
1557 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1559 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1560 PRNGD_PORT="$withval"
1561 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1566 # Check for PRNGD/EGD pool file
1567 AC_ARG_WITH(prngd-socket,
1568 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1570 if test "x$withval" != "xno" ; then
1571 PRNGD_SOCKET="$withval"
1572 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1576 # Check for existing socket only if we don't have a random device already
1577 if test -z "$RANDOM_POOL" ; then
1578 AC_MSG_CHECKING(for PRNGD/EGD socket)
1579 # Insert other locations here
1580 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1581 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1582 PRNGD_SOCKET="$sock"
1583 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1587 if test ! -z "$PRNGD_SOCKET" ; then
1588 AC_MSG_RESULT($PRNGD_SOCKET)
1590 AC_MSG_RESULT(not found)
1597 # detect pathnames for entropy gathering commands, if we need them
1598 INSTALL_SSH_PRNG_CMDS=""
1600 if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
1601 INSTALL_SSH_PRNG_CMDS="yes"
1603 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1605 # These programs are used to gather entropy from
1606 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1607 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1608 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1609 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1610 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1611 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1612 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1613 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1614 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1615 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1616 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1617 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1618 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1619 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1620 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1621 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1624 AC_ARG_WITH(mantype,
1625 [ --with-mantype=man|cat|doc Set man page type],
1632 AC_MSG_ERROR(invalid man type: $withval)
1637 if test -z "$MANTYPE"; then
1638 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
1639 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1641 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1648 if test "$MANTYPE" = "doc"; then
1655 # Check whether to enable MD5 passwords
1657 AC_ARG_WITH(md5-passwords,
1658 [ --with-md5-passwords Enable use of MD5 passwords],
1660 if test "x$withval" != "xno" ; then
1661 AC_DEFINE(HAVE_MD5_PASSWORDS)
1667 # Whether to disable shadow password support
1669 [ --without-shadow Disable shadow password support],
1671 if test "x$withval" = "xno" ; then
1672 AC_DEFINE(DISABLE_SHADOW)
1678 if test -z "$disable_shadow" ; then
1679 AC_MSG_CHECKING([if the systems has expire shadow information])
1682 #include <sys/types.h>
1685 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1686 [ sp_expire_available=yes ], []
1689 if test "x$sp_expire_available" = "xyes" ; then
1691 AC_DEFINE(HAS_SHADOW_EXPIRE)
1697 # Use ip address instead of hostname in $DISPLAY
1698 if test ! -z "$IPADDR_IN_DISPLAY" ; then
1699 DISPLAY_HACK_MSG="yes"
1700 AC_DEFINE(IPADDR_IN_DISPLAY)
1702 DISPLAY_HACK_MSG="no"
1703 AC_ARG_WITH(ipaddr-display,
1704 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1706 if test "x$withval" != "xno" ; then
1707 AC_DEFINE(IPADDR_IN_DISPLAY)
1708 DISPLAY_HACK_MSG="yes"
1714 # Whether to mess with the default path
1715 SERVER_PATH_MSG="(default)"
1716 AC_ARG_WITH(default-path,
1717 [ --with-default-path=PATH Specify default \$PATH environment for server],
1719 if test "x$withval" != "xno" ; then
1720 user_path="$withval"
1721 SERVER_PATH_MSG="$withval"
1727 /* find out what STDPATH is */
1732 #ifndef _PATH_STDPATH
1733 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1735 #include <sys/types.h>
1736 #include <sys/stat.h>
1738 #define DATA "conftest.stdpath"
1745 fd = fopen(DATA,"w");
1749 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1754 ], [ user_path=`cat conftest.stdpath` ],
1755 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1756 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1758 # make sure $bindir is in USER_PATH so scp will work
1759 t_bindir=`eval echo ${bindir}`
1761 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1764 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1766 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1767 if test $? -ne 0 ; then
1768 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1769 if test $? -ne 0 ; then
1770 user_path=$user_path:$t_bindir
1771 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1776 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1779 # Whether to force IPv4 by default (needed on broken glibc Linux)
1781 AC_ARG_WITH(ipv4-default,
1782 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1784 if test "x$withval" != "xno" ; then
1785 AC_DEFINE(IPV4_DEFAULT)
1791 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
1792 IPV4_IN6_HACK_MSG="no"
1794 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1796 if test "x$withval" != "xno" ; then
1798 AC_DEFINE(IPV4_IN_IPV6)
1799 IPV4_IN6_HACK_MSG="yes"
1804 if test "x$inet6_default_4in6" = "xyes"; then
1805 AC_MSG_RESULT([yes (default)])
1806 AC_DEFINE(IPV4_IN_IPV6)
1807 IPV4_IN6_HACK_MSG="yes"
1809 AC_MSG_RESULT([no (default)])
1814 # Whether to enable BSD auth support
1815 AC_ARG_WITH(bsd-auth,
1816 [ --with-bsd-auth Enable BSD auth support],
1818 if test "x$withval" != "xno" ; then
1825 AC_MSG_CHECKING(whether to install ssh as suid root)
1826 AC_ARG_ENABLE(suid-ssh,
1827 [ --enable-suid-ssh Install ssh as suid root (default)
1828 --disable-suid-ssh Install ssh without suid bit],
1829 [ case "$enableval" in
1834 *) AC_MSG_RESULT(yes)
1844 # Where to place sshd.pid
1846 AC_ARG_WITH(pid-dir,
1847 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1849 if test "x$withval" != "xno" ; then
1855 # make sure the directory exists
1856 if test ! -d $piddir ; then
1857 piddir=`eval echo ${sysconfdir}`
1859 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1863 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
1866 dnl allow user to disable some login recording features
1867 AC_ARG_ENABLE(lastlog,
1868 [ --disable-lastlog disable use of lastlog even if detected [no]],
1869 [ AC_DEFINE(DISABLE_LASTLOG) ]
1872 [ --disable-utmp disable use of utmp even if detected [no]],
1873 [ AC_DEFINE(DISABLE_UTMP) ]
1875 AC_ARG_ENABLE(utmpx,
1876 [ --disable-utmpx disable use of utmpx even if detected [no]],
1877 [ AC_DEFINE(DISABLE_UTMPX) ]
1880 [ --disable-wtmp disable use of wtmp even if detected [no]],
1881 [ AC_DEFINE(DISABLE_WTMP) ]
1883 AC_ARG_ENABLE(wtmpx,
1884 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
1885 [ AC_DEFINE(DISABLE_WTMPX) ]
1887 AC_ARG_ENABLE(libutil,
1888 [ --disable-libutil disable use of libutil (login() etc.) [no]],
1889 [ AC_DEFINE(DISABLE_LOGIN) ]
1891 AC_ARG_ENABLE(pututline,
1892 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
1893 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1895 AC_ARG_ENABLE(pututxline,
1896 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
1897 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1899 AC_ARG_WITH(lastlog,
1900 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
1902 if test "x$withval" = "xno" ; then
1903 AC_DEFINE(DISABLE_LASTLOG)
1905 conf_lastlog_location=$withval
1910 dnl lastlog, [uw]tmpx? detection
1911 dnl NOTE: set the paths in the platform section to avoid the
1912 dnl need for command-line parameters
1913 dnl lastlog and [uw]tmp are subject to a file search if all else fails
1915 dnl lastlog detection
1916 dnl NOTE: the code itself will detect if lastlog is a directory
1917 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1919 #include <sys/types.h>
1921 #ifdef HAVE_LASTLOG_H
1922 # include <lastlog.h>
1931 [ char *lastlog = LASTLOG_FILE; ],
1932 [ AC_MSG_RESULT(yes) ],
1935 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1937 #include <sys/types.h>
1939 #ifdef HAVE_LASTLOG_H
1940 # include <lastlog.h>
1946 [ char *lastlog = _PATH_LASTLOG; ],
1947 [ AC_MSG_RESULT(yes) ],
1950 system_lastlog_path=no
1955 if test -z "$conf_lastlog_location"; then
1956 if test x"$system_lastlog_path" = x"no" ; then
1957 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
1958 if (test -d "$f" || test -f "$f") ; then
1959 conf_lastlog_location=$f
1962 if test -z "$conf_lastlog_location"; then
1963 AC_MSG_WARN([** Cannot find lastlog **])
1964 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
1969 if test -n "$conf_lastlog_location"; then
1970 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1974 AC_MSG_CHECKING([if your system defines UTMP_FILE])
1976 #include <sys/types.h>
1982 [ char *utmp = UTMP_FILE; ],
1983 [ AC_MSG_RESULT(yes) ],
1985 system_utmp_path=no ]
1987 if test -z "$conf_utmp_location"; then
1988 if test x"$system_utmp_path" = x"no" ; then
1989 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1990 if test -f $f ; then
1991 conf_utmp_location=$f
1994 if test -z "$conf_utmp_location"; then
1995 AC_DEFINE(DISABLE_UTMP)
1999 if test -n "$conf_utmp_location"; then
2000 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2004 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2006 #include <sys/types.h>
2012 [ char *wtmp = WTMP_FILE; ],
2013 [ AC_MSG_RESULT(yes) ],
2015 system_wtmp_path=no ]
2017 if test -z "$conf_wtmp_location"; then
2018 if test x"$system_wtmp_path" = x"no" ; then
2019 for f in /usr/adm/wtmp /var/log/wtmp; do
2020 if test -f $f ; then
2021 conf_wtmp_location=$f
2024 if test -z "$conf_wtmp_location"; then
2025 AC_DEFINE(DISABLE_WTMP)
2029 if test -n "$conf_wtmp_location"; then
2030 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2034 dnl utmpx detection - I don't know any system so perverse as to require
2035 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2037 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2039 #include <sys/types.h>
2048 [ char *utmpx = UTMPX_FILE; ],
2049 [ AC_MSG_RESULT(yes) ],
2051 system_utmpx_path=no ]
2053 if test -z "$conf_utmpx_location"; then
2054 if test x"$system_utmpx_path" = x"no" ; then
2055 AC_DEFINE(DISABLE_UTMPX)
2058 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2062 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2064 #include <sys/types.h>
2073 [ char *wtmpx = WTMPX_FILE; ],
2074 [ AC_MSG_RESULT(yes) ],
2076 system_wtmpx_path=no ]
2078 if test -z "$conf_wtmpx_location"; then
2079 if test x"$system_wtmpx_path" = x"no" ; then
2080 AC_DEFINE(DISABLE_WTMPX)
2083 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2087 # Change default command timeout for builtin PRNG
2089 AC_ARG_WITH(entropy-timeout,
2090 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2092 if test "x$withval" != "xno" ; then
2093 entropy_timeout=$withval
2097 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
2100 if test ! -z "$blibpath" ; then
2101 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2102 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2107 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2110 # Print summary of options
2112 if test ! -z "$RANDOM_POOL" ; then
2113 RAND_MSG="Device ($RANDOM_POOL)"
2115 if test ! -z "$PRNGD_PORT" ; then
2116 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
2117 elif test ! -z "$PRNGD_SOCKET" ; then
2118 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
2120 RAND_MSG="Builtin (timeout $entropy_timeout)"
2125 # Someone please show me a better way :)
2126 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2127 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2128 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2129 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2130 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2131 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2132 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2133 H=`eval echo ${user_path}` ; H=`eval echo ${H}`
2136 echo "OpenSSH has been configured with the following options:"
2137 echo " User binaries: $B"
2138 echo " System binaries: $C"
2139 echo " Configuration files: $D"
2140 echo " Askpass program: $E"
2141 echo " Manual pages: $F"
2142 echo " PID file: $G"
2143 echo " sshd default user PATH: $H"
2144 echo " Random number collection: $RAND_MSG"
2145 echo " Manpage format: $MANTYPE"
2146 echo " PAM support: ${PAM_MSG}"
2147 echo " KerberosIV support: $KRB4_MSG"
2148 echo " Smartcard support: $SCARD_MSG"
2149 echo " AFS support: $AFS_MSG"
2150 echo " S/KEY support: $SKEY_MSG"
2151 echo " TCP Wrappers support: $TCPW_MSG"
2152 echo " MD5 password support: $MD5_MSG"
2153 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2154 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2155 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2157 if test ! -z "$bsd_auth"; then
2158 echo " BSD Auth support: yes"
2163 echo " Host: ${host}"
2164 echo " Compiler: ${CC}"
2165 echo " Compiler flags: ${CFLAGS}"
2166 echo "Preprocessor flags: ${CPPFLAGS}"
2167 echo " Linker flags: ${LDFLAGS}"
2168 echo " Libraries: ${LIBS}"
2172 if test "x$PAM_MSG" = "xyes" ; then
2173 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
2174 echo "otherwise password authentication may fail. Example PAM control files"
2175 echo "can be found in the contrib/ subdirectory"
2179 if test ! -z "$BUILTIN_RNG" ; then
2180 echo "WARNING: you are using the builtin random number collection service."
2181 echo "Please read WARNING.RNG and request that your OS vendor includes"
2182 echo "/dev/random in future versions of their OS."
2186 if test ! -z "$NO_SFTP"; then
2187 echo "sftp-server will be disabled. Your compiler does not support"
2188 echo "64bit integers."