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
45 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
46 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
49 # Check for some target-specific stuff
53 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
54 LDFLAGS="$LDFLAGS -L/usr/local/lib"
55 if (test "$LD" != "gcc" && test -z "$blibpath"); then
56 blibpath="/usr/lib:/lib:/usr/local/lib"
58 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
59 AC_DEFINE(BROKEN_GETADDRINFO)
60 dnl AIX handles lastlog as part of its login message
61 AC_DEFINE(DISABLE_LASTLOG)
64 LIBS="$LIBS -lregex /usr/lib/textmode.o"
65 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)
75 AC_DEFINE(IP_TOS_IS_BROKEN)
78 AC_DEFINE(BROKEN_GETADDRINFO)
81 if test -z "$GCC"; then
84 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
87 AC_DEFINE(DISABLE_SHADOW)
88 AC_DEFINE(DISABLE_UTMP)
89 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
90 LIBS="$LIBS -lxnet -lsec"
93 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
95 AC_DEFINE(PAM_SUN_CODEBASE)
97 AC_DEFINE(DISABLE_SHADOW)
98 AC_DEFINE(DISABLE_UTMP)
99 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
100 LIBS="$LIBS -lxnet -lsec"
103 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
105 PATH="$PATH:/usr/etc"
108 AC_DEFINE(BROKEN_INET_NTOA)
111 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
113 PATH="$PATH:/usr/etc"
114 AC_DEFINE(WITH_IRIX_ARRAY)
115 AC_DEFINE(WITH_IRIX_PROJECT)
116 AC_DEFINE(WITH_IRIX_AUDIT)
117 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
120 AC_DEFINE(BROKEN_INET_NTOA)
124 check_for_libcrypt_later=1
125 AC_DEFINE(DONT_TRY_OTHER_AF)
126 AC_DEFINE(PAM_TTY_KLUDGE)
127 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 ***])
140 check_for_libcrypt_later=1
143 conf_lastlog_location="/usr/adm/lastlog"
144 conf_utmp_location=/etc/utmp
145 conf_wtmp_location=/usr/adm/wtmp
148 AC_DEFINE(BROKEN_REALPATH)
150 AC_DEFINE(BROKEN_SAVED_UIDS)
151 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
155 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
156 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
158 AC_DEFINE(PAM_SUN_CODEBASE)
159 AC_DEFINE(LOGIN_NEEDS_UTMPX)
160 AC_DEFINE(LOGIN_NEEDS_TERM)
161 # hardwire lastlog location (can't detect it on some versions)
162 conf_lastlog_location="/var/adm/lastlog"
163 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
164 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
165 if test "$sol2ver" -ge 8; then
167 AC_DEFINE(DISABLE_UTMP)
168 AC_DEFINE(DISABLE_WTMP)
174 CPPFLAGS="$CPPFLAGS -DSUNOS4"
175 AC_CHECK_FUNCS(getpwanam)
176 AC_DEFINE(PAM_SUN_CODEBASE)
177 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
178 conf_utmp_location=/etc/utmp
179 conf_wtmp_location=/var/adm/wtmp
180 conf_lastlog_location=/var/adm/lastlog
184 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
185 LDFLAGS="$LDFLAGS -L/usr/local/lib"
186 LIBS="$LIBS -lc89 -lnsl -lgen -lsocket"
187 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
190 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
191 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
192 IPADDR_IN_DISPLAY=yes
194 AC_DEFINE(IP_TOS_IS_BROKEN)
195 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
196 LIBS="$LIBS -lgen -lnsl -lucb"
199 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
200 LDFLAGS="$LDFLAGS -L/usr/local/lib"
205 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
206 LDFLAGS="$LDFLAGS -L/usr/local/lib"
211 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
212 LDFLAGS="$LDFLAGS -L/usr/local/lib"
213 LIBS="$LIBS -lgen -lsocket"
216 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
217 LDFLAGS="$LDFLAGS -L/usr/local/lib"
218 LIBS="$LIBS -lgen -lsocket -los -lprot -lx -ltinfo -lm"
219 rsh_path="/usr/bin/rcmd"
222 AC_DEFINE(BROKEN_SYS_TERMIO_H)
224 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
225 AC_DEFINE(DISABLE_SHADOW)
226 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
227 AC_DEFINE(BROKEN_SAVED_UIDS)
228 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)
245 AC_MSG_CHECKING(for Digital Unix SIA)
248 [ --with-osfsia Enable Digital Unix SIA],
250 if test "x$withval" = "xno" ; then
251 AC_MSG_RESULT(disabled)
256 if test -z "$no_osfsia" ; then
257 if test -f /etc/sia/matrix.conf; then
259 AC_DEFINE(HAVE_OSF_SIA)
260 AC_DEFINE(DISABLE_LOGIN)
261 LIBS="$LIBS -lsecurity -ldb -lm -laud"
269 # Allow user to specify flags
271 [ --with-cflags Specify additional flags to pass to compiler],
273 if test "x$withval" != "xno" ; then
274 CFLAGS="$CFLAGS $withval"
278 AC_ARG_WITH(cppflags,
279 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
281 if test "x$withval" != "xno"; then
282 CPPFLAGS="$CPPFLAGS $withval"
287 [ --with-ldflags Specify additional flags to pass to linker],
289 if test "x$withval" != "xno" ; then
290 LDFLAGS="$LDFLAGS $withval"
295 [ --with-libs Specify additional libraries to link with],
297 if test "x$withval" != "xno" ; then
298 LIBS="$LIBS $withval"
304 [ --with-pcre Override built in regex library with pcre],
307 AC_CHECK_LIB(pcre, pcre_info,
309 AC_DEFINE(HAVE_LIBPCRE)
310 LIBS="$LIBS -lpcreposix -lpcre"
313 [ AC_MSG_ERROR([*** Can not locate pcre libraries.]) ]
318 # Checks for libraries.
319 if test -z "$no_libnsl" ; then
320 AC_CHECK_LIB(nsl, yp_match, , )
322 if test -z "$no_libsocket" ; then
323 AC_CHECK_LIB(socket, main, , )
326 dnl SCO OS3 needs this for libwrap
327 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
329 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
330 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
331 AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
333 # We don't want to check if we did an pcre override.
334 if test -z "$no_comp_check" ; then
335 AC_CHECK_FUNC(regcomp,
336 [ AC_DEFINE(HAVE_REGCOMP)],
338 AC_CHECK_LIB(pcre, pcre_info,
340 AC_DEFINE(HAVE_LIBPCRE)
341 LIBS="$LIBS -lpcreposix -lpcre"
344 AC_MSG_ERROR([*** No regex library found.])
351 AC_CHECK_FUNC(strcasecmp,
352 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
354 AC_CHECK_FUNC(utimes,
355 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
360 # Checks for header files.
361 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)
363 # Check for ALTDIRFUNC glob() extension
364 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
365 AC_EGREP_CPP(FOUNDIT,
368 #ifdef GLOB_ALTDIRFUNC
373 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
381 # Check for g.gl_matchc glob() extension
382 AC_MSG_CHECKING(for gl_matchc field in glob_t)
383 AC_EGREP_CPP(FOUNDIT,
386 int main(void){glob_t g; g.gl_matchc = 1;}
389 AC_DEFINE(GLOB_HAS_GL_MATCHC)
397 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
400 #include <sys/types.h>
402 int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
404 [AC_MSG_RESULT(yes)],
407 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
411 # Check whether user wants S/Key support
414 [ --with-skey=PATH Enable S/Key support],
416 if test "x$withval" != "xno" ; then
418 if test "x$withval" != "xyes" ; then
419 CPPFLAGS="$CPPFLAGS -I${withval}/include"
420 LDFLAGS="$LDFLAGS -L${withval}/lib"
427 AC_CHECK_FUNC(skey_keyinfo,
430 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
436 # Check whether user wants TCP wrappers support
438 AC_ARG_WITH(tcp-wrappers,
439 [ --with-tcp-wrappers Enable tcpwrappers support],
441 if test "x$withval" != "xno" ; then
444 AC_MSG_CHECKING(for libwrap)
448 int deny_severity = 0, allow_severity = 0;
457 AC_MSG_ERROR([*** libwrap missing])
464 dnl Checks for library functions.
465 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 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 vis waitpid _getpty __b64_ntop)
466 dnl Checks for time functions
467 AC_CHECK_FUNCS(gettimeofday time)
468 dnl Checks for libutil functions
469 AC_CHECK_HEADERS(libutil.h)
470 AC_CHECK_FUNCS(login logout updwtmp logwtmp)
471 dnl Checks for utmp functions
472 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
473 AC_CHECK_FUNCS(utmpname)
474 dnl Checks for utmpx functions
475 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
476 AC_CHECK_FUNCS(setutxent utmpxname)
478 AC_CHECK_FUNC(getuserattr,
479 [AC_DEFINE(HAVE_GETUSERATTR)],
480 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
484 [AC_DEFINE(HAVE_LOGIN)],
485 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
488 AC_CHECK_FUNC(daemon,
489 [AC_DEFINE(HAVE_DAEMON)],
490 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
493 AC_CHECK_FUNC(getpagesize,
494 [AC_DEFINE(HAVE_GETPAGESIZE)],
495 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
498 # Check for broken snprintf
499 if test "x$ac_cv_func_snprintf" = "xyes" ; then
500 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
504 int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
506 [AC_MSG_RESULT(yes)],
509 AC_DEFINE(BROKEN_SNPRINTF)
510 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
520 [ --with-pam Enable PAM support ],
522 if test "x$withval" != "xno" ; then
523 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
524 AC_MSG_ERROR([PAM headers not found])
527 AC_CHECK_LIB(dl, dlopen, , )
528 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
529 AC_CHECK_FUNCS(pam_getenvlist)
539 # Check for older PAM
540 if test "x$PAM_MSG" = "xyes" ; then
541 # Check PAM strerror arguments (old PAM)
542 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
546 #include <security/pam_appl.h>
548 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
551 AC_DEFINE(HAVE_OLD_PAM)
553 PAM_MSG="yes (old library)"
558 # The big search for OpenSSL
560 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
562 if test "x$withval" != "xno" ; then
569 saved_LDFLAGS="$LDFLAGS"
570 saved_CPPFLAGS="$CPPFLAGS"
571 if test "x$prefix" != "xNONE" ; then
572 tryssldir="$tryssldir $prefix"
574 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
575 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
576 CPPFLAGS="$saved_CPPFLAGS"
577 LDFLAGS="$saved_LDFLAGS"
578 LIBS="$saved_LIBS -lcrypto"
580 # Skip directories if they don't exist
581 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
584 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
585 # Try to use $ssldir/lib if it exists, otherwise
587 if test -d "$ssldir/lib" ; then
588 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
589 if test ! -z "$need_dash_r" ; then
590 LDFLAGS="-R$ssldir/lib $LDFLAGS"
593 LDFLAGS="-L$ssldir $saved_LDFLAGS"
594 if test ! -z "$need_dash_r" ; then
595 LDFLAGS="-R$ssldir $LDFLAGS"
598 # Try to use $ssldir/include if it exists, otherwise
600 if test -d "$ssldir/include" ; then
601 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
603 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
607 # Basic test to check for compatible version and correct linking
608 # *does not* test for RSA - that comes later.
612 #include <openssl/rand.h>
616 memset(a, 0, sizeof(a));
617 RAND_add(a, sizeof(a), sizeof(a));
618 return(RAND_status() <= 0);
627 if test ! -z "$found_crypto" ; then
632 if test -z "$found_crypto" ; then
633 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
635 if test -z "$ssldir" ; then
639 ac_cv_openssldir=$ssldir
642 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
643 AC_DEFINE(HAVE_OPENSSL)
644 dnl Need to recover ssldir - test above runs in subshell
645 ssldir=$ac_cv_openssldir
646 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
647 # Try to use $ssldir/lib if it exists, otherwise
649 if test -d "$ssldir/lib" ; then
650 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
651 if test ! -z "$need_dash_r" ; then
652 LDFLAGS="-R$ssldir/lib $LDFLAGS"
655 LDFLAGS="-L$ssldir $saved_LDFLAGS"
656 if test ! -z "$need_dash_r" ; then
657 LDFLAGS="-R$ssldir $LDFLAGS"
660 # Try to use $ssldir/include if it exists, otherwise
662 if test -d "$ssldir/include" ; then
663 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
665 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
669 LIBS="$saved_LIBS -lcrypto"
671 # Now test RSA support
673 AC_MSG_CHECKING([for RSA support])
674 for WANTS_RSAREF in "" 1 ; do
675 if test -z "$WANTS_RSAREF" ; then
678 LIBS="$saved_LIBS -lRSAglue -lrsaref"
682 #include <openssl/rand.h>
683 #include <openssl/rsa.h>
684 #include <openssl/bn.h>
685 #include <openssl/sha.h>
688 int num; RSA *key; static unsigned char p_in[] = "blahblah";
689 unsigned char c[256], p[256];
690 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
691 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
692 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
693 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
703 if test ! -z "$no_rsa" ; then
704 AC_MSG_RESULT(disabled)
707 if test -z "$rsa_works" ; then
708 AC_MSG_WARN([*** No RSA support found *** ])
711 if test -z "$WANTS_RSAREF" ; then
715 RSA_MSG="yes (using RSAref)"
716 AC_MSG_RESULT(using RSAref)
717 LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
722 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
723 # version in OpenSSL. Skip this for PAM
724 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
725 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
728 # Cheap hack to ensure NEWS-OS libraries are arranged right.
729 if test ! -z "$SONY" ; then
730 LIBS="$LIBS -liberty";
733 # Checks for data types
734 AC_CHECK_SIZEOF(char, 1)
735 AC_CHECK_SIZEOF(short int, 2)
736 AC_CHECK_SIZEOF(int, 4)
737 AC_CHECK_SIZEOF(long int, 4)
738 AC_CHECK_SIZEOF(long long int, 8)
740 # More checks for data types
741 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
743 [ #include <sys/types.h> ],
745 [ ac_cv_have_u_int="yes" ],
746 [ ac_cv_have_u_int="no" ]
749 if test "x$ac_cv_have_u_int" = "xyes" ; then
750 AC_DEFINE(HAVE_U_INT)
754 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
756 [ #include <sys/types.h> ],
757 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
758 [ ac_cv_have_intxx_t="yes" ],
759 [ ac_cv_have_intxx_t="no" ]
762 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
763 AC_DEFINE(HAVE_INTXX_T)
767 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
769 [ #include <sys/types.h> ],
770 [ int64_t a; a = 1;],
771 [ ac_cv_have_int64_t="yes" ],
772 [ ac_cv_have_int64_t="no" ]
775 if test "x$ac_cv_have_int64_t" = "xyes" ; then
776 AC_DEFINE(HAVE_INT64_T)
780 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
782 [ #include <sys/types.h> ],
783 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
784 [ ac_cv_have_u_intxx_t="yes" ],
785 [ ac_cv_have_u_intxx_t="no" ]
788 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
789 AC_DEFINE(HAVE_U_INTXX_T)
793 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
795 [ #include <sys/types.h> ],
796 [ u_int64_t a; a = 1;],
797 [ ac_cv_have_u_int64_t="yes" ],
798 [ ac_cv_have_u_int64_t="no" ]
801 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
802 AC_DEFINE(HAVE_U_INT64_T)
806 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
807 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
809 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
812 #include <sys/bitypes.h>
815 int8_t a; int16_t b; int32_t c;
816 u_int8_t e; u_int16_t f; u_int32_t g;
817 a = b = c = e = f = g = 1;
820 AC_DEFINE(HAVE_U_INTXX_T)
821 AC_DEFINE(HAVE_INTXX_T)
828 if test -z "$have_u_intxx_t" ; then
829 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
832 #include <sys/types.h>
834 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
835 [ ac_cv_have_uintxx_t="yes" ],
836 [ ac_cv_have_uintxx_t="no" ]
839 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
840 AC_DEFINE(HAVE_UINTXX_T)
844 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
847 #include <sys/types.h>
848 #include <sys/socket.h>
850 [socklen_t foo; foo = 1235;],
851 [ ac_cv_have_socklen_t="yes" ],
852 [ ac_cv_have_socklen_t="no" ]
855 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
856 AC_DEFINE(HAVE_SOCKLEN_T)
859 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
862 #include <sys/types.h>
864 [ size_t foo; foo = 1235; ],
865 [ ac_cv_have_size_t="yes" ],
866 [ ac_cv_have_size_t="no" ]
869 if test "x$ac_cv_have_size_t" = "xyes" ; then
870 AC_DEFINE(HAVE_SIZE_T)
873 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
876 #include <sys/types.h>
878 [ ssize_t foo; foo = 1235; ],
879 [ ac_cv_have_ssize_t="yes" ],
880 [ ac_cv_have_ssize_t="no" ]
883 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
884 AC_DEFINE(HAVE_SSIZE_T)
887 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
892 [ clock_t foo; foo = 1235; ],
893 [ ac_cv_have_clock_t="yes" ],
894 [ ac_cv_have_clock_t="no" ]
897 if test "x$ac_cv_have_clock_t" = "xyes" ; then
898 AC_DEFINE(HAVE_CLOCK_T)
901 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
904 #include <sys/types.h>
905 #include <sys/socket.h>
907 [ sa_family_t foo; foo = 1235; ],
908 [ ac_cv_have_sa_family_t="yes" ],
911 #include <sys/types.h>
912 #include <sys/socket.h>
913 #include <netinet/in.h>
915 [ sa_family_t foo; foo = 1235; ],
916 [ ac_cv_have_sa_family_t="yes" ],
918 [ ac_cv_have_sa_family_t="no" ]
922 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
923 AC_DEFINE(HAVE_SA_FAMILY_T)
926 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
929 #include <sys/types.h>
931 [ pid_t foo; foo = 1235; ],
932 [ ac_cv_have_pid_t="yes" ],
933 [ ac_cv_have_pid_t="no" ]
936 if test "x$ac_cv_have_pid_t" = "xyes" ; then
937 AC_DEFINE(HAVE_PID_T)
940 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
943 #include <sys/types.h>
945 [ mode_t foo; foo = 1235; ],
946 [ ac_cv_have_mode_t="yes" ],
947 [ ac_cv_have_mode_t="no" ]
950 if test "x$ac_cv_have_mode_t" = "xyes" ; then
951 AC_DEFINE(HAVE_MODE_T)
955 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
958 #include <sys/types.h>
959 #include <sys/socket.h>
961 [ struct sockaddr_storage s; ],
962 [ ac_cv_have_struct_sockaddr_storage="yes" ],
963 [ ac_cv_have_struct_sockaddr_storage="no" ]
966 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
967 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
970 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
973 #include <sys/types.h>
974 #include <netinet/in.h>
976 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
977 [ ac_cv_have_struct_sockaddr_in6="yes" ],
978 [ ac_cv_have_struct_sockaddr_in6="no" ]
981 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
982 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
985 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
988 #include <sys/types.h>
989 #include <netinet/in.h>
991 [ struct in6_addr s; s.s6_addr[0] = 0; ],
992 [ ac_cv_have_struct_in6_addr="yes" ],
993 [ ac_cv_have_struct_in6_addr="no" ]
996 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
997 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1000 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1003 #include <sys/types.h>
1004 #include <sys/socket.h>
1007 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1008 [ ac_cv_have_struct_addrinfo="yes" ],
1009 [ ac_cv_have_struct_addrinfo="no" ]
1012 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1013 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1016 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1018 [ #include <sys/time.h> ],
1019 [ struct timeval tv; tv.tv_sec = 1;],
1020 [ ac_cv_have_struct_timeval="yes" ],
1021 [ ac_cv_have_struct_timeval="no" ]
1024 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1025 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1026 have_struct_timeval=1
1029 # If we don't have int64_t then we can't compile sftp-server. So don't
1030 # even attempt to do it.
1031 if test "x$ac_cv_have_int64_t" = "xno" -a \
1032 "x$ac_cv_sizeof_long_int" != "x8" -a \
1033 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1036 dnl test snprintf (broken on SCO w/gcc)
1041 #ifdef HAVE_SNPRINTF
1045 char expected_out[50];
1047 #if (SIZEOF_LONG_INT == 8)
1048 long int num = 0x7fffffffffffffff;
1050 long long num = 0x7fffffffffffffffll;
1052 strcpy(expected_out, "9223372036854775807");
1053 snprintf(buf, mazsize, "%lld", num);
1054 if(strcmp(buf, expected_out) != 0)
1061 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1066 dnl Checks for structure members
1067 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1068 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1069 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1070 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1071 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1072 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1073 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1074 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1075 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1076 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1077 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1078 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1079 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1080 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1081 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1082 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1083 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1084 AC_STRUCT_ST_BLKSIZE
1086 AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
1087 ac_cv_have_sun_len_in_struct_sockaddr_un, [
1090 #include <sys/types.h>
1091 #include <sys/socket.h>
1093 [ struct sockaddr_un s; s.sun_len = 1; ],
1094 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
1095 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
1098 if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
1099 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
1102 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1103 ac_cv_have_ss_family_in_struct_ss, [
1106 #include <sys/types.h>
1107 #include <sys/socket.h>
1109 [ struct sockaddr_storage s; s.ss_family = 1; ],
1110 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1111 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1114 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1115 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1118 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1119 ac_cv_have___ss_family_in_struct_ss, [
1122 #include <sys/types.h>
1123 #include <sys/socket.h>
1125 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1126 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1127 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1130 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1131 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1134 AC_CACHE_CHECK([for pw_class field in struct passwd],
1135 ac_cv_have_pw_class_in_struct_passwd, [
1140 [ struct passwd p; p.pw_class = 0; ],
1141 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1142 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1145 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1146 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1149 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1150 ac_cv_have_pw_expire_in_struct_passwd, [
1155 [ struct passwd p; p.pw_expire = 0; ],
1156 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1157 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1160 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1161 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1164 AC_CACHE_CHECK([for pw_change field in struct passwd],
1165 ac_cv_have_pw_change_in_struct_passwd, [
1170 [ struct passwd p; p.pw_change = 0; ],
1171 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1172 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1175 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1176 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1179 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1181 [ extern char *__progname; printf("%s", __progname); ],
1182 [ ac_cv_libc_defines___progname="yes" ],
1183 [ ac_cv_libc_defines___progname="no" ]
1186 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1187 AC_DEFINE(HAVE___PROGNAME)
1190 AC_CACHE_CHECK([whether getopt has optreset support],
1191 ac_cv_have_getopt_optreset, [
1196 [ extern int optreset; optreset = 0; ],
1197 [ ac_cv_have_getopt_optreset="yes" ],
1198 [ ac_cv_have_getopt_optreset="no" ]
1201 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1202 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1205 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1207 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1208 [ ac_cv_libc_defines_sys_errlist="yes" ],
1209 [ ac_cv_libc_defines_sys_errlist="no" ]
1212 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1213 AC_DEFINE(HAVE_SYS_ERRLIST)
1217 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1219 [ extern int sys_nerr; printf("%i", sys_nerr);],
1220 [ ac_cv_libc_defines_sys_nerr="yes" ],
1221 [ ac_cv_libc_defines_sys_nerr="no" ]
1224 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1225 AC_DEFINE(HAVE_SYS_NERR)
1229 # Check whether user wants Kerberos support
1231 AC_ARG_WITH(kerberos4,
1232 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1234 if test "x$withval" != "xno" ; then
1236 if test "x$withval" != "xyes" ; then
1237 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1238 LDFLAGS="$LDFLAGS -L${withval}/lib"
1239 if test ! -z "$need_dash_r" ; then
1240 LDFLAGS="$LDFLAGS -R${withval}/lib"
1242 if test ! -z "$blibpath" ; then
1243 blibpath="$blibpath:${withval}/lib"
1246 if test -d /usr/include/kerberosIV ; then
1247 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1251 AC_CHECK_HEADERS(krb.h)
1252 if test "$ac_cv_header_krb_h" != yes; then
1253 AC_MSG_WARN([Cannot find krb.h, build may fail])
1255 AC_CHECK_LIB(krb, main)
1256 if test "$ac_cv_lib_krb_main" != yes; then
1257 AC_CHECK_LIB(krb4, main)
1258 if test "$ac_cv_lib_krb4_main" != yes; then
1259 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1266 AC_CHECK_LIB(des, des_cbc_encrypt)
1267 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1268 AC_CHECK_LIB(des425, des_cbc_encrypt)
1269 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1270 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1277 AC_CHECK_LIB(resolv, dn_expand, , )
1285 # Check whether user wants AFS support
1288 [ --with-afs=PATH Enable AFS support],
1290 if test "x$withval" != "xno" ; then
1292 if test "x$withval" != "xyes" ; then
1293 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1294 LDFLAGS="$LDFLAGS -L${withval}/lib"
1297 if test -z "$KRB4" ; then
1298 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1302 if test ! -z "$AFS_LIBS" ; then
1303 LIBS="$LIBS $AFS_LIBS"
1312 # Looking for programs, paths and files
1314 [ --with-rsh=PATH Specify path to remote shell program ],
1316 if test "x$withval" != "$no" ; then
1321 AC_PATH_PROG(rsh_path, rsh)
1326 [ --with-xauth=PATH Specify path to xauth program ],
1328 if test "x$withval" != "xno" ; then
1333 AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin)
1334 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
1335 xauth_path="/usr/openwin/bin/xauth"
1340 if test -z "$xauth_path" ; then
1341 XAUTH_PATH="undefined"
1342 AC_SUBST(XAUTH_PATH)
1344 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
1345 XAUTH_PATH=$xauth_path
1346 AC_SUBST(XAUTH_PATH)
1348 if test ! -z "$rsh_path" ; then
1349 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1352 # Check for mail directory (last resort if we cannot get it from headers)
1353 if test ! -z "$MAIL" ; then
1354 maildir=`dirname $MAIL`
1355 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1358 if test -z "$no_dev_ptmx" ; then
1359 AC_CHECK_FILE("/dev/ptmx",
1361 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1366 AC_CHECK_FILE("/dev/ptc",
1368 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1373 # Options from here on. Some of these are preset by platform above
1375 # Check for user-specified random device, otherwise check /dev/urandom
1377 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
1379 if test "x$withval" != "xno" ; then
1380 RANDOM_POOL="$withval";
1381 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1385 # Check for random device
1386 AC_CHECK_FILE("/dev/urandom",
1388 RANDOM_POOL="/dev/urandom";
1389 AC_SUBST(RANDOM_POOL)
1390 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1396 # Check for PRNGD/EGD pool file
1397 AC_ARG_WITH(prngd-port,
1398 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1400 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1401 PRNGD_PORT="$withval"
1402 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1407 # Check for PRNGD/EGD pool file
1408 AC_ARG_WITH(prngd-socket,
1409 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1411 if test "x$withval" != "xno" ; then
1412 PRNGD_SOCKET="$withval"
1413 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1417 # Check for existing socket only if we don't have a random device already
1418 if test -z "$RANDOM_POOL" ; then
1419 AC_MSG_CHECKING(for PRNGD/EGD socket)
1420 # Insert other locations here
1421 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1422 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1423 PRNGD_SOCKET="$sock"
1424 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1428 if test ! -z "$PRNGD_SOCKET" ; then
1429 AC_MSG_RESULT($PRNGD_SOCKET)
1431 AC_MSG_RESULT(not found)
1438 # detect pathnames for entropy gathering commands, if we need them
1439 INSTALL_SSH_PRNG_CMDS=""
1441 if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
1442 # Use these commands to collect entropy
1443 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1444 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1445 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1446 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1447 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1448 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1449 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1450 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1451 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1452 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1453 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1454 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1455 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1456 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1458 INSTALL_SSH_PRNG_CMDS="yes"
1460 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1463 AC_ARG_WITH(mantype,
1464 [ --with-mantype=man|cat|doc Set man page type],
1471 AC_MSG_ERROR(invalid man type: $withval)
1476 if test -z "$MANTYPE"; then
1477 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
1478 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1480 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1487 if test "$MANTYPE" = "doc"; then
1494 # Check whether to enable MD5 passwords
1496 AC_ARG_WITH(md5-passwords,
1497 [ --with-md5-passwords Enable use of MD5 passwords],
1499 if test "x$withval" != "xno" ; then
1500 AC_DEFINE(HAVE_MD5_PASSWORDS)
1506 # Whether to disable shadow password support
1508 [ --without-shadow Disable shadow password support],
1510 if test "x$withval" = "xno" ; then
1511 AC_DEFINE(DISABLE_SHADOW)
1517 if test -z "$disable_shadow" ; then
1518 AC_MSG_CHECKING([if the systems has expire shadow information])
1521 #include <sys/types.h>
1524 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1525 [ sp_expire_available=yes ], []
1528 if test "x$sp_expire_available" = "xyes" ; then
1530 AC_DEFINE(HAS_SHADOW_EXPIRE)
1536 # Use ip address instead of hostname in $DISPLAY
1537 if test ! -z "$IPADDR_IN_DISPLAY" ; then
1538 DISPLAY_HACK_MSG="yes"
1539 AC_DEFINE(IPADDR_IN_DISPLAY)
1541 DISPLAY_HACK_MSG="no"
1542 AC_ARG_WITH(ipaddr-display,
1543 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1545 if test "x$withval" != "xno" ; then
1546 AC_DEFINE(IPADDR_IN_DISPLAY)
1547 DISPLAY_HACK_MSG="yes"
1553 # Whether to mess with the default path
1554 SERVER_PATH_MSG="(default)"
1555 AC_ARG_WITH(default-path,
1556 [ --with-default-path=PATH Specify default \$PATH environment for server],
1558 if test "x$withval" != "xno" ; then
1559 user_path="$withval"
1560 SERVER_PATH_MSG="$withval"
1566 /* find out what STDPATH is */
1571 #ifndef _PATH_STDPATH
1572 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1574 #include <sys/types.h>
1575 #include <sys/stat.h>
1577 #define DATA "conftest.stdpath"
1584 fd = fopen(DATA,"w");
1588 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1593 ], [ user_path=`cat conftest.stdpath` ],
1594 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1595 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1597 # make sure $bindir is in USER_PATH so scp will work
1598 t_bindir=`eval echo ${bindir}`
1600 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1603 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1605 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1606 if test $? -ne 0 ; then
1607 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1608 if test $? -ne 0 ; then
1609 user_path=$user_path:$t_bindir
1610 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1615 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1618 # Whether to force IPv4 by default (needed on broken glibc Linux)
1620 AC_ARG_WITH(ipv4-default,
1621 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1623 if test "x$withval" != "xno" ; then
1624 AC_DEFINE(IPV4_DEFAULT)
1630 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
1631 IPV4_IN6_HACK_MSG="no"
1633 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1635 if test "x$withval" != "xno" ; then
1637 AC_DEFINE(IPV4_IN_IPV6)
1638 IPV4_IN6_HACK_MSG="yes"
1643 if test "x$inet6_default_4in6" = "xyes"; then
1644 AC_MSG_RESULT([yes (default)])
1645 AC_DEFINE(IPV4_IN_IPV6)
1646 IPV4_IN6_HACK_MSG="yes"
1648 AC_MSG_RESULT([no (default)])
1653 # Whether to enable BSD auth support
1654 AC_ARG_WITH(bsd-auth,
1655 [ --with-bsd-auth Enable BSD auth support],
1657 if test "x$withval" != "xno" ; then
1664 AC_MSG_CHECKING(whether to install ssh as suid root)
1665 AC_ARG_ENABLE(suid-ssh,
1666 [ --enable-suid-ssh Install ssh as suid root (default)
1667 --disable-suid-ssh Install ssh without suid bit],
1668 [ case "$enableval" in
1673 *) AC_MSG_RESULT(yes)
1683 # Where to place sshd.pid
1685 AC_ARG_WITH(pid-dir,
1686 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1688 if test "x$withval" != "xno" ; then
1694 # make sure the directory exists
1695 if test ! -d $piddir ; then
1696 piddir=`eval echo ${sysconfdir}`
1698 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1702 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
1705 dnl allow user to disable some login recording features
1706 AC_ARG_ENABLE(lastlog,
1707 [ --disable-lastlog disable use of lastlog even if detected [no]],
1708 [ AC_DEFINE(DISABLE_LASTLOG) ]
1711 [ --disable-utmp disable use of utmp even if detected [no]],
1712 [ AC_DEFINE(DISABLE_UTMP) ]
1714 AC_ARG_ENABLE(utmpx,
1715 [ --disable-utmpx disable use of utmpx even if detected [no]],
1716 [ AC_DEFINE(DISABLE_UTMPX) ]
1719 [ --disable-wtmp disable use of wtmp even if detected [no]],
1720 [ AC_DEFINE(DISABLE_WTMP) ]
1722 AC_ARG_ENABLE(wtmpx,
1723 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
1724 [ AC_DEFINE(DISABLE_WTMPX) ]
1726 AC_ARG_ENABLE(libutil,
1727 [ --disable-libutil disable use of libutil (login() etc.) [no]],
1728 [ AC_DEFINE(DISABLE_LOGIN) ]
1730 AC_ARG_ENABLE(pututline,
1731 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
1732 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1734 AC_ARG_ENABLE(pututxline,
1735 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
1736 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1738 AC_ARG_WITH(lastlog,
1739 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
1741 if test "x$withval" = "xno" ; then
1742 AC_DEFINE(DISABLE_LASTLOG)
1744 conf_lastlog_location=$withval
1749 dnl lastlog, [uw]tmpx? detection
1750 dnl NOTE: set the paths in the platform section to avoid the
1751 dnl need for command-line parameters
1752 dnl lastlog and [uw]tmp are subject to a file search if all else fails
1754 dnl lastlog detection
1755 dnl NOTE: the code itself will detect if lastlog is a directory
1756 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1758 #include <sys/types.h>
1760 #ifdef HAVE_LASTLOG_H
1761 # include <lastlog.h>
1767 [ char *lastlog = LASTLOG_FILE; ],
1768 [ AC_MSG_RESULT(yes) ],
1771 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1773 #include <sys/types.h>
1775 #ifdef HAVE_LASTLOG_H
1776 # include <lastlog.h>
1782 [ char *lastlog = _PATH_LASTLOG; ],
1783 [ AC_MSG_RESULT(yes) ],
1786 system_lastlog_path=no
1791 if test -z "$conf_lastlog_location"; then
1792 if test x"$system_lastlog_path" = x"no" ; then
1793 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
1794 if (test -d "$f" || test -f "$f") ; then
1795 conf_lastlog_location=$f
1798 if test -z "$conf_lastlog_location"; then
1799 AC_MSG_WARN([** Cannot find lastlog **])
1800 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
1805 if test -n "$conf_lastlog_location"; then
1806 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1810 AC_MSG_CHECKING([if your system defines UTMP_FILE])
1812 #include <sys/types.h>
1818 [ char *utmp = UTMP_FILE; ],
1819 [ AC_MSG_RESULT(yes) ],
1821 system_utmp_path=no ]
1823 if test -z "$conf_utmp_location"; then
1824 if test x"$system_utmp_path" = x"no" ; then
1825 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1826 if test -f $f ; then
1827 conf_utmp_location=$f
1830 if test -z "$conf_utmp_location"; then
1831 AC_DEFINE(DISABLE_UTMP)
1835 if test -n "$conf_utmp_location"; then
1836 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1840 AC_MSG_CHECKING([if your system defines WTMP_FILE])
1842 #include <sys/types.h>
1848 [ char *wtmp = WTMP_FILE; ],
1849 [ AC_MSG_RESULT(yes) ],
1851 system_wtmp_path=no ]
1853 if test -z "$conf_wtmp_location"; then
1854 if test x"$system_wtmp_path" = x"no" ; then
1855 for f in /usr/adm/wtmp /var/log/wtmp; do
1856 if test -f $f ; then
1857 conf_wtmp_location=$f
1860 if test -z "$conf_wtmp_location"; then
1861 AC_DEFINE(DISABLE_WTMP)
1865 if test -n "$conf_wtmp_location"; then
1866 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1870 dnl utmpx detection - I don't know any system so perverse as to require
1871 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1873 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1875 #include <sys/types.h>
1884 [ char *utmpx = UTMPX_FILE; ],
1885 [ AC_MSG_RESULT(yes) ],
1887 system_utmpx_path=no ]
1889 if test -z "$conf_utmpx_location"; then
1890 if test x"$system_utmpx_path" = x"no" ; then
1891 AC_DEFINE(DISABLE_UTMPX)
1894 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1898 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1900 #include <sys/types.h>
1909 [ char *wtmpx = WTMPX_FILE; ],
1910 [ AC_MSG_RESULT(yes) ],
1912 system_wtmpx_path=no ]
1914 if test -z "$conf_wtmpx_location"; then
1915 if test x"$system_wtmpx_path" = x"no" ; then
1916 AC_DEFINE(DISABLE_WTMPX)
1919 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1923 # Change default command timeout for builtin PRNG
1925 AC_ARG_WITH(entropy-timeout,
1926 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1928 if test "x$withval" != "xno" ; then
1929 entropy_timeout=$withval
1933 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1936 if test ! -z "$blibpath" ; then
1937 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1938 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1943 AC_OUTPUT(Makefile openbsd-compat/Makefile ssh_prng_cmds)
1945 # Print summary of options
1947 if test ! -z "$RANDOM_POOL" ; then
1948 RAND_MSG="Device ($RANDOM_POOL)"
1950 if test ! -z "$PRNGD_PORT" ; then
1951 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
1952 elif test ! -z "$PRNGD_SOCKET" ; then
1953 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
1955 RAND_MSG="Builtin (timeout $entropy_timeout)"
1960 # Someone please show me a better way :)
1961 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1962 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1963 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1964 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
1965 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
1966 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
1967 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
1968 H=`eval echo ${user_path}` ; H=`eval echo ${H}`
1971 echo "OpenSSH has been configured with the following options:"
1972 echo " User binaries: $B"
1973 echo " System binaries: $C"
1974 echo " Configuration files: $D"
1975 echo " Askpass program: $E"
1976 echo " Manual pages: $F"
1977 echo " PID file: $G"
1978 echo " sshd default user PATH: $H"
1979 echo " Random number collection: $RAND_MSG"
1980 echo " Manpage format: $MANTYPE"
1981 echo " PAM support: ${PAM_MSG}"
1982 echo " KerberosIV support: $KRB4_MSG"
1983 echo " AFS support: $AFS_MSG"
1984 echo " S/KEY support: $SKEY_MSG"
1985 echo " TCP Wrappers support: $TCPW_MSG"
1986 echo " MD5 password support: $MD5_MSG"
1987 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1988 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1989 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1991 if test ! -z "$bsd_auth"; then
1992 echo " BSD Auth support: yes"
1997 echo " Host: ${host}"
1998 echo " Compiler: ${CC}"
1999 echo " Compiler flags: ${CFLAGS}"
2000 echo "Preprocessor flags: ${CPPFLAGS}"
2001 echo " Linker flags: ${LDFLAGS}"
2002 echo " Libraries: ${LIBS}"
2006 if test "x$PAM_MSG" = "xyes" ; then
2007 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
2008 echo "otherwise password authentication may fail. Example PAM control files"
2009 echo "can be found in the contrib/ subdirectory"
2013 if test ! -z "$BUILTIN_RNG" ; then
2014 echo "WARNING: you are using the builtin random number collection service."
2015 echo "Please read WARNING.RNG and request that your OS vendor includes"
2016 echo "/dev/random in future versions of their OS."
2020 if test ! -z "$NO_SFTP"; then
2021 echo "sftp-server will be disabled. Your compiler does not support"
2022 echo "64bit integers."