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 if test -z "$GCC"; then
61 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
62 AC_DEFINE(IPADDR_IN_DISPLAY)
64 AC_MSG_CHECKING(for HPUX trusted system password database)
65 if test -f /tcb/files/auth/system/default; then
67 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
69 AC_MSG_WARN([This configuration is untested])
72 AC_DEFINE(DISABLE_SHADOW)
78 if test -z "$GCC"; then
81 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
82 AC_DEFINE(IPADDR_IN_DISPLAY)
83 AC_MSG_CHECKING(for HPUX trusted system password database)
84 if test -f /tcb/files/auth/system/default; then
86 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
88 AC_MSG_WARN([This configuration is untested])
91 AC_DEFINE(DISABLE_SHADOW)
97 CFLAGS="$CFLAGS -I/usr/local/include"
102 AC_DEFINE(BROKEN_INET_NTOA)
105 CFLAGS="$CFLAGS -I/usr/local/include"
108 AC_DEFINE(WITH_IRIX_ARRAY)
109 AC_DEFINE(WITH_IRIX_PROJECT)
110 AC_DEFINE(WITH_IRIX_AUDIT)
113 AC_DEFINE(BROKEN_INET_NTOA)
117 AC_DEFINE(DONT_TRY_OTHER_AF)
118 AC_DEFINE(PAM_TTY_KLUDGE)
119 inet6_default_4in6=yes
125 # hardwire lastlog location (can't detect it on some versions)
126 conf_lastlog_location="/usr/adm/lastlog"
127 conf_utmp_location=/etc/utmp
129 CFLAGS="$CFLAGS -I/usr/local/include"
131 AC_MSG_WARN([*** Tested: PA-RISC/m68k Untested: Sparc/Intel])
132 AC_MSG_WARN([*** Expect 'scp' to fail!])
133 AC_MSG_WARN([*** Please report any problems, thanks])
136 CFLAGS="$CFLAGS -I/usr/local/include"
137 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib"
139 # hardwire lastlog location (can't detect it on some versions)
140 conf_lastlog_location="/var/adm/lastlog"
141 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
142 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
143 if test "$sol2ver" -ge 8; then
145 AC_DEFINE(DISABLE_UTMP)
146 AC_DEFINE(DISABLE_WTMP)
152 CFLAGS="$CFLAGS -DSUNOS4"
153 AC_CHECK_FUNCS(getpwanam)
154 conf_utmp_location=/etc/utmp
155 conf_wtmp_location=/var/adm/wtmp
156 conf_lastlog_location=/var/adm/lastlog
162 CFLAGS="$CFLAGS -I/usr/local/include"
163 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
165 AC_DEFINE(IP_TOS_IS_BROKEN)
167 LIBS="$LIBS -lgen -lnsl -lucb"
170 CFLAGS="$CFLAGS -I/usr/local/include"
171 LDFLAGS="$LDFLAGS -L/usr/local/lib"
174 LIBS="$LIBS -lgen -lsocket"
177 CFLAGS="$CFLAGS -I/usr/local/include"
178 LDFLAGS="$LDFLAGS -L/usr/local/lib"
181 LIBS="$LIBS -lgen -lsocket"
186 if test ! -z "USE_SIA" ; then
187 AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
188 if test -f /etc/sia/matrix.conf; then
190 AC_DEFINE(HAVE_OSF_SIA)
191 AC_DEFINE(DISABLE_LOGIN)
192 LIBS="$LIBS -lsecurity -ldb -lm -laud"
200 # Allow user to specify flags
202 [ --with-cflags Specify additional flags to pass to compiler],
204 if test "x$withval" != "xno" ; then
205 CFLAGS="$CFLAGS $withval"
210 [ --with-ldlags Specify additional flags to pass to linker],
212 if test "x$withval" != "xno" ; then
213 LDFLAGS="$LDFLAGS $withval"
218 [ --with-libs Specify additional libraries to link with],
220 if test "x$withval" != "xno" ; then
221 LIBS="$LIBS $withval"
227 # Checks for libraries.
228 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
229 AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
231 if test -z "$no_libsocket" ; then
232 AC_CHECK_LIB(nsl, yp_match, , )
234 if test -z "$no_libnsl" ; then
235 AC_CHECK_LIB(socket, main, , )
238 # Checks for header files.
239 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)
241 dnl Checks for library functions.
242 AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo 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)
243 dnl Checks for time functions
244 AC_CHECK_FUNCS(gettimeofday time)
245 dnl Checks for libutil functions
246 AC_CHECK_FUNCS(login logout updwtmp logwtmp)
247 dnl Checks for utmp functions
248 AC_CHECK_FUNCS(entutent getutent getutid getutline pututline setutent)
249 AC_CHECK_FUNCS(utmpname)
250 dnl Checks for utmpx functions
251 AC_CHECK_FUNCS(entutxent getutxent getutxid getutxline pututxline )
252 AC_CHECK_FUNCS(setutxent utmpxname)
254 AC_CHECK_FUNC(getuserattr,
255 [AC_DEFINE(HAVE_GETUSERATTR)],
256 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
260 [AC_DEFINE(HAVE_LOGIN)],
261 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
264 AC_CHECK_FUNC(daemon,
265 [AC_DEFINE(HAVE_DAEMON)],
266 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
269 AC_CHECK_FUNC(getpagesize,
270 [AC_DEFINE(HAVE_GETPAGESIZE)],
271 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
274 # Check for broken snprintf
275 if test "x$ac_cv_func_snprintf" = "xyes" ; then
276 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
280 int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
282 [AC_MSG_RESULT(yes)],
285 AC_DEFINE(BROKEN_SNPRINTF)
286 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
293 [ --without-pam Disable PAM support ],
295 if test "x$withval" = "xno" ; then
297 AC_DEFINE(DISABLE_PAM)
302 if (test -z "$no_pam" && test "x$ac_cv_header_security_pam_appl_h" = "xyes") ; then
303 AC_CHECK_LIB(dl, dlopen, , )
306 AC_CHECK_FUNCS(pam_getenvlist)
312 # Check PAM strerror arguments (old PAM)
313 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
317 #include <security/pam_appl.h>
319 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
322 AC_DEFINE(HAVE_OLD_PAM)
324 PAM_MSG="yes (old library)"
329 # The big search for OpenSSL
331 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
333 if test "x$withval" != "$xno" ; then
340 saved_LDFLAGS="$LDFLAGS"
341 saved_CFLAGS="$CFLAGS"
342 if test "x$prefix" != "xNONE" ; then
343 tryssldir="$tryssldir $prefix"
345 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
347 for ssldir in "" $tryssldir /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
348 if test ! -z "$ssldir" ; then
349 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
350 CFLAGS="$saved_CFLAGS -I$ssldir/include"
351 if test ! -z "$need_dash_r" ; then
352 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
355 LDFLAGS="$saved_LDFLAGS"
358 LIBS="$saved_LIBS -lcrypto"
360 # Basic test to check for compatible version and correct linking
361 # *does not* test for RSA - that comes later.
365 #include <openssl/rand.h>
369 memset(a, 0, sizeof(a));
370 RAND_add(a, sizeof(a), sizeof(a));
371 return(RAND_status() <= 0);
380 if test ! -z "$found_crypto" ; then
385 if test -z "$found_crypto" ; then
386 AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install])
388 if test -z "$ssldir" ; then
392 ac_cv_openssldir=$ssldir
395 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
396 AC_DEFINE(HAVE_OPENSSL)
397 dnl Need to recover ssldir - test above runs in subshell
398 ssldir=$ac_cv_openssldir
399 CFLAGS="$saved_CFLAGS -I$ssldir/include"
400 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
401 if test ! -z "$need_dash_r" ; then
402 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
404 if test ! -z "$blibpath" ; then
405 blibpath="$blibpath:$ssldir:$ssldir/lib"
408 LIBS="$saved_LIBS -lcrypto"
410 # Now test RSA support
412 AC_MSG_CHECKING([for RSA support])
413 for WANTS_RSAREF in "" 1 ; do
414 if test -z "$WANTS_RSAREF" ; then
417 LIBS="$saved_LIBS -lRSAglue -lrsaref"
421 #include <openssl/rand.h>
422 #include <openssl/rsa.h>
423 #include <openssl/bn.h>
424 #include <openssl/sha.h>
427 int num; RSA *key; static unsigned char p_in[] = "blahblah";
428 unsigned char c[256], p[256];
429 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
430 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
431 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
432 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
441 if test ! -z "$no_rsa" ; then
442 AC_MSG_RESULT(disabled)
445 if test -z "$rsa_works" ; then
446 AC_MSG_WARN([*** No RSA support found *** ])
449 if test -z "$WANTS_RSAREF" ; then
453 RSA_MSG="yes (using RSAref)"
454 AC_MSG_RESULT(using RSAref)
455 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
460 # Checks for data types
461 AC_CHECK_SIZEOF(char, 1)
462 AC_CHECK_SIZEOF(short int, 2)
463 AC_CHECK_SIZEOF(int, 4)
464 AC_CHECK_SIZEOF(long int, 4)
465 AC_CHECK_SIZEOF(long long int, 8)
467 # More checks for data types
468 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
470 [ #include <sys/types.h> ],
472 [ ac_cv_have_u_int="yes" ],
473 [ ac_cv_have_u_int="no" ]
476 if test "x$ac_cv_have_u_int" = "xyes" ; then
477 AC_DEFINE(HAVE_U_INT)
481 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
483 [ #include <sys/types.h> ],
484 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
485 [ ac_cv_have_intxx_t="yes" ],
486 [ ac_cv_have_intxx_t="no" ]
489 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
490 AC_DEFINE(HAVE_INTXX_T)
494 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
496 [ #include <sys/types.h> ],
497 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
498 [ ac_cv_have_u_intxx_t="yes" ],
499 [ ac_cv_have_u_intxx_t="no" ]
502 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
503 AC_DEFINE(HAVE_U_INTXX_T)
507 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
508 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
510 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
513 #include <sys/bitypes.h>
516 int8_t a; int16_t b; int32_t c;
517 u_int8_t e; u_int16_t f; u_int32_t g;
518 a = b = c = e = f = g = 1;
521 AC_DEFINE(HAVE_U_INTXX_T)
522 AC_DEFINE(HAVE_INTXX_T)
529 if test -z "$have_u_intxx_t" ; then
530 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
533 #include <sys/types.h>
535 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
536 [ ac_cv_have_uintxx_t="yes" ],
537 [ ac_cv_have_uintxx_t="no" ]
540 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
541 AC_DEFINE(HAVE_UINTXX_T)
545 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
548 #include <sys/types.h>
549 #include <sys/socket.h>
551 [socklen_t foo; foo = 1235;],
552 [ ac_cv_have_socklen_t="yes" ],
553 [ ac_cv_have_socklen_t="no" ]
556 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
557 AC_DEFINE(HAVE_SOCKLEN_T)
560 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
563 #include <sys/types.h>
565 [ size_t foo; foo = 1235; ],
566 [ ac_cv_have_size_t="yes" ],
567 [ ac_cv_have_size_t="no" ]
570 if test "x$ac_cv_have_size_t" = "xyes" ; then
571 AC_DEFINE(HAVE_SIZE_T)
574 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
577 #include <sys/types.h>
579 [ ssize_t foo; foo = 1235; ],
580 [ ac_cv_have_ssize_t="yes" ],
581 [ ac_cv_have_ssize_t="no" ]
584 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
585 AC_DEFINE(HAVE_SSIZE_T)
588 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
591 #include <sys/types.h>
592 #include <sys/socket.h>
594 [ sa_family_t foo; foo = 1235; ],
595 [ ac_cv_have_sa_family_t="yes" ],
596 [ ac_cv_have_sa_family_t="no" ]
599 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
600 AC_DEFINE(HAVE_SA_FAMILY_T)
603 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
606 #include <sys/types.h>
608 [ pid_t foo; foo = 1235; ],
609 [ ac_cv_have_pid_t="yes" ],
610 [ ac_cv_have_pid_t="no" ]
613 if test "x$ac_cv_have_pid_t" = "xyes" ; then
614 AC_DEFINE(HAVE_PID_T)
617 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
620 #include <sys/types.h>
622 [ mode_t foo; foo = 1235; ],
623 [ ac_cv_have_mode_t="yes" ],
624 [ ac_cv_have_mode_t="no" ]
627 if test "x$ac_cv_have_mode_t" = "xyes" ; then
628 AC_DEFINE(HAVE_MODE_T)
632 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
635 #include <sys/types.h>
636 #include <sys/socket.h>
638 [ struct sockaddr_storage s; ],
639 [ ac_cv_have_struct_sockaddr_storage="yes" ],
640 [ ac_cv_have_struct_sockaddr_storage="no" ]
643 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
644 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
647 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
650 #include <sys/types.h>
651 #include <netinet/in.h>
653 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
654 [ ac_cv_have_struct_sockaddr_in6="yes" ],
655 [ ac_cv_have_struct_sockaddr_in6="no" ]
658 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
659 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
662 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
665 #include <sys/types.h>
666 #include <netinet/in.h>
668 [ struct in6_addr s; s.s6_addr[0] = 0; ],
669 [ ac_cv_have_struct_in6_addr="yes" ],
670 [ ac_cv_have_struct_in6_addr="no" ]
673 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
674 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
677 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
680 #include <sys/types.h>
681 #include <sys/socket.h>
684 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
685 [ ac_cv_have_struct_addrinfo="yes" ],
686 [ ac_cv_have_struct_addrinfo="no" ]
689 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
690 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
694 # Checks for structure members
696 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
697 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
698 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
699 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
700 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
701 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
702 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
703 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
704 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
705 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
706 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
707 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
708 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
709 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
710 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
711 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
712 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
714 AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
715 ac_cv_have_sun_len_in_struct_sockaddr_un, [
718 #include <sys/types.h>
719 #include <sys/socket.h>
721 [ struct sockaddr_un s; s.sun_len = 1; ],
722 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
723 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
726 if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
727 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
730 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
731 ac_cv_have_ss_family_in_struct_ss, [
734 #include <sys/types.h>
735 #include <sys/socket.h>
737 [ struct sockaddr_storage s; s.ss_family = 1; ],
738 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
739 [ ac_cv_have_ss_family_in_struct_ss="no" ],
742 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
743 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
746 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
747 ac_cv_have___ss_family_in_struct_ss, [
750 #include <sys/types.h>
751 #include <sys/socket.h>
753 [ struct sockaddr_storage s; s.__ss_family = 1; ],
754 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
755 [ ac_cv_have___ss_family_in_struct_ss="no" ]
758 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
759 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
762 AC_CACHE_CHECK([for pw_class field in struct passwd],
763 ac_cv_have_pw_class_in_struct_passwd, [
766 #include <sys/types.h>
769 [ struct passwd p s; p.pw_class = NULL; ],
770 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
771 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
774 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
775 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
779 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
781 [ extern char *__progname; printf("%s", __progname); ],
782 [ ac_cv_libc_defines___progname="yes" ],
783 [ ac_cv_libc_defines___progname="no" ]
786 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
787 AC_DEFINE(HAVE___PROGNAME)
791 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
793 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
794 [ ac_cv_libc_defines_sys_errlist="yes" ],
795 [ ac_cv_libc_defines_sys_errlist="no" ]
798 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
799 AC_DEFINE(HAVE_SYS_ERRLIST)
803 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
805 [ extern int sys_nerr; printf("%i", sys_nerr);],
806 [ ac_cv_libc_defines_sys_nerr="yes" ],
807 [ ac_cv_libc_defines_sys_nerr="no" ]
810 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
811 AC_DEFINE(HAVE_SYS_NERR)
815 # Looking for programs, paths and files
817 [ --with-rsh=PATH Specify path to remote shell program ],
819 if test "x$withval" != "$no" ; then
824 AC_PATH_PROG(rsh_path, rsh)
829 [ --with-xauth=PATH Specify path to xauth program ],
831 if test "x$withval" != "$xno" ; then
836 AC_PATH_PROG(xauth_path, xauth)
837 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
838 xauth_path="/usr/openwin/bin/xauth"
843 if test ! -z "$xauth_path" ; then
844 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
846 if test ! -z "$rsh_path" ; then
847 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
850 # Check for mail directory (last resort if we cannot get it from headers)
851 if test ! -z "$MAIL" ; then
852 maildir=`dirname $MAIL`
853 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
856 if test -z "$no_dev_ptmx" ; then
857 AC_CHECK_FILE("/dev/ptmx",
859 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
864 AC_CHECK_FILE("/dev/ptc",
866 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
871 # Options from here on. Some of these are preset by platform above
873 # Check for user-specified random device, otherwise check /dev/urandom
875 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
877 if test "x$withval" != "xno" ; then
878 RANDOM_POOL="$withval";
879 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
883 # Check for random device
884 AC_CHECK_FILE("/dev/urandom",
886 RANDOM_POOL="/dev/urandom";
887 AC_SUBST(RANDOM_POOL)
888 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
894 # Check for EGD pool file
895 AC_ARG_WITH(egd-pool,
896 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
898 if test "x$withval" != "xno" ; then
899 EGD_SOCKET="$withval";
900 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
905 # detect pathnames for entropy gathering commands, if we need them
906 INSTALL_SSH_PRNG_CMDS=""
908 if (test -z "$RANDOM_POOL" && test -z "$EGD_SOCKET") ; then
909 # Use these commands to collect entropy
910 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
911 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
912 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
913 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
914 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
915 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
916 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
917 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
918 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
919 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
920 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
921 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
922 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
923 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
924 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
926 INSTALL_SSH_PRNG_CMDS="yes"
928 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
932 [ --with-catman=man|cat Install preformatted manpages[no]],
935 if test x"$withval" != x"yes" ; then
941 if test -z "$MANTYPE" ; then
942 MANTYPE='$(TROFFMAN)'
950 # Check whether user wants Kerberos support
952 AC_ARG_WITH(kerberos4,
953 [ --with-kerberos4=PATH Enable Kerberos 4 support],
955 if test "x$withval" != "xno" ; then
957 if test "x$withval" != "$xyes" ; then
958 CFLAGS="$CFLAGS -I${withval}/include"
959 LDFLAGS="$LDFLAGS -L${withval}/lib"
960 if test ! -z "$need_dash_r" ; then
961 LDFLAGS="$LDFLAGS -R${withval}/lib"
963 if test ! -z "$blibpath" ; then
964 blibpath="$blibpath:${withval}/lib"
967 if test -d /usr/include/kerberosIV ; then
968 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
972 AC_CHECK_HEADERS(krb.h)
973 AC_CHECK_LIB(krb, main)
974 if test "$ac_cv_header_krb_h" != yes; then
975 AC_MSG_WARN([Cannot find krb.h, build may fail])
977 if test "$ac_cv_lib_krb_main" != yes; then
978 AC_MSG_WARN([Cannot find libkrb, build may fail])
982 AC_CHECK_LIB(resolv, dn_expand, , )
990 # Check whether user wants AFS support
993 [ --with-afs=PATH Enable AFS support],
995 if test "x$withval" != "xno" ; then
997 if test "x$withval" != "$xyes" ; then
998 CFLAGS="$CFLAGS -I${withval}/include"
999 LFLAGS="$LFLAGS -L${withval}/lib"
1002 if test -z "$KRB4" ; then
1003 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1007 if test ! -z "$AFS_LIBS" ; then
1008 LIBS="$LIBS $AFS_LIBS"
1017 # Check whether user wants S/Key support
1020 [ --with-skey Enable S/Key support],
1022 if test "x$withval" != "xno" ; then
1030 # Check whether user wants TCP wrappers support
1032 AC_ARG_WITH(tcp-wrappers,
1033 [ --with-tcp-wrappers Enable tcpwrappers support],
1035 if test "x$withval" != "xno" ; then
1038 AC_MSG_CHECKING(for libwrap)
1042 int deny_severity = 0, allow_severity = 0;
1051 AC_MSG_ERROR([*** libwrap missing])
1058 # Check whether to enable MD5 passwords
1060 AC_ARG_WITH(md5-passwords,
1061 [ --with-md5-passwords Enable use of MD5 passwords],
1063 if test "x$withval" != "xno" ; then
1064 AC_DEFINE(HAVE_MD5_PASSWORDS)
1070 # Whether to disable shadow password support
1072 [ --without-shadow Disable shadow password support],
1074 if test "x$withval" = "xno" ; then
1075 AC_DEFINE(DISABLE_SHADOW)
1081 if test -z "$disable_shadow" ; then
1082 AC_MSG_CHECKING([if the systems has expire shadow information])
1085 #include <sys/types.h>
1088 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1089 [ sp_expire_available=yes ], []
1092 if test "x$sp_expire_available" = "xyes" ; then
1094 AC_DEFINE(HAS_SHADOW_EXPIRE)
1100 # Use ip address instead of hostname in $DISPLAY
1101 DISPLAY_HACK_MSG="no"
1102 AC_ARG_WITH(ipaddr-display,
1103 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1105 if test "x$withval" != "xno" ; then
1106 AC_DEFINE(IPADDR_IN_DISPLAY)
1107 DISPLAY_HACK_MSG="yes"
1112 # Whether to mess with the default path
1113 SERVER_PATH_MSG="(default)"
1114 AC_ARG_WITH(default-path,
1115 [ --with-default-path=PATH Specify default \$PATH environment for server],
1117 if test "x$withval" != "xno" ; then
1118 AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
1119 SERVER_PATH_MSG="$withval"
1124 # Whether to force IPv4 by default (needed on broken glibc Linux)
1126 AC_ARG_WITH(ipv4-default,
1127 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1129 if test "x$withval" != "xno" ; then
1130 AC_DEFINE(IPV4_DEFAULT)
1136 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
1137 IPV4_IN6_HACK_MSG="no"
1139 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1141 if test "x$withval" != "xno" ; then
1143 AC_DEFINE(IPV4_IN_IPV6)
1144 IPV4_IN6_HACK_MSG="yes"
1149 if test "x$inet6_default_4in6" = "xyes"; then
1150 AC_MSG_RESULT([yes (default)])
1151 AC_DEFINE(IPV4_IN_IPV6)
1152 IPV4_IN6_HACK_MSG="yes"
1154 AC_MSG_RESULT([no (default)])
1159 # Where to place sshd.pid
1161 AC_ARG_WITH(pid-dir,
1162 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1164 if test "x$withval" != "xno" ; then
1170 AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
1173 dnl allow user to disable some login recording features
1174 AC_ARG_ENABLE(lastlog,
1175 [ --disable-lastlog disable use of lastlog even if detected [no]],
1176 [ AC_DEFINE(DISABLE_LASTLOG) ]
1179 [ --disable-utmp disable use of utmp even if detected [no]],
1180 [ AC_DEFINE(DISABLE_UTMP) ]
1182 AC_ARG_ENABLE(utmpx,
1183 [ --disable-utmpx disable use of utmpx even if detected [no]],
1184 [ AC_DEFINE(DISABLE_UTMPX) ]
1187 [ --disable-wtmp disable use of wtmp even if detected [no]],
1188 [ AC_DEFINE(DISABLE_WTMP) ]
1190 AC_ARG_ENABLE(wtmpx,
1191 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
1192 [ AC_DEFINE(DISABLE_WTMPX) ]
1194 AC_ARG_ENABLE(libutil,
1195 [ --disable-libutil disable use of libutil (login() etc.) [no]],
1196 [ AC_DEFINE(DISABLE_LOGIN) ]
1198 AC_ARG_ENABLE(pututline,
1199 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
1200 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1202 AC_ARG_ENABLE(pututxline,
1203 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
1204 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1206 AC_ARG_WITH(lastlog,
1207 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
1208 [ conf_lastlog_location="$withval"; ],)
1210 dnl lastlog, [uw]tmpx? detection
1211 dnl NOTE: set the paths in the platform section to avoid the
1212 dnl need for command-line parameters
1213 dnl lastlog and [uw]tmp are subject to a file search if all else fails
1215 dnl lastlog detection
1216 dnl NOTE: the code itself will detect if lastlog is a directory
1217 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1219 #include <sys/types.h>
1221 #ifdef HAVE_LASTLOG_H
1222 # include <lastlog.h>
1228 [ char *lastlog = LASTLOG_FILE; ],
1229 [ AC_MSG_RESULT(yes) ],
1232 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1234 #include <sys/types.h>
1236 #ifdef HAVE_LASTLOG_H
1237 # include <lastlog.h>
1243 [ char *lastlog = _PATH_LASTLOG; ],
1244 [ AC_MSG_RESULT(yes) ],
1247 system_lastlog_path=no
1252 if test -z "$conf_lastlog_location"; then
1253 if test x"$system_lastlog_path" = x"no" ; then
1254 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
1255 if (test -d "$f" || test -f "$f") ; then
1256 conf_lastlog_location=$f
1259 if test -z "$conf_lastlog_location"; then
1260 AC_MSG_WARN([** Cannot find lastlog **])
1261 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
1266 if test -n "$conf_lastlog_location"; then
1267 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1271 AC_MSG_CHECKING([if your system defines UTMP_FILE])
1273 #include <sys/types.h>
1279 [ char *utmp = UTMP_FILE; ],
1280 [ AC_MSG_RESULT(yes) ],
1282 system_utmp_path=no ]
1284 if test -z "$conf_utmp_location"; then
1285 if test x"$system_utmp_path" = x"no" ; then
1286 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1287 if test -f $f ; then
1288 conf_utmp_location=$f
1291 if test -z "$conf_utmp_location"; then
1292 AC_DEFINE(DISABLE_UTMP)
1296 if test -n "$conf_utmp_location"; then
1297 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1301 AC_MSG_CHECKING([if your system defines WTMP_FILE])
1303 #include <sys/types.h>
1309 [ char *wtmp = WTMP_FILE; ],
1310 [ AC_MSG_RESULT(yes) ],
1312 system_wtmp_path=no ]
1314 if test -z "$conf_wtmp_location"; then
1315 if test x"$system_wtmp_path" = x"no" ; then
1316 for f in /usr/adm/wtmp /var/log/wtmp; do
1317 if test -f $f ; then
1318 conf_wtmp_location=$f
1321 if test -z "$conf_wtmp_location"; then
1322 AC_DEFINE(DISABLE_WTMP)
1326 if test -n "$conf_wtmp_location"; then
1327 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1331 dnl utmpx detection - I don't know any system so perverse as to require
1332 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1334 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1336 #include <sys/types.h>
1345 [ char *utmpx = UTMPX_FILE; ],
1346 [ AC_MSG_RESULT(yes) ],
1348 system_utmpx_path=no ]
1350 if test -z "$conf_utmpx_location"; then
1351 if test x"$system_utmpx_path" = x"no" ; then
1352 AC_DEFINE(DISABLE_UTMPX)
1355 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1359 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1361 #include <sys/types.h>
1370 [ char *wtmpx = WTMPX_FILE; ],
1371 [ AC_MSG_RESULT(yes) ],
1373 system_wtmpx_path=no ]
1375 if test -z "$conf_wtmpx_location"; then
1376 if test x"$system_wtmpx_path" = x"no" ; then
1377 AC_DEFINE(DISABLE_WTMPX)
1380 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1384 # Change default command timeout for builtin PRNG
1386 AC_ARG_WITH(entropy-timeout,
1387 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1389 if test "x$withval" != "xno" ; then
1390 entropy_timeout=$withval
1394 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1397 if test ! -z "$blibpath" ; then
1398 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1399 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1402 AC_OUTPUT(Makefile ssh_prng_cmds)
1404 # Print summary of options
1406 if test x$MANTYPE = x'$(CATMAN)' ; then
1411 if test ! -z "$RANDOM_POOL" ; then
1412 RAND_MSG="Device ($RANDOM_POOL)"
1414 if test ! -z "$EGD_SOCKET" ; then
1415 RAND_MSG="EGD ($EGD_SOCKET)"
1417 RAND_MSG="Builtin (timeout $entropy_timeout)"
1421 # Someone please show me a better way :)
1422 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1423 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1424 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1425 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
1426 E=`eval echo ${libexecdir}/ssh/ssh-askpass` ; E=`eval echo ${E}`
1427 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
1428 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
1431 echo "OpenSSH configured has been configured with the following options."
1432 echo " User binaries: $B"
1433 echo " System binaries: $C"
1434 echo " Configuration files: $D"
1435 echo " Askpass program: $E"
1436 echo " Manual pages: $F"
1437 echo " PID file: $G"
1438 echo " Random number collection: $RAND_MSG"
1439 echo " Manpage format: $MAN_MSG"
1440 echo " PAM support: ${PAM_MSG}"
1441 echo " KerberosIV support: $KRB4_MSG"
1442 echo " AFS support: $AFS_MSG"
1443 echo " S/KEY support: $SKEY_MSG"
1444 echo " TCP Wrappers support: $TCPW_MSG"
1445 echo " MD5 password support: $MD5_MSG"
1446 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1447 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1448 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1452 echo "Compiler flags: ${CFLAGS}"
1453 echo "Linker flags: ${LDFLAGS}"
1454 echo "Libraries: ${LIBS}"