blob: 84229411e415b3a030cff6393d0fbffd45687702 [file] [log] [blame]
Tim Rice200a5c02002-02-26 22:12:34 -08001# $Id: configure.ac,v 1.23 2002/02/27 06:12:35 tim Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Tim Rice13aae5e2001-10-21 17:53:58 -07003AC_INIT
4AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +10005
6AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11007AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11008AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11009AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100010
Damien Millera22ba012000-03-02 23:09:20 +110011# Checks for programs.
Damien Millerab18c411999-11-11 10:40:23 +110012AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100013AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110014AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000015AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070016AC_PATH_PROGS(PERL, perl5 perl)
Damien Millere79334a1999-12-29 10:03:37 +110017AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100018AC_PATH_PROG(ENT, ent)
19AC_SUBST(ENT)
Damien Miller78315eb2000-09-29 23:01:36 +110020AC_PATH_PROGS(FILEPRIV, filepriv, true, /sbin:/usr/sbin)
Damien Miller4864e8f2001-02-08 10:07:08 +110021AC_PATH_PROG(TEST_MINUS_S_SH, bash)
22AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
23AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110024
Damien Millere8bb4502001-09-25 16:39:35 +100025# System features
26AC_SYS_LARGEFILE
27
Damien Miller3f62aba2000-11-29 11:56:35 +110028if test -z "$AR" ; then
29 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
30fi
31
Damien Millerad833b32000-08-23 10:46:23 +100032# Use LOGIN_PROGRAM from environment if possible
33if test ! -z "$LOGIN_PROGRAM" ; then
34 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
35else
36 # Search for login
37 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
38 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
39 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
40 fi
41fi
42
Damien Miller166bd442000-03-16 10:48:25 +110043if test -z "$LD" ; then
44 LD=$CC
45fi
46AC_SUBST(LD)
47
Damien Miller166bd442000-03-16 10:48:25 +110048AC_C_INLINE
Damien Miller649d9992001-06-27 23:35:51 +100049if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
50 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110051fi
52
Damien Millera22ba012000-03-02 23:09:20 +110053# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110054case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110055*-*-aix*)
56 AFS_LIBS="-lld"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000057 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110058 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100059 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Miller29ea30d2000-03-17 10:54:15 +110060 blibpath="/usr/lib:/lib:/usr/local/lib"
61 fi
Damien Millerd2c208a2000-05-17 22:00:02 +100062 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
Damien Millereca71f82000-01-20 22:38:27 +110063 AC_DEFINE(BROKEN_GETADDRINFO)
andre60f3c982000-06-03 16:18:19 +000064 dnl AIX handles lastlog as part of its login message
65 AC_DEFINE(DISABLE_LASTLOG)
Damien Millerd054b072002-02-14 08:44:04 +110066 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller75b1d102000-01-07 14:01:41 +110067 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110068*-*-cygwin*)
Tim Ricefe1d1002001-11-26 17:19:43 -080069 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110070 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +000071 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +110072 AC_DEFINE(DISABLE_SHADOW)
73 AC_DEFINE(IPV4_DEFAULT)
74 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +000075 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Damien Millerbac2d8a2000-09-05 16:13:06 +110076 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000077*-*-dgux*)
78 AC_DEFINE(IP_TOS_IS_BROKEN)
79 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +000080*-*-darwin*)
81 AC_DEFINE(BROKEN_GETADDRINFO)
82 ;;
Damien Miller76112de1999-12-21 11:18:08 +110083*-*-hpux10*)
84 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +100085 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +110086 fi
Kevin Steves315f8b72001-06-28 00:24:41 +000087 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +110088 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +100089 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110090 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110091 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000092 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves315f8b72001-06-28 00:24:41 +000093 LIBS="$LIBS -lxnet -lsec"
Damien Miller76112de1999-12-21 11:18:08 +110094 ;;
Damien Miller1bead332000-04-30 00:47:29 +100095*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +000096 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +110097 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +110098 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +110099 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100100 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100101 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000102 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000103 LIBS="$LIBS -lxnet -lsec"
Damien Miller1bead332000-04-30 00:47:29 +1000104 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100105*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000106 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000107 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100108 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000109 AC_DEFINE(BROKEN_INET_NTOA)
Damien Miller1808f382000-01-06 12:03:12 +1100110 ;;
111*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000112 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000113 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100114 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000115 AC_DEFINE(WITH_IRIX_ARRAY)
116 AC_DEFINE(WITH_IRIX_PROJECT)
117 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom4a1d9162000-11-21 10:45:31 +0000118 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000119 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100120 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100121*-*-linux*)
122 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100123 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100124 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000125 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller28e4d8f2002-01-22 23:51:42 +1100126 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller7bcb0892000-03-11 20:45:40 +1100127 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100128 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000129mips-sony-bsd|mips-sony-newsos4)
130 AC_DEFINE(HAVE_NEWS4)
131 SONY=1
132 AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT),
Damien Miller5dfe9762001-02-16 12:05:39 +1100133 AC_MSG_ERROR([*** libiberty missing - please install first or check config.log ***])
Ben Lindstromb5628642000-10-18 00:02:25 +0000134 )
135 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100136*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100137 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100138 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100139*-*-freebsd*)
140 check_for_libcrypt_later=1
141 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000142*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000143 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100144 conf_utmp_location=/etc/utmp
145 conf_wtmp_location=/usr/adm/wtmp
146 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000147 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000148 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000149 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100150 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000151 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000152 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000153 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100154*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000155 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000156 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100157 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100158 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000159 AC_DEFINE(LOGIN_NEEDS_UTMPX)
160 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000161 AC_DEFINE(PAM_TTY_KLUDGE)
andre2ff7b5d2000-06-03 14:57:40 +0000162 # hardwire lastlog location (can't detect it on some versions)
163 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000164 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
165 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
166 if test "$sol2ver" -ge 8; then
167 AC_MSG_RESULT(yes)
168 AC_DEFINE(DISABLE_UTMP)
169 AC_DEFINE(DISABLE_WTMP)
170 else
171 AC_MSG_RESULT(no)
172 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100173 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000174*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000175 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000176 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100177 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller877d8ea2001-02-18 15:29:28 +1100178 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000179 conf_utmp_location=/etc/utmp
180 conf_wtmp_location=/var/adm/wtmp
181 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000182 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000183 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000184*-ncr-sysv*)
185 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
186 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700187 LIBS="$LIBS -lc89"
Ben Lindstrom34328342001-04-23 22:39:42 +0000188 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Kevin Steves0bd4b342002-01-05 23:24:27 +0000189 AC_DEFINE(USE_PIPES)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000190 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000191*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000192 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700193 # /usr/ucblib MUST NOT be searched on ReliantUNIX
194 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100195 IPADDR_IN_DISPLAY=yes
196 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000197 AC_DEFINE(IP_TOS_IS_BROKEN)
Kevin Steves52dd4682001-03-08 18:26:57 +0000198 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700199 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
200 # Attention: always take care to bind libsocket and libnsl before libc,
201 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000202 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100203*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000204 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100205 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Ricea4f7ae12001-09-17 14:34:33 -0700206# enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100207 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100208 ;;
209*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000210 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100211 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Ricea4f7ae12001-09-17 14:34:33 -0700212# enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100213 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100214 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100215*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000216 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100217 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100218 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100219*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000220 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100221 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700222 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller78315eb2000-09-29 23:01:36 +1100223 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100224 RANLIB=true
225 no_dev_ptmx=1
226 AC_DEFINE(BROKEN_SYS_TERMIO_H)
227 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100228 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000229 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000230 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Millerfbd884a2001-02-27 08:39:07 +1100231 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100232 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700233 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700234 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100235 ;;
236*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000237 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000238 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100239 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000240 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100241 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100242 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100243 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000244 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom42717bf2000-12-28 15:46:20 +0000245 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller217f5672001-02-16 12:12:41 +1100246 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700247 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000248 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000249*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700250 no_libsocket=1
251 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000252 AC_DEFINE(USE_PIPES)
Tim Ricee991e3c2001-08-07 15:29:07 -0700253 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
254 LIBS="$LIBS -lgen -lrsc"
255 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000256*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000257 AC_MSG_CHECKING(for Digital Unix SIA)
258 no_osfsia=""
259 AC_ARG_WITH(osfsia,
260 [ --with-osfsia Enable Digital Unix SIA],
261 [
262 if test "x$withval" = "xno" ; then
263 AC_MSG_RESULT(disabled)
264 no_osfsia=1
265 fi
266 ],
267 )
268 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000269 if test -f /etc/sia/matrix.conf; then
270 AC_MSG_RESULT(yes)
271 AC_DEFINE(HAVE_OSF_SIA)
272 AC_DEFINE(DISABLE_LOGIN)
273 LIBS="$LIBS -lsecurity -ldb -lm -laud"
274 else
275 AC_MSG_RESULT(no)
276 fi
277 fi
278 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000279
280*-*-nto-qnx)
281 AC_DEFINE(USE_PIPES)
282 AC_DEFINE(NO_X11_UNIX_SOCKETS)
283 AC_DEFINE(MISSING_NFDBITS)
284 AC_DEFINE(MISSING_HOWMANY)
285 AC_DEFINE(MISSING_FD_MASK)
286 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100287esac
288
Damien Millere37bfc12000-06-05 09:37:43 +1000289# Allow user to specify flags
290AC_ARG_WITH(cflags,
291 [ --with-cflags Specify additional flags to pass to compiler],
292 [
293 if test "x$withval" != "xno" ; then
294 CFLAGS="$CFLAGS $withval"
295 fi
296 ]
297)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000298AC_ARG_WITH(cppflags,
299 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
300 [
301 if test "x$withval" != "xno"; then
302 CPPFLAGS="$CPPFLAGS $withval"
303 fi
304 ]
305)
Damien Millere37bfc12000-06-05 09:37:43 +1000306AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000307 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000308 [
309 if test "x$withval" != "xno" ; then
310 LDFLAGS="$LDFLAGS $withval"
311 fi
312 ]
313)
314AC_ARG_WITH(libs,
315 [ --with-libs Specify additional libraries to link with],
316 [
317 if test "x$withval" != "xno" ; then
318 LIBS="$LIBS $withval"
319 fi
320 ]
321)
322
Tim Rice4cec93f2002-02-26 08:40:48 -0800323# Checks for header files.
324AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
325 getopt.h glob.h lastlog.h limits.h login.h \
326 login_cap.h maillock.h netdb.h netgroup.h \
327 netinet/in_systm.h paths.h poll.h pty.h \
328 security/pam_appl.h shadow.h stddef.h stdint.h \
329 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
330 sys/poll.h sys/queue.h sys/select.h sys/stat.h \
331 sys/stropts.h sys/sysmacros.h sys/time.h \
332 sys/ttcompat.h sys/un.h time.h ttyent.h usersec.h \
333 util.h utime.h utmp.h utmpx.h)
334
Damien Millera22ba012000-03-02 23:09:20 +1100335# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700336AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
337AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000338
Damien Millerdf288022001-02-18 13:07:07 +1100339dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700340if test "x$with_tcp_wrappers" != "xno" ; then
341 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
342 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
343 fi
344fi
Damien Millerdf288022001-02-18 13:07:07 +1100345
Tim Rice13aae5e2001-10-21 17:53:58 -0700346AC_CHECK_FUNC(getspnam, ,
347 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700348
Damien Miller150c8b52002-02-13 23:06:56 +1100349AC_ARG_WITH(rpath,
350 [ --without-rpath Disable auto-added -R linker paths],
351 [
352 if test "x$withval" = "xno" ; then
353 need_dash_r=""
354 fi
355 if test "x$withval" = "xyes" ; then
356 need_dash_r=1
357 fi
358 ]
359)
360
Tim Rice13aae5e2001-10-21 17:53:58 -0700361dnl zlib is required
362AC_ARG_WITH(zlib,
363 [ --with-zlib=PATH Use zlib in PATH],
364 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000365 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100366 AC_MSG_ERROR([*** zlib is required ***])
367 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700368 if test -d "$withval/lib"; then
369 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700370 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700371 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700372 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700373 fi
374 else
375 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700376 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700377 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700378 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700379 fi
380 fi
381 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700382 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700383 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700384 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700385 fi
386 ]
387)
388
Tim Rice17b93e52001-10-23 22:36:54 -0700389AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100390
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000391dnl UnixWare 2.x
392AC_CHECK_FUNC(strcasecmp,
393 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
394)
395AC_CHECK_FUNC(utimes,
396 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
397)
Damien Millerab18c411999-11-11 10:40:23 +1100398
Tim Ricee589a292001-11-03 11:09:32 -0800399dnl Checks for libutil functions
400AC_CHECK_HEADERS(libutil.h)
401AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
402AC_CHECK_FUNCS(logout updwtmp logwtmp)
403
Ben Lindstrom8697e082001-02-24 21:41:10 +0000404AC_FUNC_STRFTIME
405
Damien Miller3c027682001-03-14 11:39:45 +1100406# Check for ALTDIRFUNC glob() extension
407AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
408AC_EGREP_CPP(FOUNDIT,
409 [
410 #include <glob.h>
411 #ifdef GLOB_ALTDIRFUNC
412 FOUNDIT
413 #endif
414 ],
415 [
416 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
417 AC_MSG_RESULT(yes)
418 ],
419 [
420 AC_MSG_RESULT(no)
421 ]
422)
Damien Millerab18c411999-11-11 10:40:23 +1100423
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000424# Check for g.gl_matchc glob() extension
425AC_MSG_CHECKING(for gl_matchc field in glob_t)
426AC_EGREP_CPP(FOUNDIT,
427 [
428 #include <glob.h>
429 int main(void){glob_t g; g.gl_matchc = 1;}
430 ],
431 [
432 AC_DEFINE(GLOB_HAS_GL_MATCHC)
433 AC_MSG_RESULT(yes)
434 ],
435 [
436 AC_MSG_RESULT(no)
437 ]
438)
439
Damien Miller18bb4732001-03-28 14:35:30 +1000440AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
441AC_TRY_RUN(
442 [
443#include <sys/types.h>
444#include <dirent.h>
445int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
446 ],
447 [AC_MSG_RESULT(yes)],
448 [
449 AC_MSG_RESULT(no)
450 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
451 ]
452)
453
Damien Millerc547bf12001-02-16 10:18:12 +1100454# Check whether user wants S/Key support
455SKEY_MSG="no"
456AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700457 [ --with-skey[[=PATH]] Enable S/Key support
458 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100459 [
460 if test "x$withval" != "xno" ; then
461
462 if test "x$withval" != "xyes" ; then
463 CPPFLAGS="$CPPFLAGS -I${withval}/include"
464 LDFLAGS="$LDFLAGS -L${withval}/lib"
465 fi
466
467 AC_DEFINE(SKEY)
468 LIBS="-lskey $LIBS"
469 SKEY_MSG="yes"
470
Tim Rice4cec93f2002-02-26 08:40:48 -0800471 AC_MSG_CHECKING([for s/key support])
472 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100473 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800474#include <stdio.h>
475#include <skey.h>
476int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
477 ],
478 [AC_MSG_RESULT(yes)],
479 [
480 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100481 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
482 ])
483 fi
484 ]
485)
486
487# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700488TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100489AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700490 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
491 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100492 [
493 if test "x$withval" != "xno" ; then
494 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700495 saved_LDFLAGS="$LDFLAGS"
496 saved_CPPFLAGS="$CPPFLAGS"
497 if test -n "${withval}" -a "${withval}" != "yes"; then
498 if test -d "${withval}/lib"; then
499 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700500 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700501 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700502 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700503 fi
504 else
505 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700506 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700507 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700508 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700509 fi
510 fi
511 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700512 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700513 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700514 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700515 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700516 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800517 LIBWRAP="-lwrap"
518 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100519 AC_MSG_CHECKING(for libwrap)
520 AC_TRY_LINK(
521 [
522#include <tcpd.h>
523 int deny_severity = 0, allow_severity = 0;
524 ],
525 [hosts_access(0);],
526 [
527 AC_MSG_RESULT(yes)
528 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800529 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700530 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100531 ],
532 [
533 AC_MSG_ERROR([*** libwrap missing])
534 ]
535 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800536 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100537 fi
538 ]
539)
540
Damien Millerad833b32000-08-23 10:46:23 +1000541dnl Checks for library functions.
Tim Rice13aae5e2001-10-21 17:53:58 -0700542AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa \
543 clock fchmod fchown freeaddrinfo futimes gai_strerror \
544 getaddrinfo getcwd getgrouplist getnameinfo getopt \
545 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
546 inet_ntop innetgr login_getcapbool md5_crypt memmove \
547 mkdtemp on_exit openpty readpassphrase realpath \
548 rresvport_af setdtablesize setegid setenv seteuid \
549 setlogin setproctitle setresgid setreuid setrlimit \
550 setsid setvbuf sigaction sigvec snprintf strerror \
551 strlcat strlcpy strmode strsep sysconf tcgetpgrp utimes \
552 vhangup vsnprintf waitpid __b64_ntop _getpty)
553
554dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700555AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700556 AC_CHECK_LIB(gen, dirname,[
557 AC_CACHE_CHECK([for broken dirname],
558 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700559 save_LIBS="$LIBS"
560 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700561 AC_TRY_RUN(
562 [
563#include <libgen.h>
564#include <string.h>
565
566int main(int argc, char **argv) {
567 char *s, buf[32];
568
569 strncpy(buf,"/etc", 32);
570 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700571 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700572 exit(1);
573 } else {
574 exit(0);
575 }
576}
577 ],
578 [ ac_cv_have_broken_dirname="no" ],
579 [ ac_cv_have_broken_dirname="yes" ]
580 )
Tim Rice17b93e52001-10-23 22:36:54 -0700581 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700582 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700583 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700584 LIBS="$LIBS -lgen"
585 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700586 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700587 fi
588 ])
589])
590
Damien Millerad833b32000-08-23 10:46:23 +1000591dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000592AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000593dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000594AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000595AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000596dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000597AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000598AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100599
Damien Miller5fc85652000-07-09 23:53:07 +1000600AC_CHECK_FUNC(getuserattr,
601 [AC_DEFINE(HAVE_GETUSERATTR)],
602 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
603)
604
Damien Miller04f80141999-11-19 15:32:34 +1100605AC_CHECK_FUNC(daemon,
606 [AC_DEFINE(HAVE_DAEMON)],
607 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
608)
609
Damien Miller9fb07e42000-03-05 16:22:59 +1100610AC_CHECK_FUNC(getpagesize,
611 [AC_DEFINE(HAVE_GETPAGESIZE)],
612 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
613)
614
Damien Millercb170cb2000-07-01 16:52:55 +1000615# Check for broken snprintf
616if test "x$ac_cv_func_snprintf" = "xyes" ; then
617 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
618 AC_TRY_RUN(
619 [
620#include <stdio.h>
621int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
622 ],
623 [AC_MSG_RESULT(yes)],
624 [
625 AC_MSG_RESULT(no)
626 AC_DEFINE(BROKEN_SNPRINTF)
627 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
628 ]
629 )
630fi
631
Damien Miller606f8802000-09-16 15:39:56 +1100632AC_FUNC_GETPGRP
633
Damien Millera64b57a2001-01-17 10:44:13 +1100634# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000635PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100636AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100637 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100638 [
Damien Millera64b57a2001-01-17 10:44:13 +1100639 if test "x$withval" != "xno" ; then
640 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
641 AC_MSG_ERROR([PAM headers not found])
642 fi
643
644 AC_CHECK_LIB(dl, dlopen, , )
645 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
646 AC_CHECK_FUNCS(pam_getenvlist)
647
648 disable_shadow=yes
649 PAM_MSG="yes"
650
651 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800652 if test $ac_cv_lib_dl_dlopen = yes; then
653 LIBPAM="-lpam -ldl"
654 else
655 LIBPAM="-lpam"
656 fi
657 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100658 fi
659 ]
660)
Damien Millera22ba012000-03-02 23:09:20 +1100661
Damien Millera64b57a2001-01-17 10:44:13 +1100662# Check for older PAM
663if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100664 # Check PAM strerror arguments (old PAM)
665 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
666 AC_TRY_COMPILE(
667 [
Damien Miller81171112000-04-23 11:14:01 +1000668#include <stdlib.h>
669#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100670 ],
671 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
672 [AC_MSG_RESULT(no)],
673 [
674 AC_DEFINE(HAVE_OLD_PAM)
675 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000676 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100677 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100678 )
Damien Millera22ba012000-03-02 23:09:20 +1100679fi
680
681# The big search for OpenSSL
682AC_ARG_WITH(ssl-dir,
683 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
684 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000685 if test "x$withval" != "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100686 tryssldir=$withval
687 fi
688 ]
689)
690
691saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100692saved_LDFLAGS="$LDFLAGS"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000693saved_CPPFLAGS="$CPPFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100694if test "x$prefix" != "xNONE" ; then
695 tryssldir="$tryssldir $prefix"
696fi
Damien Miller61e50f12000-05-08 20:49:37 +1000697AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera1b61e12000-09-16 17:02:16 +1100698 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
Damien Millerccdefb62001-02-19 12:56:39 +1100699 CPPFLAGS="$saved_CPPFLAGS"
700 LDFLAGS="$saved_LDFLAGS"
Damien Miller3b512e12000-05-17 23:29:18 +1000701 LIBS="$saved_LIBS -lcrypto"
Damien Millerccdefb62001-02-19 12:56:39 +1100702
703 # Skip directories if they don't exist
704 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
705 continue;
706 fi
707 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
708 # Try to use $ssldir/lib if it exists, otherwise
709 # $ssldir
710 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000711 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100712 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000713 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100714 fi
715 else
Damien Millerb68af622001-03-28 21:05:26 +1000716 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100717 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000718 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100719 fi
720 fi
721 # Try to use $ssldir/include if it exists, otherwise
722 # $ssldir
723 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000724 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100725 else
Damien Millerb68af622001-03-28 21:05:26 +1000726 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100727 fi
728 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000729
Damien Miller3b512e12000-05-17 23:29:18 +1000730 # Basic test to check for compatible version and correct linking
731 # *does not* test for RSA - that comes later.
732 AC_TRY_RUN(
733 [
Damien Millere59ce622000-05-01 20:54:17 +1000734#include <string.h>
735#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000736int main(void)
737{
Damien Miller3b512e12000-05-17 23:29:18 +1000738 char a[2048];
739 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000740 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000741 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000742}
Damien Miller3b512e12000-05-17 23:29:18 +1000743 ],
744 [
745 found_crypto=1
746 break;
747 ], []
748 )
Damien Miller61e50f12000-05-08 20:49:37 +1000749
750 if test ! -z "$found_crypto" ; then
751 break;
752 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100753 done
754
Damien Miller61e50f12000-05-08 20:49:37 +1000755 if test -z "$found_crypto" ; then
Damien Miller5dfe9762001-02-16 12:05:39 +1100756 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
Damien Millerb85dcad2000-03-11 11:37:00 +1100757 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000758 if test -z "$ssldir" ; then
759 ssldir="(system)"
760 fi
Damien Millera22ba012000-03-02 23:09:20 +1100761
Damien Miller61e50f12000-05-08 20:49:37 +1000762 ac_cv_openssldir=$ssldir
763])
764
Damien Milleredb82922000-06-20 13:25:52 +1000765if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000766 AC_DEFINE(HAVE_OPENSSL)
767 dnl Need to recover ssldir - test above runs in subshell
768 ssldir=$ac_cv_openssldir
Damien Millera64b57a2001-01-17 10:44:13 +1100769 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
Damien Millerccdefb62001-02-19 12:56:39 +1100770 # Try to use $ssldir/lib if it exists, otherwise
771 # $ssldir
772 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000773 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100774 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000775 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100776 fi
777 else
Damien Millerb68af622001-03-28 21:05:26 +1000778 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100779 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000780 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100781 fi
Damien Millera64b57a2001-01-17 10:44:13 +1100782 fi
Damien Millerccdefb62001-02-19 12:56:39 +1100783 # Try to use $ssldir/include if it exists, otherwise
784 # $ssldir
785 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000786 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100787 else
Damien Millerb68af622001-03-28 21:05:26 +1000788 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millera64b57a2001-01-17 10:44:13 +1100789 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100790 fi
Damien Millera22ba012000-03-02 23:09:20 +1100791fi
Damien Miller3b512e12000-05-17 23:29:18 +1000792LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000793
Damien Miller3b512e12000-05-17 23:29:18 +1000794# Now test RSA support
795saved_LIBS="$LIBS"
796AC_MSG_CHECKING([for RSA support])
797for WANTS_RSAREF in "" 1 ; do
798 if test -z "$WANTS_RSAREF" ; then
799 LIBS="$saved_LIBS"
800 else
801 LIBS="$saved_LIBS -lRSAglue -lrsaref"
802 fi
803 AC_TRY_RUN([
804#include <string.h>
805#include <openssl/rand.h>
806#include <openssl/rsa.h>
807#include <openssl/bn.h>
808#include <openssl/sha.h>
809int main(void)
810{
811 int num; RSA *key; static unsigned char p_in[] = "blahblah";
812 unsigned char c[256], p[256];
813 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
814 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
815 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
816 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
817}
818 ],
819 [
820 rsa_works=1
821 break;
822 ], [])
823done
Ben Lindstrom23fec142001-06-09 02:16:28 +0000824LIBS="$saved_LIBS"
Damien Miller3b512e12000-05-17 23:29:18 +1000825
826if test ! -z "$no_rsa" ; then
827 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000828 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000829else
830 if test -z "$rsa_works" ; then
831 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000832 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000833 else
834 if test -z "$WANTS_RSAREF" ; then
835 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000836 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000837 else
Damien Miller7b22d652000-06-18 14:07:04 +1000838 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000839 AC_MSG_RESULT(using RSAref)
Ben Lindstrom23fec142001-06-09 02:16:28 +0000840 LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
Damien Miller3b512e12000-05-17 23:29:18 +1000841 fi
842 fi
843fi
Damien Millera22ba012000-03-02 23:09:20 +1100844
Damien Millerec932372002-01-22 22:16:03 +1100845# Sanity check OpenSSL headers
846AC_MSG_CHECKING([whether OpenSSL's headers match the library])
847AC_TRY_RUN(
848 [
849#include <string.h>
850#include <openssl/opensslv.h>
851int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
852 ],
853 [
854 AC_MSG_RESULT(yes)
855 ],
856 [
857 AC_MSG_RESULT(no)
858 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
859 ]
860)
861
Damien Millera64b57a2001-01-17 10:44:13 +1100862# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
863# version in OpenSSL. Skip this for PAM
864if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100865 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100866fi
867
Damien Miller6c21c512002-01-22 21:57:53 +1100868
869### Configure cryptographic random number support
870
871# Check wheter OpenSSL seeds itself
872AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
873AC_TRY_RUN(
874 [
875#include <string.h>
876#include <openssl/rand.h>
877int main(void) { return(RAND_status() == 1 ? 0 : 1); }
878 ],
879 [
880 OPENSSL_SEEDS_ITSELF=yes
881 AC_MSG_RESULT(yes)
882 ],
883 [
884 AC_MSG_RESULT(no)
885 # Default to use of the rand helper if OpenSSL doesn't
886 # seed itself
887 USE_RAND_HELPER=yes
888 ]
889)
890
891
892# Do we want to force the use of the rand helper?
893AC_ARG_WITH(rand-helper,
894 [ --with-rand-helper Use subprocess to gather strong randomness ],
895 [
896 if test "x$withval" = "xno" ; then
897 # Force use of OpenSSL's internal RNG, even if
898 # the previous test showed it to be unseeded.
899 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
900 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
901 OPENSSL_SEEDS_ITSELF=yes
902 USE_RAND_HELPER=""
903 fi
904 else
905 USE_RAND_HELPER=yes
906 fi
907 ],
908)
909
910# Which randomness source do we use?
911if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
912 # OpenSSL only
913 AC_DEFINE(OPENSSL_PRNG_ONLY)
914 RAND_MSG="OpenSSL internal ONLY"
915 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800916elif test ! -z "$USE_RAND_HELPER" ; then
917 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100918 RAND_MSG="ssh-rand-helper"
919 INSTALL_SSH_RAND_HELPER="yes"
920fi
921AC_SUBST(INSTALL_SSH_RAND_HELPER)
922
923### Configuration of ssh-rand-helper
924
925# PRNGD TCP socket
926AC_ARG_WITH(prngd-port,
927 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
928 [
Damien Millere996d722002-01-23 11:20:59 +1100929 case "$withval" in
930 no)
931 withval=""
932 ;;
933 [[0-9]]*)
934 ;;
935 *)
936 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
937 ;;
938 esac
939 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100940 PRNGD_PORT="$withval"
941 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
942 fi
943 ]
944)
945
946# PRNGD Unix domain socket
947AC_ARG_WITH(prngd-socket,
948 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
949 [
Damien Millere996d722002-01-23 11:20:59 +1100950 case "$withval" in
951 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100952 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100953 ;;
954 no)
955 withval=""
956 ;;
957 /*)
958 ;;
959 *)
960 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
961 ;;
962 esac
963
964 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100965 if test ! -z "$PRNGD_PORT" ; then
966 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
967 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100968 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100969 AC_MSG_WARN(Entropy socket is not readable)
970 fi
971 PRNGD_SOCKET="$withval"
972 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
973 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800974 ],
975 [
976 # Check for existing socket only if we don't have a random device already
977 if test "$USE_RAND_HELPER" = yes ; then
978 AC_MSG_CHECKING(for PRNGD/EGD socket)
979 # Insert other locations here
980 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
981 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
982 PRNGD_SOCKET="$sock"
983 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
984 break;
985 fi
986 done
987 if test ! -z "$PRNGD_SOCKET" ; then
988 AC_MSG_RESULT($PRNGD_SOCKET)
989 else
990 AC_MSG_RESULT(not found)
991 fi
992 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100993 ]
994)
995
996# Change default command timeout for hashing entropy source
997entropy_timeout=200
998AC_ARG_WITH(entropy-timeout,
999 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1000 [
1001 if test "x$withval" != "xno" ; then
1002 entropy_timeout=$withval
1003 fi
1004 ]
1005)
1006
1007AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1008
1009# These programs are used by the command hashing source to gather entropy
1010OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1011OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1012OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1013OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1014OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1015OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1016OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1017OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1018OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1019OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1020OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1021OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1022OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1023OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1024OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1025OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1026
1027# Where does ssh-rand-helper get its randomness from?
1028INSTALL_SSH_PRNG_CMDS=""
1029if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1030 if test ! -z "$PRNGD_PORT" ; then
1031 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1032 elif test ! -z "$PRNGD_SOCKET" ; then
1033 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1034 else
1035 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1036 RAND_HELPER_CMDHASH=yes
1037 INSTALL_SSH_PRNG_CMDS="yes"
1038 fi
1039fi
1040AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1041
1042
Ben Lindstromb5628642000-10-18 00:02:25 +00001043# Cheap hack to ensure NEWS-OS libraries are arranged right.
1044if test ! -z "$SONY" ; then
1045 LIBS="$LIBS -liberty";
1046fi
1047
Damien Millera22ba012000-03-02 23:09:20 +11001048# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001049AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001050AC_CHECK_SIZEOF(short int, 2)
1051AC_CHECK_SIZEOF(int, 4)
1052AC_CHECK_SIZEOF(long int, 4)
1053AC_CHECK_SIZEOF(long long int, 8)
1054
Damien Millera22ba012000-03-02 23:09:20 +11001055# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001056AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1057 AC_TRY_COMPILE(
1058 [ #include <sys/types.h> ],
1059 [ u_int a; a = 1;],
1060 [ ac_cv_have_u_int="yes" ],
1061 [ ac_cv_have_u_int="no" ]
1062 )
1063])
1064if test "x$ac_cv_have_u_int" = "xyes" ; then
1065 AC_DEFINE(HAVE_U_INT)
1066 have_u_int=1
1067fi
1068
Damien Miller61e50f12000-05-08 20:49:37 +10001069AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1070 AC_TRY_COMPILE(
1071 [ #include <sys/types.h> ],
1072 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1073 [ ac_cv_have_intxx_t="yes" ],
1074 [ ac_cv_have_intxx_t="no" ]
1075 )
1076])
1077if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1078 AC_DEFINE(HAVE_INTXX_T)
1079 have_intxx_t=1
1080fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001081
1082if (test -z "$have_intxx_t" && \
1083 test "x$ac_cv_header_stdint_h" = "xyes")
1084then
1085 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1086 AC_TRY_COMPILE(
1087 [ #include <stdint.h> ],
1088 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1089 [
1090 AC_DEFINE(HAVE_INTXX_T)
1091 AC_MSG_RESULT(yes)
1092 ],
1093 [ AC_MSG_RESULT(no) ]
1094 )
1095fi
1096
Damien Miller578783e2000-09-23 14:12:24 +11001097AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1098 AC_TRY_COMPILE(
1099 [ #include <sys/types.h> ],
1100 [ int64_t a; a = 1;],
1101 [ ac_cv_have_int64_t="yes" ],
1102 [ ac_cv_have_int64_t="no" ]
1103 )
1104])
1105if test "x$ac_cv_have_int64_t" = "xyes" ; then
1106 AC_DEFINE(HAVE_INT64_T)
1107 have_int64_t=1
1108fi
1109
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001110if test -z "$have_int64_t" ; then
1111 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1112 AC_TRY_COMPILE(
1113 [ #include <sys/socket.h> ],
1114 [ int64_t a; a = 1],
1115 [
1116 AC_DEFINE(HAVE_INT64_T)
1117 AC_MSG_RESULT(yes)
1118 ],
1119 [ AC_MSG_RESULT(no) ]
1120 )
1121fi
1122
Tim Rice4cec93f2002-02-26 08:40:48 -08001123if test -z "$have_int64_t" ; then
1124 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1125 AC_TRY_COMPILE(
1126 [ #include <sys/bitypes.h> ],
1127 [ int64_t a; a = 1],
1128 [
1129 AC_DEFINE(HAVE_INT64_T)
1130 AC_MSG_RESULT(yes)
1131 ],
1132 [ AC_MSG_RESULT(no) ]
1133 )
1134fi
1135
Damien Miller61e50f12000-05-08 20:49:37 +10001136AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1137 AC_TRY_COMPILE(
1138 [ #include <sys/types.h> ],
1139 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1140 [ ac_cv_have_u_intxx_t="yes" ],
1141 [ ac_cv_have_u_intxx_t="no" ]
1142 )
1143])
1144if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1145 AC_DEFINE(HAVE_U_INTXX_T)
1146 have_u_intxx_t=1
1147fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001148
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001149if test -z "$have_u_intxx_t" ; then
1150 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1151 AC_TRY_COMPILE(
1152 [ #include <sys/socket.h> ],
1153 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1154 [
1155 AC_DEFINE(HAVE_U_INTXX_T)
1156 AC_MSG_RESULT(yes)
1157 ],
1158 [ AC_MSG_RESULT(no) ]
1159 )
1160fi
1161
Damien Miller578783e2000-09-23 14:12:24 +11001162AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1163 AC_TRY_COMPILE(
1164 [ #include <sys/types.h> ],
1165 [ u_int64_t a; a = 1;],
1166 [ ac_cv_have_u_int64_t="yes" ],
1167 [ ac_cv_have_u_int64_t="no" ]
1168 )
1169])
1170if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1171 AC_DEFINE(HAVE_U_INT64_T)
1172 have_u_int64_t=1
1173fi
1174
Tim Rice4cec93f2002-02-26 08:40:48 -08001175if test -z "$have_u_int64_t" ; then
1176 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1177 AC_TRY_COMPILE(
1178 [ #include <sys/bitypes.h> ],
1179 [ u_int64_t a; a = 1],
1180 [
1181 AC_DEFINE(HAVE_U_INT64_T)
1182 AC_MSG_RESULT(yes)
1183 ],
1184 [ AC_MSG_RESULT(no) ]
1185 )
1186fi
1187
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001188if test -z "$have_u_intxx_t" ; then
1189 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1190 AC_TRY_COMPILE(
1191 [
1192#include <sys/types.h>
1193 ],
1194 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1195 [ ac_cv_have_uintxx_t="yes" ],
1196 [ ac_cv_have_uintxx_t="no" ]
1197 )
1198 ])
1199 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1200 AC_DEFINE(HAVE_UINTXX_T)
1201 fi
1202fi
1203
1204if test -z "$have_uintxx_t" ; then
1205 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1206 AC_TRY_COMPILE(
1207 [ #include <stdint.h> ],
1208 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1209 [
1210 AC_DEFINE(HAVE_UINTXX_T)
1211 AC_MSG_RESULT(yes)
1212 ],
1213 [ AC_MSG_RESULT(no) ]
1214 )
1215fi
1216
Damien Milleredb82922000-06-20 13:25:52 +10001217if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1218 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001219then
1220 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1221 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001222 [
1223#include <sys/bitypes.h>
1224 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001225 [
Damien Miller70494d12000-04-03 15:57:06 +10001226 int8_t a; int16_t b; int32_t c;
1227 u_int8_t e; u_int16_t f; u_int32_t g;
1228 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001229 ],
1230 [
1231 AC_DEFINE(HAVE_U_INTXX_T)
1232 AC_DEFINE(HAVE_INTXX_T)
1233 AC_MSG_RESULT(yes)
1234 ],
1235 [AC_MSG_RESULT(no)]
1236 )
1237fi
1238
Damien Miller58be7382001-09-15 21:31:54 +10001239
1240AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1241 AC_TRY_COMPILE(
1242 [
1243#include <sys/types.h>
1244 ],
1245 [ u_char foo; foo = 125; ],
1246 [ ac_cv_have_u_char="yes" ],
1247 [ ac_cv_have_u_char="no" ]
1248 )
1249])
1250if test "x$ac_cv_have_u_char" = "xyes" ; then
1251 AC_DEFINE(HAVE_U_CHAR)
1252fi
1253
Tim Rice13aae5e2001-10-21 17:53:58 -07001254TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001255
Tim Rice200a5c02002-02-26 22:12:34 -08001256AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001257
Damien Miller61e50f12000-05-08 20:49:37 +10001258AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1259 AC_TRY_COMPILE(
1260 [
1261#include <sys/types.h>
1262 ],
1263 [ size_t foo; foo = 1235; ],
1264 [ ac_cv_have_size_t="yes" ],
1265 [ ac_cv_have_size_t="no" ]
1266 )
1267])
1268if test "x$ac_cv_have_size_t" = "xyes" ; then
1269 AC_DEFINE(HAVE_SIZE_T)
1270fi
Damien Miller95058511999-12-29 10:36:45 +11001271
Damien Miller615f9392000-05-17 22:53:33 +10001272AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1273 AC_TRY_COMPILE(
1274 [
1275#include <sys/types.h>
1276 ],
1277 [ ssize_t foo; foo = 1235; ],
1278 [ ac_cv_have_ssize_t="yes" ],
1279 [ ac_cv_have_ssize_t="no" ]
1280 )
1281])
1282if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1283 AC_DEFINE(HAVE_SSIZE_T)
1284fi
1285
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001286AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1287 AC_TRY_COMPILE(
1288 [
1289#include <time.h>
1290 ],
1291 [ clock_t foo; foo = 1235; ],
1292 [ ac_cv_have_clock_t="yes" ],
1293 [ ac_cv_have_clock_t="no" ]
1294 )
1295])
1296if test "x$ac_cv_have_clock_t" = "xyes" ; then
1297 AC_DEFINE(HAVE_CLOCK_T)
1298fi
1299
Damien Millerb54b40e2000-06-23 08:23:34 +10001300AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1301 AC_TRY_COMPILE(
1302 [
1303#include <sys/types.h>
1304#include <sys/socket.h>
1305 ],
1306 [ sa_family_t foo; foo = 1235; ],
1307 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001308 [ AC_TRY_COMPILE(
1309 [
1310#include <sys/types.h>
1311#include <sys/socket.h>
1312#include <netinet/in.h>
1313 ],
1314 [ sa_family_t foo; foo = 1235; ],
1315 [ ac_cv_have_sa_family_t="yes" ],
1316
Damien Millerb54b40e2000-06-23 08:23:34 +10001317 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001318 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001319 )
1320])
1321if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1322 AC_DEFINE(HAVE_SA_FAMILY_T)
1323fi
1324
Damien Miller0f91b4e2000-06-18 15:43:25 +10001325AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1326 AC_TRY_COMPILE(
1327 [
1328#include <sys/types.h>
1329 ],
1330 [ pid_t foo; foo = 1235; ],
1331 [ ac_cv_have_pid_t="yes" ],
1332 [ ac_cv_have_pid_t="no" ]
1333 )
1334])
1335if test "x$ac_cv_have_pid_t" = "xyes" ; then
1336 AC_DEFINE(HAVE_PID_T)
1337fi
1338
1339AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1340 AC_TRY_COMPILE(
1341 [
1342#include <sys/types.h>
1343 ],
1344 [ mode_t foo; foo = 1235; ],
1345 [ ac_cv_have_mode_t="yes" ],
1346 [ ac_cv_have_mode_t="no" ]
1347 )
1348])
1349if test "x$ac_cv_have_mode_t" = "xyes" ; then
1350 AC_DEFINE(HAVE_MODE_T)
1351fi
1352
Damien Miller61e50f12000-05-08 20:49:37 +10001353
1354AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1355 AC_TRY_COMPILE(
1356 [
Damien Miller81171112000-04-23 11:14:01 +10001357#include <sys/types.h>
1358#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001359 ],
1360 [ struct sockaddr_storage s; ],
1361 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1362 [ ac_cv_have_struct_sockaddr_storage="no" ]
1363 )
1364])
1365if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1366 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1367fi
Damien Miller34132e52000-01-14 15:45:46 +11001368
Damien Miller61e50f12000-05-08 20:49:37 +10001369AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1370 AC_TRY_COMPILE(
1371 [
Damien Miller7b22d652000-06-18 14:07:04 +10001372#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001373#include <netinet/in.h>
1374 ],
1375 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1376 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1377 [ ac_cv_have_struct_sockaddr_in6="no" ]
1378 )
1379])
1380if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1381 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1382fi
Damien Miller34132e52000-01-14 15:45:46 +11001383
Damien Miller61e50f12000-05-08 20:49:37 +10001384AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1385 AC_TRY_COMPILE(
1386 [
Damien Miller7b22d652000-06-18 14:07:04 +10001387#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001388#include <netinet/in.h>
1389 ],
1390 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1391 [ ac_cv_have_struct_in6_addr="yes" ],
1392 [ ac_cv_have_struct_in6_addr="no" ]
1393 )
1394])
1395if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1396 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1397fi
Damien Miller34132e52000-01-14 15:45:46 +11001398
Damien Miller61e50f12000-05-08 20:49:37 +10001399AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1400 AC_TRY_COMPILE(
1401 [
Damien Miller81171112000-04-23 11:14:01 +10001402#include <sys/types.h>
1403#include <sys/socket.h>
1404#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001405 ],
1406 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1407 [ ac_cv_have_struct_addrinfo="yes" ],
1408 [ ac_cv_have_struct_addrinfo="no" ]
1409 )
1410])
1411if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1412 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1413fi
1414
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001415AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1416 AC_TRY_COMPILE(
1417 [ #include <sys/time.h> ],
1418 [ struct timeval tv; tv.tv_sec = 1;],
1419 [ ac_cv_have_struct_timeval="yes" ],
1420 [ ac_cv_have_struct_timeval="no" ]
1421 )
1422])
1423if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1424 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1425 have_struct_timeval=1
1426fi
1427
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001428# If we don't have int64_t then we can't compile sftp-server. So don't
1429# even attempt to do it.
1430if test "x$ac_cv_have_int64_t" = "xno" -a \
1431 "x$ac_cv_sizeof_long_int" != "x8" -a \
1432 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1433 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001434else
1435dnl test snprintf (broken on SCO w/gcc)
1436 AC_TRY_RUN(
1437 [
1438#include <stdio.h>
1439#include <string.h>
1440#ifdef HAVE_SNPRINTF
1441main()
1442{
1443 char buf[50];
1444 char expected_out[50];
1445 int mazsize = 50 ;
1446#if (SIZEOF_LONG_INT == 8)
1447 long int num = 0x7fffffffffffffff;
1448#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001449 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001450#endif
1451 strcpy(expected_out, "9223372036854775807");
1452 snprintf(buf, mazsize, "%lld", num);
1453 if(strcmp(buf, expected_out) != 0)
1454 exit(1);
1455 exit(0);
1456}
1457#else
1458main() { exit(0); }
1459#endif
1460 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1461 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001462fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001463AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001464
Damien Miller78315eb2000-09-29 23:01:36 +11001465dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001466OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1467OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1468OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1469OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1470OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001471OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001472OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1473OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001474OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001475OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1476OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1477OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1478OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001479OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1480OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1481OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1482OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001483
1484AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001485
Damien Miller61e50f12000-05-08 20:49:37 +10001486AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1487 ac_cv_have_ss_family_in_struct_ss, [
1488 AC_TRY_COMPILE(
1489 [
Damien Miller81171112000-04-23 11:14:01 +10001490#include <sys/types.h>
1491#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001492 ],
1493 [ struct sockaddr_storage s; s.ss_family = 1; ],
1494 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1495 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1496 )
1497])
1498if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1499 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1500fi
1501
Damien Miller61e50f12000-05-08 20:49:37 +10001502AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1503 ac_cv_have___ss_family_in_struct_ss, [
1504 AC_TRY_COMPILE(
1505 [
Damien Miller81171112000-04-23 11:14:01 +10001506#include <sys/types.h>
1507#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001508 ],
1509 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1510 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1511 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1512 )
1513])
1514if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1515 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1516fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001517
Damien Millerad833b32000-08-23 10:46:23 +10001518AC_CACHE_CHECK([for pw_class field in struct passwd],
1519 ac_cv_have_pw_class_in_struct_passwd, [
1520 AC_TRY_COMPILE(
1521 [
Damien Millerad833b32000-08-23 10:46:23 +10001522#include <pwd.h>
1523 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001524 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001525 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1526 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1527 )
1528])
1529if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1530 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1531fi
1532
Kevin Steves82456952001-06-22 21:14:18 +00001533AC_CACHE_CHECK([for pw_expire field in struct passwd],
1534 ac_cv_have_pw_expire_in_struct_passwd, [
1535 AC_TRY_COMPILE(
1536 [
1537#include <pwd.h>
1538 ],
1539 [ struct passwd p; p.pw_expire = 0; ],
1540 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1541 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1542 )
1543])
1544if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1545 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1546fi
1547
1548AC_CACHE_CHECK([for pw_change field in struct passwd],
1549 ac_cv_have_pw_change_in_struct_passwd, [
1550 AC_TRY_COMPILE(
1551 [
1552#include <pwd.h>
1553 ],
1554 [ struct passwd p; p.pw_change = 0; ],
1555 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1556 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1557 )
1558])
1559if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1560 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1561fi
Damien Miller61e50f12000-05-08 20:49:37 +10001562
1563AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1564 AC_TRY_LINK([],
1565 [ extern char *__progname; printf("%s", __progname); ],
1566 [ ac_cv_libc_defines___progname="yes" ],
1567 [ ac_cv_libc_defines___progname="no" ]
1568 )
1569])
1570if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1571 AC_DEFINE(HAVE___PROGNAME)
1572fi
1573
Damien Miller4f8e6692001-07-14 13:22:53 +10001574AC_CACHE_CHECK([whether getopt has optreset support],
1575 ac_cv_have_getopt_optreset, [
1576 AC_TRY_LINK(
1577 [
1578#include <getopt.h>
1579 ],
1580 [ extern int optreset; optreset = 0; ],
1581 [ ac_cv_have_getopt_optreset="yes" ],
1582 [ ac_cv_have_getopt_optreset="no" ]
1583 )
1584])
1585if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1586 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1587fi
Damien Millera22ba012000-03-02 23:09:20 +11001588
Damien Millerecbb26d2000-07-15 14:59:14 +10001589AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1590 AC_TRY_LINK([],
1591 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1592 [ ac_cv_libc_defines_sys_errlist="yes" ],
1593 [ ac_cv_libc_defines_sys_errlist="no" ]
1594 )
1595])
1596if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1597 AC_DEFINE(HAVE_SYS_ERRLIST)
1598fi
1599
1600
Damien Miller11fa2cc2000-08-16 10:35:58 +10001601AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1602 AC_TRY_LINK([],
1603 [ extern int sys_nerr; printf("%i", sys_nerr);],
1604 [ ac_cv_libc_defines_sys_nerr="yes" ],
1605 [ ac_cv_libc_defines_sys_nerr="no" ]
1606 )
1607])
1608if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1609 AC_DEFINE(HAVE_SYS_NERR)
1610fi
1611
1612
Damien Millerc79bc0d2001-03-28 13:03:42 +10001613# Check whether user wants Kerberos support
Damien Miller85de5802001-09-18 14:01:11 +10001614SCARD_MSG="no"
1615AC_ARG_WITH(smartcard,
1616 [ --with-smartcard Enable smartcard support],
1617 [
1618 if test "x$withval" != "xno" ; then
1619 if test "x$withval" != "xyes" ; then
1620 CPPFLAGS="$CPPFLAGS -I${withval}"
1621 LDFLAGS="$LDFLAGS -L${withval}"
1622 if test ! -z "$need_dash_r" ; then
1623 LDFLAGS="$LDFLAGS -R${withval}"
1624 fi
1625 if test ! -z "$blibpath" ; then
1626 blibpath="$blibpath:${withval}"
1627 fi
1628 fi
1629 AC_CHECK_HEADERS(sectok.h)
1630 if test "$ac_cv_header_sectok_h" != yes; then
1631 AC_MSG_ERROR(Can't find sectok.h)
1632 fi
1633 AC_CHECK_LIB(sectok, sectok_open)
1634 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1635 AC_MSG_ERROR(Can't find libsectok)
1636 fi
1637 AC_DEFINE(SMARTCARD)
1638 SCARD_MSG="yes"
1639 fi
1640 ]
1641)
1642
1643# Check whether user wants Kerberos support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001644KRB4_MSG="no"
1645AC_ARG_WITH(kerberos4,
1646 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1647 [
1648 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001649 if test "x$withval" != "xyes" ; then
1650 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1651 LDFLAGS="$LDFLAGS -L${withval}/lib"
1652 if test ! -z "$need_dash_r" ; then
1653 LDFLAGS="$LDFLAGS -R${withval}/lib"
1654 fi
1655 if test ! -z "$blibpath" ; then
1656 blibpath="$blibpath:${withval}/lib"
1657 fi
1658 else
1659 if test -d /usr/include/kerberosIV ; then
1660 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1661 fi
1662 fi
1663
1664 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001665 if test "$ac_cv_header_krb_h" != yes; then
1666 AC_MSG_WARN([Cannot find krb.h, build may fail])
1667 fi
Damien Miller98344742001-03-28 14:37:06 +10001668 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001669 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001670 AC_CHECK_LIB(krb4, main)
1671 if test "$ac_cv_lib_krb4_main" != yes; then
1672 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1673 else
1674 KLIBS="-lkrb4"
1675 fi
1676 else
1677 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001678 fi
Damien Miller98344742001-03-28 14:37:06 +10001679 AC_CHECK_LIB(des, des_cbc_encrypt)
1680 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1681 AC_CHECK_LIB(des425, des_cbc_encrypt)
1682 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1683 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1684 else
1685 KLIBS="-ldes425"
1686 fi
1687 else
1688 KLIBS="-ldes"
1689 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001690 AC_CHECK_LIB(resolv, dn_expand, , )
1691 KRB4=yes
1692 KRB4_MSG="yes"
1693 AC_DEFINE(KRB4)
1694 fi
1695 ]
1696)
1697
1698# Check whether user wants AFS support
1699AFS_MSG="no"
1700AC_ARG_WITH(afs,
1701 [ --with-afs=PATH Enable AFS support],
1702 [
1703 if test "x$withval" != "xno" ; then
1704
1705 if test "x$withval" != "xyes" ; then
1706 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1707 LDFLAGS="$LDFLAGS -L${withval}/lib"
1708 fi
1709
1710 if test -z "$KRB4" ; then
1711 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1712 fi
1713
1714 LIBS="-lkafs $LIBS"
1715 if test ! -z "$AFS_LIBS" ; then
1716 LIBS="$LIBS $AFS_LIBS"
1717 fi
1718 AC_DEFINE(AFS)
1719 AFS_MSG="yes"
1720 fi
1721 ]
1722)
1723LIBS="$LIBS $KLIBS"
1724
Damien Millera22ba012000-03-02 23:09:20 +11001725# Looking for programs, paths and files
1726AC_ARG_WITH(rsh,
1727 [ --with-rsh=PATH Specify path to remote shell program ],
1728 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001729 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001730 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001731 fi
1732 ],
1733 [
1734 AC_PATH_PROG(rsh_path, rsh)
1735 ]
1736)
1737
1738AC_ARG_WITH(xauth,
1739 [ --with-xauth=PATH Specify path to xauth program ],
1740 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001741 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001742 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001743 fi
1744 ],
1745 [
Damien Miller78315eb2000-09-29 23:01:36 +11001746 AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin)
Damien Milleredb82922000-06-20 13:25:52 +10001747 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001748 xauth_path="/usr/openwin/bin/xauth"
1749 fi
1750 ]
1751)
1752
Damien Millera19cf472000-11-29 13:28:50 +11001753if test -z "$xauth_path" ; then
1754 XAUTH_PATH="undefined"
1755 AC_SUBST(XAUTH_PATH)
1756else
Damien Millera22ba012000-03-02 23:09:20 +11001757 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001758 XAUTH_PATH=$xauth_path
1759 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001760fi
1761if test ! -z "$rsh_path" ; then
1762 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1763fi
1764
1765# Check for mail directory (last resort if we cannot get it from headers)
1766if test ! -z "$MAIL" ; then
1767 maildir=`dirname $MAIL`
1768 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1769fi
1770
Damien Millera22ba012000-03-02 23:09:20 +11001771if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +11001772 AC_CHECK_FILE("/dev/ptmx",
1773 [
1774 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1775 have_dev_ptmx=1
1776 ]
1777 )
Damien Millera22ba012000-03-02 23:09:20 +11001778fi
Damien Miller204ad072000-03-02 23:56:12 +11001779AC_CHECK_FILE("/dev/ptc",
1780 [
1781 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1782 have_dev_ptc=1
1783 ]
1784)
1785
Damien Millera22ba012000-03-02 23:09:20 +11001786# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001787AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001788 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001789 [
Damien Miller897741e2001-04-16 10:41:46 +10001790 case "$withval" in
1791 man|cat|doc)
1792 MANTYPE=$withval
1793 ;;
1794 *)
1795 AC_MSG_ERROR(invalid man type: $withval)
1796 ;;
1797 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001798 ]
1799)
Ben Lindstrombc709922001-04-18 18:04:21 +00001800if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001801 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001802 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1803 MANTYPE=doc
1804 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1805 MANTYPE=man
1806 else
1807 MANTYPE=cat
1808 fi
1809fi
Damien Miller670a4b82000-01-22 13:53:11 +11001810AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001811if test "$MANTYPE" = "doc"; then
1812 mansubdir=man;
1813else
1814 mansubdir=$MANTYPE;
1815fi
1816AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001817
Damien Millera22ba012000-03-02 23:09:20 +11001818# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001819MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001820AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001821 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001822 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001823 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001824 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001825 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001826 fi
1827 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001828)
1829
Damien Millera22ba012000-03-02 23:09:20 +11001830# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001831AC_ARG_WITH(shadow,
1832 [ --without-shadow Disable shadow password support],
1833 [
1834 if test "x$withval" = "xno" ; then
1835 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001836 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001837 fi
1838 ]
1839)
1840
Damien Miller1f335fb2000-06-26 11:31:33 +10001841if test -z "$disable_shadow" ; then
1842 AC_MSG_CHECKING([if the systems has expire shadow information])
1843 AC_TRY_COMPILE(
1844 [
1845#include <sys/types.h>
1846#include <shadow.h>
1847 struct spwd sp;
1848 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1849 [ sp_expire_available=yes ], []
1850 )
1851
1852 if test "x$sp_expire_available" = "xyes" ; then
1853 AC_MSG_RESULT(yes)
1854 AC_DEFINE(HAS_SHADOW_EXPIRE)
1855 else
1856 AC_MSG_RESULT(no)
1857 fi
1858fi
1859
Damien Millera22ba012000-03-02 23:09:20 +11001860# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001861if test ! -z "$IPADDR_IN_DISPLAY" ; then
1862 DISPLAY_HACK_MSG="yes"
1863 AC_DEFINE(IPADDR_IN_DISPLAY)
1864else
1865 DISPLAY_HACK_MSG="no"
1866 AC_ARG_WITH(ipaddr-display,
1867 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1868 [
1869 if test "x$withval" != "xno" ; then
1870 AC_DEFINE(IPADDR_IN_DISPLAY)
1871 DISPLAY_HACK_MSG="yes"
1872 fi
1873 ]
1874 )
1875fi
Damien Miller76112de1999-12-21 11:18:08 +11001876
Damien Millera22ba012000-03-02 23:09:20 +11001877# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001878SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001879AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11001880 [ --with-default-path=PATH Specify default \$PATH environment for server],
1881 [
1882 if test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001883 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001884 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001885 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001886 ],
1887 [
1888 AC_TRY_RUN(
1889 [
1890/* find out what STDPATH is */
1891#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001892#ifdef HAVE_PATHS_H
1893# include <paths.h>
1894#endif
1895#ifndef _PATH_STDPATH
1896# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1897#endif
1898#include <sys/types.h>
1899#include <sys/stat.h>
1900#include <fcntl.h>
1901#define DATA "conftest.stdpath"
1902
1903main()
1904{
1905 FILE *fd;
1906 int rc;
1907
1908 fd = fopen(DATA,"w");
1909 if(fd == NULL)
1910 exit(1);
1911
1912 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1913 exit(1);
1914
1915 exit(0);
1916}
1917 ], [ user_path=`cat conftest.stdpath` ],
1918 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1919 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1920 )
1921# make sure $bindir is in USER_PATH so scp will work
1922 t_bindir=`eval echo ${bindir}`
1923 case $t_bindir in
1924 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1925 esac
1926 case $t_bindir in
1927 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1928 esac
1929 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1930 if test $? -ne 0 ; then
1931 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1932 if test $? -ne 0 ; then
1933 user_path=$user_path:$t_bindir
1934 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1935 fi
1936 fi
Damien Miller5a3e6831999-12-27 09:48:56 +11001937 ]
1938)
Tim Rice59ea0a02001-03-10 13:50:45 -08001939AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1940AC_SUBST(user_path)
Damien Miller5a3e6831999-12-27 09:48:56 +11001941
Damien Millera22ba012000-03-02 23:09:20 +11001942# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10001943IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11001944AC_ARG_WITH(ipv4-default,
1945 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1946 [
1947 if test "x$withval" != "xno" ; then
1948 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10001949 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11001950 fi
1951 ]
1952)
1953
Damien Miller61e50f12000-05-08 20:49:37 +10001954AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10001955IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11001956AC_ARG_WITH(4in6,
1957 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1958 [
1959 if test "x$withval" != "xno" ; then
1960 AC_MSG_RESULT(yes)
1961 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001962 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001963 else
1964 AC_MSG_RESULT(no)
1965 fi
1966 ],[
1967 if test "x$inet6_default_4in6" = "xyes"; then
1968 AC_MSG_RESULT([yes (default)])
1969 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001970 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001971 else
1972 AC_MSG_RESULT([no (default)])
1973 fi
1974 ]
1975)
1976
Damien Miller60396b02001-02-18 17:01:00 +11001977# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11001978BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11001979AC_ARG_WITH(bsd-auth,
1980 [ --with-bsd-auth Enable BSD auth support],
1981 [
1982 if test "x$withval" != "xno" ; then
1983 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11001984 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11001985 fi
1986 ]
1987)
1988
Damien Miller78315eb2000-09-29 23:01:36 +11001989AC_MSG_CHECKING(whether to install ssh as suid root)
1990AC_ARG_ENABLE(suid-ssh,
1991[ --enable-suid-ssh Install ssh as suid root (default)
1992 --disable-suid-ssh Install ssh without suid bit],
1993[ case "$enableval" in
1994 no)
1995 AC_MSG_RESULT(no)
1996 SSHMODE=0711
1997 ;;
1998 *) AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00001999 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11002000 ;;
2001 esac ],
2002 AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00002003 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11002004)
2005AC_SUBST(SSHMODE)
2006
2007
Damien Millera22ba012000-03-02 23:09:20 +11002008# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002009piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +11002010AC_ARG_WITH(pid-dir,
2011 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2012 [
2013 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +11002014 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +11002015 fi
2016 ]
2017)
Damien Miller4018c192000-04-30 09:30:44 +10002018
Damien Miller78315eb2000-09-29 23:01:36 +11002019# make sure the directory exists
2020if test ! -d $piddir ; then
2021 piddir=`eval echo ${sysconfdir}`
2022 case $piddir in
2023 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2024 esac
2025fi
2026
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002027AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002028AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002029
andre2ff7b5d2000-06-03 14:57:40 +00002030dnl allow user to disable some login recording features
2031AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002032 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002033 [ AC_DEFINE(DISABLE_LASTLOG) ]
2034)
2035AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002036 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002037 [ AC_DEFINE(DISABLE_UTMP) ]
2038)
2039AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002040 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002041 [ AC_DEFINE(DISABLE_UTMPX) ]
2042)
2043AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002044 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002045 [ AC_DEFINE(DISABLE_WTMP) ]
2046)
2047AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002048 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002049 [ AC_DEFINE(DISABLE_WTMPX) ]
2050)
2051AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002052 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002053 [ AC_DEFINE(DISABLE_LOGIN) ]
2054)
2055AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002056 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002057 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2058)
2059AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002060 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002061 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2062)
2063AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002064 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002065 [
2066 if test "x$withval" = "xno" ; then
2067 AC_DEFINE(DISABLE_LASTLOG)
2068 else
2069 conf_lastlog_location=$withval
2070 fi
2071 ]
2072)
andre2ff7b5d2000-06-03 14:57:40 +00002073
2074dnl lastlog, [uw]tmpx? detection
2075dnl NOTE: set the paths in the platform section to avoid the
2076dnl need for command-line parameters
2077dnl lastlog and [uw]tmp are subject to a file search if all else fails
2078
2079dnl lastlog detection
2080dnl NOTE: the code itself will detect if lastlog is a directory
2081AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2082AC_TRY_COMPILE([
2083#include <sys/types.h>
2084#include <utmp.h>
2085#ifdef HAVE_LASTLOG_H
2086# include <lastlog.h>
2087#endif
Damien Miller2994e082000-06-04 15:51:47 +10002088#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002089# include <paths.h>
2090#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002091#ifdef HAVE_LOGIN_H
2092# include <login.h>
2093#endif
andre2ff7b5d2000-06-03 14:57:40 +00002094 ],
2095 [ char *lastlog = LASTLOG_FILE; ],
2096 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002097 [
2098 AC_MSG_RESULT(no)
2099 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2100 AC_TRY_COMPILE([
2101#include <sys/types.h>
2102#include <utmp.h>
2103#ifdef HAVE_LASTLOG_H
2104# include <lastlog.h>
2105#endif
2106#ifdef HAVE_PATHS_H
2107# include <paths.h>
2108#endif
2109 ],
2110 [ char *lastlog = _PATH_LASTLOG; ],
2111 [ AC_MSG_RESULT(yes) ],
2112 [
andree441aa32000-06-12 22:34:38 +00002113 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002114 system_lastlog_path=no
2115 ])
2116 ]
andre2ff7b5d2000-06-03 14:57:40 +00002117)
Damien Miller2994e082000-06-04 15:51:47 +10002118
andre2ff7b5d2000-06-03 14:57:40 +00002119if test -z "$conf_lastlog_location"; then
2120 if test x"$system_lastlog_path" = x"no" ; then
2121 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002122 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002123 conf_lastlog_location=$f
2124 fi
2125 done
2126 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002127 AC_MSG_WARN([** Cannot find lastlog **])
2128 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002129 fi
2130 fi
2131fi
2132
2133if test -n "$conf_lastlog_location"; then
2134 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2135fi
2136
2137dnl utmp detection
2138AC_MSG_CHECKING([if your system defines UTMP_FILE])
2139AC_TRY_COMPILE([
2140#include <sys/types.h>
2141#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002142#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002143# include <paths.h>
2144#endif
2145 ],
2146 [ char *utmp = UTMP_FILE; ],
2147 [ AC_MSG_RESULT(yes) ],
2148 [ AC_MSG_RESULT(no)
2149 system_utmp_path=no ]
2150)
2151if test -z "$conf_utmp_location"; then
2152 if test x"$system_utmp_path" = x"no" ; then
2153 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2154 if test -f $f ; then
2155 conf_utmp_location=$f
2156 fi
2157 done
2158 if test -z "$conf_utmp_location"; then
2159 AC_DEFINE(DISABLE_UTMP)
2160 fi
2161 fi
2162fi
2163if test -n "$conf_utmp_location"; then
2164 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2165fi
2166
2167dnl wtmp detection
2168AC_MSG_CHECKING([if your system defines WTMP_FILE])
2169AC_TRY_COMPILE([
2170#include <sys/types.h>
2171#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002172#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002173# include <paths.h>
2174#endif
2175 ],
2176 [ char *wtmp = WTMP_FILE; ],
2177 [ AC_MSG_RESULT(yes) ],
2178 [ AC_MSG_RESULT(no)
2179 system_wtmp_path=no ]
2180)
2181if test -z "$conf_wtmp_location"; then
2182 if test x"$system_wtmp_path" = x"no" ; then
2183 for f in /usr/adm/wtmp /var/log/wtmp; do
2184 if test -f $f ; then
2185 conf_wtmp_location=$f
2186 fi
2187 done
2188 if test -z "$conf_wtmp_location"; then
2189 AC_DEFINE(DISABLE_WTMP)
2190 fi
2191 fi
2192fi
2193if test -n "$conf_wtmp_location"; then
2194 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2195fi
2196
2197
2198dnl utmpx detection - I don't know any system so perverse as to require
2199dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2200dnl there, though.
2201AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2202AC_TRY_COMPILE([
2203#include <sys/types.h>
2204#include <utmp.h>
2205#ifdef HAVE_UTMPX_H
2206#include <utmpx.h>
2207#endif
Damien Miller2994e082000-06-04 15:51:47 +10002208#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002209# include <paths.h>
2210#endif
2211 ],
2212 [ char *utmpx = UTMPX_FILE; ],
2213 [ AC_MSG_RESULT(yes) ],
2214 [ AC_MSG_RESULT(no)
2215 system_utmpx_path=no ]
2216)
2217if test -z "$conf_utmpx_location"; then
2218 if test x"$system_utmpx_path" = x"no" ; then
2219 AC_DEFINE(DISABLE_UTMPX)
2220 fi
2221else
2222 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2223fi
2224
2225dnl wtmpx detection
2226AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2227AC_TRY_COMPILE([
2228#include <sys/types.h>
2229#include <utmp.h>
2230#ifdef HAVE_UTMPX_H
2231#include <utmpx.h>
2232#endif
Damien Miller2994e082000-06-04 15:51:47 +10002233#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002234# include <paths.h>
2235#endif
2236 ],
2237 [ char *wtmpx = WTMPX_FILE; ],
2238 [ AC_MSG_RESULT(yes) ],
2239 [ AC_MSG_RESULT(no)
2240 system_wtmpx_path=no ]
2241)
2242if test -z "$conf_wtmpx_location"; then
2243 if test x"$system_wtmpx_path" = x"no" ; then
2244 AC_DEFINE(DISABLE_WTMPX)
2245 fi
2246else
2247 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2248fi
2249
Damien Miller4018c192000-04-30 09:30:44 +10002250
Damien Miller29ea30d2000-03-17 10:54:15 +11002251if test ! -z "$blibpath" ; then
2252 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2253 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2254fi
2255
Tim Rice4cec93f2002-02-26 08:40:48 -08002256dnl remove pam and dl because they are in $LIBPAM
2257if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002258 LIBS=`echo $LIBS | sed 's/-lpam //'`
2259fi
2260if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2261 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002262fi
2263
Damien Millerbac2d8a2000-09-05 16:13:06 +11002264AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002265AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2266AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002267
Damien Miller7b22d652000-06-18 14:07:04 +10002268# Print summary of options
2269
Damien Miller7b22d652000-06-18 14:07:04 +10002270# Someone please show me a better way :)
2271A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2272B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2273C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2274D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002275E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002276F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002277G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Tim Rice59ea0a02001-03-10 13:50:45 -08002278H=`eval echo ${user_path}` ; H=`eval echo ${H}`
Damien Miller7b22d652000-06-18 14:07:04 +10002279
2280echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002281echo "OpenSSH has been configured with the following options:"
Damien Miller7b22d652000-06-18 14:07:04 +10002282echo " User binaries: $B"
2283echo " System binaries: $C"
2284echo " Configuration files: $D"
2285echo " Askpass program: $E"
2286echo " Manual pages: $F"
2287echo " PID file: $G"
Tim Rice59ea0a02001-03-10 13:50:45 -08002288echo " sshd default user PATH: $H"
Damien Miller897741e2001-04-16 10:41:46 +10002289echo " Manpage format: $MANTYPE"
Damien Miller7b22d652000-06-18 14:07:04 +10002290echo " PAM support: ${PAM_MSG}"
2291echo " KerberosIV support: $KRB4_MSG"
Damien Miller85de5802001-09-18 14:01:11 +10002292echo " Smartcard support: $SCARD_MSG"
Damien Miller7b22d652000-06-18 14:07:04 +10002293echo " AFS support: $AFS_MSG"
2294echo " S/KEY support: $SKEY_MSG"
2295echo " TCP Wrappers support: $TCPW_MSG"
2296echo " MD5 password support: $MD5_MSG"
2297echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2298echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2299echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002300echo " BSD Auth support: $BSD_AUTH_MSG"
2301echo " Random number source: $RAND_MSG"
2302if test ! -z "$USE_RAND_HELPER" ; then
2303 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002304fi
2305
Damien Miller7b22d652000-06-18 14:07:04 +10002306echo ""
2307
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002308echo " Host: ${host}"
2309echo " Compiler: ${CC}"
2310echo " Compiler flags: ${CFLAGS}"
2311echo "Preprocessor flags: ${CPPFLAGS}"
2312echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002313echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002314
2315echo ""
2316
Damien Miller82cf0ce2000-12-20 13:34:48 +11002317if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002318 echo "PAM is enabled. You may need to install a PAM control file "
2319 echo "for sshd, otherwise password authentication may fail. "
2320 echo "Example PAM control files can be found in the contrib/ "
2321 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002322 echo ""
2323fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002324
2325if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002326 echo "sftp-server will be disabled. Your compiler does not "
2327 echo "support 64bit integers."
2328 echo ""
2329fi
2330
2331if test ! -z "$RAND_HELPER_CMDHASH" ; then
2332 echo "WARNING: you are using the builtin random number collection "
2333 echo "service. Please read WARNING.RNG and request that your OS "
2334 echo "vendor includes kernel-based random number collection in "
2335 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002336 echo ""
2337fi
Damien Miller60396b02001-02-18 17:01:00 +11002338