5 AC_CONFIG_HEADER(config.h)
10 # Checks for programs.
15 AC_PATH_PROGS(PERL, perl5 perl)
17 AC_PATH_PROG(ENT, ent)
19 AC_PATH_PROGS(FILEPRIV, filepriv, true, /sbin:/usr/sbin)
20 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
21 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
22 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
27 if test -z "$AR" ; then
28 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
31 # Use LOGIN_PROGRAM from environment if possible
32 if test ! -z "$LOGIN_PROGRAM" ; then
33 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
36 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
37 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
38 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
42 if test -z "$LD" ; then
48 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
49 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
52 # Check for some target-specific stuff
56 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
57 LDFLAGS="$LDFLAGS -L/usr/local/lib"
58 if (test "$LD" != "gcc" && test -z "$blibpath"); then
59 blibpath="/usr/lib:/lib:/usr/local/lib"
61 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
62 AC_DEFINE(BROKEN_GETADDRINFO)
63 dnl AIX handles lastlog as part of its login message
64 AC_DEFINE(DISABLE_LASTLOG)
67 LIBS="$LIBS -lregex /usr/lib/textmode.o"
68 AC_DEFINE(HAVE_CYGWIN)
70 AC_DEFINE(DISABLE_SHADOW)
71 AC_DEFINE(IPV4_DEFAULT)
72 AC_DEFINE(IP_TOS_IS_BROKEN)
73 AC_DEFINE(NO_X11_UNIX_SOCKETS)
78 AC_DEFINE(IP_TOS_IS_BROKEN)
81 AC_DEFINE(BROKEN_GETADDRINFO)
84 if test -z "$GCC"; then
87 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
90 AC_DEFINE(DISABLE_SHADOW)
91 AC_DEFINE(DISABLE_UTMP)
92 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
93 LIBS="$LIBS -lxnet -lsec"
96 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
98 AC_DEFINE(PAM_SUN_CODEBASE)
100 AC_DEFINE(DISABLE_SHADOW)
101 AC_DEFINE(DISABLE_UTMP)
102 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
103 LIBS="$LIBS -lxnet -lsec"
106 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
108 PATH="$PATH:/usr/etc"
111 AC_DEFINE(BROKEN_INET_NTOA)
114 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
116 PATH="$PATH:/usr/etc"
117 AC_DEFINE(WITH_IRIX_ARRAY)
118 AC_DEFINE(WITH_IRIX_PROJECT)
119 AC_DEFINE(WITH_IRIX_AUDIT)
120 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
123 AC_DEFINE(BROKEN_INET_NTOA)
127 check_for_libcrypt_later=1
128 AC_DEFINE(DONT_TRY_OTHER_AF)
129 AC_DEFINE(PAM_TTY_KLUDGE)
130 inet6_default_4in6=yes
132 mips-sony-bsd|mips-sony-newsos4)
133 AC_DEFINE(HAVE_NEWS4)
135 AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT),
136 AC_MSG_ERROR([*** libiberty missing - please install first or check config.log ***])
143 check_for_libcrypt_later=1
146 conf_lastlog_location="/usr/adm/lastlog"
147 conf_utmp_location=/etc/utmp
148 conf_wtmp_location=/usr/adm/wtmp
151 AC_DEFINE(BROKEN_REALPATH)
153 AC_DEFINE(BROKEN_SAVED_UIDS)
154 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
158 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
159 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
161 AC_DEFINE(PAM_SUN_CODEBASE)
162 AC_DEFINE(LOGIN_NEEDS_UTMPX)
163 AC_DEFINE(LOGIN_NEEDS_TERM)
164 # hardwire lastlog location (can't detect it on some versions)
165 conf_lastlog_location="/var/adm/lastlog"
166 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
167 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
168 if test "$sol2ver" -ge 8; then
170 AC_DEFINE(DISABLE_UTMP)
171 AC_DEFINE(DISABLE_WTMP)
177 CPPFLAGS="$CPPFLAGS -DSUNOS4"
178 AC_CHECK_FUNCS(getpwanam)
179 AC_DEFINE(PAM_SUN_CODEBASE)
180 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
181 conf_utmp_location=/etc/utmp
182 conf_wtmp_location=/var/adm/wtmp
183 conf_lastlog_location=/var/adm/lastlog
187 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
188 LDFLAGS="$LDFLAGS -L/usr/local/lib"
189 LIBS="$LIBS -lc89 -lnsl -lgen -lsocket"
190 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
193 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
194 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
195 IPADDR_IN_DISPLAY=yes
197 AC_DEFINE(IP_TOS_IS_BROKEN)
198 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
199 LIBS="$LIBS -lgen -lnsl -lucb"
202 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
203 LDFLAGS="$LDFLAGS -L/usr/local/lib"
208 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
209 LDFLAGS="$LDFLAGS -L/usr/local/lib"
214 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
215 LDFLAGS="$LDFLAGS -L/usr/local/lib"
216 LIBS="$LIBS -lgen -lsocket"
219 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
220 LDFLAGS="$LDFLAGS -L/usr/local/lib"
221 LIBS="$LIBS -lgen -lsocket -los -lprot -lx -ltinfo -lm"
222 rsh_path="/usr/bin/rcmd"
225 AC_DEFINE(BROKEN_SYS_TERMIO_H)
227 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
228 AC_DEFINE(DISABLE_SHADOW)
229 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
230 AC_DEFINE(BROKEN_SAVED_UIDS)
231 AC_CHECK_FUNCS(getluid setluid)
235 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
236 LDFLAGS="$LDFLAGS -L/usr/local/lib"
237 LIBS="$LIBS -lprot -lx -ltinfo -lm"
239 rsh_path="/usr/bin/rcmd"
241 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
242 AC_DEFINE(DISABLE_SHADOW)
243 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
244 AC_CHECK_FUNCS(getluid setluid)
251 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
252 LIBS="$LIBS -lgen -lrsc"
255 AC_MSG_CHECKING(for Digital Unix SIA)
258 [ --with-osfsia Enable Digital Unix SIA],
260 if test "x$withval" = "xno" ; then
261 AC_MSG_RESULT(disabled)
266 if test -z "$no_osfsia" ; then
267 if test -f /etc/sia/matrix.conf; then
269 AC_DEFINE(HAVE_OSF_SIA)
270 AC_DEFINE(DISABLE_LOGIN)
271 LIBS="$LIBS -lsecurity -ldb -lm -laud"
280 AC_DEFINE(NO_X11_UNIX_SOCKETS)
281 AC_DEFINE(MISSING_NFDBITS)
282 AC_DEFINE(MISSING_HOWMANY)
283 AC_DEFINE(MISSING_FD_MASK)
287 # Allow user to specify flags
289 [ --with-cflags Specify additional flags to pass to compiler],
291 if test "x$withval" != "xno" ; then
292 CFLAGS="$CFLAGS $withval"
296 AC_ARG_WITH(cppflags,
297 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
299 if test "x$withval" != "xno"; then
300 CPPFLAGS="$CPPFLAGS $withval"
305 [ --with-ldflags Specify additional flags to pass to linker],
307 if test "x$withval" != "xno" ; then
308 LDFLAGS="$LDFLAGS $withval"
313 [ --with-libs Specify additional libraries to link with],
315 if test "x$withval" != "xno" ; then
316 LIBS="$LIBS $withval"
322 [ --with-pcre Override built in regex library with pcre],
325 AC_CHECK_LIB(pcre, pcre_info,
327 AC_DEFINE(HAVE_LIBPCRE)
328 LIBS="$LIBS -lpcreposix -lpcre"
331 [ AC_MSG_ERROR([*** Can not locate pcre libraries.]) ]
336 # Checks for libraries.
337 if test -z "$no_libnsl" ; then
338 AC_CHECK_LIB(nsl, yp_match, , )
340 if test -z "$no_libsocket" ; then
341 AC_CHECK_LIB(socket, main, , )
344 dnl SCO OS3 needs this for libwrap
345 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
347 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
348 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
349 AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
351 # We don't want to check if we did an pcre override.
352 if test -z "$no_comp_check" ; then
353 AC_CHECK_FUNC(regcomp,
354 [ AC_DEFINE(HAVE_REGCOMP)],
356 AC_CHECK_LIB(pcre, pcre_info,
358 AC_DEFINE(HAVE_LIBPCRE)
359 LIBS="$LIBS -lpcreposix -lpcre"
362 AC_MSG_ERROR([*** No regex library found.])
369 AC_CHECK_FUNC(strcasecmp,
370 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
372 AC_CHECK_FUNC(utimes,
373 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
378 # Checks for header files.
379 AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h getopt.h glob.h lastlog.h libgen.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h regex.h shadow.h security/pam_appl.h stdint.h strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/queue.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h sys/un.h stddef.h time.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h)
381 # Check for ALTDIRFUNC glob() extension
382 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
383 AC_EGREP_CPP(FOUNDIT,
386 #ifdef GLOB_ALTDIRFUNC
391 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
399 # Check for g.gl_matchc glob() extension
400 AC_MSG_CHECKING(for gl_matchc field in glob_t)
401 AC_EGREP_CPP(FOUNDIT,
404 int main(void){glob_t g; g.gl_matchc = 1;}
407 AC_DEFINE(GLOB_HAS_GL_MATCHC)
415 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
418 #include <sys/types.h>
420 int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
422 [AC_MSG_RESULT(yes)],
425 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
429 # Check whether user wants S/Key support
432 [ --with-skey=PATH Enable S/Key support],
434 if test "x$withval" != "xno" ; then
436 if test "x$withval" != "xyes" ; then
437 CPPFLAGS="$CPPFLAGS -I${withval}/include"
438 LDFLAGS="$LDFLAGS -L${withval}/lib"
445 AC_CHECK_FUNC(skey_keyinfo,
448 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
454 # Check whether user wants TCP wrappers support
456 AC_ARG_WITH(tcp-wrappers,
457 [ --with-tcp-wrappers Enable tcpwrappers support],
459 if test "x$withval" != "xno" ; then
462 AC_MSG_CHECKING(for libwrap)
466 int deny_severity = 0, allow_severity = 0;
475 AC_MSG_ERROR([*** libwrap missing])
482 dnl Checks for library functions.
483 AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa clock dirname fchown fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getopt getnameinfo getrlimit getrusage getttyent glob inet_aton inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty readpassphrase realpath rresvport_af setdtablesize setenv setegid seteuid setlogin setproctitle setresgid setreuid setrlimit setsid setvbuf sigaction sigvec snprintf strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp utimes vsnprintf vhangup waitpid _getpty __b64_ntop)
484 dnl Checks for time functions
485 AC_CHECK_FUNCS(gettimeofday time)
486 dnl Checks for libutil functions
487 AC_CHECK_HEADERS(libutil.h)
488 AC_CHECK_FUNCS(login logout updwtmp logwtmp)
489 dnl Checks for utmp functions
490 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
491 AC_CHECK_FUNCS(utmpname)
492 dnl Checks for utmpx functions
493 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
494 AC_CHECK_FUNCS(setutxent utmpxname)
496 AC_CHECK_FUNC(getuserattr,
497 [AC_DEFINE(HAVE_GETUSERATTR)],
498 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
502 [AC_DEFINE(HAVE_LOGIN)],
503 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
506 AC_CHECK_FUNC(daemon,
507 [AC_DEFINE(HAVE_DAEMON)],
508 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
511 AC_CHECK_FUNC(getpagesize,
512 [AC_DEFINE(HAVE_GETPAGESIZE)],
513 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
516 # Check for broken snprintf
517 if test "x$ac_cv_func_snprintf" = "xyes" ; then
518 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
522 int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
524 [AC_MSG_RESULT(yes)],
527 AC_DEFINE(BROKEN_SNPRINTF)
528 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
538 [ --with-pam Enable PAM support ],
540 if test "x$withval" != "xno" ; then
541 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
542 AC_MSG_ERROR([PAM headers not found])
545 AC_CHECK_LIB(dl, dlopen, , )
546 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
547 AC_CHECK_FUNCS(pam_getenvlist)
557 # Check for older PAM
558 if test "x$PAM_MSG" = "xyes" ; then
559 # Check PAM strerror arguments (old PAM)
560 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
564 #include <security/pam_appl.h>
566 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
569 AC_DEFINE(HAVE_OLD_PAM)
571 PAM_MSG="yes (old library)"
576 # The big search for OpenSSL
578 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
580 if test "x$withval" != "xno" ; then
587 saved_LDFLAGS="$LDFLAGS"
588 saved_CPPFLAGS="$CPPFLAGS"
589 if test "x$prefix" != "xNONE" ; then
590 tryssldir="$tryssldir $prefix"
592 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
593 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
594 CPPFLAGS="$saved_CPPFLAGS"
595 LDFLAGS="$saved_LDFLAGS"
596 LIBS="$saved_LIBS -lcrypto"
598 # Skip directories if they don't exist
599 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
602 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
603 # Try to use $ssldir/lib if it exists, otherwise
605 if test -d "$ssldir/lib" ; then
606 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
607 if test ! -z "$need_dash_r" ; then
608 LDFLAGS="-R$ssldir/lib $LDFLAGS"
611 LDFLAGS="-L$ssldir $saved_LDFLAGS"
612 if test ! -z "$need_dash_r" ; then
613 LDFLAGS="-R$ssldir $LDFLAGS"
616 # Try to use $ssldir/include if it exists, otherwise
618 if test -d "$ssldir/include" ; then
619 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
621 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
625 # Basic test to check for compatible version and correct linking
626 # *does not* test for RSA - that comes later.
630 #include <openssl/rand.h>
634 memset(a, 0, sizeof(a));
635 RAND_add(a, sizeof(a), sizeof(a));
636 return(RAND_status() <= 0);
645 if test ! -z "$found_crypto" ; then
650 if test -z "$found_crypto" ; then
651 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
653 if test -z "$ssldir" ; then
657 ac_cv_openssldir=$ssldir
660 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
661 AC_DEFINE(HAVE_OPENSSL)
662 dnl Need to recover ssldir - test above runs in subshell
663 ssldir=$ac_cv_openssldir
664 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
665 # Try to use $ssldir/lib if it exists, otherwise
667 if test -d "$ssldir/lib" ; then
668 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
669 if test ! -z "$need_dash_r" ; then
670 LDFLAGS="-R$ssldir/lib $LDFLAGS"
673 LDFLAGS="-L$ssldir $saved_LDFLAGS"
674 if test ! -z "$need_dash_r" ; then
675 LDFLAGS="-R$ssldir $LDFLAGS"
678 # Try to use $ssldir/include if it exists, otherwise
680 if test -d "$ssldir/include" ; then
681 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
683 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
687 LIBS="$saved_LIBS -lcrypto"
689 # Now test RSA support
691 AC_MSG_CHECKING([for RSA support])
692 for WANTS_RSAREF in "" 1 ; do
693 if test -z "$WANTS_RSAREF" ; then
696 LIBS="$saved_LIBS -lRSAglue -lrsaref"
700 #include <openssl/rand.h>
701 #include <openssl/rsa.h>
702 #include <openssl/bn.h>
703 #include <openssl/sha.h>
706 int num; RSA *key; static unsigned char p_in[] = "blahblah";
707 unsigned char c[256], p[256];
708 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
709 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
710 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
711 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
721 if test ! -z "$no_rsa" ; then
722 AC_MSG_RESULT(disabled)
725 if test -z "$rsa_works" ; then
726 AC_MSG_WARN([*** No RSA support found *** ])
729 if test -z "$WANTS_RSAREF" ; then
733 RSA_MSG="yes (using RSAref)"
734 AC_MSG_RESULT(using RSAref)
735 LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
740 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
741 # version in OpenSSL. Skip this for PAM
742 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
743 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
746 # Cheap hack to ensure NEWS-OS libraries are arranged right.
747 if test ! -z "$SONY" ; then
748 LIBS="$LIBS -liberty";
751 # Checks for data types
752 AC_CHECK_SIZEOF(char, 1)
753 AC_CHECK_SIZEOF(short int, 2)
754 AC_CHECK_SIZEOF(int, 4)
755 AC_CHECK_SIZEOF(long int, 4)
756 AC_CHECK_SIZEOF(long long int, 8)
758 # More checks for data types
759 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
761 [ #include <sys/types.h> ],
763 [ ac_cv_have_u_int="yes" ],
764 [ ac_cv_have_u_int="no" ]
767 if test "x$ac_cv_have_u_int" = "xyes" ; then
768 AC_DEFINE(HAVE_U_INT)
772 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
774 [ #include <sys/types.h> ],
775 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
776 [ ac_cv_have_intxx_t="yes" ],
777 [ ac_cv_have_intxx_t="no" ]
780 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
781 AC_DEFINE(HAVE_INTXX_T)
785 if (test -z "$have_intxx_t" && \
786 test "x$ac_cv_header_stdint_h" = "xyes")
788 AC_MSG_CHECKING([for intXX_t types in stdint.h])
790 [ #include <stdint.h> ],
791 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
793 AC_DEFINE(HAVE_INTXX_T)
796 [ AC_MSG_RESULT(no) ]
800 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
802 [ #include <sys/types.h> ],
803 [ int64_t a; a = 1;],
804 [ ac_cv_have_int64_t="yes" ],
805 [ ac_cv_have_int64_t="no" ]
808 if test "x$ac_cv_have_int64_t" = "xyes" ; then
809 AC_DEFINE(HAVE_INT64_T)
813 if test -z "$have_int64_t" ; then
814 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
816 [ #include <sys/socket.h> ],
819 AC_DEFINE(HAVE_INT64_T)
822 [ AC_MSG_RESULT(no) ]
826 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
828 [ #include <sys/types.h> ],
829 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
830 [ ac_cv_have_u_intxx_t="yes" ],
831 [ ac_cv_have_u_intxx_t="no" ]
834 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
835 AC_DEFINE(HAVE_U_INTXX_T)
839 if test -z "$have_u_intxx_t" ; then
840 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
842 [ #include <sys/socket.h> ],
843 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
845 AC_DEFINE(HAVE_U_INTXX_T)
848 [ AC_MSG_RESULT(no) ]
852 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
854 [ #include <sys/types.h> ],
855 [ u_int64_t a; a = 1;],
856 [ ac_cv_have_u_int64_t="yes" ],
857 [ ac_cv_have_u_int64_t="no" ]
860 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
861 AC_DEFINE(HAVE_U_INT64_T)
865 if test -z "$have_u_intxx_t" ; then
866 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
869 #include <sys/types.h>
871 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
872 [ ac_cv_have_uintxx_t="yes" ],
873 [ ac_cv_have_uintxx_t="no" ]
876 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
877 AC_DEFINE(HAVE_UINTXX_T)
881 if test -z "$have_uintxx_t" ; then
882 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
884 [ #include <stdint.h> ],
885 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
887 AC_DEFINE(HAVE_UINTXX_T)
890 [ AC_MSG_RESULT(no) ]
894 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
895 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
897 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
900 #include <sys/bitypes.h>
903 int8_t a; int16_t b; int32_t c;
904 u_int8_t e; u_int16_t f; u_int32_t g;
905 a = b = c = e = f = g = 1;
908 AC_DEFINE(HAVE_U_INTXX_T)
909 AC_DEFINE(HAVE_INTXX_T)
917 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
920 #include <sys/types.h>
922 [ u_char foo; foo = 125; ],
923 [ ac_cv_have_u_char="yes" ],
924 [ ac_cv_have_u_char="no" ]
927 if test "x$ac_cv_have_u_char" = "xyes" ; then
928 AC_DEFINE(HAVE_U_CHAR)
931 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
934 #include <sys/types.h>
935 #include <sys/socket.h>
937 [socklen_t foo; foo = 1235;],
938 [ ac_cv_have_socklen_t="yes" ],
939 [ ac_cv_have_socklen_t="no" ]
942 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
943 AC_DEFINE(HAVE_SOCKLEN_T)
946 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
949 #include <sys/types.h>
951 [ size_t foo; foo = 1235; ],
952 [ ac_cv_have_size_t="yes" ],
953 [ ac_cv_have_size_t="no" ]
956 if test "x$ac_cv_have_size_t" = "xyes" ; then
957 AC_DEFINE(HAVE_SIZE_T)
960 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
963 #include <sys/types.h>
965 [ ssize_t foo; foo = 1235; ],
966 [ ac_cv_have_ssize_t="yes" ],
967 [ ac_cv_have_ssize_t="no" ]
970 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
971 AC_DEFINE(HAVE_SSIZE_T)
974 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
979 [ clock_t foo; foo = 1235; ],
980 [ ac_cv_have_clock_t="yes" ],
981 [ ac_cv_have_clock_t="no" ]
984 if test "x$ac_cv_have_clock_t" = "xyes" ; then
985 AC_DEFINE(HAVE_CLOCK_T)
988 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
991 #include <sys/types.h>
992 #include <sys/socket.h>
994 [ sa_family_t foo; foo = 1235; ],
995 [ ac_cv_have_sa_family_t="yes" ],
998 #include <sys/types.h>
999 #include <sys/socket.h>
1000 #include <netinet/in.h>
1002 [ sa_family_t foo; foo = 1235; ],
1003 [ ac_cv_have_sa_family_t="yes" ],
1005 [ ac_cv_have_sa_family_t="no" ]
1009 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1010 AC_DEFINE(HAVE_SA_FAMILY_T)
1013 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1016 #include <sys/types.h>
1018 [ pid_t foo; foo = 1235; ],
1019 [ ac_cv_have_pid_t="yes" ],
1020 [ ac_cv_have_pid_t="no" ]
1023 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1024 AC_DEFINE(HAVE_PID_T)
1027 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1030 #include <sys/types.h>
1032 [ mode_t foo; foo = 1235; ],
1033 [ ac_cv_have_mode_t="yes" ],
1034 [ ac_cv_have_mode_t="no" ]
1037 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1038 AC_DEFINE(HAVE_MODE_T)
1042 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1045 #include <sys/types.h>
1046 #include <sys/socket.h>
1048 [ struct sockaddr_storage s; ],
1049 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1050 [ ac_cv_have_struct_sockaddr_storage="no" ]
1053 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1054 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1057 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1060 #include <sys/types.h>
1061 #include <netinet/in.h>
1063 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1064 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1065 [ ac_cv_have_struct_sockaddr_in6="no" ]
1068 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1069 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1072 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1075 #include <sys/types.h>
1076 #include <netinet/in.h>
1078 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1079 [ ac_cv_have_struct_in6_addr="yes" ],
1080 [ ac_cv_have_struct_in6_addr="no" ]
1083 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1084 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1087 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1090 #include <sys/types.h>
1091 #include <sys/socket.h>
1094 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1095 [ ac_cv_have_struct_addrinfo="yes" ],
1096 [ ac_cv_have_struct_addrinfo="no" ]
1099 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1100 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1103 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1105 [ #include <sys/time.h> ],
1106 [ struct timeval tv; tv.tv_sec = 1;],
1107 [ ac_cv_have_struct_timeval="yes" ],
1108 [ ac_cv_have_struct_timeval="no" ]
1111 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1112 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1113 have_struct_timeval=1
1116 # If we don't have int64_t then we can't compile sftp-server. So don't
1117 # even attempt to do it.
1118 if test "x$ac_cv_have_int64_t" = "xno" -a \
1119 "x$ac_cv_sizeof_long_int" != "x8" -a \
1120 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1123 dnl test snprintf (broken on SCO w/gcc)
1128 #ifdef HAVE_SNPRINTF
1132 char expected_out[50];
1134 #if (SIZEOF_LONG_INT == 8)
1135 long int num = 0x7fffffffffffffff;
1137 long long num = 0x7fffffffffffffffll;
1139 strcpy(expected_out, "9223372036854775807");
1140 snprintf(buf, mazsize, "%lld", num);
1141 if(strcmp(buf, expected_out) != 0)
1148 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1153 dnl Checks for structure members
1154 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1155 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1156 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1157 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1158 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1159 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1160 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1161 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1162 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1163 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1164 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1165 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1166 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1167 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1168 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1169 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1170 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1171 AC_STRUCT_ST_BLKSIZE
1173 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1174 ac_cv_have_ss_family_in_struct_ss, [
1177 #include <sys/types.h>
1178 #include <sys/socket.h>
1180 [ struct sockaddr_storage s; s.ss_family = 1; ],
1181 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1182 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1185 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1186 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1189 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1190 ac_cv_have___ss_family_in_struct_ss, [
1193 #include <sys/types.h>
1194 #include <sys/socket.h>
1196 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1197 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1198 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1201 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1202 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1205 AC_CACHE_CHECK([for pw_class field in struct passwd],
1206 ac_cv_have_pw_class_in_struct_passwd, [
1211 [ struct passwd p; p.pw_class = 0; ],
1212 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1213 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1216 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1217 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1220 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1221 ac_cv_have_pw_expire_in_struct_passwd, [
1226 [ struct passwd p; p.pw_expire = 0; ],
1227 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1228 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1231 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1232 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1235 AC_CACHE_CHECK([for pw_change field in struct passwd],
1236 ac_cv_have_pw_change_in_struct_passwd, [
1241 [ struct passwd p; p.pw_change = 0; ],
1242 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1243 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1246 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1247 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1250 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1252 [ extern char *__progname; printf("%s", __progname); ],
1253 [ ac_cv_libc_defines___progname="yes" ],
1254 [ ac_cv_libc_defines___progname="no" ]
1257 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1258 AC_DEFINE(HAVE___PROGNAME)
1261 AC_CACHE_CHECK([whether getopt has optreset support],
1262 ac_cv_have_getopt_optreset, [
1267 [ extern int optreset; optreset = 0; ],
1268 [ ac_cv_have_getopt_optreset="yes" ],
1269 [ ac_cv_have_getopt_optreset="no" ]
1272 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1273 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1276 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1278 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1279 [ ac_cv_libc_defines_sys_errlist="yes" ],
1280 [ ac_cv_libc_defines_sys_errlist="no" ]
1283 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1284 AC_DEFINE(HAVE_SYS_ERRLIST)
1288 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1290 [ extern int sys_nerr; printf("%i", sys_nerr);],
1291 [ ac_cv_libc_defines_sys_nerr="yes" ],
1292 [ ac_cv_libc_defines_sys_nerr="no" ]
1295 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1296 AC_DEFINE(HAVE_SYS_NERR)
1300 # Check whether user wants Kerberos support
1302 AC_ARG_WITH(smartcard,
1303 [ --with-smartcard Enable smartcard support],
1305 if test "x$withval" != "xno" ; then
1306 if test "x$withval" != "xyes" ; then
1307 CPPFLAGS="$CPPFLAGS -I${withval}"
1308 LDFLAGS="$LDFLAGS -L${withval}"
1309 if test ! -z "$need_dash_r" ; then
1310 LDFLAGS="$LDFLAGS -R${withval}"
1312 if test ! -z "$blibpath" ; then
1313 blibpath="$blibpath:${withval}"
1316 AC_CHECK_HEADERS(sectok.h)
1317 if test "$ac_cv_header_sectok_h" != yes; then
1318 AC_MSG_ERROR(Can't find sectok.h)
1320 AC_CHECK_LIB(sectok, sectok_open)
1321 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1322 AC_MSG_ERROR(Can't find libsectok)
1324 AC_DEFINE(SMARTCARD)
1330 # Check whether user wants Kerberos support
1332 AC_ARG_WITH(kerberos4,
1333 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1335 if test "x$withval" != "xno" ; then
1336 if test "x$withval" != "xyes" ; then
1337 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1338 LDFLAGS="$LDFLAGS -L${withval}/lib"
1339 if test ! -z "$need_dash_r" ; then
1340 LDFLAGS="$LDFLAGS -R${withval}/lib"
1342 if test ! -z "$blibpath" ; then
1343 blibpath="$blibpath:${withval}/lib"
1346 if test -d /usr/include/kerberosIV ; then
1347 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1351 AC_CHECK_HEADERS(krb.h)
1352 if test "$ac_cv_header_krb_h" != yes; then
1353 AC_MSG_WARN([Cannot find krb.h, build may fail])
1355 AC_CHECK_LIB(krb, main)
1356 if test "$ac_cv_lib_krb_main" != yes; then
1357 AC_CHECK_LIB(krb4, main)
1358 if test "$ac_cv_lib_krb4_main" != yes; then
1359 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1366 AC_CHECK_LIB(des, des_cbc_encrypt)
1367 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1368 AC_CHECK_LIB(des425, des_cbc_encrypt)
1369 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1370 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1377 AC_CHECK_LIB(resolv, dn_expand, , )
1385 # Check whether user wants AFS support
1388 [ --with-afs=PATH Enable AFS support],
1390 if test "x$withval" != "xno" ; then
1392 if test "x$withval" != "xyes" ; then
1393 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1394 LDFLAGS="$LDFLAGS -L${withval}/lib"
1397 if test -z "$KRB4" ; then
1398 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1402 if test ! -z "$AFS_LIBS" ; then
1403 LIBS="$LIBS $AFS_LIBS"
1412 # Looking for programs, paths and files
1414 [ --with-rsh=PATH Specify path to remote shell program ],
1416 if test "x$withval" != "$no" ; then
1421 AC_PATH_PROG(rsh_path, rsh)
1426 [ --with-xauth=PATH Specify path to xauth program ],
1428 if test "x$withval" != "xno" ; then
1433 AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin)
1434 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
1435 xauth_path="/usr/openwin/bin/xauth"
1440 if test -z "$xauth_path" ; then
1441 XAUTH_PATH="undefined"
1442 AC_SUBST(XAUTH_PATH)
1444 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
1445 XAUTH_PATH=$xauth_path
1446 AC_SUBST(XAUTH_PATH)
1448 if test ! -z "$rsh_path" ; then
1449 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1452 # Check for mail directory (last resort if we cannot get it from headers)
1453 if test ! -z "$MAIL" ; then
1454 maildir=`dirname $MAIL`
1455 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1458 if test -z "$no_dev_ptmx" ; then
1459 AC_CHECK_FILE("/dev/ptmx",
1461 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1466 AC_CHECK_FILE("/dev/ptc",
1468 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1473 # Options from here on. Some of these are preset by platform above
1475 # Check for user-specified random device, otherwise check /dev/urandom
1477 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
1479 if test "x$withval" != "xno" ; then
1480 RANDOM_POOL="$withval";
1481 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1485 # Check for random device
1486 AC_CHECK_FILE("/dev/urandom",
1488 RANDOM_POOL="/dev/urandom";
1489 AC_SUBST(RANDOM_POOL)
1490 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1496 # Check for PRNGD/EGD pool file
1497 AC_ARG_WITH(prngd-port,
1498 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1500 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1501 PRNGD_PORT="$withval"
1502 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1507 # Check for PRNGD/EGD pool file
1508 AC_ARG_WITH(prngd-socket,
1509 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1511 if test "x$withval" != "xno" ; then
1512 PRNGD_SOCKET="$withval"
1513 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1517 # Check for existing socket only if we don't have a random device already
1518 if test -z "$RANDOM_POOL" ; then
1519 AC_MSG_CHECKING(for PRNGD/EGD socket)
1520 # Insert other locations here
1521 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1522 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1523 PRNGD_SOCKET="$sock"
1524 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1528 if test ! -z "$PRNGD_SOCKET" ; then
1529 AC_MSG_RESULT($PRNGD_SOCKET)
1531 AC_MSG_RESULT(not found)
1538 # detect pathnames for entropy gathering commands, if we need them
1539 INSTALL_SSH_PRNG_CMDS=""
1541 if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
1542 # Use these commands to collect entropy
1543 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1544 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1545 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1546 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1547 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1548 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1549 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1550 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1551 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1552 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1553 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1554 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1555 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1556 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1557 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1558 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1560 INSTALL_SSH_PRNG_CMDS="yes"
1562 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1565 AC_ARG_WITH(mantype,
1566 [ --with-mantype=man|cat|doc Set man page type],
1573 AC_MSG_ERROR(invalid man type: $withval)
1578 if test -z "$MANTYPE"; then
1579 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
1580 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1582 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1589 if test "$MANTYPE" = "doc"; then
1596 # Check whether to enable MD5 passwords
1598 AC_ARG_WITH(md5-passwords,
1599 [ --with-md5-passwords Enable use of MD5 passwords],
1601 if test "x$withval" != "xno" ; then
1602 AC_DEFINE(HAVE_MD5_PASSWORDS)
1608 # Whether to disable shadow password support
1610 [ --without-shadow Disable shadow password support],
1612 if test "x$withval" = "xno" ; then
1613 AC_DEFINE(DISABLE_SHADOW)
1619 if test -z "$disable_shadow" ; then
1620 AC_MSG_CHECKING([if the systems has expire shadow information])
1623 #include <sys/types.h>
1626 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1627 [ sp_expire_available=yes ], []
1630 if test "x$sp_expire_available" = "xyes" ; then
1632 AC_DEFINE(HAS_SHADOW_EXPIRE)
1638 # Use ip address instead of hostname in $DISPLAY
1639 if test ! -z "$IPADDR_IN_DISPLAY" ; then
1640 DISPLAY_HACK_MSG="yes"
1641 AC_DEFINE(IPADDR_IN_DISPLAY)
1643 DISPLAY_HACK_MSG="no"
1644 AC_ARG_WITH(ipaddr-display,
1645 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1647 if test "x$withval" != "xno" ; then
1648 AC_DEFINE(IPADDR_IN_DISPLAY)
1649 DISPLAY_HACK_MSG="yes"
1655 # Whether to mess with the default path
1656 SERVER_PATH_MSG="(default)"
1657 AC_ARG_WITH(default-path,
1658 [ --with-default-path=PATH Specify default \$PATH environment for server],
1660 if test "x$withval" != "xno" ; then
1661 user_path="$withval"
1662 SERVER_PATH_MSG="$withval"
1668 /* find out what STDPATH is */
1673 #ifndef _PATH_STDPATH
1674 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1676 #include <sys/types.h>
1677 #include <sys/stat.h>
1679 #define DATA "conftest.stdpath"
1686 fd = fopen(DATA,"w");
1690 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1695 ], [ user_path=`cat conftest.stdpath` ],
1696 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1697 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1699 # make sure $bindir is in USER_PATH so scp will work
1700 t_bindir=`eval echo ${bindir}`
1702 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1705 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1707 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1708 if test $? -ne 0 ; then
1709 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1710 if test $? -ne 0 ; then
1711 user_path=$user_path:$t_bindir
1712 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1717 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1720 # Whether to force IPv4 by default (needed on broken glibc Linux)
1722 AC_ARG_WITH(ipv4-default,
1723 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1725 if test "x$withval" != "xno" ; then
1726 AC_DEFINE(IPV4_DEFAULT)
1732 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
1733 IPV4_IN6_HACK_MSG="no"
1735 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1737 if test "x$withval" != "xno" ; then
1739 AC_DEFINE(IPV4_IN_IPV6)
1740 IPV4_IN6_HACK_MSG="yes"
1745 if test "x$inet6_default_4in6" = "xyes"; then
1746 AC_MSG_RESULT([yes (default)])
1747 AC_DEFINE(IPV4_IN_IPV6)
1748 IPV4_IN6_HACK_MSG="yes"
1750 AC_MSG_RESULT([no (default)])
1755 # Whether to enable BSD auth support
1756 AC_ARG_WITH(bsd-auth,
1757 [ --with-bsd-auth Enable BSD auth support],
1759 if test "x$withval" != "xno" ; then
1766 AC_MSG_CHECKING(whether to install ssh as suid root)
1767 AC_ARG_ENABLE(suid-ssh,
1768 [ --enable-suid-ssh Install ssh as suid root (default)
1769 --disable-suid-ssh Install ssh without suid bit],
1770 [ case "$enableval" in
1775 *) AC_MSG_RESULT(yes)
1785 # Where to place sshd.pid
1787 AC_ARG_WITH(pid-dir,
1788 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1790 if test "x$withval" != "xno" ; then
1796 # make sure the directory exists
1797 if test ! -d $piddir ; then
1798 piddir=`eval echo ${sysconfdir}`
1800 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1804 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
1807 dnl allow user to disable some login recording features
1808 AC_ARG_ENABLE(lastlog,
1809 [ --disable-lastlog disable use of lastlog even if detected [no]],
1810 [ AC_DEFINE(DISABLE_LASTLOG) ]
1813 [ --disable-utmp disable use of utmp even if detected [no]],
1814 [ AC_DEFINE(DISABLE_UTMP) ]
1816 AC_ARG_ENABLE(utmpx,
1817 [ --disable-utmpx disable use of utmpx even if detected [no]],
1818 [ AC_DEFINE(DISABLE_UTMPX) ]
1821 [ --disable-wtmp disable use of wtmp even if detected [no]],
1822 [ AC_DEFINE(DISABLE_WTMP) ]
1824 AC_ARG_ENABLE(wtmpx,
1825 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
1826 [ AC_DEFINE(DISABLE_WTMPX) ]
1828 AC_ARG_ENABLE(libutil,
1829 [ --disable-libutil disable use of libutil (login() etc.) [no]],
1830 [ AC_DEFINE(DISABLE_LOGIN) ]
1832 AC_ARG_ENABLE(pututline,
1833 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
1834 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1836 AC_ARG_ENABLE(pututxline,
1837 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
1838 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1840 AC_ARG_WITH(lastlog,
1841 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
1843 if test "x$withval" = "xno" ; then
1844 AC_DEFINE(DISABLE_LASTLOG)
1846 conf_lastlog_location=$withval
1851 dnl lastlog, [uw]tmpx? detection
1852 dnl NOTE: set the paths in the platform section to avoid the
1853 dnl need for command-line parameters
1854 dnl lastlog and [uw]tmp are subject to a file search if all else fails
1856 dnl lastlog detection
1857 dnl NOTE: the code itself will detect if lastlog is a directory
1858 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1860 #include <sys/types.h>
1862 #ifdef HAVE_LASTLOG_H
1863 # include <lastlog.h>
1872 [ char *lastlog = LASTLOG_FILE; ],
1873 [ AC_MSG_RESULT(yes) ],
1876 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1878 #include <sys/types.h>
1880 #ifdef HAVE_LASTLOG_H
1881 # include <lastlog.h>
1887 [ char *lastlog = _PATH_LASTLOG; ],
1888 [ AC_MSG_RESULT(yes) ],
1891 system_lastlog_path=no
1896 if test -z "$conf_lastlog_location"; then
1897 if test x"$system_lastlog_path" = x"no" ; then
1898 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
1899 if (test -d "$f" || test -f "$f") ; then
1900 conf_lastlog_location=$f
1903 if test -z "$conf_lastlog_location"; then
1904 AC_MSG_WARN([** Cannot find lastlog **])
1905 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
1910 if test -n "$conf_lastlog_location"; then
1911 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1915 AC_MSG_CHECKING([if your system defines UTMP_FILE])
1917 #include <sys/types.h>
1923 [ char *utmp = UTMP_FILE; ],
1924 [ AC_MSG_RESULT(yes) ],
1926 system_utmp_path=no ]
1928 if test -z "$conf_utmp_location"; then
1929 if test x"$system_utmp_path" = x"no" ; then
1930 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1931 if test -f $f ; then
1932 conf_utmp_location=$f
1935 if test -z "$conf_utmp_location"; then
1936 AC_DEFINE(DISABLE_UTMP)
1940 if test -n "$conf_utmp_location"; then
1941 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1945 AC_MSG_CHECKING([if your system defines WTMP_FILE])
1947 #include <sys/types.h>
1953 [ char *wtmp = WTMP_FILE; ],
1954 [ AC_MSG_RESULT(yes) ],
1956 system_wtmp_path=no ]
1958 if test -z "$conf_wtmp_location"; then
1959 if test x"$system_wtmp_path" = x"no" ; then
1960 for f in /usr/adm/wtmp /var/log/wtmp; do
1961 if test -f $f ; then
1962 conf_wtmp_location=$f
1965 if test -z "$conf_wtmp_location"; then
1966 AC_DEFINE(DISABLE_WTMP)
1970 if test -n "$conf_wtmp_location"; then
1971 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1975 dnl utmpx detection - I don't know any system so perverse as to require
1976 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1978 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1980 #include <sys/types.h>
1989 [ char *utmpx = UTMPX_FILE; ],
1990 [ AC_MSG_RESULT(yes) ],
1992 system_utmpx_path=no ]
1994 if test -z "$conf_utmpx_location"; then
1995 if test x"$system_utmpx_path" = x"no" ; then
1996 AC_DEFINE(DISABLE_UTMPX)
1999 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2003 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2005 #include <sys/types.h>
2014 [ char *wtmpx = WTMPX_FILE; ],
2015 [ AC_MSG_RESULT(yes) ],
2017 system_wtmpx_path=no ]
2019 if test -z "$conf_wtmpx_location"; then
2020 if test x"$system_wtmpx_path" = x"no" ; then
2021 AC_DEFINE(DISABLE_WTMPX)
2024 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2028 # Change default command timeout for builtin PRNG
2030 AC_ARG_WITH(entropy-timeout,
2031 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2033 if test "x$withval" != "xno" ; then
2034 entropy_timeout=$withval
2038 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
2041 if test ! -z "$blibpath" ; then
2042 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2043 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2048 AC_OUTPUT(Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds)
2050 # Print summary of options
2052 if test ! -z "$RANDOM_POOL" ; then
2053 RAND_MSG="Device ($RANDOM_POOL)"
2055 if test ! -z "$PRNGD_PORT" ; then
2056 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
2057 elif test ! -z "$PRNGD_SOCKET" ; then
2058 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
2060 RAND_MSG="Builtin (timeout $entropy_timeout)"
2065 # Someone please show me a better way :)
2066 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2067 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2068 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2069 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2070 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2071 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2072 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2073 H=`eval echo ${user_path}` ; H=`eval echo ${H}`
2076 echo "OpenSSH has been configured with the following options:"
2077 echo " User binaries: $B"
2078 echo " System binaries: $C"
2079 echo " Configuration files: $D"
2080 echo " Askpass program: $E"
2081 echo " Manual pages: $F"
2082 echo " PID file: $G"
2083 echo " sshd default user PATH: $H"
2084 echo " Random number collection: $RAND_MSG"
2085 echo " Manpage format: $MANTYPE"
2086 echo " PAM support: ${PAM_MSG}"
2087 echo " KerberosIV support: $KRB4_MSG"
2088 echo " Smartcard support: $SCARD_MSG"
2089 echo " AFS support: $AFS_MSG"
2090 echo " S/KEY support: $SKEY_MSG"
2091 echo " TCP Wrappers support: $TCPW_MSG"
2092 echo " MD5 password support: $MD5_MSG"
2093 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2094 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2095 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2097 if test ! -z "$bsd_auth"; then
2098 echo " BSD Auth support: yes"
2103 echo " Host: ${host}"
2104 echo " Compiler: ${CC}"
2105 echo " Compiler flags: ${CFLAGS}"
2106 echo "Preprocessor flags: ${CPPFLAGS}"
2107 echo " Linker flags: ${LDFLAGS}"
2108 echo " Libraries: ${LIBS}"
2112 if test "x$PAM_MSG" = "xyes" ; then
2113 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
2114 echo "otherwise password authentication may fail. Example PAM control files"
2115 echo "can be found in the contrib/ subdirectory"
2119 if test ! -z "$BUILTIN_RNG" ; then
2120 echo "WARNING: you are using the builtin random number collection service."
2121 echo "Please read WARNING.RNG and request that your OS vendor includes"
2122 echo "/dev/random in future versions of their OS."
2126 if test ! -z "$NO_SFTP"; then
2127 echo "sftp-server will be disabled. Your compiler does not support"
2128 echo "64bit integers."