3 AC_CONFIG_HEADER(config.h)
11 AC_CHECK_PROG(AR, ar, ar)
12 AC_PATH_PROG(PERL, perl)
14 AC_PATH_PROG(ENT, ent)
17 # Use LOGIN_PROGRAM from environment if possible
18 if test ! -z "$LOGIN_PROGRAM" ; then
19 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
22 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
23 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
24 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
28 if test -z "$LD" ; then
35 if test "$GCC" = "yes"; then
36 CFLAGS="$CFLAGS -Wall"
39 # Check for some target-specific stuff
43 CFLAGS="$CFLAGS -I/usr/local/include"
44 LDFLAGS="$LDFLAGS -L/usr/local/lib"
45 if (test "$LD" != "gcc" && test -z "$blibpath"); then
46 blibpath="/usr/lib:/lib:/usr/local/lib"
48 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
49 AC_DEFINE(BROKEN_GETADDRINFO)
52 dnl AIX handles lastlog as part of its login message
53 AC_DEFINE(DISABLE_LASTLOG)
58 LIBS="$LIBS /usr/lib/textmode.o"
59 AC_DEFINE(HAVE_CYGWIN)
60 AC_DEFINE(DISABLE_PAM)
61 AC_DEFINE(DISABLE_SHADOW)
62 AC_DEFINE(IPV4_DEFAULT)
63 AC_DEFINE(IP_TOS_IS_BROKEN)
64 AC_DEFINE(BROKEN_VHANGUP)
70 if test -z "$GCC"; then
73 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
76 AC_MSG_CHECKING(for HPUX trusted system password database)
77 if test -f /tcb/files/auth/system/default; then
79 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
81 AC_MSG_WARN([This configuration is untested])
84 AC_DEFINE(DISABLE_SHADOW)
90 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
93 AC_MSG_CHECKING(for HPUX trusted system password database)
94 if test -f /tcb/files/auth/system/default; then
96 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
98 AC_MSG_WARN([This configuration is untested])
101 AC_DEFINE(DISABLE_SHADOW)
107 CFLAGS="$CFLAGS -I/usr/local/include"
112 AC_DEFINE(BROKEN_INET_NTOA)
115 CFLAGS="$CFLAGS -I/usr/local/include"
118 AC_DEFINE(WITH_IRIX_ARRAY)
119 AC_DEFINE(WITH_IRIX_PROJECT)
120 AC_DEFINE(WITH_IRIX_AUDIT)
123 AC_DEFINE(BROKEN_INET_NTOA)
127 AC_DEFINE(DONT_TRY_OTHER_AF)
128 AC_DEFINE(PAM_TTY_KLUDGE)
129 inet6_default_4in6=yes
135 conf_lastlog_location="/usr/adm/lastlog"
136 conf_utmp_location=/etc/utmp
137 conf_wtmp_location=/usr/adm/wtmp
140 CFLAGS="$CFLAGS -I/usr/local/include"
143 CFLAGS="$CFLAGS -I/usr/local/include"
144 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib"
146 # hardwire lastlog location (can't detect it on some versions)
147 conf_lastlog_location="/var/adm/lastlog"
148 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
149 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
150 if test "$sol2ver" -ge 8; then
152 AC_DEFINE(DISABLE_UTMP)
153 AC_DEFINE(DISABLE_WTMP)
159 CFLAGS="$CFLAGS -DSUNOS4"
160 AC_CHECK_FUNCS(getpwanam)
161 conf_utmp_location=/etc/utmp
162 conf_wtmp_location=/var/adm/wtmp
163 conf_lastlog_location=/var/adm/lastlog
169 CFLAGS="$CFLAGS -I/usr/local/include"
170 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
172 AC_DEFINE(IP_TOS_IS_BROKEN)
174 LIBS="$LIBS -lgen -lnsl -lucb"
177 CFLAGS="$CFLAGS -I/usr/local/include"
178 LDFLAGS="$LDFLAGS -L/usr/local/lib"
181 LIBS="$LIBS -lgen -lsocket"
185 CFLAGS="$CFLAGS -I/usr/local/include"
186 LDFLAGS="$LDFLAGS -L/usr/local/lib"
189 LIBS="$LIBS -lgen -lsocket"
194 if test ! -z "USE_SIA" ; then
195 AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
196 if test -f /etc/sia/matrix.conf; then
198 AC_DEFINE(HAVE_OSF_SIA)
199 AC_DEFINE(DISABLE_LOGIN)
200 LIBS="$LIBS -lsecurity -ldb -lm -laud"
208 # Allow user to specify flags
210 [ --with-cflags Specify additional flags to pass to compiler],
212 if test "x$withval" != "xno" ; then
213 CFLAGS="$CFLAGS $withval"
218 [ --with-ldlags Specify additional flags to pass to linker],
220 if test "x$withval" != "xno" ; then
221 LDFLAGS="$LDFLAGS $withval"
226 [ --with-libs Specify additional libraries to link with],
228 if test "x$withval" != "xno" ; then
229 LIBS="$LIBS $withval"
235 # Checks for libraries.
236 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
237 AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
239 if test -z "$no_libsocket" ; then
240 AC_CHECK_LIB(nsl, yp_match, , )
242 if test -z "$no_libnsl" ; then
243 AC_CHECK_LIB(socket, main, , )
246 # Checks for header files.
247 AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.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 shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h)
249 dnl Checks for library functions.
250 AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo futimes gai_strerror getaddrinfo getnameinfo getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid sigaction sigvec snprintf strerror strlcat strlcpy strsep vsnprintf vhangup _getpty __b64_ntop)
251 dnl Checks for time functions
252 AC_CHECK_FUNCS(gettimeofday time)
253 dnl Checks for libutil functions
254 AC_CHECK_FUNCS(login logout updwtmp logwtmp)
255 dnl Checks for utmp functions
256 AC_CHECK_FUNCS(entutent getutent getutid getutline pututline setutent)
257 AC_CHECK_FUNCS(utmpname)
258 dnl Checks for utmpx functions
259 AC_CHECK_FUNCS(entutxent getutxent getutxid getutxline pututxline )
260 AC_CHECK_FUNCS(setutxent utmpxname)
262 AC_CHECK_FUNC(getuserattr,
263 [AC_DEFINE(HAVE_GETUSERATTR)],
264 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
268 [AC_DEFINE(HAVE_LOGIN)],
269 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
272 AC_CHECK_FUNC(daemon,
273 [AC_DEFINE(HAVE_DAEMON)],
274 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
277 AC_CHECK_FUNC(getpagesize,
278 [AC_DEFINE(HAVE_GETPAGESIZE)],
279 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
282 # Check for broken snprintf
283 if test "x$ac_cv_func_snprintf" = "xyes" ; then
284 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
288 int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
290 [AC_MSG_RESULT(yes)],
293 AC_DEFINE(BROKEN_SNPRINTF)
294 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
301 [ --without-pam Disable PAM support ],
303 if test "x$withval" = "xno" ; then
305 AC_DEFINE(DISABLE_PAM)
310 if (test -z "$no_pam" && test "x$ac_cv_header_security_pam_appl_h" = "xyes") ; then
311 AC_CHECK_LIB(dl, dlopen, , )
314 AC_CHECK_FUNCS(pam_getenvlist)
320 # Check PAM strerror arguments (old PAM)
321 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
325 #include <security/pam_appl.h>
327 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
330 AC_DEFINE(HAVE_OLD_PAM)
332 PAM_MSG="yes (old library)"
337 # The big search for OpenSSL
339 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
341 if test "x$withval" != "$xno" ; then
348 saved_LDFLAGS="$LDFLAGS"
349 saved_CFLAGS="$CFLAGS"
350 if test "x$prefix" != "xNONE" ; then
351 tryssldir="$tryssldir $prefix"
353 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
355 for ssldir in "" $tryssldir /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
356 if test ! -z "$ssldir" ; then
357 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
358 CFLAGS="$saved_CFLAGS -I$ssldir/include"
359 if test ! -z "$need_dash_r" ; then
360 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
363 LDFLAGS="$saved_LDFLAGS"
366 LIBS="$saved_LIBS -lcrypto"
368 # Basic test to check for compatible version and correct linking
369 # *does not* test for RSA - that comes later.
373 #include <openssl/rand.h>
377 memset(a, 0, sizeof(a));
378 RAND_add(a, sizeof(a), sizeof(a));
379 return(RAND_status() <= 0);
388 if test ! -z "$found_crypto" ; then
393 if test -z "$found_crypto" ; then
394 AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install])
396 if test -z "$ssldir" ; then
400 ac_cv_openssldir=$ssldir
403 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
404 AC_DEFINE(HAVE_OPENSSL)
405 dnl Need to recover ssldir - test above runs in subshell
406 ssldir=$ac_cv_openssldir
407 CFLAGS="$saved_CFLAGS -I$ssldir/include"
408 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
409 if test ! -z "$need_dash_r" ; then
410 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
412 if test ! -z "$blibpath" ; then
413 blibpath="$blibpath:$ssldir:$ssldir/lib"
416 LIBS="$saved_LIBS -lcrypto"
418 # Now test RSA support
420 AC_MSG_CHECKING([for RSA support])
421 for WANTS_RSAREF in "" 1 ; do
422 if test -z "$WANTS_RSAREF" ; then
425 LIBS="$saved_LIBS -lRSAglue -lrsaref"
429 #include <openssl/rand.h>
430 #include <openssl/rsa.h>
431 #include <openssl/bn.h>
432 #include <openssl/sha.h>
435 int num; RSA *key; static unsigned char p_in[] = "blahblah";
436 unsigned char c[256], p[256];
437 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
438 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
439 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
440 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
449 if test ! -z "$no_rsa" ; then
450 AC_MSG_RESULT(disabled)
453 if test -z "$rsa_works" ; then
454 AC_MSG_WARN([*** No RSA support found *** ])
457 if test -z "$WANTS_RSAREF" ; then
461 RSA_MSG="yes (using RSAref)"
462 AC_MSG_RESULT(using RSAref)
463 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
468 # Checks for data types
469 AC_CHECK_SIZEOF(char, 1)
470 AC_CHECK_SIZEOF(short int, 2)
471 AC_CHECK_SIZEOF(int, 4)
472 AC_CHECK_SIZEOF(long int, 4)
473 AC_CHECK_SIZEOF(long long int, 8)
475 # More checks for data types
476 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
478 [ #include <sys/types.h> ],
480 [ ac_cv_have_u_int="yes" ],
481 [ ac_cv_have_u_int="no" ]
484 if test "x$ac_cv_have_u_int" = "xyes" ; then
485 AC_DEFINE(HAVE_U_INT)
489 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
491 [ #include <sys/types.h> ],
492 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
493 [ ac_cv_have_intxx_t="yes" ],
494 [ ac_cv_have_intxx_t="no" ]
497 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
498 AC_DEFINE(HAVE_INTXX_T)
502 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
504 [ #include <sys/types.h> ],
505 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
506 [ ac_cv_have_u_intxx_t="yes" ],
507 [ ac_cv_have_u_intxx_t="no" ]
510 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
511 AC_DEFINE(HAVE_U_INTXX_T)
515 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
516 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
518 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
521 #include <sys/bitypes.h>
524 int8_t a; int16_t b; int32_t c;
525 u_int8_t e; u_int16_t f; u_int32_t g;
526 a = b = c = e = f = g = 1;
529 AC_DEFINE(HAVE_U_INTXX_T)
530 AC_DEFINE(HAVE_INTXX_T)
537 if test -z "$have_u_intxx_t" ; then
538 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
541 #include <sys/types.h>
543 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
544 [ ac_cv_have_uintxx_t="yes" ],
545 [ ac_cv_have_uintxx_t="no" ]
548 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
549 AC_DEFINE(HAVE_UINTXX_T)
553 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
556 #include <sys/types.h>
557 #include <sys/socket.h>
559 [socklen_t foo; foo = 1235;],
560 [ ac_cv_have_socklen_t="yes" ],
561 [ ac_cv_have_socklen_t="no" ]
564 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
565 AC_DEFINE(HAVE_SOCKLEN_T)
568 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
571 #include <sys/types.h>
573 [ size_t foo; foo = 1235; ],
574 [ ac_cv_have_size_t="yes" ],
575 [ ac_cv_have_size_t="no" ]
578 if test "x$ac_cv_have_size_t" = "xyes" ; then
579 AC_DEFINE(HAVE_SIZE_T)
582 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
585 #include <sys/types.h>
587 [ ssize_t foo; foo = 1235; ],
588 [ ac_cv_have_ssize_t="yes" ],
589 [ ac_cv_have_ssize_t="no" ]
592 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
593 AC_DEFINE(HAVE_SSIZE_T)
596 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
599 #include <sys/types.h>
600 #include <sys/socket.h>
602 [ sa_family_t foo; foo = 1235; ],
603 [ ac_cv_have_sa_family_t="yes" ],
604 [ ac_cv_have_sa_family_t="no" ]
607 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
608 AC_DEFINE(HAVE_SA_FAMILY_T)
611 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
614 #include <sys/types.h>
616 [ pid_t foo; foo = 1235; ],
617 [ ac_cv_have_pid_t="yes" ],
618 [ ac_cv_have_pid_t="no" ]
621 if test "x$ac_cv_have_pid_t" = "xyes" ; then
622 AC_DEFINE(HAVE_PID_T)
625 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
628 #include <sys/types.h>
630 [ mode_t foo; foo = 1235; ],
631 [ ac_cv_have_mode_t="yes" ],
632 [ ac_cv_have_mode_t="no" ]
635 if test "x$ac_cv_have_mode_t" = "xyes" ; then
636 AC_DEFINE(HAVE_MODE_T)
640 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
643 #include <sys/types.h>
644 #include <sys/socket.h>
646 [ struct sockaddr_storage s; ],
647 [ ac_cv_have_struct_sockaddr_storage="yes" ],
648 [ ac_cv_have_struct_sockaddr_storage="no" ]
651 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
652 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
655 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
658 #include <sys/types.h>
659 #include <netinet/in.h>
661 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
662 [ ac_cv_have_struct_sockaddr_in6="yes" ],
663 [ ac_cv_have_struct_sockaddr_in6="no" ]
666 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
667 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
670 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
673 #include <sys/types.h>
674 #include <netinet/in.h>
676 [ struct in6_addr s; s.s6_addr[0] = 0; ],
677 [ ac_cv_have_struct_in6_addr="yes" ],
678 [ ac_cv_have_struct_in6_addr="no" ]
681 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
682 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
685 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
688 #include <sys/types.h>
689 #include <sys/socket.h>
692 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
693 [ ac_cv_have_struct_addrinfo="yes" ],
694 [ ac_cv_have_struct_addrinfo="no" ]
697 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
698 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
702 # Checks for structure members
704 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
705 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
706 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
707 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
708 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
709 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
710 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
711 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
712 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
713 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
714 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
715 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
716 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
717 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
718 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
719 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
720 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
722 AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
723 ac_cv_have_sun_len_in_struct_sockaddr_un, [
726 #include <sys/types.h>
727 #include <sys/socket.h>
729 [ struct sockaddr_un s; s.sun_len = 1; ],
730 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
731 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
734 if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
735 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
738 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
739 ac_cv_have_ss_family_in_struct_ss, [
742 #include <sys/types.h>
743 #include <sys/socket.h>
745 [ struct sockaddr_storage s; s.ss_family = 1; ],
746 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
747 [ ac_cv_have_ss_family_in_struct_ss="no" ],
750 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
751 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
754 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
755 ac_cv_have___ss_family_in_struct_ss, [
758 #include <sys/types.h>
759 #include <sys/socket.h>
761 [ struct sockaddr_storage s; s.__ss_family = 1; ],
762 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
763 [ ac_cv_have___ss_family_in_struct_ss="no" ]
766 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
767 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
770 AC_CACHE_CHECK([for pw_class field in struct passwd],
771 ac_cv_have_pw_class_in_struct_passwd, [
774 #include <sys/types.h>
777 [ struct passwd p s; p.pw_class = NULL; ],
778 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
779 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
782 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
783 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
787 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
789 [ extern char *__progname; printf("%s", __progname); ],
790 [ ac_cv_libc_defines___progname="yes" ],
791 [ ac_cv_libc_defines___progname="no" ]
794 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
795 AC_DEFINE(HAVE___PROGNAME)
799 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
801 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
802 [ ac_cv_libc_defines_sys_errlist="yes" ],
803 [ ac_cv_libc_defines_sys_errlist="no" ]
806 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
807 AC_DEFINE(HAVE_SYS_ERRLIST)
811 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
813 [ extern int sys_nerr; printf("%i", sys_nerr);],
814 [ ac_cv_libc_defines_sys_nerr="yes" ],
815 [ ac_cv_libc_defines_sys_nerr="no" ]
818 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
819 AC_DEFINE(HAVE_SYS_NERR)
823 # Looking for programs, paths and files
825 [ --with-rsh=PATH Specify path to remote shell program ],
827 if test "x$withval" != "$no" ; then
832 AC_PATH_PROG(rsh_path, rsh)
837 [ --with-xauth=PATH Specify path to xauth program ],
839 if test "x$withval" != "$xno" ; then
844 AC_PATH_PROG(xauth_path, xauth)
845 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
846 xauth_path="/usr/openwin/bin/xauth"
851 if test ! -z "$xauth_path" ; then
852 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
854 if test ! -z "$rsh_path" ; then
855 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
858 # Check for mail directory (last resort if we cannot get it from headers)
859 if test ! -z "$MAIL" ; then
860 maildir=`dirname $MAIL`
861 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
864 if test -z "$no_dev_ptmx" ; then
865 AC_CHECK_FILE("/dev/ptmx",
867 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
872 AC_CHECK_FILE("/dev/ptc",
874 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
879 # Options from here on. Some of these are preset by platform above
881 # Check for user-specified random device, otherwise check /dev/urandom
883 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
885 if test "x$withval" != "xno" ; then
886 RANDOM_POOL="$withval";
887 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
891 # Check for random device
892 AC_CHECK_FILE("/dev/urandom",
894 RANDOM_POOL="/dev/urandom";
895 AC_SUBST(RANDOM_POOL)
896 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
902 # Check for EGD pool file
903 AC_ARG_WITH(egd-pool,
904 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
906 if test "x$withval" != "xno" ; then
907 EGD_SOCKET="$withval";
908 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
913 # detect pathnames for entropy gathering commands, if we need them
914 INSTALL_SSH_PRNG_CMDS=""
916 if (test -z "$RANDOM_POOL" && test -z "$EGD_SOCKET") ; then
917 # Use these commands to collect entropy
918 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
919 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
920 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
921 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
922 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
923 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
924 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
925 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
926 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
927 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
928 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
929 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
930 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
931 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
932 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
934 INSTALL_SSH_PRNG_CMDS="yes"
936 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
940 [ --with-catman=man|cat Install preformatted manpages[no]],
943 if test x"$withval" != x"yes" ; then
949 if test -z "$MANTYPE" ; then
950 MANTYPE='$(TROFFMAN)'
958 # Check whether user wants Kerberos support
960 AC_ARG_WITH(kerberos4,
961 [ --with-kerberos4=PATH Enable Kerberos 4 support],
963 if test "x$withval" != "xno" ; then
965 if test "x$withval" != "$xyes" ; then
966 CFLAGS="$CFLAGS -I${withval}/include"
967 LDFLAGS="$LDFLAGS -L${withval}/lib"
968 if test ! -z "$need_dash_r" ; then
969 LDFLAGS="$LDFLAGS -R${withval}/lib"
971 if test ! -z "$blibpath" ; then
972 blibpath="$blibpath:${withval}/lib"
975 if test -d /usr/include/kerberosIV ; then
976 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
980 AC_CHECK_HEADERS(krb.h)
981 AC_CHECK_LIB(krb, main)
982 if test "$ac_cv_header_krb_h" != yes; then
983 AC_MSG_WARN([Cannot find krb.h, build may fail])
985 if test "$ac_cv_lib_krb_main" != yes; then
986 AC_MSG_WARN([Cannot find libkrb, build may fail])
990 AC_CHECK_LIB(resolv, dn_expand, , )
998 # Check whether user wants AFS support
1001 [ --with-afs=PATH Enable AFS support],
1003 if test "x$withval" != "xno" ; then
1005 if test "x$withval" != "$xyes" ; then
1006 CFLAGS="$CFLAGS -I${withval}/include"
1007 LFLAGS="$LFLAGS -L${withval}/lib"
1010 if test -z "$KRB4" ; then
1011 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1015 if test ! -z "$AFS_LIBS" ; then
1016 LIBS="$LIBS $AFS_LIBS"
1025 # Check whether user wants S/Key support
1028 [ --with-skey Enable S/Key support],
1030 if test "x$withval" != "xno" ; then
1038 # Check whether user wants TCP wrappers support
1040 AC_ARG_WITH(tcp-wrappers,
1041 [ --with-tcp-wrappers Enable tcpwrappers support],
1043 if test "x$withval" != "xno" ; then
1046 AC_MSG_CHECKING(for libwrap)
1050 int deny_severity = 0, allow_severity = 0;
1059 AC_MSG_ERROR([*** libwrap missing])
1066 # Check whether to enable MD5 passwords
1068 AC_ARG_WITH(md5-passwords,
1069 [ --with-md5-passwords Enable use of MD5 passwords],
1071 if test "x$withval" != "xno" ; then
1072 AC_DEFINE(HAVE_MD5_PASSWORDS)
1078 # Whether to disable shadow password support
1080 [ --without-shadow Disable shadow password support],
1082 if test "x$withval" = "xno" ; then
1083 AC_DEFINE(DISABLE_SHADOW)
1089 if test -z "$disable_shadow" ; then
1090 AC_MSG_CHECKING([if the systems has expire shadow information])
1093 #include <sys/types.h>
1096 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1097 [ sp_expire_available=yes ], []
1100 if test "x$sp_expire_available" = "xyes" ; then
1102 AC_DEFINE(HAS_SHADOW_EXPIRE)
1108 # Use ip address instead of hostname in $DISPLAY
1109 if test ! -z "$IPADDR_IN_DISPLAY" ; then
1110 DISPLAY_HACK_MSG="yes"
1111 AC_DEFINE(IPADDR_IN_DISPLAY)
1113 DISPLAY_HACK_MSG="no"
1114 AC_ARG_WITH(ipaddr-display,
1115 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1117 if test "x$withval" != "xno" ; then
1118 AC_DEFINE(IPADDR_IN_DISPLAY)
1119 DISPLAY_HACK_MSG="yes"
1125 # Whether to mess with the default path
1126 SERVER_PATH_MSG="(default)"
1127 AC_ARG_WITH(default-path,
1128 [ --with-default-path=PATH Specify default \$PATH environment for server],
1130 if test "x$withval" != "xno" ; then
1131 AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
1132 SERVER_PATH_MSG="$withval"
1137 # Whether to force IPv4 by default (needed on broken glibc Linux)
1139 AC_ARG_WITH(ipv4-default,
1140 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1142 if test "x$withval" != "xno" ; then
1143 AC_DEFINE(IPV4_DEFAULT)
1149 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
1150 IPV4_IN6_HACK_MSG="no"
1152 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1154 if test "x$withval" != "xno" ; then
1156 AC_DEFINE(IPV4_IN_IPV6)
1157 IPV4_IN6_HACK_MSG="yes"
1162 if test "x$inet6_default_4in6" = "xyes"; then
1163 AC_MSG_RESULT([yes (default)])
1164 AC_DEFINE(IPV4_IN_IPV6)
1165 IPV4_IN6_HACK_MSG="yes"
1167 AC_MSG_RESULT([no (default)])
1172 # Where to place sshd.pid
1174 AC_ARG_WITH(pid-dir,
1175 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1177 if test "x$withval" != "xno" ; then
1183 AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
1186 dnl allow user to disable some login recording features
1187 AC_ARG_ENABLE(lastlog,
1188 [ --disable-lastlog disable use of lastlog even if detected [no]],
1189 [ AC_DEFINE(DISABLE_LASTLOG) ]
1192 [ --disable-utmp disable use of utmp even if detected [no]],
1193 [ AC_DEFINE(DISABLE_UTMP) ]
1195 AC_ARG_ENABLE(utmpx,
1196 [ --disable-utmpx disable use of utmpx even if detected [no]],
1197 [ AC_DEFINE(DISABLE_UTMPX) ]
1200 [ --disable-wtmp disable use of wtmp even if detected [no]],
1201 [ AC_DEFINE(DISABLE_WTMP) ]
1203 AC_ARG_ENABLE(wtmpx,
1204 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
1205 [ AC_DEFINE(DISABLE_WTMPX) ]
1207 AC_ARG_ENABLE(libutil,
1208 [ --disable-libutil disable use of libutil (login() etc.) [no]],
1209 [ AC_DEFINE(DISABLE_LOGIN) ]
1211 AC_ARG_ENABLE(pututline,
1212 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
1213 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1215 AC_ARG_ENABLE(pututxline,
1216 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
1217 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1219 AC_ARG_WITH(lastlog,
1220 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
1221 [ conf_lastlog_location="$withval"; ],)
1223 dnl lastlog, [uw]tmpx? detection
1224 dnl NOTE: set the paths in the platform section to avoid the
1225 dnl need for command-line parameters
1226 dnl lastlog and [uw]tmp are subject to a file search if all else fails
1228 dnl lastlog detection
1229 dnl NOTE: the code itself will detect if lastlog is a directory
1230 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1232 #include <sys/types.h>
1234 #ifdef HAVE_LASTLOG_H
1235 # include <lastlog.h>
1241 [ char *lastlog = LASTLOG_FILE; ],
1242 [ AC_MSG_RESULT(yes) ],
1245 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1247 #include <sys/types.h>
1249 #ifdef HAVE_LASTLOG_H
1250 # include <lastlog.h>
1256 [ char *lastlog = _PATH_LASTLOG; ],
1257 [ AC_MSG_RESULT(yes) ],
1260 system_lastlog_path=no
1265 if test -z "$conf_lastlog_location"; then
1266 if test x"$system_lastlog_path" = x"no" ; then
1267 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
1268 if (test -d "$f" || test -f "$f") ; then
1269 conf_lastlog_location=$f
1272 if test -z "$conf_lastlog_location"; then
1273 AC_MSG_WARN([** Cannot find lastlog **])
1274 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
1279 if test -n "$conf_lastlog_location"; then
1280 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1284 AC_MSG_CHECKING([if your system defines UTMP_FILE])
1286 #include <sys/types.h>
1292 [ char *utmp = UTMP_FILE; ],
1293 [ AC_MSG_RESULT(yes) ],
1295 system_utmp_path=no ]
1297 if test -z "$conf_utmp_location"; then
1298 if test x"$system_utmp_path" = x"no" ; then
1299 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1300 if test -f $f ; then
1301 conf_utmp_location=$f
1304 if test -z "$conf_utmp_location"; then
1305 AC_DEFINE(DISABLE_UTMP)
1309 if test -n "$conf_utmp_location"; then
1310 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1314 AC_MSG_CHECKING([if your system defines WTMP_FILE])
1316 #include <sys/types.h>
1322 [ char *wtmp = WTMP_FILE; ],
1323 [ AC_MSG_RESULT(yes) ],
1325 system_wtmp_path=no ]
1327 if test -z "$conf_wtmp_location"; then
1328 if test x"$system_wtmp_path" = x"no" ; then
1329 for f in /usr/adm/wtmp /var/log/wtmp; do
1330 if test -f $f ; then
1331 conf_wtmp_location=$f
1334 if test -z "$conf_wtmp_location"; then
1335 AC_DEFINE(DISABLE_WTMP)
1339 if test -n "$conf_wtmp_location"; then
1340 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1344 dnl utmpx detection - I don't know any system so perverse as to require
1345 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1347 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1349 #include <sys/types.h>
1358 [ char *utmpx = UTMPX_FILE; ],
1359 [ AC_MSG_RESULT(yes) ],
1361 system_utmpx_path=no ]
1363 if test -z "$conf_utmpx_location"; then
1364 if test x"$system_utmpx_path" = x"no" ; then
1365 AC_DEFINE(DISABLE_UTMPX)
1368 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1372 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1374 #include <sys/types.h>
1383 [ char *wtmpx = WTMPX_FILE; ],
1384 [ AC_MSG_RESULT(yes) ],
1386 system_wtmpx_path=no ]
1388 if test -z "$conf_wtmpx_location"; then
1389 if test x"$system_wtmpx_path" = x"no" ; then
1390 AC_DEFINE(DISABLE_WTMPX)
1393 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1397 # Change default command timeout for builtin PRNG
1399 AC_ARG_WITH(entropy-timeout,
1400 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1402 if test "x$withval" != "xno" ; then
1403 entropy_timeout=$withval
1407 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1410 if test ! -z "$blibpath" ; then
1411 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1412 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1417 AC_OUTPUT(Makefile ssh_prng_cmds)
1419 # Print summary of options
1421 if test x$MANTYPE = x'$(CATMAN)' ; then
1426 if test ! -z "$RANDOM_POOL" ; then
1427 RAND_MSG="Device ($RANDOM_POOL)"
1429 if test ! -z "$EGD_SOCKET" ; then
1430 RAND_MSG="EGD ($EGD_SOCKET)"
1432 RAND_MSG="Builtin (timeout $entropy_timeout)"
1436 # Someone please show me a better way :)
1437 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1438 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1439 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1440 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
1441 E=`eval echo ${libexecdir}/ssh/ssh-askpass` ; E=`eval echo ${E}`
1442 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
1443 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
1446 echo "OpenSSH configured has been configured with the following options."
1447 echo " User binaries: $B"
1448 echo " System binaries: $C"
1449 echo " Configuration files: $D"
1450 echo " Askpass program: $E"
1451 echo " Manual pages: $F"
1452 echo " PID file: $G"
1453 echo " Random number collection: $RAND_MSG"
1454 echo " Manpage format: $MAN_MSG"
1455 echo " PAM support: ${PAM_MSG}"
1456 echo " KerberosIV support: $KRB4_MSG"
1457 echo " AFS support: $AFS_MSG"
1458 echo " S/KEY support: $SKEY_MSG"
1459 echo " TCP Wrappers support: $TCPW_MSG"
1460 echo " MD5 password support: $MD5_MSG"
1461 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1462 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1463 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1467 echo "Compiler flags: ${CFLAGS}"
1468 echo "Linker flags: ${LDFLAGS}"
1469 echo "Libraries: ${LIBS}"