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)
24 if test -z "$AR" ; then
25 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
28 # Use LOGIN_PROGRAM from environment if possible
29 if test ! -z "$LOGIN_PROGRAM" ; then
30 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
33 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
34 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
35 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
39 if test -z "$LD" ; then
46 if test "$GCC" = "yes"; then
47 CFLAGS="$CFLAGS -Wall"
50 # Check for some target-specific stuff
54 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
55 LDFLAGS="$LDFLAGS -L/usr/local/lib"
56 if (test "$LD" != "gcc" && test -z "$blibpath"); then
57 blibpath="/usr/lib:/lib:/usr/local/lib"
59 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
60 AC_DEFINE(BROKEN_GETADDRINFO)
61 dnl AIX handles lastlog as part of its login message
62 AC_DEFINE(DISABLE_LASTLOG)
65 LIBS="$LIBS -lregex /usr/lib/textmode.o"
66 AC_DEFINE(HAVE_CYGWIN)
68 AC_DEFINE(DISABLE_SHADOW)
69 AC_DEFINE(IPV4_DEFAULT)
70 AC_DEFINE(IP_TOS_IS_BROKEN)
71 AC_DEFINE(NO_X11_UNIX_SOCKETS)
76 AC_DEFINE(IP_TOS_IS_BROKEN)
79 if test -z "$GCC"; then
82 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
85 AC_DEFINE(DISABLE_SHADOW)
86 AC_DEFINE(DISABLE_UTMP)
87 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
91 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
93 AC_DEFINE(PAM_SUN_CODEBASE)
95 AC_DEFINE(DISABLE_SHADOW)
96 AC_DEFINE(DISABLE_UTMP)
97 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
101 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
103 PATH="$PATH:/usr/etc"
106 AC_DEFINE(BROKEN_INET_NTOA)
109 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
111 PATH="$PATH:/usr/etc"
112 AC_DEFINE(WITH_IRIX_ARRAY)
113 AC_DEFINE(WITH_IRIX_PROJECT)
114 AC_DEFINE(WITH_IRIX_AUDIT)
115 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 # hardwire lastlog location (can't detect it on some versions)
160 conf_lastlog_location="/var/adm/lastlog"
161 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
162 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
163 if test "$sol2ver" -ge 8; then
165 AC_DEFINE(DISABLE_UTMP)
166 AC_DEFINE(DISABLE_WTMP)
172 CPPFLAGS="$CPPFLAGS -DSUNOS4"
173 AC_CHECK_FUNCS(getpwanam)
174 AC_DEFINE(PAM_SUN_CODEBASE)
175 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
176 conf_utmp_location=/etc/utmp
177 conf_wtmp_location=/var/adm/wtmp
178 conf_lastlog_location=/var/adm/lastlog
182 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
183 LDFLAGS="$LDFLAGS -L/usr/local/lib"
184 LIBS="$LIBS -lc89 -lnsl -lgen -lsocket"
185 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
188 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
189 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
190 IPADDR_IN_DISPLAY=yes
192 AC_DEFINE(IP_TOS_IS_BROKEN)
193 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
194 LIBS="$LIBS -lgen -lnsl -lucb"
197 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
198 LDFLAGS="$LDFLAGS -L/usr/local/lib"
203 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
204 LDFLAGS="$LDFLAGS -L/usr/local/lib"
209 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
210 LDFLAGS="$LDFLAGS -L/usr/local/lib"
211 LIBS="$LIBS -lgen -lsocket"
214 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
215 LDFLAGS="$LDFLAGS -L/usr/local/lib"
216 LIBS="$LIBS -lgen -lsocket -los -lprot -lx -ltinfo -lm"
217 rsh_path="/usr/bin/rcmd"
220 AC_DEFINE(BROKEN_SYS_TERMIO_H)
222 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
223 AC_DEFINE(DISABLE_SHADOW)
224 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
225 AC_DEFINE(BROKEN_SAVED_UIDS)
226 AC_CHECK_FUNCS(getluid setluid)
230 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
231 LDFLAGS="$LDFLAGS -L/usr/local/lib"
232 LIBS="$LIBS -lprot -lx -ltinfo -lm"
234 rsh_path="/usr/bin/rcmd"
236 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
237 AC_DEFINE(DISABLE_SHADOW)
238 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
239 AC_CHECK_FUNCS(getluid setluid)
243 AC_MSG_CHECKING(for Digital Unix SIA)
246 [ --with-osfsia Enable Digital Unix SIA],
248 if test "x$withval" = "xno" ; then
249 AC_MSG_RESULT(disabled)
254 if test -z "$no_osfsia" ; then
255 if test -f /etc/sia/matrix.conf; then
257 AC_DEFINE(HAVE_OSF_SIA)
258 AC_DEFINE(DISABLE_LOGIN)
259 LIBS="$LIBS -lsecurity -ldb -lm -laud"
267 # Allow user to specify flags
269 [ --with-cflags Specify additional flags to pass to compiler],
271 if test "x$withval" != "xno" ; then
272 CFLAGS="$CFLAGS $withval"
276 AC_ARG_WITH(cppflags,
277 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
279 if test "x$withval" != "xno"; then
280 CPPFLAGS="$CPPFLAGS $withval"
285 [ --with-ldflags Specify additional flags to pass to linker],
287 if test "x$withval" != "xno" ; then
288 LDFLAGS="$LDFLAGS $withval"
293 [ --with-libs Specify additional libraries to link with],
295 if test "x$withval" != "xno" ; then
296 LIBS="$LIBS $withval"
302 [ --with-pcre Override built in regex library with pcre],
305 AC_CHECK_LIB(pcre, pcre_info,
307 AC_DEFINE(HAVE_LIBPCRE)
308 LIBS="$LIBS -lpcreposix -lpcre"
311 [ AC_MSG_ERROR([*** Can not locate pcre libraries.]) ]
316 # Checks for libraries.
317 if test -z "$no_libnsl" ; then
318 AC_CHECK_LIB(nsl, yp_match, , )
320 if test -z "$no_libsocket" ; then
321 AC_CHECK_LIB(socket, main, , )
324 dnl SCO OS3 needs this for libwrap
325 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
327 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
328 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
329 AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
331 # We don't want to check if we did an pcre override.
332 if test -z "$no_comp_check" ; then
333 AC_CHECK_FUNC(regcomp,
334 [ AC_DEFINE(HAVE_REGCOMP)],
336 AC_CHECK_LIB(pcre, pcre_info,
338 AC_DEFINE(HAVE_LIBPCRE)
339 LIBS="$LIBS -lpcreposix -lpcre"
342 AC_MSG_ERROR([*** No regex library found.])
349 AC_CHECK_FUNC(strcasecmp,
350 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
352 AC_CHECK_FUNC(utimes,
353 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
358 # Checks for header files.
359 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 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 vis.h)
361 # Check for ALTDIRFUNC glob() extension
362 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
363 AC_EGREP_CPP(FOUNDIT,
366 #ifdef GLOB_ALTDIRFUNC
371 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
379 # Check for g.gl_matchc glob() extension
380 AC_MSG_CHECKING(for gl_matchc field in glob_t)
381 AC_EGREP_CPP(FOUNDIT,
384 int main(void){glob_t g; g.gl_matchc = 1;}
387 AC_DEFINE(GLOB_HAS_GL_MATCHC)
395 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
398 #include <sys/types.h>
400 int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
402 [AC_MSG_RESULT(yes)],
405 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
409 # Check whether user wants S/Key support
412 [ --with-skey=PATH Enable S/Key support],
414 if test "x$withval" != "xno" ; then
416 if test "x$withval" != "xyes" ; then
417 CPPFLAGS="$CPPFLAGS -I${withval}/include"
418 LDFLAGS="$LDFLAGS -L${withval}/lib"
425 AC_CHECK_FUNC(skey_keyinfo,
428 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
434 # Check whether user wants TCP wrappers support
436 AC_ARG_WITH(tcp-wrappers,
437 [ --with-tcp-wrappers Enable tcpwrappers support],
439 if test "x$withval" != "xno" ; then
442 AC_MSG_CHECKING(for libwrap)
446 int deny_severity = 0, allow_severity = 0;
455 AC_MSG_ERROR([*** libwrap missing])
462 dnl Checks for library functions.
463 AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa clock dirname fchown fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getnameinfo getrlimit getrusage getttyent getusershell glob inet_aton inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setdtablesize setenv setegid seteuid setlogin setproctitle setresgid setreuid setrlimit setsid setvbuf sigaction sigvec snprintf strerror strlcat strlcpy strmode strsep strtok_r sysconf tcgetpgrp utimes vsnprintf vhangup vis waitpid _getpty __b64_ntop)
464 dnl Checks for time functions
465 AC_CHECK_FUNCS(gettimeofday time)
466 dnl Checks for libutil functions
467 AC_CHECK_HEADERS(libutil.h)
468 AC_CHECK_FUNCS(login logout updwtmp logwtmp)
469 dnl Checks for utmp functions
470 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
471 AC_CHECK_FUNCS(utmpname)
472 dnl Checks for utmpx functions
473 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
474 AC_CHECK_FUNCS(setutxent utmpxname)
476 AC_CHECK_FUNC(getuserattr,
477 [AC_DEFINE(HAVE_GETUSERATTR)],
478 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
482 [AC_DEFINE(HAVE_LOGIN)],
483 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
486 AC_CHECK_FUNC(daemon,
487 [AC_DEFINE(HAVE_DAEMON)],
488 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
491 AC_CHECK_FUNC(getpagesize,
492 [AC_DEFINE(HAVE_GETPAGESIZE)],
493 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
496 # Check for broken snprintf
497 if test "x$ac_cv_func_snprintf" = "xyes" ; then
498 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
502 int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
504 [AC_MSG_RESULT(yes)],
507 AC_DEFINE(BROKEN_SNPRINTF)
508 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
518 [ --with-pam Enable PAM support ],
520 if test "x$withval" != "xno" ; then
521 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
522 AC_MSG_ERROR([PAM headers not found])
525 AC_CHECK_LIB(dl, dlopen, , )
526 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
527 AC_CHECK_FUNCS(pam_getenvlist)
537 # Check for older PAM
538 if test "x$PAM_MSG" = "xyes" ; then
539 # Check PAM strerror arguments (old PAM)
540 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
544 #include <security/pam_appl.h>
546 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
549 AC_DEFINE(HAVE_OLD_PAM)
551 PAM_MSG="yes (old library)"
556 # The big search for OpenSSL
558 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
560 if test "x$withval" != "xno" ; then
567 saved_LDFLAGS="$LDFLAGS"
568 saved_CPPFLAGS="$CPPFLAGS"
569 if test "x$prefix" != "xNONE" ; then
570 tryssldir="$tryssldir $prefix"
572 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
573 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
574 CPPFLAGS="$saved_CPPFLAGS"
575 LDFLAGS="$saved_LDFLAGS"
576 LIBS="$saved_LIBS -lcrypto"
578 # Skip directories if they don't exist
579 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
582 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
583 # Try to use $ssldir/lib if it exists, otherwise
585 if test -d "$ssldir/lib" ; then
586 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
587 if test ! -z "$need_dash_r" ; then
588 LDFLAGS="-R$ssldir/lib $LDFLAGS"
591 LDFLAGS="-L$ssldir $saved_LDFLAGS"
592 if test ! -z "$need_dash_r" ; then
593 LDFLAGS="-R$ssldir $LDFLAGS"
596 # Try to use $ssldir/include if it exists, otherwise
598 if test -d "$ssldir/include" ; then
599 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
601 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
605 # Basic test to check for compatible version and correct linking
606 # *does not* test for RSA - that comes later.
610 #include <openssl/rand.h>
614 memset(a, 0, sizeof(a));
615 RAND_add(a, sizeof(a), sizeof(a));
616 return(RAND_status() <= 0);
625 if test ! -z "$found_crypto" ; then
630 if test -z "$found_crypto" ; then
631 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
633 if test -z "$ssldir" ; then
637 ac_cv_openssldir=$ssldir
640 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
641 AC_DEFINE(HAVE_OPENSSL)
642 dnl Need to recover ssldir - test above runs in subshell
643 ssldir=$ac_cv_openssldir
644 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
645 # Try to use $ssldir/lib if it exists, otherwise
647 if test -d "$ssldir/lib" ; then
648 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
649 if test ! -z "$need_dash_r" ; then
650 LDFLAGS="-R$ssldir/lib $LDFLAGS"
653 LDFLAGS="-L$ssldir $saved_LDFLAGS"
654 if test ! -z "$need_dash_r" ; then
655 LDFLAGS="-R$ssldir $LDFLAGS"
658 # Try to use $ssldir/include if it exists, otherwise
660 if test -d "$ssldir/include" ; then
661 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
663 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
667 LIBS="$saved_LIBS -lcrypto"
669 # Now test RSA support
671 AC_MSG_CHECKING([for RSA support])
672 for WANTS_RSAREF in "" 1 ; do
673 if test -z "$WANTS_RSAREF" ; then
676 LIBS="$saved_LIBS -lRSAglue -lrsaref"
680 #include <openssl/rand.h>
681 #include <openssl/rsa.h>
682 #include <openssl/bn.h>
683 #include <openssl/sha.h>
686 int num; RSA *key; static unsigned char p_in[] = "blahblah";
687 unsigned char c[256], p[256];
688 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
689 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
690 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
691 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
701 if test ! -z "$no_rsa" ; then
702 AC_MSG_RESULT(disabled)
705 if test -z "$rsa_works" ; then
706 AC_MSG_WARN([*** No RSA support found *** ])
709 if test -z "$WANTS_RSAREF" ; then
713 RSA_MSG="yes (using RSAref)"
714 AC_MSG_RESULT(using RSAref)
715 LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
720 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
721 # version in OpenSSL. Skip this for PAM
722 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
723 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
726 # Cheap hack to ensure NEWS-OS libraries are arranged right.
727 if test ! -z "$SONY" ; then
728 LIBS="$LIBS -liberty";
731 # Checks for data types
732 AC_CHECK_SIZEOF(char, 1)
733 AC_CHECK_SIZEOF(short int, 2)
734 AC_CHECK_SIZEOF(int, 4)
735 AC_CHECK_SIZEOF(long int, 4)
736 AC_CHECK_SIZEOF(long long int, 8)
738 # More checks for data types
739 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
741 [ #include <sys/types.h> ],
743 [ ac_cv_have_u_int="yes" ],
744 [ ac_cv_have_u_int="no" ]
747 if test "x$ac_cv_have_u_int" = "xyes" ; then
748 AC_DEFINE(HAVE_U_INT)
752 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
754 [ #include <sys/types.h> ],
755 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
756 [ ac_cv_have_intxx_t="yes" ],
757 [ ac_cv_have_intxx_t="no" ]
760 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
761 AC_DEFINE(HAVE_INTXX_T)
765 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
767 [ #include <sys/types.h> ],
768 [ int64_t a; a = 1;],
769 [ ac_cv_have_int64_t="yes" ],
770 [ ac_cv_have_int64_t="no" ]
773 if test "x$ac_cv_have_int64_t" = "xyes" ; then
774 AC_DEFINE(HAVE_INT64_T)
778 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
780 [ #include <sys/types.h> ],
781 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
782 [ ac_cv_have_u_intxx_t="yes" ],
783 [ ac_cv_have_u_intxx_t="no" ]
786 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
787 AC_DEFINE(HAVE_U_INTXX_T)
791 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
793 [ #include <sys/types.h> ],
794 [ u_int64_t a; a = 1;],
795 [ ac_cv_have_u_int64_t="yes" ],
796 [ ac_cv_have_u_int64_t="no" ]
799 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
800 AC_DEFINE(HAVE_U_INT64_T)
804 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
805 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
807 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
810 #include <sys/bitypes.h>
813 int8_t a; int16_t b; int32_t c;
814 u_int8_t e; u_int16_t f; u_int32_t g;
815 a = b = c = e = f = g = 1;
818 AC_DEFINE(HAVE_U_INTXX_T)
819 AC_DEFINE(HAVE_INTXX_T)
826 if test -z "$have_u_intxx_t" ; then
827 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
830 #include <sys/types.h>
832 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
833 [ ac_cv_have_uintxx_t="yes" ],
834 [ ac_cv_have_uintxx_t="no" ]
837 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
838 AC_DEFINE(HAVE_UINTXX_T)
842 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
845 #include <sys/types.h>
846 #include <sys/socket.h>
848 [socklen_t foo; foo = 1235;],
849 [ ac_cv_have_socklen_t="yes" ],
850 [ ac_cv_have_socklen_t="no" ]
853 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
854 AC_DEFINE(HAVE_SOCKLEN_T)
857 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
860 #include <sys/types.h>
862 [ size_t foo; foo = 1235; ],
863 [ ac_cv_have_size_t="yes" ],
864 [ ac_cv_have_size_t="no" ]
867 if test "x$ac_cv_have_size_t" = "xyes" ; then
868 AC_DEFINE(HAVE_SIZE_T)
871 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
874 #include <sys/types.h>
876 [ ssize_t foo; foo = 1235; ],
877 [ ac_cv_have_ssize_t="yes" ],
878 [ ac_cv_have_ssize_t="no" ]
881 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
882 AC_DEFINE(HAVE_SSIZE_T)
885 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
890 [ clock_t foo; foo = 1235; ],
891 [ ac_cv_have_clock_t="yes" ],
892 [ ac_cv_have_clock_t="no" ]
895 if test "x$ac_cv_have_clock_t" = "xyes" ; then
896 AC_DEFINE(HAVE_CLOCK_T)
899 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
902 #include <sys/types.h>
903 #include <sys/socket.h>
905 [ sa_family_t foo; foo = 1235; ],
906 [ ac_cv_have_sa_family_t="yes" ],
909 #include <sys/types.h>
910 #include <sys/socket.h>
911 #include <netinet/in.h>
913 [ sa_family_t foo; foo = 1235; ],
914 [ ac_cv_have_sa_family_t="yes" ],
916 [ ac_cv_have_sa_family_t="no" ]
920 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
921 AC_DEFINE(HAVE_SA_FAMILY_T)
924 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
927 #include <sys/types.h>
929 [ pid_t foo; foo = 1235; ],
930 [ ac_cv_have_pid_t="yes" ],
931 [ ac_cv_have_pid_t="no" ]
934 if test "x$ac_cv_have_pid_t" = "xyes" ; then
935 AC_DEFINE(HAVE_PID_T)
938 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
941 #include <sys/types.h>
943 [ mode_t foo; foo = 1235; ],
944 [ ac_cv_have_mode_t="yes" ],
945 [ ac_cv_have_mode_t="no" ]
948 if test "x$ac_cv_have_mode_t" = "xyes" ; then
949 AC_DEFINE(HAVE_MODE_T)
953 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
956 #include <sys/types.h>
957 #include <sys/socket.h>
959 [ struct sockaddr_storage s; ],
960 [ ac_cv_have_struct_sockaddr_storage="yes" ],
961 [ ac_cv_have_struct_sockaddr_storage="no" ]
964 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
965 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
968 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
971 #include <sys/types.h>
972 #include <netinet/in.h>
974 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
975 [ ac_cv_have_struct_sockaddr_in6="yes" ],
976 [ ac_cv_have_struct_sockaddr_in6="no" ]
979 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
980 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
983 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
986 #include <sys/types.h>
987 #include <netinet/in.h>
989 [ struct in6_addr s; s.s6_addr[0] = 0; ],
990 [ ac_cv_have_struct_in6_addr="yes" ],
991 [ ac_cv_have_struct_in6_addr="no" ]
994 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
995 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
998 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1001 #include <sys/types.h>
1002 #include <sys/socket.h>
1005 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1006 [ ac_cv_have_struct_addrinfo="yes" ],
1007 [ ac_cv_have_struct_addrinfo="no" ]
1010 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1011 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1014 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1016 [ #include <sys/time.h> ],
1017 [ struct timeval tv; tv.tv_sec = 1;],
1018 [ ac_cv_have_struct_timeval="yes" ],
1019 [ ac_cv_have_struct_timeval="no" ]
1022 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1023 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1024 have_struct_timeval=1
1027 # If we don't have int64_t then we can't compile sftp-server. So don't
1028 # even attempt to do it.
1029 if test "x$ac_cv_have_int64_t" = "xno" -a \
1030 "x$ac_cv_sizeof_long_int" != "x8" -a \
1031 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1034 dnl test snprintf (broken on SCO w/gcc)
1039 #ifdef HAVE_SNPRINTF
1043 char expected_out[50];
1045 #if (SIZEOF_LONG_INT == 8)
1046 long int num = 0x7fffffffffffffff;
1048 long long num = 0x7fffffffffffffff;
1050 strcpy(expected_out, "9223372036854775807");
1051 snprintf(buf, mazsize, "%lld", num);
1052 if(strcmp(buf, expected_out) != 0)
1059 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1064 dnl Checks for structure members
1065 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1066 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1067 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1068 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1069 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1070 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1071 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1072 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1073 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1074 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1075 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1076 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1077 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1078 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1079 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1080 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1081 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1082 AC_STRUCT_ST_BLKSIZE
1084 AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
1085 ac_cv_have_sun_len_in_struct_sockaddr_un, [
1088 #include <sys/types.h>
1089 #include <sys/socket.h>
1091 [ struct sockaddr_un s; s.sun_len = 1; ],
1092 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
1093 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
1096 if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
1097 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
1100 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1101 ac_cv_have_ss_family_in_struct_ss, [
1104 #include <sys/types.h>
1105 #include <sys/socket.h>
1107 [ struct sockaddr_storage s; s.ss_family = 1; ],
1108 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1109 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1112 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1113 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1116 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1117 ac_cv_have___ss_family_in_struct_ss, [
1120 #include <sys/types.h>
1121 #include <sys/socket.h>
1123 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1124 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1125 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1128 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1129 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1132 AC_CACHE_CHECK([for pw_class field in struct passwd],
1133 ac_cv_have_pw_class_in_struct_passwd, [
1138 [ struct passwd p; p.pw_class = 0; ],
1139 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1140 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1143 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1144 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1147 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1148 ac_cv_have_pw_expire_in_struct_passwd, [
1153 [ struct passwd p; p.pw_expire = 0; ],
1154 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1155 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1158 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1159 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1162 AC_CACHE_CHECK([for pw_change field in struct passwd],
1163 ac_cv_have_pw_change_in_struct_passwd, [
1168 [ struct passwd p; p.pw_change = 0; ],
1169 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1170 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1173 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1174 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1177 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1179 [ extern char *__progname; printf("%s", __progname); ],
1180 [ ac_cv_libc_defines___progname="yes" ],
1181 [ ac_cv_libc_defines___progname="no" ]
1184 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1185 AC_DEFINE(HAVE___PROGNAME)
1189 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1191 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1192 [ ac_cv_libc_defines_sys_errlist="yes" ],
1193 [ ac_cv_libc_defines_sys_errlist="no" ]
1196 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1197 AC_DEFINE(HAVE_SYS_ERRLIST)
1201 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1203 [ extern int sys_nerr; printf("%i", sys_nerr);],
1204 [ ac_cv_libc_defines_sys_nerr="yes" ],
1205 [ ac_cv_libc_defines_sys_nerr="no" ]
1208 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1209 AC_DEFINE(HAVE_SYS_NERR)
1213 # Check whether user wants Kerberos support
1215 AC_ARG_WITH(kerberos4,
1216 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1218 if test "x$withval" != "xno" ; then
1220 if test "x$withval" != "xyes" ; then
1221 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1222 LDFLAGS="$LDFLAGS -L${withval}/lib"
1223 if test ! -z "$need_dash_r" ; then
1224 LDFLAGS="$LDFLAGS -R${withval}/lib"
1226 if test ! -z "$blibpath" ; then
1227 blibpath="$blibpath:${withval}/lib"
1230 if test -d /usr/include/kerberosIV ; then
1231 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1235 AC_CHECK_HEADERS(krb.h)
1236 if test "$ac_cv_header_krb_h" != yes; then
1237 AC_MSG_WARN([Cannot find krb.h, build may fail])
1239 AC_CHECK_LIB(krb, main)
1240 if test "$ac_cv_lib_krb_main" != yes; then
1241 AC_CHECK_LIB(krb4, main)
1242 if test "$ac_cv_lib_krb4_main" != yes; then
1243 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1250 AC_CHECK_LIB(des, des_cbc_encrypt)
1251 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1252 AC_CHECK_LIB(des425, des_cbc_encrypt)
1253 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1254 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1261 AC_CHECK_LIB(resolv, dn_expand, , )
1269 # Check whether user wants AFS support
1272 [ --with-afs=PATH Enable AFS support],
1274 if test "x$withval" != "xno" ; then
1276 if test "x$withval" != "xyes" ; then
1277 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1278 LDFLAGS="$LDFLAGS -L${withval}/lib"
1281 if test -z "$KRB4" ; then
1282 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1286 if test ! -z "$AFS_LIBS" ; then
1287 LIBS="$LIBS $AFS_LIBS"
1296 # Looking for programs, paths and files
1298 [ --with-rsh=PATH Specify path to remote shell program ],
1300 if test "x$withval" != "$no" ; then
1305 AC_PATH_PROG(rsh_path, rsh)
1310 [ --with-xauth=PATH Specify path to xauth program ],
1312 if test "x$withval" != "xno" ; then
1317 AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin)
1318 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
1319 xauth_path="/usr/openwin/bin/xauth"
1324 if test -z "$xauth_path" ; then
1325 XAUTH_PATH="undefined"
1326 AC_SUBST(XAUTH_PATH)
1328 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
1329 XAUTH_PATH=$xauth_path
1330 AC_SUBST(XAUTH_PATH)
1332 if test ! -z "$rsh_path" ; then
1333 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1336 # Check for mail directory (last resort if we cannot get it from headers)
1337 if test ! -z "$MAIL" ; then
1338 maildir=`dirname $MAIL`
1339 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1342 if test -z "$no_dev_ptmx" ; then
1343 AC_CHECK_FILE("/dev/ptmx",
1345 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1350 AC_CHECK_FILE("/dev/ptc",
1352 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1357 # Options from here on. Some of these are preset by platform above
1359 # Check for user-specified random device, otherwise check /dev/urandom
1361 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
1363 if test "x$withval" != "xno" ; then
1364 RANDOM_POOL="$withval";
1365 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1369 # Check for random device
1370 AC_CHECK_FILE("/dev/urandom",
1372 RANDOM_POOL="/dev/urandom";
1373 AC_SUBST(RANDOM_POOL)
1374 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1380 # Check for PRNGD/EGD pool file
1381 AC_ARG_WITH(prngd-port,
1382 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1384 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1385 PRNGD_PORT="$withval"
1386 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1391 # Check for PRNGD/EGD pool file
1392 AC_ARG_WITH(prngd-socket,
1393 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1395 if test "x$withval" != "xno" ; then
1396 PRNGD_SOCKET="$withval"
1397 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1401 # Check for existing socket only if we don't have a random device already
1402 if test -z "$RANDOM_POOL" ; then
1403 AC_MSG_CHECKING(for PRNGD/EGD socket)
1404 # Insert other locations here
1405 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1406 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1407 PRNGD_SOCKET="$sock"
1408 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1412 if test ! -z "$PRNGD_SOCKET" ; then
1413 AC_MSG_RESULT($PRNGD_SOCKET)
1415 AC_MSG_RESULT(not found)
1422 # detect pathnames for entropy gathering commands, if we need them
1423 INSTALL_SSH_PRNG_CMDS=""
1425 if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
1426 # Use these commands to collect entropy
1427 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1428 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1429 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1430 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1431 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1432 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1433 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1434 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1435 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1436 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1437 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1438 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1439 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1440 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1442 INSTALL_SSH_PRNG_CMDS="yes"
1444 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1447 AC_ARG_WITH(mantype,
1448 [ --with-mantype=man|cat|doc Set man page type],
1455 AC_MSG_ERROR(invalid man type: $withval)
1460 if test -z "$MANTYPE"; then
1461 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
1462 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1464 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1471 if test "$MANTYPE" = "doc"; then
1478 # Check whether to enable MD5 passwords
1480 AC_ARG_WITH(md5-passwords,
1481 [ --with-md5-passwords Enable use of MD5 passwords],
1483 if test "x$withval" != "xno" ; then
1484 AC_DEFINE(HAVE_MD5_PASSWORDS)
1490 # Whether to disable shadow password support
1492 [ --without-shadow Disable shadow password support],
1494 if test "x$withval" = "xno" ; then
1495 AC_DEFINE(DISABLE_SHADOW)
1501 if test -z "$disable_shadow" ; then
1502 AC_MSG_CHECKING([if the systems has expire shadow information])
1505 #include <sys/types.h>
1508 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1509 [ sp_expire_available=yes ], []
1512 if test "x$sp_expire_available" = "xyes" ; then
1514 AC_DEFINE(HAS_SHADOW_EXPIRE)
1520 # Use ip address instead of hostname in $DISPLAY
1521 if test ! -z "$IPADDR_IN_DISPLAY" ; then
1522 DISPLAY_HACK_MSG="yes"
1523 AC_DEFINE(IPADDR_IN_DISPLAY)
1525 DISPLAY_HACK_MSG="no"
1526 AC_ARG_WITH(ipaddr-display,
1527 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1529 if test "x$withval" != "xno" ; then
1530 AC_DEFINE(IPADDR_IN_DISPLAY)
1531 DISPLAY_HACK_MSG="yes"
1537 # Whether to mess with the default path
1538 SERVER_PATH_MSG="(default)"
1539 AC_ARG_WITH(default-path,
1540 [ --with-default-path=PATH Specify default \$PATH environment for server],
1542 if test "x$withval" != "xno" ; then
1543 user_path="$withval"
1544 SERVER_PATH_MSG="$withval"
1550 /* find out what STDPATH is */
1555 #ifndef _PATH_STDPATH
1556 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1558 #include <sys/types.h>
1559 #include <sys/stat.h>
1561 #define DATA "conftest.stdpath"
1568 fd = fopen(DATA,"w");
1572 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1577 ], [ user_path=`cat conftest.stdpath` ],
1578 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1579 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1581 # make sure $bindir is in USER_PATH so scp will work
1582 t_bindir=`eval echo ${bindir}`
1584 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1587 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1589 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1590 if test $? -ne 0 ; then
1591 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1592 if test $? -ne 0 ; then
1593 user_path=$user_path:$t_bindir
1594 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1599 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1602 # Whether to force IPv4 by default (needed on broken glibc Linux)
1604 AC_ARG_WITH(ipv4-default,
1605 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1607 if test "x$withval" != "xno" ; then
1608 AC_DEFINE(IPV4_DEFAULT)
1614 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
1615 IPV4_IN6_HACK_MSG="no"
1617 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1619 if test "x$withval" != "xno" ; then
1621 AC_DEFINE(IPV4_IN_IPV6)
1622 IPV4_IN6_HACK_MSG="yes"
1627 if test "x$inet6_default_4in6" = "xyes"; then
1628 AC_MSG_RESULT([yes (default)])
1629 AC_DEFINE(IPV4_IN_IPV6)
1630 IPV4_IN6_HACK_MSG="yes"
1632 AC_MSG_RESULT([no (default)])
1637 # Whether to enable BSD auth support
1638 AC_ARG_WITH(bsd-auth,
1639 [ --with-bsd-auth Enable BSD auth support],
1641 if test "x$withval" != "xno" ; then
1648 AC_MSG_CHECKING(whether to install ssh as suid root)
1649 AC_ARG_ENABLE(suid-ssh,
1650 [ --enable-suid-ssh Install ssh as suid root (default)
1651 --disable-suid-ssh Install ssh without suid bit],
1652 [ case "$enableval" in
1657 *) AC_MSG_RESULT(yes)
1667 # Where to place sshd.pid
1669 AC_ARG_WITH(pid-dir,
1670 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1672 if test "x$withval" != "xno" ; then
1678 # make sure the directory exists
1679 if test ! -d $piddir ; then
1680 piddir=`eval echo ${sysconfdir}`
1682 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1686 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
1689 dnl allow user to disable some login recording features
1690 AC_ARG_ENABLE(lastlog,
1691 [ --disable-lastlog disable use of lastlog even if detected [no]],
1692 [ AC_DEFINE(DISABLE_LASTLOG) ]
1695 [ --disable-utmp disable use of utmp even if detected [no]],
1696 [ AC_DEFINE(DISABLE_UTMP) ]
1698 AC_ARG_ENABLE(utmpx,
1699 [ --disable-utmpx disable use of utmpx even if detected [no]],
1700 [ AC_DEFINE(DISABLE_UTMPX) ]
1703 [ --disable-wtmp disable use of wtmp even if detected [no]],
1704 [ AC_DEFINE(DISABLE_WTMP) ]
1706 AC_ARG_ENABLE(wtmpx,
1707 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
1708 [ AC_DEFINE(DISABLE_WTMPX) ]
1710 AC_ARG_ENABLE(libutil,
1711 [ --disable-libutil disable use of libutil (login() etc.) [no]],
1712 [ AC_DEFINE(DISABLE_LOGIN) ]
1714 AC_ARG_ENABLE(pututline,
1715 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
1716 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1718 AC_ARG_ENABLE(pututxline,
1719 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
1720 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1722 AC_ARG_WITH(lastlog,
1723 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
1725 if test "x$withval" = "xno" ; then
1726 AC_DEFINE(DISABLE_LASTLOG)
1728 conf_lastlog_location=$withval
1733 dnl lastlog, [uw]tmpx? detection
1734 dnl NOTE: set the paths in the platform section to avoid the
1735 dnl need for command-line parameters
1736 dnl lastlog and [uw]tmp are subject to a file search if all else fails
1738 dnl lastlog detection
1739 dnl NOTE: the code itself will detect if lastlog is a directory
1740 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1742 #include <sys/types.h>
1744 #ifdef HAVE_LASTLOG_H
1745 # include <lastlog.h>
1751 [ char *lastlog = LASTLOG_FILE; ],
1752 [ AC_MSG_RESULT(yes) ],
1755 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1757 #include <sys/types.h>
1759 #ifdef HAVE_LASTLOG_H
1760 # include <lastlog.h>
1766 [ char *lastlog = _PATH_LASTLOG; ],
1767 [ AC_MSG_RESULT(yes) ],
1770 system_lastlog_path=no
1775 if test -z "$conf_lastlog_location"; then
1776 if test x"$system_lastlog_path" = x"no" ; then
1777 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
1778 if (test -d "$f" || test -f "$f") ; then
1779 conf_lastlog_location=$f
1782 if test -z "$conf_lastlog_location"; then
1783 AC_MSG_WARN([** Cannot find lastlog **])
1784 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
1789 if test -n "$conf_lastlog_location"; then
1790 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1794 AC_MSG_CHECKING([if your system defines UTMP_FILE])
1796 #include <sys/types.h>
1802 [ char *utmp = UTMP_FILE; ],
1803 [ AC_MSG_RESULT(yes) ],
1805 system_utmp_path=no ]
1807 if test -z "$conf_utmp_location"; then
1808 if test x"$system_utmp_path" = x"no" ; then
1809 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1810 if test -f $f ; then
1811 conf_utmp_location=$f
1814 if test -z "$conf_utmp_location"; then
1815 AC_DEFINE(DISABLE_UTMP)
1819 if test -n "$conf_utmp_location"; then
1820 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1824 AC_MSG_CHECKING([if your system defines WTMP_FILE])
1826 #include <sys/types.h>
1832 [ char *wtmp = WTMP_FILE; ],
1833 [ AC_MSG_RESULT(yes) ],
1835 system_wtmp_path=no ]
1837 if test -z "$conf_wtmp_location"; then
1838 if test x"$system_wtmp_path" = x"no" ; then
1839 for f in /usr/adm/wtmp /var/log/wtmp; do
1840 if test -f $f ; then
1841 conf_wtmp_location=$f
1844 if test -z "$conf_wtmp_location"; then
1845 AC_DEFINE(DISABLE_WTMP)
1849 if test -n "$conf_wtmp_location"; then
1850 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1854 dnl utmpx detection - I don't know any system so perverse as to require
1855 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1857 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1859 #include <sys/types.h>
1868 [ char *utmpx = UTMPX_FILE; ],
1869 [ AC_MSG_RESULT(yes) ],
1871 system_utmpx_path=no ]
1873 if test -z "$conf_utmpx_location"; then
1874 if test x"$system_utmpx_path" = x"no" ; then
1875 AC_DEFINE(DISABLE_UTMPX)
1878 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1882 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1884 #include <sys/types.h>
1893 [ char *wtmpx = WTMPX_FILE; ],
1894 [ AC_MSG_RESULT(yes) ],
1896 system_wtmpx_path=no ]
1898 if test -z "$conf_wtmpx_location"; then
1899 if test x"$system_wtmpx_path" = x"no" ; then
1900 AC_DEFINE(DISABLE_WTMPX)
1903 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1907 # Change default command timeout for builtin PRNG
1909 AC_ARG_WITH(entropy-timeout,
1910 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1912 if test "x$withval" != "xno" ; then
1913 entropy_timeout=$withval
1917 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1920 if test ! -z "$blibpath" ; then
1921 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1922 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1927 AC_OUTPUT(Makefile openbsd-compat/Makefile ssh_prng_cmds)
1929 # Print summary of options
1931 if test ! -z "$RANDOM_POOL" ; then
1932 RAND_MSG="Device ($RANDOM_POOL)"
1934 if test ! -z "$PRNGD_PORT" ; then
1935 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
1936 elif test ! -z "$PRNGD_SOCKET" ; then
1937 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
1939 RAND_MSG="Builtin (timeout $entropy_timeout)"
1944 # Someone please show me a better way :)
1945 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1946 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1947 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1948 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
1949 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
1950 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
1951 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
1952 H=`eval echo ${user_path}` ; H=`eval echo ${H}`
1955 echo "OpenSSH has been configured with the following options:"
1956 echo " User binaries: $B"
1957 echo " System binaries: $C"
1958 echo " Configuration files: $D"
1959 echo " Askpass program: $E"
1960 echo " Manual pages: $F"
1961 echo " PID file: $G"
1962 echo " sshd default user PATH: $H"
1963 echo " Random number collection: $RAND_MSG"
1964 echo " Manpage format: $MANTYPE"
1965 echo " PAM support: ${PAM_MSG}"
1966 echo " KerberosIV support: $KRB4_MSG"
1967 echo " AFS support: $AFS_MSG"
1968 echo " S/KEY support: $SKEY_MSG"
1969 echo " TCP Wrappers support: $TCPW_MSG"
1970 echo " MD5 password support: $MD5_MSG"
1971 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1972 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1973 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1975 if test ! -z "$bsd_auth"; then
1976 echo " BSD Auth support: yes"
1981 echo " Host: ${host}"
1982 echo " Compiler: ${CC}"
1983 echo " Compiler flags: ${CFLAGS}"
1984 echo "Preprocessor flags: ${CPPFLAGS}"
1985 echo " Linker flags: ${LDFLAGS}"
1986 echo " Libraries: ${LIBS}"
1990 if test "x$PAM_MSG" = "xyes" ; then
1991 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
1992 echo "otherwise password authentication may fail. Example PAM control files"
1993 echo "can be found in the contrib/ subdirectory"
1997 if test ! -z "$BUILTIN_RNG" ; then
1998 echo "WARNING: you are using the builtin random number collection service."
1999 echo "Please read WARNING.RNG and request that your OS vendor includes"
2000 echo "/dev/random in future versions of their OS."
2004 if test ! -z "$NO_SFTP"; then
2005 echo "sftp-server will be disabled. Your compiler does not support"
2006 echo "64bit integers."