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"
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 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
81 AC_MSG_CHECKING(for HPUX trusted system password database)
82 if test -f /tcb/files/auth/system/default; then
84 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
86 AC_MSG_WARN([This configuration is untested])
89 AC_DEFINE(DISABLE_SHADOW)
95 CFLAGS="$CFLAGS -I/usr/local/include"
100 AC_DEFINE(BROKEN_INET_NTOA)
103 CFLAGS="$CFLAGS -I/usr/local/include"
106 AC_DEFINE(WITH_IRIX_ARRAY)
107 AC_DEFINE(WITH_IRIX_PROJECT)
108 AC_DEFINE(WITH_IRIX_AUDIT)
111 AC_DEFINE(BROKEN_INET_NTOA)
115 AC_DEFINE(DONT_TRY_OTHER_AF)
116 AC_DEFINE(PAM_TTY_KLUDGE)
117 inet6_default_4in6=yes
123 conf_lastlog_location="/usr/adm/lastlog"
124 conf_utmp_location=/etc/utmp
125 conf_wtmp_location=/usr/adm/wtmp
128 CFLAGS="$CFLAGS -I/usr/local/include"
131 CFLAGS="$CFLAGS -I/usr/local/include"
132 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib"
134 # hardwire lastlog location (can't detect it on some versions)
135 conf_lastlog_location="/var/adm/lastlog"
136 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
137 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
138 if test "$sol2ver" -ge 8; then
140 AC_DEFINE(DISABLE_UTMP)
141 AC_DEFINE(DISABLE_WTMP)
147 CFLAGS="$CFLAGS -DSUNOS4"
148 AC_CHECK_FUNCS(getpwanam)
149 conf_utmp_location=/etc/utmp
150 conf_wtmp_location=/var/adm/wtmp
151 conf_lastlog_location=/var/adm/lastlog
157 CFLAGS="$CFLAGS -I/usr/local/include"
158 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
160 AC_DEFINE(IP_TOS_IS_BROKEN)
162 LIBS="$LIBS -lgen -lnsl -lucb"
165 CFLAGS="$CFLAGS -I/usr/local/include"
166 LDFLAGS="$LDFLAGS -L/usr/local/lib"
169 LIBS="$LIBS -lgen -lsocket"
173 CFLAGS="$CFLAGS -I/usr/local/include"
174 LDFLAGS="$LDFLAGS -L/usr/local/lib"
177 LIBS="$LIBS -lgen -lsocket"
182 if test ! -z "USE_SIA" ; then
183 AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
184 if test -f /etc/sia/matrix.conf; then
186 AC_DEFINE(HAVE_OSF_SIA)
187 AC_DEFINE(DISABLE_LOGIN)
188 LIBS="$LIBS -lsecurity -ldb -lm -laud"
196 # Allow user to specify flags
198 [ --with-cflags Specify additional flags to pass to compiler],
200 if test "x$withval" != "xno" ; then
201 CFLAGS="$CFLAGS $withval"
206 [ --with-ldlags Specify additional flags to pass to linker],
208 if test "x$withval" != "xno" ; then
209 LDFLAGS="$LDFLAGS $withval"
214 [ --with-libs Specify additional libraries to link with],
216 if test "x$withval" != "xno" ; then
217 LIBS="$LIBS $withval"
223 # Checks for libraries.
224 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
225 AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
227 if test -z "$no_libsocket" ; then
228 AC_CHECK_LIB(nsl, yp_match, , )
230 if test -z "$no_libnsl" ; then
231 AC_CHECK_LIB(socket, main, , )
234 # Checks for header files.
235 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)
237 dnl Checks for library functions.
238 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)
239 dnl Checks for time functions
240 AC_CHECK_FUNCS(gettimeofday time)
241 dnl Checks for libutil functions
242 AC_CHECK_FUNCS(login logout updwtmp logwtmp)
243 dnl Checks for utmp functions
244 AC_CHECK_FUNCS(entutent getutent getutid getutline pututline setutent)
245 AC_CHECK_FUNCS(utmpname)
246 dnl Checks for utmpx functions
247 AC_CHECK_FUNCS(entutxent getutxent getutxid getutxline pututxline )
248 AC_CHECK_FUNCS(setutxent utmpxname)
250 AC_CHECK_FUNC(getuserattr,
251 [AC_DEFINE(HAVE_GETUSERATTR)],
252 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
256 [AC_DEFINE(HAVE_LOGIN)],
257 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
260 AC_CHECK_FUNC(daemon,
261 [AC_DEFINE(HAVE_DAEMON)],
262 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
265 AC_CHECK_FUNC(getpagesize,
266 [AC_DEFINE(HAVE_GETPAGESIZE)],
267 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
270 # Check for broken snprintf
271 if test "x$ac_cv_func_snprintf" = "xyes" ; then
272 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
276 int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
278 [AC_MSG_RESULT(yes)],
281 AC_DEFINE(BROKEN_SNPRINTF)
282 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
289 [ --without-pam Disable PAM support ],
291 if test "x$withval" = "xno" ; then
293 AC_DEFINE(DISABLE_PAM)
298 if (test -z "$no_pam" && test "x$ac_cv_header_security_pam_appl_h" = "xyes") ; then
299 AC_CHECK_LIB(dl, dlopen, , )
302 AC_CHECK_FUNCS(pam_getenvlist)
308 # Check PAM strerror arguments (old PAM)
309 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
313 #include <security/pam_appl.h>
315 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
318 AC_DEFINE(HAVE_OLD_PAM)
320 PAM_MSG="yes (old library)"
325 # The big search for OpenSSL
327 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
329 if test "x$withval" != "$xno" ; then
336 saved_LDFLAGS="$LDFLAGS"
337 saved_CFLAGS="$CFLAGS"
338 if test "x$prefix" != "xNONE" ; then
339 tryssldir="$tryssldir $prefix"
341 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
343 for ssldir in "" $tryssldir /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
344 if test ! -z "$ssldir" ; then
345 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
346 CFLAGS="$saved_CFLAGS -I$ssldir/include"
347 if test ! -z "$need_dash_r" ; then
348 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
351 LDFLAGS="$saved_LDFLAGS"
354 LIBS="$saved_LIBS -lcrypto"
356 # Basic test to check for compatible version and correct linking
357 # *does not* test for RSA - that comes later.
361 #include <openssl/rand.h>
365 memset(a, 0, sizeof(a));
366 RAND_add(a, sizeof(a), sizeof(a));
367 return(RAND_status() <= 0);
376 if test ! -z "$found_crypto" ; then
381 if test -z "$found_crypto" ; then
382 AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install])
384 if test -z "$ssldir" ; then
388 ac_cv_openssldir=$ssldir
391 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
392 AC_DEFINE(HAVE_OPENSSL)
393 dnl Need to recover ssldir - test above runs in subshell
394 ssldir=$ac_cv_openssldir
395 CFLAGS="$saved_CFLAGS -I$ssldir/include"
396 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
397 if test ! -z "$need_dash_r" ; then
398 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
400 if test ! -z "$blibpath" ; then
401 blibpath="$blibpath:$ssldir:$ssldir/lib"
404 LIBS="$saved_LIBS -lcrypto"
406 # Now test RSA support
408 AC_MSG_CHECKING([for RSA support])
409 for WANTS_RSAREF in "" 1 ; do
410 if test -z "$WANTS_RSAREF" ; then
413 LIBS="$saved_LIBS -lRSAglue -lrsaref"
417 #include <openssl/rand.h>
418 #include <openssl/rsa.h>
419 #include <openssl/bn.h>
420 #include <openssl/sha.h>
423 int num; RSA *key; static unsigned char p_in[] = "blahblah";
424 unsigned char c[256], p[256];
425 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
426 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
427 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
428 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
437 if test ! -z "$no_rsa" ; then
438 AC_MSG_RESULT(disabled)
441 if test -z "$rsa_works" ; then
442 AC_MSG_WARN([*** No RSA support found *** ])
445 if test -z "$WANTS_RSAREF" ; then
449 RSA_MSG="yes (using RSAref)"
450 AC_MSG_RESULT(using RSAref)
451 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
456 # Checks for data types
457 AC_CHECK_SIZEOF(char, 1)
458 AC_CHECK_SIZEOF(short int, 2)
459 AC_CHECK_SIZEOF(int, 4)
460 AC_CHECK_SIZEOF(long int, 4)
461 AC_CHECK_SIZEOF(long long int, 8)
463 # More checks for data types
464 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
466 [ #include <sys/types.h> ],
468 [ ac_cv_have_u_int="yes" ],
469 [ ac_cv_have_u_int="no" ]
472 if test "x$ac_cv_have_u_int" = "xyes" ; then
473 AC_DEFINE(HAVE_U_INT)
477 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
479 [ #include <sys/types.h> ],
480 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
481 [ ac_cv_have_intxx_t="yes" ],
482 [ ac_cv_have_intxx_t="no" ]
485 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
486 AC_DEFINE(HAVE_INTXX_T)
490 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
492 [ #include <sys/types.h> ],
493 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
494 [ ac_cv_have_u_intxx_t="yes" ],
495 [ ac_cv_have_u_intxx_t="no" ]
498 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
499 AC_DEFINE(HAVE_U_INTXX_T)
503 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
504 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
506 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
509 #include <sys/bitypes.h>
512 int8_t a; int16_t b; int32_t c;
513 u_int8_t e; u_int16_t f; u_int32_t g;
514 a = b = c = e = f = g = 1;
517 AC_DEFINE(HAVE_U_INTXX_T)
518 AC_DEFINE(HAVE_INTXX_T)
525 if test -z "$have_u_intxx_t" ; then
526 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
529 #include <sys/types.h>
531 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
532 [ ac_cv_have_uintxx_t="yes" ],
533 [ ac_cv_have_uintxx_t="no" ]
536 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
537 AC_DEFINE(HAVE_UINTXX_T)
541 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
544 #include <sys/types.h>
545 #include <sys/socket.h>
547 [socklen_t foo; foo = 1235;],
548 [ ac_cv_have_socklen_t="yes" ],
549 [ ac_cv_have_socklen_t="no" ]
552 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
553 AC_DEFINE(HAVE_SOCKLEN_T)
556 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
559 #include <sys/types.h>
561 [ size_t foo; foo = 1235; ],
562 [ ac_cv_have_size_t="yes" ],
563 [ ac_cv_have_size_t="no" ]
566 if test "x$ac_cv_have_size_t" = "xyes" ; then
567 AC_DEFINE(HAVE_SIZE_T)
570 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
573 #include <sys/types.h>
575 [ ssize_t foo; foo = 1235; ],
576 [ ac_cv_have_ssize_t="yes" ],
577 [ ac_cv_have_ssize_t="no" ]
580 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
581 AC_DEFINE(HAVE_SSIZE_T)
584 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
587 #include <sys/types.h>
588 #include <sys/socket.h>
590 [ sa_family_t foo; foo = 1235; ],
591 [ ac_cv_have_sa_family_t="yes" ],
592 [ ac_cv_have_sa_family_t="no" ]
595 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
596 AC_DEFINE(HAVE_SA_FAMILY_T)
599 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
602 #include <sys/types.h>
604 [ pid_t foo; foo = 1235; ],
605 [ ac_cv_have_pid_t="yes" ],
606 [ ac_cv_have_pid_t="no" ]
609 if test "x$ac_cv_have_pid_t" = "xyes" ; then
610 AC_DEFINE(HAVE_PID_T)
613 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
616 #include <sys/types.h>
618 [ mode_t foo; foo = 1235; ],
619 [ ac_cv_have_mode_t="yes" ],
620 [ ac_cv_have_mode_t="no" ]
623 if test "x$ac_cv_have_mode_t" = "xyes" ; then
624 AC_DEFINE(HAVE_MODE_T)
628 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
631 #include <sys/types.h>
632 #include <sys/socket.h>
634 [ struct sockaddr_storage s; ],
635 [ ac_cv_have_struct_sockaddr_storage="yes" ],
636 [ ac_cv_have_struct_sockaddr_storage="no" ]
639 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
640 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
643 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
646 #include <sys/types.h>
647 #include <netinet/in.h>
649 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
650 [ ac_cv_have_struct_sockaddr_in6="yes" ],
651 [ ac_cv_have_struct_sockaddr_in6="no" ]
654 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
655 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
658 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
661 #include <sys/types.h>
662 #include <netinet/in.h>
664 [ struct in6_addr s; s.s6_addr[0] = 0; ],
665 [ ac_cv_have_struct_in6_addr="yes" ],
666 [ ac_cv_have_struct_in6_addr="no" ]
669 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
670 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
673 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
676 #include <sys/types.h>
677 #include <sys/socket.h>
680 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
681 [ ac_cv_have_struct_addrinfo="yes" ],
682 [ ac_cv_have_struct_addrinfo="no" ]
685 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
686 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
690 # Checks for structure members
692 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
693 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
694 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
695 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
696 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
697 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
698 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
699 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
700 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
701 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
702 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
703 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
704 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
705 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
706 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
707 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
708 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
710 AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
711 ac_cv_have_sun_len_in_struct_sockaddr_un, [
714 #include <sys/types.h>
715 #include <sys/socket.h>
717 [ struct sockaddr_un s; s.sun_len = 1; ],
718 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
719 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
722 if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
723 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
726 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
727 ac_cv_have_ss_family_in_struct_ss, [
730 #include <sys/types.h>
731 #include <sys/socket.h>
733 [ struct sockaddr_storage s; s.ss_family = 1; ],
734 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
735 [ ac_cv_have_ss_family_in_struct_ss="no" ],
738 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
739 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
742 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
743 ac_cv_have___ss_family_in_struct_ss, [
746 #include <sys/types.h>
747 #include <sys/socket.h>
749 [ struct sockaddr_storage s; s.__ss_family = 1; ],
750 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
751 [ ac_cv_have___ss_family_in_struct_ss="no" ]
754 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
755 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
758 AC_CACHE_CHECK([for pw_class field in struct passwd],
759 ac_cv_have_pw_class_in_struct_passwd, [
762 #include <sys/types.h>
765 [ struct passwd p s; p.pw_class = NULL; ],
766 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
767 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
770 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
771 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
775 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
777 [ extern char *__progname; printf("%s", __progname); ],
778 [ ac_cv_libc_defines___progname="yes" ],
779 [ ac_cv_libc_defines___progname="no" ]
782 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
783 AC_DEFINE(HAVE___PROGNAME)
787 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
789 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
790 [ ac_cv_libc_defines_sys_errlist="yes" ],
791 [ ac_cv_libc_defines_sys_errlist="no" ]
794 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
795 AC_DEFINE(HAVE_SYS_ERRLIST)
799 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
801 [ extern int sys_nerr; printf("%i", sys_nerr);],
802 [ ac_cv_libc_defines_sys_nerr="yes" ],
803 [ ac_cv_libc_defines_sys_nerr="no" ]
806 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
807 AC_DEFINE(HAVE_SYS_NERR)
811 # Looking for programs, paths and files
813 [ --with-rsh=PATH Specify path to remote shell program ],
815 if test "x$withval" != "$no" ; then
820 AC_PATH_PROG(rsh_path, rsh)
825 [ --with-xauth=PATH Specify path to xauth program ],
827 if test "x$withval" != "$xno" ; then
832 AC_PATH_PROG(xauth_path, xauth)
833 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
834 xauth_path="/usr/openwin/bin/xauth"
839 if test ! -z "$xauth_path" ; then
840 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
842 if test ! -z "$rsh_path" ; then
843 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
846 # Check for mail directory (last resort if we cannot get it from headers)
847 if test ! -z "$MAIL" ; then
848 maildir=`dirname $MAIL`
849 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
852 if test -z "$no_dev_ptmx" ; then
853 AC_CHECK_FILE("/dev/ptmx",
855 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
860 AC_CHECK_FILE("/dev/ptc",
862 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
867 # Options from here on. Some of these are preset by platform above
869 # Check for user-specified random device, otherwise check /dev/urandom
871 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
873 if test "x$withval" != "xno" ; then
874 RANDOM_POOL="$withval";
875 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
879 # Check for random device
880 AC_CHECK_FILE("/dev/urandom",
882 RANDOM_POOL="/dev/urandom";
883 AC_SUBST(RANDOM_POOL)
884 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
890 # Check for EGD pool file
891 AC_ARG_WITH(egd-pool,
892 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
894 if test "x$withval" != "xno" ; then
895 EGD_SOCKET="$withval";
896 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
901 # detect pathnames for entropy gathering commands, if we need them
902 INSTALL_SSH_PRNG_CMDS=""
904 if (test -z "$RANDOM_POOL" && test -z "$EGD_SOCKET") ; then
905 # Use these commands to collect entropy
906 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
907 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
908 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
909 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
910 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
911 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
912 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
913 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
914 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
915 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
916 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
917 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
918 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
919 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
920 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
922 INSTALL_SSH_PRNG_CMDS="yes"
924 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
928 [ --with-catman=man|cat Install preformatted manpages[no]],
931 if test x"$withval" != x"yes" ; then
937 if test -z "$MANTYPE" ; then
938 MANTYPE='$(TROFFMAN)'
946 # Check whether user wants Kerberos support
948 AC_ARG_WITH(kerberos4,
949 [ --with-kerberos4=PATH Enable Kerberos 4 support],
951 if test "x$withval" != "xno" ; then
953 if test "x$withval" != "$xyes" ; then
954 CFLAGS="$CFLAGS -I${withval}/include"
955 LDFLAGS="$LDFLAGS -L${withval}/lib"
956 if test ! -z "$need_dash_r" ; then
957 LDFLAGS="$LDFLAGS -R${withval}/lib"
959 if test ! -z "$blibpath" ; then
960 blibpath="$blibpath:${withval}/lib"
963 if test -d /usr/include/kerberosIV ; then
964 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
968 AC_CHECK_HEADERS(krb.h)
969 AC_CHECK_LIB(krb, main)
970 if test "$ac_cv_header_krb_h" != yes; then
971 AC_MSG_WARN([Cannot find krb.h, build may fail])
973 if test "$ac_cv_lib_krb_main" != yes; then
974 AC_MSG_WARN([Cannot find libkrb, build may fail])
978 AC_CHECK_LIB(resolv, dn_expand, , )
986 # Check whether user wants AFS support
989 [ --with-afs=PATH Enable AFS support],
991 if test "x$withval" != "xno" ; then
993 if test "x$withval" != "$xyes" ; then
994 CFLAGS="$CFLAGS -I${withval}/include"
995 LFLAGS="$LFLAGS -L${withval}/lib"
998 if test -z "$KRB4" ; then
999 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1003 if test ! -z "$AFS_LIBS" ; then
1004 LIBS="$LIBS $AFS_LIBS"
1013 # Check whether user wants S/Key support
1016 [ --with-skey Enable S/Key support],
1018 if test "x$withval" != "xno" ; then
1026 # Check whether user wants TCP wrappers support
1028 AC_ARG_WITH(tcp-wrappers,
1029 [ --with-tcp-wrappers Enable tcpwrappers support],
1031 if test "x$withval" != "xno" ; then
1034 AC_MSG_CHECKING(for libwrap)
1038 int deny_severity = 0, allow_severity = 0;
1047 AC_MSG_ERROR([*** libwrap missing])
1054 # Check whether to enable MD5 passwords
1056 AC_ARG_WITH(md5-passwords,
1057 [ --with-md5-passwords Enable use of MD5 passwords],
1059 if test "x$withval" != "xno" ; then
1060 AC_DEFINE(HAVE_MD5_PASSWORDS)
1066 # Whether to disable shadow password support
1068 [ --without-shadow Disable shadow password support],
1070 if test "x$withval" = "xno" ; then
1071 AC_DEFINE(DISABLE_SHADOW)
1077 if test -z "$disable_shadow" ; then
1078 AC_MSG_CHECKING([if the systems has expire shadow information])
1081 #include <sys/types.h>
1084 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1085 [ sp_expire_available=yes ], []
1088 if test "x$sp_expire_available" = "xyes" ; then
1090 AC_DEFINE(HAS_SHADOW_EXPIRE)
1096 # Use ip address instead of hostname in $DISPLAY
1097 if test ! -z "$IPADDR_IN_DISPLAY" ; then
1098 DISPLAY_HACK_MSG="yes"
1099 AC_DEFINE(IPADDR_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"
1113 # Whether to mess with the default path
1114 SERVER_PATH_MSG="(default)"
1115 AC_ARG_WITH(default-path,
1116 [ --with-default-path=PATH Specify default \$PATH environment for server],
1118 if test "x$withval" != "xno" ; then
1119 AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
1120 SERVER_PATH_MSG="$withval"
1125 # Whether to force IPv4 by default (needed on broken glibc Linux)
1127 AC_ARG_WITH(ipv4-default,
1128 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1130 if test "x$withval" != "xno" ; then
1131 AC_DEFINE(IPV4_DEFAULT)
1137 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
1138 IPV4_IN6_HACK_MSG="no"
1140 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1142 if test "x$withval" != "xno" ; then
1144 AC_DEFINE(IPV4_IN_IPV6)
1145 IPV4_IN6_HACK_MSG="yes"
1150 if test "x$inet6_default_4in6" = "xyes"; then
1151 AC_MSG_RESULT([yes (default)])
1152 AC_DEFINE(IPV4_IN_IPV6)
1153 IPV4_IN6_HACK_MSG="yes"
1155 AC_MSG_RESULT([no (default)])
1160 # Where to place sshd.pid
1162 AC_ARG_WITH(pid-dir,
1163 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1165 if test "x$withval" != "xno" ; then
1171 AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
1174 dnl allow user to disable some login recording features
1175 AC_ARG_ENABLE(lastlog,
1176 [ --disable-lastlog disable use of lastlog even if detected [no]],
1177 [ AC_DEFINE(DISABLE_LASTLOG) ]
1180 [ --disable-utmp disable use of utmp even if detected [no]],
1181 [ AC_DEFINE(DISABLE_UTMP) ]
1183 AC_ARG_ENABLE(utmpx,
1184 [ --disable-utmpx disable use of utmpx even if detected [no]],
1185 [ AC_DEFINE(DISABLE_UTMPX) ]
1188 [ --disable-wtmp disable use of wtmp even if detected [no]],
1189 [ AC_DEFINE(DISABLE_WTMP) ]
1191 AC_ARG_ENABLE(wtmpx,
1192 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
1193 [ AC_DEFINE(DISABLE_WTMPX) ]
1195 AC_ARG_ENABLE(libutil,
1196 [ --disable-libutil disable use of libutil (login() etc.) [no]],
1197 [ AC_DEFINE(DISABLE_LOGIN) ]
1199 AC_ARG_ENABLE(pututline,
1200 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
1201 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1203 AC_ARG_ENABLE(pututxline,
1204 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
1205 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1207 AC_ARG_WITH(lastlog,
1208 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
1209 [ conf_lastlog_location="$withval"; ],)
1211 dnl lastlog, [uw]tmpx? detection
1212 dnl NOTE: set the paths in the platform section to avoid the
1213 dnl need for command-line parameters
1214 dnl lastlog and [uw]tmp are subject to a file search if all else fails
1216 dnl lastlog detection
1217 dnl NOTE: the code itself will detect if lastlog is a directory
1218 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1220 #include <sys/types.h>
1222 #ifdef HAVE_LASTLOG_H
1223 # include <lastlog.h>
1229 [ char *lastlog = LASTLOG_FILE; ],
1230 [ AC_MSG_RESULT(yes) ],
1233 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1235 #include <sys/types.h>
1237 #ifdef HAVE_LASTLOG_H
1238 # include <lastlog.h>
1244 [ char *lastlog = _PATH_LASTLOG; ],
1245 [ AC_MSG_RESULT(yes) ],
1248 system_lastlog_path=no
1253 if test -z "$conf_lastlog_location"; then
1254 if test x"$system_lastlog_path" = x"no" ; then
1255 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
1256 if (test -d "$f" || test -f "$f") ; then
1257 conf_lastlog_location=$f
1260 if test -z "$conf_lastlog_location"; then
1261 AC_MSG_WARN([** Cannot find lastlog **])
1262 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
1267 if test -n "$conf_lastlog_location"; then
1268 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1272 AC_MSG_CHECKING([if your system defines UTMP_FILE])
1274 #include <sys/types.h>
1280 [ char *utmp = UTMP_FILE; ],
1281 [ AC_MSG_RESULT(yes) ],
1283 system_utmp_path=no ]
1285 if test -z "$conf_utmp_location"; then
1286 if test x"$system_utmp_path" = x"no" ; then
1287 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1288 if test -f $f ; then
1289 conf_utmp_location=$f
1292 if test -z "$conf_utmp_location"; then
1293 AC_DEFINE(DISABLE_UTMP)
1297 if test -n "$conf_utmp_location"; then
1298 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1302 AC_MSG_CHECKING([if your system defines WTMP_FILE])
1304 #include <sys/types.h>
1310 [ char *wtmp = WTMP_FILE; ],
1311 [ AC_MSG_RESULT(yes) ],
1313 system_wtmp_path=no ]
1315 if test -z "$conf_wtmp_location"; then
1316 if test x"$system_wtmp_path" = x"no" ; then
1317 for f in /usr/adm/wtmp /var/log/wtmp; do
1318 if test -f $f ; then
1319 conf_wtmp_location=$f
1322 if test -z "$conf_wtmp_location"; then
1323 AC_DEFINE(DISABLE_WTMP)
1327 if test -n "$conf_wtmp_location"; then
1328 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1332 dnl utmpx detection - I don't know any system so perverse as to require
1333 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1335 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1337 #include <sys/types.h>
1346 [ char *utmpx = UTMPX_FILE; ],
1347 [ AC_MSG_RESULT(yes) ],
1349 system_utmpx_path=no ]
1351 if test -z "$conf_utmpx_location"; then
1352 if test x"$system_utmpx_path" = x"no" ; then
1353 AC_DEFINE(DISABLE_UTMPX)
1356 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1360 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1362 #include <sys/types.h>
1371 [ char *wtmpx = WTMPX_FILE; ],
1372 [ AC_MSG_RESULT(yes) ],
1374 system_wtmpx_path=no ]
1376 if test -z "$conf_wtmpx_location"; then
1377 if test x"$system_wtmpx_path" = x"no" ; then
1378 AC_DEFINE(DISABLE_WTMPX)
1381 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1385 # Change default command timeout for builtin PRNG
1387 AC_ARG_WITH(entropy-timeout,
1388 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1390 if test "x$withval" != "xno" ; then
1391 entropy_timeout=$withval
1395 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1398 if test ! -z "$blibpath" ; then
1399 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1400 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1403 AC_OUTPUT(Makefile ssh_prng_cmds)
1405 # Print summary of options
1407 if test x$MANTYPE = x'$(CATMAN)' ; then
1412 if test ! -z "$RANDOM_POOL" ; then
1413 RAND_MSG="Device ($RANDOM_POOL)"
1415 if test ! -z "$EGD_SOCKET" ; then
1416 RAND_MSG="EGD ($EGD_SOCKET)"
1418 RAND_MSG="Builtin (timeout $entropy_timeout)"
1422 # Someone please show me a better way :)
1423 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1424 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1425 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1426 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
1427 E=`eval echo ${libexecdir}/ssh/ssh-askpass` ; E=`eval echo ${E}`
1428 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
1429 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
1432 echo "OpenSSH configured has been configured with the following options."
1433 echo " User binaries: $B"
1434 echo " System binaries: $C"
1435 echo " Configuration files: $D"
1436 echo " Askpass program: $E"
1437 echo " Manual pages: $F"
1438 echo " PID file: $G"
1439 echo " Random number collection: $RAND_MSG"
1440 echo " Manpage format: $MAN_MSG"
1441 echo " PAM support: ${PAM_MSG}"
1442 echo " KerberosIV support: $KRB4_MSG"
1443 echo " AFS support: $AFS_MSG"
1444 echo " S/KEY support: $SKEY_MSG"
1445 echo " TCP Wrappers support: $TCPW_MSG"
1446 echo " MD5 password support: $MD5_MSG"
1447 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1448 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1449 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1453 echo "Compiler flags: ${CFLAGS}"
1454 echo "Linker flags: ${LDFLAGS}"
1455 echo "Libraries: ${LIBS}"