5 AC_CONFIG_HEADER(config.h)
10 # Checks for programs.
15 AC_PATH_PROG(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)
67 AC_DEFINE(DISABLE_SHADOW)
68 AC_DEFINE(IPV4_DEFAULT)
69 AC_DEFINE(IP_TOS_IS_BROKEN)
70 AC_DEFINE(NO_X11_UNIX_SOCKETS)
76 AC_DEFINE(IP_TOS_IS_BROKEN)
80 if test -z "$GCC"; then
83 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
86 AC_DEFINE(DISABLE_SHADOW)
87 AC_DEFINE(DISABLE_UTMP)
88 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
92 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
94 AC_DEFINE(PAM_SUN_CODEBASE)
96 AC_DEFINE(DISABLE_SHADOW)
97 AC_DEFINE(DISABLE_UTMP)
98 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
102 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
104 PATH="$PATH:/usr/etc"
107 AC_DEFINE(BROKEN_INET_NTOA)
110 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
112 PATH="$PATH:/usr/etc"
113 AC_DEFINE(WITH_IRIX_ARRAY)
114 AC_DEFINE(WITH_IRIX_PROJECT)
115 AC_DEFINE(WITH_IRIX_AUDIT)
116 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
119 AC_DEFINE(BROKEN_INET_NTOA)
123 check_for_libcrypt_later=1
124 AC_DEFINE(DONT_TRY_OTHER_AF)
125 AC_DEFINE(PAM_TTY_KLUDGE)
126 inet6_default_4in6=yes
129 mips-sony-bsd|mips-sony-newsos4)
130 AC_DEFINE(HAVE_NEWS4)
132 AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT),
133 AC_MSG_ERROR([*** libiberty missing - please install first or check config.log ***])
142 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"
159 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
160 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
162 AC_DEFINE(PAM_SUN_CODEBASE)
163 # hardwire lastlog location (can't detect it on some versions)
164 conf_lastlog_location="/var/adm/lastlog"
165 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
166 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
167 if test "$sol2ver" -ge 8; then
169 AC_DEFINE(DISABLE_UTMP)
170 AC_DEFINE(DISABLE_WTMP)
176 CPPFLAGS="$CPPFLAGS -DSUNOS4"
177 AC_CHECK_FUNCS(getpwanam)
178 AC_DEFINE(PAM_SUN_CODEBASE)
179 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
180 conf_utmp_location=/etc/utmp
181 conf_wtmp_location=/var/adm/wtmp
182 conf_lastlog_location=/var/adm/lastlog
186 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
187 LDFLAGS="$LDFLAGS -L/usr/local/lib"
188 LIBS="$LIBS -lc89 -lnsl -lgen -lsocket"
191 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
192 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
193 IPADDR_IN_DISPLAY=yes
195 AC_DEFINE(IP_TOS_IS_BROKEN)
196 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
197 LIBS="$LIBS -lgen -lnsl -lucb"
200 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
201 LDFLAGS="$LDFLAGS -L/usr/local/lib"
206 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
207 LDFLAGS="$LDFLAGS -L/usr/local/lib"
212 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
213 LDFLAGS="$LDFLAGS -L/usr/local/lib"
214 LIBS="$LIBS -lgen -lsocket"
217 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
218 LDFLAGS="$LDFLAGS -L/usr/local/lib"
219 LIBS="$LIBS -lgen -lsocket -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)
232 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
233 LDFLAGS="$LDFLAGS -L/usr/local/lib"
234 LIBS="$LIBS -lprot -lx -ltinfo -lm"
236 rsh_path="/usr/bin/rcmd"
238 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
239 AC_DEFINE(DISABLE_SHADOW)
240 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
241 AC_CHECK_FUNCS(getluid setluid)
244 if test ! -z "USE_SIA" ; then
245 AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
246 if test -f /etc/sia/matrix.conf; then
248 AC_DEFINE(HAVE_OSF_SIA)
249 AC_DEFINE(DISABLE_LOGIN)
250 LIBS="$LIBS -lsecurity -ldb -lm -laud"
258 # Allow user to specify flags
260 [ --with-cflags Specify additional flags to pass to compiler],
262 if test "x$withval" != "xno" ; then
263 CFLAGS="$CFLAGS $withval"
267 AC_ARG_WITH(cppflags,
268 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
270 if test "x$withval" != "xno"; then
271 CPPFLAGS="$CPPFLAGS $withval"
276 [ --with-ldflags Specify additional flags to pass to linker],
278 if test "x$withval" != "xno" ; then
279 LDFLAGS="$LDFLAGS $withval"
284 [ --with-libs Specify additional libraries to link with],
286 if test "x$withval" != "xno" ; then
287 LIBS="$LIBS $withval"
293 [ --with-pcre Override built in regex library with pcre],
296 AC_CHECK_LIB(pcre, pcre_info,
298 AC_DEFINE(HAVE_LIBPCRE)
299 LIBS="$LIBS -lpcreposix -lpcre"
302 [ AC_MSG_ERROR([*** Can not locate pcre libraries.]) ]
307 # Checks for libraries.
308 if test -z "$no_libnsl" ; then
309 AC_CHECK_LIB(nsl, yp_match, , )
311 if test -z "$no_libsocket" ; then
312 AC_CHECK_LIB(socket, main, , )
315 dnl SCO OS3 needs this for libwrap
316 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
318 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
319 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
320 AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
322 # We don't want to check if we did an pcre override.
323 if test -z "$no_comp_check" ; then
324 AC_CHECK_FUNC(regcomp,
325 [ AC_DEFINE(HAVE_REGCOMP)],
327 AC_CHECK_LIB(pcre, pcre_info,
329 AC_DEFINE(HAVE_LIBPCRE)
330 LIBS="$LIBS -lpcreposix -lpcre"
333 AC_MSG_ERROR([*** No regex library found.])
340 AC_CHECK_FUNC(strcasecmp,
341 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
343 AC_CHECK_FUNC(utimes,
344 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
349 # Checks for header files.
350 AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.h glob.h lastlog.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)
352 # Check for ALTDIRFUNC glob() extension
353 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
354 AC_EGREP_CPP(FOUNDIT,
357 #ifdef GLOB_ALTDIRFUNC
362 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
370 # Check for g.gl_matchc glob() extension
371 AC_MSG_CHECKING(for gl_matchc field in glob_t)
372 AC_EGREP_CPP(FOUNDIT,
375 int main(void){glob_t g; g.gl_matchc = 1;}
378 AC_DEFINE(GLOB_HAS_GL_MATCHC)
386 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
389 #include <sys/types.h>
391 int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
393 [AC_MSG_RESULT(yes)],
396 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
400 # Check whether user wants S/Key support
403 [ --with-skey=PATH Enable S/Key support],
405 if test "x$withval" != "xno" ; then
407 if test "x$withval" != "xyes" ; then
408 CPPFLAGS="$CPPFLAGS -I${withval}/include"
409 LDFLAGS="$LDFLAGS -L${withval}/lib"
416 AC_CHECK_FUNC(skey_keyinfo,
419 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
425 # Check whether user wants TCP wrappers support
427 AC_ARG_WITH(tcp-wrappers,
428 [ --with-tcp-wrappers Enable tcpwrappers support],
430 if test "x$withval" != "xno" ; then
433 AC_MSG_CHECKING(for libwrap)
437 int deny_severity = 0, allow_severity = 0;
446 AC_MSG_ERROR([*** libwrap missing])
453 dnl Checks for library functions.
454 AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa clock 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 sigaction sigvec snprintf strerror strlcat strlcpy strmode strsep strtok_r sysconf tcgetpgrp utimes vsnprintf vhangup vis waitpid _getpty __b64_ntop)
455 dnl Checks for time functions
456 AC_CHECK_FUNCS(gettimeofday time)
457 dnl Checks for libutil functions
458 AC_CHECK_HEADERS(libutil.h)
459 AC_CHECK_FUNCS(login logout updwtmp logwtmp)
460 dnl Checks for utmp functions
461 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
462 AC_CHECK_FUNCS(utmpname)
463 dnl Checks for utmpx functions
464 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
465 AC_CHECK_FUNCS(setutxent utmpxname)
467 AC_CHECK_FUNC(getuserattr,
468 [AC_DEFINE(HAVE_GETUSERATTR)],
469 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
473 [AC_DEFINE(HAVE_LOGIN)],
474 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
477 AC_CHECK_FUNC(daemon,
478 [AC_DEFINE(HAVE_DAEMON)],
479 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
482 AC_CHECK_FUNC(getpagesize,
483 [AC_DEFINE(HAVE_GETPAGESIZE)],
484 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
487 # Check for broken snprintf
488 if test "x$ac_cv_func_snprintf" = "xyes" ; then
489 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
493 int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
495 [AC_MSG_RESULT(yes)],
498 AC_DEFINE(BROKEN_SNPRINTF)
499 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
509 [ --with-pam Enable PAM support ],
511 if test "x$withval" != "xno" ; then
512 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
513 AC_MSG_ERROR([PAM headers not found])
516 AC_CHECK_LIB(dl, dlopen, , )
517 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
518 AC_CHECK_FUNCS(pam_getenvlist)
528 # Check for older PAM
529 if test "x$PAM_MSG" = "xyes" ; then
530 # Check PAM strerror arguments (old PAM)
531 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
535 #include <security/pam_appl.h>
537 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
540 AC_DEFINE(HAVE_OLD_PAM)
542 PAM_MSG="yes (old library)"
547 # The big search for OpenSSL
549 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
551 if test "x$withval" != "xno" ; then
558 saved_LDFLAGS="$LDFLAGS"
559 saved_CPPFLAGS="$CPPFLAGS"
560 if test "x$prefix" != "xNONE" ; then
561 tryssldir="$tryssldir $prefix"
563 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
564 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
565 CPPFLAGS="$saved_CPPFLAGS"
566 LDFLAGS="$saved_LDFLAGS"
567 LIBS="$saved_LIBS -lcrypto"
569 # Skip directories if they don't exist
570 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
573 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
574 # Try to use $ssldir/lib if it exists, otherwise
576 if test -d "$ssldir/lib" ; then
577 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
578 if test ! -z "$need_dash_r" ; then
579 LDFLAGS="-R$ssldir/lib $LDFLAGS"
582 LDFLAGS="-L$ssldir $saved_LDFLAGS"
583 if test ! -z "$need_dash_r" ; then
584 LDFLAGS="-R$ssldir $LDFLAGS"
587 # Try to use $ssldir/include if it exists, otherwise
589 if test -d "$ssldir/include" ; then
590 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
592 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
596 # Basic test to check for compatible version and correct linking
597 # *does not* test for RSA - that comes later.
601 #include <openssl/rand.h>
605 memset(a, 0, sizeof(a));
606 RAND_add(a, sizeof(a), sizeof(a));
607 return(RAND_status() <= 0);
616 if test ! -z "$found_crypto" ; then
621 if test -z "$found_crypto" ; then
622 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
624 if test -z "$ssldir" ; then
628 ac_cv_openssldir=$ssldir
631 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
632 AC_DEFINE(HAVE_OPENSSL)
633 dnl Need to recover ssldir - test above runs in subshell
634 ssldir=$ac_cv_openssldir
635 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
636 # Try to use $ssldir/lib if it exists, otherwise
638 if test -d "$ssldir/lib" ; then
639 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
640 if test ! -z "$need_dash_r" ; then
641 LDFLAGS="-R$ssldir/lib $LDFLAGS"
644 LDFLAGS="-L$ssldir $saved_LDFLAGS"
645 if test ! -z "$need_dash_r" ; then
646 LDFLAGS="-R$ssldir $LDFLAGS"
649 # Try to use $ssldir/include if it exists, otherwise
651 if test -d "$ssldir/include" ; then
652 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
654 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
658 LIBS="$saved_LIBS -lcrypto"
660 # Now test RSA support
662 AC_MSG_CHECKING([for RSA support])
663 for WANTS_RSAREF in "" 1 ; do
664 if test -z "$WANTS_RSAREF" ; then
667 LIBS="$saved_LIBS -lRSAglue -lrsaref"
671 #include <openssl/rand.h>
672 #include <openssl/rsa.h>
673 #include <openssl/bn.h>
674 #include <openssl/sha.h>
677 int num; RSA *key; static unsigned char p_in[] = "blahblah";
678 unsigned char c[256], p[256];
679 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
680 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
681 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
682 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
691 if test ! -z "$no_rsa" ; then
692 AC_MSG_RESULT(disabled)
695 if test -z "$rsa_works" ; then
696 AC_MSG_WARN([*** No RSA support found *** ])
699 if test -z "$WANTS_RSAREF" ; then
703 RSA_MSG="yes (using RSAref)"
704 AC_MSG_RESULT(using RSAref)
705 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
710 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
711 # version in OpenSSL. Skip this for PAM
712 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
713 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
716 # Cheap hack to ensure NEWS-OS libraries are arranged right.
717 if test ! -z "$SONY" ; then
718 LIBS="$LIBS -liberty";
721 # Checks for data types
722 AC_CHECK_SIZEOF(char, 1)
723 AC_CHECK_SIZEOF(short int, 2)
724 AC_CHECK_SIZEOF(int, 4)
725 AC_CHECK_SIZEOF(long int, 4)
726 AC_CHECK_SIZEOF(long long int, 8)
728 # More checks for data types
729 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
731 [ #include <sys/types.h> ],
733 [ ac_cv_have_u_int="yes" ],
734 [ ac_cv_have_u_int="no" ]
737 if test "x$ac_cv_have_u_int" = "xyes" ; then
738 AC_DEFINE(HAVE_U_INT)
742 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
744 [ #include <sys/types.h> ],
745 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
746 [ ac_cv_have_intxx_t="yes" ],
747 [ ac_cv_have_intxx_t="no" ]
750 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
751 AC_DEFINE(HAVE_INTXX_T)
755 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
757 [ #include <sys/types.h> ],
758 [ int64_t a; a = 1;],
759 [ ac_cv_have_int64_t="yes" ],
760 [ ac_cv_have_int64_t="no" ]
763 if test "x$ac_cv_have_int64_t" = "xyes" ; then
764 AC_DEFINE(HAVE_INT64_T)
768 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
770 [ #include <sys/types.h> ],
771 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
772 [ ac_cv_have_u_intxx_t="yes" ],
773 [ ac_cv_have_u_intxx_t="no" ]
776 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
777 AC_DEFINE(HAVE_U_INTXX_T)
781 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
783 [ #include <sys/types.h> ],
784 [ u_int64_t a; a = 1;],
785 [ ac_cv_have_u_int64_t="yes" ],
786 [ ac_cv_have_u_int64_t="no" ]
789 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
790 AC_DEFINE(HAVE_U_INT64_T)
794 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
795 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
797 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
800 #include <sys/bitypes.h>
803 int8_t a; int16_t b; int32_t c;
804 u_int8_t e; u_int16_t f; u_int32_t g;
805 a = b = c = e = f = g = 1;
808 AC_DEFINE(HAVE_U_INTXX_T)
809 AC_DEFINE(HAVE_INTXX_T)
816 if test -z "$have_u_intxx_t" ; then
817 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
820 #include <sys/types.h>
822 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
823 [ ac_cv_have_uintxx_t="yes" ],
824 [ ac_cv_have_uintxx_t="no" ]
827 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
828 AC_DEFINE(HAVE_UINTXX_T)
832 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
835 #include <sys/types.h>
836 #include <sys/socket.h>
838 [socklen_t foo; foo = 1235;],
839 [ ac_cv_have_socklen_t="yes" ],
840 [ ac_cv_have_socklen_t="no" ]
843 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
844 AC_DEFINE(HAVE_SOCKLEN_T)
847 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
850 #include <sys/types.h>
852 [ size_t foo; foo = 1235; ],
853 [ ac_cv_have_size_t="yes" ],
854 [ ac_cv_have_size_t="no" ]
857 if test "x$ac_cv_have_size_t" = "xyes" ; then
858 AC_DEFINE(HAVE_SIZE_T)
861 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
864 #include <sys/types.h>
866 [ ssize_t foo; foo = 1235; ],
867 [ ac_cv_have_ssize_t="yes" ],
868 [ ac_cv_have_ssize_t="no" ]
871 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
872 AC_DEFINE(HAVE_SSIZE_T)
875 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
880 [ clock_t foo; foo = 1235; ],
881 [ ac_cv_have_clock_t="yes" ],
882 [ ac_cv_have_clock_t="no" ]
885 if test "x$ac_cv_have_clock_t" = "xyes" ; then
886 AC_DEFINE(HAVE_CLOCK_T)
889 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
892 #include <sys/types.h>
893 #include <sys/socket.h>
895 [ sa_family_t foo; foo = 1235; ],
896 [ ac_cv_have_sa_family_t="yes" ],
899 #include <sys/types.h>
900 #include <sys/socket.h>
901 #include <netinet/in.h>
903 [ sa_family_t foo; foo = 1235; ],
904 [ ac_cv_have_sa_family_t="yes" ],
906 [ ac_cv_have_sa_family_t="no" ]
910 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
911 AC_DEFINE(HAVE_SA_FAMILY_T)
914 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
917 #include <sys/types.h>
919 [ pid_t foo; foo = 1235; ],
920 [ ac_cv_have_pid_t="yes" ],
921 [ ac_cv_have_pid_t="no" ]
924 if test "x$ac_cv_have_pid_t" = "xyes" ; then
925 AC_DEFINE(HAVE_PID_T)
928 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
931 #include <sys/types.h>
933 [ mode_t foo; foo = 1235; ],
934 [ ac_cv_have_mode_t="yes" ],
935 [ ac_cv_have_mode_t="no" ]
938 if test "x$ac_cv_have_mode_t" = "xyes" ; then
939 AC_DEFINE(HAVE_MODE_T)
943 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
946 #include <sys/types.h>
947 #include <sys/socket.h>
949 [ struct sockaddr_storage s; ],
950 [ ac_cv_have_struct_sockaddr_storage="yes" ],
951 [ ac_cv_have_struct_sockaddr_storage="no" ]
954 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
955 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
958 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
961 #include <sys/types.h>
962 #include <netinet/in.h>
964 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
965 [ ac_cv_have_struct_sockaddr_in6="yes" ],
966 [ ac_cv_have_struct_sockaddr_in6="no" ]
969 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
970 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
973 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
976 #include <sys/types.h>
977 #include <netinet/in.h>
979 [ struct in6_addr s; s.s6_addr[0] = 0; ],
980 [ ac_cv_have_struct_in6_addr="yes" ],
981 [ ac_cv_have_struct_in6_addr="no" ]
984 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
985 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
988 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
991 #include <sys/types.h>
992 #include <sys/socket.h>
995 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
996 [ ac_cv_have_struct_addrinfo="yes" ],
997 [ ac_cv_have_struct_addrinfo="no" ]
1000 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1001 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1004 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1006 [ #include <sys/time.h> ],
1007 [ struct timeval tv; tv.tv_sec = 1;],
1008 [ ac_cv_have_struct_timeval="yes" ],
1009 [ ac_cv_have_struct_timeval="no" ]
1012 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1013 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1014 have_struct_timeval=1
1017 # If we don't have int64_t then we can't compile sftp-server. So don't
1018 # even attempt to do it.
1019 if test "x$ac_cv_have_int64_t" = "xno" -a \
1020 "x$ac_cv_sizeof_long_int" != "x8" -a \
1021 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1024 dnl test snprintf (broken on SCO w/gcc)
1029 #ifdef HAVE_SNPRINTF
1033 char expected_out[50];
1035 #if (SIZEOF_LONG_INT == 8)
1036 long int num = 0x7fffffffffffffff;
1038 long long num = 0x7fffffffffffffff;
1040 strcpy(expected_out, "9223372036854775807");
1041 snprintf(buf, mazsize, "%lld", num);
1042 if(strcmp(buf, expected_out) != 0)
1049 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1054 dnl Checks for structure members
1055 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1056 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1057 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1058 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1059 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1060 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1061 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1062 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1063 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1064 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1065 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1066 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1067 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1068 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1069 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1070 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1071 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1072 AC_STRUCT_ST_BLKSIZE
1074 AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
1075 ac_cv_have_sun_len_in_struct_sockaddr_un, [
1078 #include <sys/types.h>
1079 #include <sys/socket.h>
1081 [ struct sockaddr_un s; s.sun_len = 1; ],
1082 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
1083 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
1086 if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
1087 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
1090 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1091 ac_cv_have_ss_family_in_struct_ss, [
1094 #include <sys/types.h>
1095 #include <sys/socket.h>
1097 [ struct sockaddr_storage s; s.ss_family = 1; ],
1098 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1099 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1102 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1103 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1106 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1107 ac_cv_have___ss_family_in_struct_ss, [
1110 #include <sys/types.h>
1111 #include <sys/socket.h>
1113 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1114 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1115 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1118 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1119 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1122 AC_CACHE_CHECK([for pw_class field in struct passwd],
1123 ac_cv_have_pw_class_in_struct_passwd, [
1128 [ struct passwd p; p.pw_class = 0; ],
1129 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1130 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1133 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1134 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1138 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1140 [ extern char *__progname; printf("%s", __progname); ],
1141 [ ac_cv_libc_defines___progname="yes" ],
1142 [ ac_cv_libc_defines___progname="no" ]
1145 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1146 AC_DEFINE(HAVE___PROGNAME)
1150 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1152 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1153 [ ac_cv_libc_defines_sys_errlist="yes" ],
1154 [ ac_cv_libc_defines_sys_errlist="no" ]
1157 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1158 AC_DEFINE(HAVE_SYS_ERRLIST)
1162 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1164 [ extern int sys_nerr; printf("%i", sys_nerr);],
1165 [ ac_cv_libc_defines_sys_nerr="yes" ],
1166 [ ac_cv_libc_defines_sys_nerr="no" ]
1169 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1170 AC_DEFINE(HAVE_SYS_NERR)
1174 # Check whether user wants Kerberos support
1176 AC_ARG_WITH(kerberos4,
1177 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1179 if test "x$withval" != "xno" ; then
1181 if test "x$withval" != "xyes" ; then
1182 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1183 LDFLAGS="$LDFLAGS -L${withval}/lib"
1184 if test ! -z "$need_dash_r" ; then
1185 LDFLAGS="$LDFLAGS -R${withval}/lib"
1187 if test ! -z "$blibpath" ; then
1188 blibpath="$blibpath:${withval}/lib"
1191 if test -d /usr/include/kerberosIV ; then
1192 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1196 AC_CHECK_HEADERS(krb.h)
1197 if test "$ac_cv_header_krb_h" != yes; then
1198 AC_MSG_WARN([Cannot find krb.h, build may fail])
1200 AC_CHECK_LIB(krb, main)
1201 if test "$ac_cv_lib_krb_main" != yes; then
1202 AC_CHECK_LIB(krb4, main)
1203 if test "$ac_cv_lib_krb4_main" != yes; then
1204 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1211 AC_CHECK_LIB(des, des_cbc_encrypt)
1212 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1213 AC_CHECK_LIB(des425, des_cbc_encrypt)
1214 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1215 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1222 AC_CHECK_LIB(resolv, dn_expand, , )
1230 # Check whether user wants AFS support
1233 [ --with-afs=PATH Enable AFS support],
1235 if test "x$withval" != "xno" ; then
1237 if test "x$withval" != "xyes" ; then
1238 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1239 LDFLAGS="$LDFLAGS -L${withval}/lib"
1242 if test -z "$KRB4" ; then
1243 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1247 if test ! -z "$AFS_LIBS" ; then
1248 LIBS="$LIBS $AFS_LIBS"
1257 # Looking for programs, paths and files
1259 [ --with-rsh=PATH Specify path to remote shell program ],
1261 if test "x$withval" != "$no" ; then
1266 AC_PATH_PROG(rsh_path, rsh)
1271 [ --with-xauth=PATH Specify path to xauth program ],
1273 if test "x$withval" != "xno" ; then
1278 AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin)
1279 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
1280 xauth_path="/usr/openwin/bin/xauth"
1285 if test -z "$xauth_path" ; then
1286 XAUTH_PATH="undefined"
1287 AC_SUBST(XAUTH_PATH)
1289 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
1290 XAUTH_PATH=$xauth_path
1291 AC_SUBST(XAUTH_PATH)
1293 if test ! -z "$rsh_path" ; then
1294 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1297 # Check for mail directory (last resort if we cannot get it from headers)
1298 if test ! -z "$MAIL" ; then
1299 maildir=`dirname $MAIL`
1300 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1303 if test -z "$no_dev_ptmx" ; then
1304 AC_CHECK_FILE("/dev/ptmx",
1306 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1311 AC_CHECK_FILE("/dev/ptc",
1313 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1318 # Options from here on. Some of these are preset by platform above
1320 # Check for user-specified random device, otherwise check /dev/urandom
1322 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
1324 if test "x$withval" != "xno" ; then
1325 RANDOM_POOL="$withval";
1326 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1330 # Check for random device
1331 AC_CHECK_FILE("/dev/urandom",
1333 RANDOM_POOL="/dev/urandom";
1334 AC_SUBST(RANDOM_POOL)
1335 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1341 # Check for PRNGD/EGD pool file
1342 AC_ARG_WITH(prngd-port,
1343 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1345 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1346 PRNGD_PORT="$withval"
1347 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1352 # Check for PRNGD/EGD pool file
1353 AC_ARG_WITH(prngd-socket,
1354 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1356 if test "x$withval" != "xno" ; then
1357 PRNGD_SOCKET="$withval"
1358 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1362 # Check for existing socket only if we don't have a random device already
1363 if test -z "$RANDOM_POOL" ; then
1364 AC_MSG_CHECKING(for PRNGD/EGD socket)
1365 # Insert other locations here
1366 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1367 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1368 PRNGD_SOCKET="$sock"
1369 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1373 if test ! -z "$PRNGD_SOCKET" ; then
1374 AC_MSG_RESULT($PRNGD_SOCKET)
1376 AC_MSG_RESULT(not found)
1383 # detect pathnames for entropy gathering commands, if we need them
1384 INSTALL_SSH_PRNG_CMDS=""
1386 if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
1387 # Use these commands to collect entropy
1388 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1389 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1390 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1391 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1392 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1393 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1394 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1395 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1396 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1397 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1398 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1399 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1400 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1401 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1403 INSTALL_SSH_PRNG_CMDS="yes"
1405 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1409 [ --with-mantype=man|cat|doc Set man page type],
1416 AC_MSG_ERROR(invalid man type: $withval)
1420 if test -z "$MANTYPE" ; then
1427 # Check whether to enable MD5 passwords
1429 AC_ARG_WITH(md5-passwords,
1430 [ --with-md5-passwords Enable use of MD5 passwords],
1432 if test "x$withval" != "xno" ; then
1433 AC_DEFINE(HAVE_MD5_PASSWORDS)
1439 # Whether to disable shadow password support
1441 [ --without-shadow Disable shadow password support],
1443 if test "x$withval" = "xno" ; then
1444 AC_DEFINE(DISABLE_SHADOW)
1450 if test -z "$disable_shadow" ; then
1451 AC_MSG_CHECKING([if the systems has expire shadow information])
1454 #include <sys/types.h>
1457 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1458 [ sp_expire_available=yes ], []
1461 if test "x$sp_expire_available" = "xyes" ; then
1463 AC_DEFINE(HAS_SHADOW_EXPIRE)
1469 # Use ip address instead of hostname in $DISPLAY
1470 if test ! -z "$IPADDR_IN_DISPLAY" ; then
1471 DISPLAY_HACK_MSG="yes"
1472 AC_DEFINE(IPADDR_IN_DISPLAY)
1474 DISPLAY_HACK_MSG="no"
1475 AC_ARG_WITH(ipaddr-display,
1476 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1478 if test "x$withval" != "xno" ; then
1479 AC_DEFINE(IPADDR_IN_DISPLAY)
1480 DISPLAY_HACK_MSG="yes"
1486 # Whether to mess with the default path
1487 SERVER_PATH_MSG="(default)"
1488 AC_ARG_WITH(default-path,
1489 [ --with-default-path=PATH Specify default \$PATH environment for server],
1491 if test "x$withval" != "xno" ; then
1492 user_path="$withval"
1493 SERVER_PATH_MSG="$withval"
1499 /* find out what STDPATH is */
1504 #ifndef _PATH_STDPATH
1505 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1507 #include <sys/types.h>
1508 #include <sys/stat.h>
1510 #define DATA "conftest.stdpath"
1517 fd = fopen(DATA,"w");
1521 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1526 ], [ user_path=`cat conftest.stdpath` ],
1527 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1528 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1530 # make sure $bindir is in USER_PATH so scp will work
1531 t_bindir=`eval echo ${bindir}`
1533 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1536 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1538 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1539 if test $? -ne 0 ; then
1540 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1541 if test $? -ne 0 ; then
1542 user_path=$user_path:$t_bindir
1543 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1548 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1551 # Whether to force IPv4 by default (needed on broken glibc Linux)
1553 AC_ARG_WITH(ipv4-default,
1554 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1556 if test "x$withval" != "xno" ; then
1557 AC_DEFINE(IPV4_DEFAULT)
1563 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
1564 IPV4_IN6_HACK_MSG="no"
1566 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1568 if test "x$withval" != "xno" ; then
1570 AC_DEFINE(IPV4_IN_IPV6)
1571 IPV4_IN6_HACK_MSG="yes"
1576 if test "x$inet6_default_4in6" = "xyes"; then
1577 AC_MSG_RESULT([yes (default)])
1578 AC_DEFINE(IPV4_IN_IPV6)
1579 IPV4_IN6_HACK_MSG="yes"
1581 AC_MSG_RESULT([no (default)])
1586 # Whether to enable BSD auth support
1587 AC_ARG_WITH(bsd-auth,
1588 [ --with-bsd-auth Enable BSD auth support],
1590 if test "x$withval" != "xno" ; then
1597 AC_MSG_CHECKING(whether to install ssh as suid root)
1598 AC_ARG_ENABLE(suid-ssh,
1599 [ --enable-suid-ssh Install ssh as suid root (default)
1600 --disable-suid-ssh Install ssh without suid bit],
1601 [ case "$enableval" in
1606 *) AC_MSG_RESULT(yes)
1616 # Where to place sshd.pid
1618 AC_ARG_WITH(pid-dir,
1619 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1621 if test "x$withval" != "xno" ; then
1627 # make sure the directory exists
1628 if test ! -d $piddir ; then
1629 piddir=`eval echo ${sysconfdir}`
1631 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1635 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
1638 dnl allow user to disable some login recording features
1639 AC_ARG_ENABLE(lastlog,
1640 [ --disable-lastlog disable use of lastlog even if detected [no]],
1641 [ AC_DEFINE(DISABLE_LASTLOG) ]
1644 [ --disable-utmp disable use of utmp even if detected [no]],
1645 [ AC_DEFINE(DISABLE_UTMP) ]
1647 AC_ARG_ENABLE(utmpx,
1648 [ --disable-utmpx disable use of utmpx even if detected [no]],
1649 [ AC_DEFINE(DISABLE_UTMPX) ]
1652 [ --disable-wtmp disable use of wtmp even if detected [no]],
1653 [ AC_DEFINE(DISABLE_WTMP) ]
1655 AC_ARG_ENABLE(wtmpx,
1656 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
1657 [ AC_DEFINE(DISABLE_WTMPX) ]
1659 AC_ARG_ENABLE(libutil,
1660 [ --disable-libutil disable use of libutil (login() etc.) [no]],
1661 [ AC_DEFINE(DISABLE_LOGIN) ]
1663 AC_ARG_ENABLE(pututline,
1664 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
1665 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1667 AC_ARG_ENABLE(pututxline,
1668 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
1669 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1671 AC_ARG_WITH(lastlog,
1672 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
1674 if test "x$withval" = "xno" ; then
1675 AC_DEFINE(DISABLE_LASTLOG)
1677 conf_lastlog_location=$withval
1682 dnl lastlog, [uw]tmpx? detection
1683 dnl NOTE: set the paths in the platform section to avoid the
1684 dnl need for command-line parameters
1685 dnl lastlog and [uw]tmp are subject to a file search if all else fails
1687 dnl lastlog detection
1688 dnl NOTE: the code itself will detect if lastlog is a directory
1689 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1691 #include <sys/types.h>
1693 #ifdef HAVE_LASTLOG_H
1694 # include <lastlog.h>
1700 [ char *lastlog = LASTLOG_FILE; ],
1701 [ AC_MSG_RESULT(yes) ],
1704 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1706 #include <sys/types.h>
1708 #ifdef HAVE_LASTLOG_H
1709 # include <lastlog.h>
1715 [ char *lastlog = _PATH_LASTLOG; ],
1716 [ AC_MSG_RESULT(yes) ],
1719 system_lastlog_path=no
1724 if test -z "$conf_lastlog_location"; then
1725 if test x"$system_lastlog_path" = x"no" ; then
1726 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
1727 if (test -d "$f" || test -f "$f") ; then
1728 conf_lastlog_location=$f
1731 if test -z "$conf_lastlog_location"; then
1732 AC_MSG_WARN([** Cannot find lastlog **])
1733 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
1738 if test -n "$conf_lastlog_location"; then
1739 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1743 AC_MSG_CHECKING([if your system defines UTMP_FILE])
1745 #include <sys/types.h>
1751 [ char *utmp = UTMP_FILE; ],
1752 [ AC_MSG_RESULT(yes) ],
1754 system_utmp_path=no ]
1756 if test -z "$conf_utmp_location"; then
1757 if test x"$system_utmp_path" = x"no" ; then
1758 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1759 if test -f $f ; then
1760 conf_utmp_location=$f
1763 if test -z "$conf_utmp_location"; then
1764 AC_DEFINE(DISABLE_UTMP)
1768 if test -n "$conf_utmp_location"; then
1769 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1773 AC_MSG_CHECKING([if your system defines WTMP_FILE])
1775 #include <sys/types.h>
1781 [ char *wtmp = WTMP_FILE; ],
1782 [ AC_MSG_RESULT(yes) ],
1784 system_wtmp_path=no ]
1786 if test -z "$conf_wtmp_location"; then
1787 if test x"$system_wtmp_path" = x"no" ; then
1788 for f in /usr/adm/wtmp /var/log/wtmp; do
1789 if test -f $f ; then
1790 conf_wtmp_location=$f
1793 if test -z "$conf_wtmp_location"; then
1794 AC_DEFINE(DISABLE_WTMP)
1798 if test -n "$conf_wtmp_location"; then
1799 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1803 dnl utmpx detection - I don't know any system so perverse as to require
1804 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1806 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1808 #include <sys/types.h>
1817 [ char *utmpx = UTMPX_FILE; ],
1818 [ AC_MSG_RESULT(yes) ],
1820 system_utmpx_path=no ]
1822 if test -z "$conf_utmpx_location"; then
1823 if test x"$system_utmpx_path" = x"no" ; then
1824 AC_DEFINE(DISABLE_UTMPX)
1827 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1831 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1833 #include <sys/types.h>
1842 [ char *wtmpx = WTMPX_FILE; ],
1843 [ AC_MSG_RESULT(yes) ],
1845 system_wtmpx_path=no ]
1847 if test -z "$conf_wtmpx_location"; then
1848 if test x"$system_wtmpx_path" = x"no" ; then
1849 AC_DEFINE(DISABLE_WTMPX)
1852 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1856 # Change default command timeout for builtin PRNG
1858 AC_ARG_WITH(entropy-timeout,
1859 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1861 if test "x$withval" != "xno" ; then
1862 entropy_timeout=$withval
1866 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1869 if test ! -z "$blibpath" ; then
1870 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1871 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1876 AC_OUTPUT(Makefile openbsd-compat/Makefile ssh_prng_cmds)
1878 # Print summary of options
1880 if test ! -z "$RANDOM_POOL" ; then
1881 RAND_MSG="Device ($RANDOM_POOL)"
1883 if test ! -z "$PRNGD_PORT" ; then
1884 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
1885 elif test ! -z "$PRNGD_SOCKET" ; then
1886 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
1888 RAND_MSG="Builtin (timeout $entropy_timeout)"
1893 # Someone please show me a better way :)
1894 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1895 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1896 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1897 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
1898 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
1899 F=`eval echo ${mandir}` ; F=`eval echo ${F}`
1900 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
1901 H=`eval echo ${user_path}` ; H=`eval echo ${H}`
1904 echo "OpenSSH has been configured with the following options:"
1905 echo " User binaries: $B"
1906 echo " System binaries: $C"
1907 echo " Configuration files: $D"
1908 echo " Askpass program: $E"
1909 echo " Manual pages: $F"
1910 echo " PID file: $G"
1911 echo " sshd default user PATH: $H"
1912 echo " Random number collection: $RAND_MSG"
1913 echo " Manpage format: $MANTYPE"
1914 echo " PAM support: ${PAM_MSG}"
1915 echo " KerberosIV support: $KRB4_MSG"
1916 echo " AFS support: $AFS_MSG"
1917 echo " S/KEY support: $SKEY_MSG"
1918 echo " TCP Wrappers support: $TCPW_MSG"
1919 echo " MD5 password support: $MD5_MSG"
1920 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1921 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1922 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1924 if test ! -z "$bsd_auth"; then
1925 echo " BSD Auth support: yes"
1930 echo " Host: ${host}"
1931 echo " Compiler: ${CC}"
1932 echo " Compiler flags: ${CFLAGS}"
1933 echo "Preprocessor flags: ${CPPFLAGS}"
1934 echo " Linker flags: ${LDFLAGS}"
1935 echo " Libraries: ${LIBS}"
1939 if test "x$PAM_MSG" = "xyes" ; then
1940 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
1941 echo "otherwise password authentication may fail. Example PAM control files"
1942 echo "can be found in the contrib/ subdirectory"
1946 if test ! -z "$BUILTIN_RNG" ; then
1947 echo "WARNING: you are using the builtin random number collection service."
1948 echo "Please read WARNING.RNG and request that your OS vendor includes"
1949 echo "/dev/random in future versions of their OS."
1953 if test ! -z "$NO_SFTP"; then
1954 echo "sftp-server will be disabled. Your compiler does not support"
1955 echo "64bit integers."