blob: caa747f64c0a21f4398e00458cdb01c004b656e1 [file] [log] [blame]
Ben Lindstrom924144e2002-04-05 20:23:35 +00001# $Id: configure.ac,v 1.32 2002/04/05 20:23:37 mouring 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 Miller75b1d102000-01-07 14:01:41 +110066 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110067*-*-cygwin*)
Tim Ricefe1d1002001-11-26 17:19:43 -080068 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110069 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +000070 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +110071 AC_DEFINE(DISABLE_SHADOW)
72 AC_DEFINE(IPV4_DEFAULT)
73 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +000074 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Damien Millerbac2d8a2000-09-05 16:13:06 +110075 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000076*-*-dgux*)
77 AC_DEFINE(IP_TOS_IS_BROKEN)
78 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +000079*-*-darwin*)
80 AC_DEFINE(BROKEN_GETADDRINFO)
81 ;;
Damien Miller76112de1999-12-21 11:18:08 +110082*-*-hpux10*)
83 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +100084 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +110085 fi
Kevin Steves315f8b72001-06-28 00:24:41 +000086 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +110087 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +100088 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110089 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110090 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000091 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves315f8b72001-06-28 00:24:41 +000092 LIBS="$LIBS -lxnet -lsec"
Damien Miller76112de1999-12-21 11:18:08 +110093 ;;
Damien Miller1bead332000-04-30 00:47:29 +100094*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +000095 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +110096 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +110097 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +110098 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110099 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100100 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000101 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000102 LIBS="$LIBS -lxnet -lsec"
Damien Miller1bead332000-04-30 00:47:29 +1000103 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100104*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000105 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000106 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100107 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000108 AC_DEFINE(BROKEN_INET_NTOA)
Damien Miller1808f382000-01-06 12:03:12 +1100109 ;;
110*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000111 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000112 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100113 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000114 AC_DEFINE(WITH_IRIX_ARRAY)
115 AC_DEFINE(WITH_IRIX_PROJECT)
116 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom784e2342002-03-08 03:50:57 +0000117 AC_DEFINE(WITH_IRIX_JOBS)
Damien Miller11fa2cc2000-08-16 10:35:58 +1000118 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100119 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100120*-*-linux*)
121 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100122 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100123 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000124 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100125 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100126 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000127mips-sony-bsd|mips-sony-newsos4)
128 AC_DEFINE(HAVE_NEWS4)
129 SONY=1
130 AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT),
Damien Miller5dfe9762001-02-16 12:05:39 +1100131 AC_MSG_ERROR([*** libiberty missing - please install first or check config.log ***])
Ben Lindstromb5628642000-10-18 00:02:25 +0000132 )
133 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100134*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100135 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100136 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100137*-*-freebsd*)
138 check_for_libcrypt_later=1
139 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000140*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000141 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100142 conf_utmp_location=/etc/utmp
143 conf_wtmp_location=/usr/adm/wtmp
144 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000145 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000146 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000147 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100148 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000149 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000150 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000151 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100152*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000153 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000154 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100155 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100156 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000157 AC_DEFINE(LOGIN_NEEDS_UTMPX)
158 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000159 AC_DEFINE(PAM_TTY_KLUDGE)
andre2ff7b5d2000-06-03 14:57:40 +0000160 # hardwire lastlog location (can't detect it on some versions)
161 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000162 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
163 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
164 if test "$sol2ver" -ge 8; then
165 AC_MSG_RESULT(yes)
166 AC_DEFINE(DISABLE_UTMP)
167 AC_DEFINE(DISABLE_WTMP)
168 else
169 AC_MSG_RESULT(no)
170 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100171 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000172*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000173 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000174 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100175 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000176 conf_utmp_location=/etc/utmp
177 conf_wtmp_location=/var/adm/wtmp
178 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000179 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000180 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000181*-ncr-sysv*)
182 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
183 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700184 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000185 AC_DEFINE(USE_PIPES)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000186 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000187*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000188 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700189 # /usr/ucblib MUST NOT be searched on ReliantUNIX
190 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100191 IPADDR_IN_DISPLAY=yes
192 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000193 AC_DEFINE(IP_TOS_IS_BROKEN)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700194 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
195 # Attention: always take care to bind libsocket and libnsl before libc,
196 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000197 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100198*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000199 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100200 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Ricea4f7ae12001-09-17 14:34:33 -0700201# enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100202 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100203 ;;
204*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000205 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100206 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Ricea4f7ae12001-09-17 14:34:33 -0700207# enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100208 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100209 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100210*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000211 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100212 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100213 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100214*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000215 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100216 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700217 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller78315eb2000-09-29 23:01:36 +1100218 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100219 RANLIB=true
220 no_dev_ptmx=1
221 AC_DEFINE(BROKEN_SYS_TERMIO_H)
222 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100223 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000224 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100225 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100226 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700227 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700228 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100229 ;;
230*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000231 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000232 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100233 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000234 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100235 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100236 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100237 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000238 AC_DEFINE(DISABLE_SHADOW)
Damien Miller217f5672001-02-16 12:12:41 +1100239 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700240 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000241 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000242*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700243 no_libsocket=1
244 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000245 AC_DEFINE(USE_PIPES)
Tim Ricee991e3c2001-08-07 15:29:07 -0700246 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
247 LIBS="$LIBS -lgen -lrsc"
248 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000249*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000250 AC_MSG_CHECKING(for Digital Unix SIA)
251 no_osfsia=""
252 AC_ARG_WITH(osfsia,
253 [ --with-osfsia Enable Digital Unix SIA],
254 [
255 if test "x$withval" = "xno" ; then
256 AC_MSG_RESULT(disabled)
257 no_osfsia=1
258 fi
259 ],
260 )
261 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000262 if test -f /etc/sia/matrix.conf; then
263 AC_MSG_RESULT(yes)
264 AC_DEFINE(HAVE_OSF_SIA)
265 AC_DEFINE(DISABLE_LOGIN)
266 LIBS="$LIBS -lsecurity -ldb -lm -laud"
267 else
268 AC_MSG_RESULT(no)
269 fi
270 fi
271 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000272
273*-*-nto-qnx)
274 AC_DEFINE(USE_PIPES)
275 AC_DEFINE(NO_X11_UNIX_SOCKETS)
276 AC_DEFINE(MISSING_NFDBITS)
277 AC_DEFINE(MISSING_HOWMANY)
278 AC_DEFINE(MISSING_FD_MASK)
279 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100280esac
281
Damien Millere37bfc12000-06-05 09:37:43 +1000282# Allow user to specify flags
283AC_ARG_WITH(cflags,
284 [ --with-cflags Specify additional flags to pass to compiler],
285 [
286 if test "x$withval" != "xno" ; then
287 CFLAGS="$CFLAGS $withval"
288 fi
289 ]
290)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000291AC_ARG_WITH(cppflags,
292 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
293 [
294 if test "x$withval" != "xno"; then
295 CPPFLAGS="$CPPFLAGS $withval"
296 fi
297 ]
298)
Damien Millere37bfc12000-06-05 09:37:43 +1000299AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000300 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000301 [
302 if test "x$withval" != "xno" ; then
303 LDFLAGS="$LDFLAGS $withval"
304 fi
305 ]
306)
307AC_ARG_WITH(libs,
308 [ --with-libs Specify additional libraries to link with],
309 [
310 if test "x$withval" != "xno" ; then
311 LIBS="$LIBS $withval"
312 fi
313 ]
314)
315
Tim Rice4cec93f2002-02-26 08:40:48 -0800316# Checks for header files.
317AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
318 getopt.h glob.h lastlog.h limits.h login.h \
319 login_cap.h maillock.h netdb.h netgroup.h \
320 netinet/in_systm.h paths.h poll.h pty.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000321 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800322 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
Ben Lindstrom924144e2002-04-05 20:23:35 +0000323 sys/poll.h sys/select.h sys/stat.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800324 sys/stropts.h sys/sysmacros.h sys/time.h \
Kevin Steves117b06d2002-03-30 17:55:21 +0000325 sys/un.h time.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800326 util.h utime.h utmp.h utmpx.h)
327
Damien Millera22ba012000-03-02 23:09:20 +1100328# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700329AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
330AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000331
Damien Millerdf288022001-02-18 13:07:07 +1100332dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700333if test "x$with_tcp_wrappers" != "xno" ; then
334 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
335 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
336 fi
337fi
Damien Millerdf288022001-02-18 13:07:07 +1100338
Tim Rice13aae5e2001-10-21 17:53:58 -0700339AC_CHECK_FUNC(getspnam, ,
340 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700341
Damien Miller150c8b52002-02-13 23:06:56 +1100342AC_ARG_WITH(rpath,
343 [ --without-rpath Disable auto-added -R linker paths],
344 [
345 if test "x$withval" = "xno" ; then
346 need_dash_r=""
347 fi
348 if test "x$withval" = "xyes" ; then
349 need_dash_r=1
350 fi
351 ]
352)
353
Tim Rice13aae5e2001-10-21 17:53:58 -0700354dnl zlib is required
355AC_ARG_WITH(zlib,
356 [ --with-zlib=PATH Use zlib in PATH],
357 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000358 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100359 AC_MSG_ERROR([*** zlib is required ***])
360 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700361 if test -d "$withval/lib"; then
362 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700363 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700364 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700365 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700366 fi
367 else
368 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700369 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700370 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700371 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700372 fi
373 fi
374 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700375 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700376 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700377 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700378 fi
379 ]
380)
381
Tim Rice17b93e52001-10-23 22:36:54 -0700382AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100383
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000384dnl UnixWare 2.x
385AC_CHECK_FUNC(strcasecmp,
386 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
387)
388AC_CHECK_FUNC(utimes,
389 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
390)
Damien Millerab18c411999-11-11 10:40:23 +1100391
Tim Ricee589a292001-11-03 11:09:32 -0800392dnl Checks for libutil functions
393AC_CHECK_HEADERS(libutil.h)
394AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
395AC_CHECK_FUNCS(logout updwtmp logwtmp)
396
Ben Lindstrom8697e082001-02-24 21:41:10 +0000397AC_FUNC_STRFTIME
398
Damien Miller3c027682001-03-14 11:39:45 +1100399# Check for ALTDIRFUNC glob() extension
400AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
401AC_EGREP_CPP(FOUNDIT,
402 [
403 #include <glob.h>
404 #ifdef GLOB_ALTDIRFUNC
405 FOUNDIT
406 #endif
407 ],
408 [
409 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
410 AC_MSG_RESULT(yes)
411 ],
412 [
413 AC_MSG_RESULT(no)
414 ]
415)
Damien Millerab18c411999-11-11 10:40:23 +1100416
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000417# Check for g.gl_matchc glob() extension
418AC_MSG_CHECKING(for gl_matchc field in glob_t)
419AC_EGREP_CPP(FOUNDIT,
420 [
421 #include <glob.h>
422 int main(void){glob_t g; g.gl_matchc = 1;}
423 ],
424 [
425 AC_DEFINE(GLOB_HAS_GL_MATCHC)
426 AC_MSG_RESULT(yes)
427 ],
428 [
429 AC_MSG_RESULT(no)
430 ]
431)
432
Damien Miller18bb4732001-03-28 14:35:30 +1000433AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
434AC_TRY_RUN(
435 [
436#include <sys/types.h>
437#include <dirent.h>
438int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
439 ],
440 [AC_MSG_RESULT(yes)],
441 [
442 AC_MSG_RESULT(no)
443 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
444 ]
445)
446
Damien Millerc547bf12001-02-16 10:18:12 +1100447# Check whether user wants S/Key support
448SKEY_MSG="no"
449AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700450 [ --with-skey[[=PATH]] Enable S/Key support
451 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100452 [
453 if test "x$withval" != "xno" ; then
454
455 if test "x$withval" != "xyes" ; then
456 CPPFLAGS="$CPPFLAGS -I${withval}/include"
457 LDFLAGS="$LDFLAGS -L${withval}/lib"
458 fi
459
460 AC_DEFINE(SKEY)
461 LIBS="-lskey $LIBS"
462 SKEY_MSG="yes"
463
Tim Rice4cec93f2002-02-26 08:40:48 -0800464 AC_MSG_CHECKING([for s/key support])
465 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100466 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800467#include <stdio.h>
468#include <skey.h>
469int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
470 ],
471 [AC_MSG_RESULT(yes)],
472 [
473 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100474 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
475 ])
476 fi
477 ]
478)
479
480# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700481TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100482AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700483 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
484 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100485 [
486 if test "x$withval" != "xno" ; then
487 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700488 saved_LDFLAGS="$LDFLAGS"
489 saved_CPPFLAGS="$CPPFLAGS"
490 if test -n "${withval}" -a "${withval}" != "yes"; then
491 if test -d "${withval}/lib"; then
492 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700493 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700494 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700495 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700496 fi
497 else
498 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700499 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700500 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700501 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700502 fi
503 fi
504 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700505 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700506 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700507 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700508 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700509 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800510 LIBWRAP="-lwrap"
511 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100512 AC_MSG_CHECKING(for libwrap)
513 AC_TRY_LINK(
514 [
515#include <tcpd.h>
516 int deny_severity = 0, allow_severity = 0;
517 ],
518 [hosts_access(0);],
519 [
520 AC_MSG_RESULT(yes)
521 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800522 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700523 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100524 ],
525 [
526 AC_MSG_ERROR([*** libwrap missing])
527 ]
528 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800529 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100530 fi
531 ]
532)
533
Damien Millerad833b32000-08-23 10:46:23 +1000534dnl Checks for library functions.
Tim Rice13aae5e2001-10-21 17:53:58 -0700535AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa \
536 clock fchmod fchown freeaddrinfo futimes gai_strerror \
537 getaddrinfo getcwd getgrouplist getnameinfo getopt \
538 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
539 inet_ntop innetgr login_getcapbool md5_crypt memmove \
540 mkdtemp on_exit openpty readpassphrase realpath \
541 rresvport_af setdtablesize setegid setenv seteuid \
542 setlogin setproctitle setresgid setreuid setrlimit \
543 setsid setvbuf sigaction sigvec snprintf strerror \
544 strlcat strlcpy strmode strsep sysconf tcgetpgrp utimes \
545 vhangup vsnprintf waitpid __b64_ntop _getpty)
546
547dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700548AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700549 AC_CHECK_LIB(gen, dirname,[
550 AC_CACHE_CHECK([for broken dirname],
551 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700552 save_LIBS="$LIBS"
553 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700554 AC_TRY_RUN(
555 [
556#include <libgen.h>
557#include <string.h>
558
559int main(int argc, char **argv) {
560 char *s, buf[32];
561
562 strncpy(buf,"/etc", 32);
563 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700564 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700565 exit(1);
566 } else {
567 exit(0);
568 }
569}
570 ],
571 [ ac_cv_have_broken_dirname="no" ],
572 [ ac_cv_have_broken_dirname="yes" ]
573 )
Tim Rice17b93e52001-10-23 22:36:54 -0700574 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700575 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700576 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700577 LIBS="$LIBS -lgen"
578 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700579 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700580 fi
581 ])
582])
583
Damien Millerad833b32000-08-23 10:46:23 +1000584dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000585AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000586dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000587AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000588AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000589dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000590AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000591AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100592
Damien Miller5fc85652000-07-09 23:53:07 +1000593AC_CHECK_FUNC(getuserattr,
594 [AC_DEFINE(HAVE_GETUSERATTR)],
595 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
596)
597
Damien Miller04f80141999-11-19 15:32:34 +1100598AC_CHECK_FUNC(daemon,
599 [AC_DEFINE(HAVE_DAEMON)],
600 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
601)
602
Damien Miller9fb07e42000-03-05 16:22:59 +1100603AC_CHECK_FUNC(getpagesize,
604 [AC_DEFINE(HAVE_GETPAGESIZE)],
605 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
606)
607
Damien Millercb170cb2000-07-01 16:52:55 +1000608# Check for broken snprintf
609if test "x$ac_cv_func_snprintf" = "xyes" ; then
610 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
611 AC_TRY_RUN(
612 [
613#include <stdio.h>
614int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
615 ],
616 [AC_MSG_RESULT(yes)],
617 [
618 AC_MSG_RESULT(no)
619 AC_DEFINE(BROKEN_SNPRINTF)
620 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
621 ]
622 )
623fi
624
Damien Miller606f8802000-09-16 15:39:56 +1100625AC_FUNC_GETPGRP
626
Damien Millera64b57a2001-01-17 10:44:13 +1100627# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000628PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100629AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100630 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100631 [
Damien Millera64b57a2001-01-17 10:44:13 +1100632 if test "x$withval" != "xno" ; then
633 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
634 AC_MSG_ERROR([PAM headers not found])
635 fi
636
637 AC_CHECK_LIB(dl, dlopen, , )
638 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
639 AC_CHECK_FUNCS(pam_getenvlist)
640
641 disable_shadow=yes
642 PAM_MSG="yes"
643
644 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800645 if test $ac_cv_lib_dl_dlopen = yes; then
646 LIBPAM="-lpam -ldl"
647 else
648 LIBPAM="-lpam"
649 fi
650 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100651 fi
652 ]
653)
Damien Millera22ba012000-03-02 23:09:20 +1100654
Damien Millera64b57a2001-01-17 10:44:13 +1100655# Check for older PAM
656if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100657 # Check PAM strerror arguments (old PAM)
658 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
659 AC_TRY_COMPILE(
660 [
Damien Miller81171112000-04-23 11:14:01 +1000661#include <stdlib.h>
662#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100663 ],
664 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
665 [AC_MSG_RESULT(no)],
666 [
667 AC_DEFINE(HAVE_OLD_PAM)
668 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000669 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100670 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100671 )
Damien Millera22ba012000-03-02 23:09:20 +1100672fi
673
674# The big search for OpenSSL
675AC_ARG_WITH(ssl-dir,
676 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
677 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000678 if test "x$withval" != "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100679 tryssldir=$withval
680 fi
681 ]
682)
683
684saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100685saved_LDFLAGS="$LDFLAGS"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000686saved_CPPFLAGS="$CPPFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100687if test "x$prefix" != "xNONE" ; then
688 tryssldir="$tryssldir $prefix"
689fi
Damien Miller61e50f12000-05-08 20:49:37 +1000690AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera1b61e12000-09-16 17:02:16 +1100691 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 +1100692 CPPFLAGS="$saved_CPPFLAGS"
693 LDFLAGS="$saved_LDFLAGS"
Damien Miller3b512e12000-05-17 23:29:18 +1000694 LIBS="$saved_LIBS -lcrypto"
Damien Millerccdefb62001-02-19 12:56:39 +1100695
696 # Skip directories if they don't exist
697 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
698 continue;
699 fi
700 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
701 # Try to use $ssldir/lib if it exists, otherwise
702 # $ssldir
703 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000704 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100705 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000706 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100707 fi
708 else
Damien Millerb68af622001-03-28 21:05:26 +1000709 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100710 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000711 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100712 fi
713 fi
714 # Try to use $ssldir/include if it exists, otherwise
715 # $ssldir
716 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000717 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100718 else
Damien Millerb68af622001-03-28 21:05:26 +1000719 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100720 fi
721 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000722
Damien Miller3b512e12000-05-17 23:29:18 +1000723 # Basic test to check for compatible version and correct linking
724 # *does not* test for RSA - that comes later.
725 AC_TRY_RUN(
726 [
Damien Millere59ce622000-05-01 20:54:17 +1000727#include <string.h>
728#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000729int main(void)
730{
Damien Miller3b512e12000-05-17 23:29:18 +1000731 char a[2048];
732 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000733 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000734 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000735}
Damien Miller3b512e12000-05-17 23:29:18 +1000736 ],
737 [
738 found_crypto=1
739 break;
740 ], []
741 )
Damien Miller61e50f12000-05-08 20:49:37 +1000742
743 if test ! -z "$found_crypto" ; then
744 break;
745 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100746 done
747
Damien Miller61e50f12000-05-08 20:49:37 +1000748 if test -z "$found_crypto" ; then
Damien Miller5dfe9762001-02-16 12:05:39 +1100749 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
Damien Millerb85dcad2000-03-11 11:37:00 +1100750 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000751 if test -z "$ssldir" ; then
752 ssldir="(system)"
753 fi
Damien Millera22ba012000-03-02 23:09:20 +1100754
Damien Miller61e50f12000-05-08 20:49:37 +1000755 ac_cv_openssldir=$ssldir
756])
757
Damien Milleredb82922000-06-20 13:25:52 +1000758if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000759 AC_DEFINE(HAVE_OPENSSL)
760 dnl Need to recover ssldir - test above runs in subshell
761 ssldir=$ac_cv_openssldir
Damien Millera64b57a2001-01-17 10:44:13 +1100762 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
Damien Millerccdefb62001-02-19 12:56:39 +1100763 # Try to use $ssldir/lib if it exists, otherwise
764 # $ssldir
765 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000766 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100767 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000768 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100769 fi
770 else
Damien Millerb68af622001-03-28 21:05:26 +1000771 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100772 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000773 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100774 fi
Damien Millera64b57a2001-01-17 10:44:13 +1100775 fi
Damien Millerccdefb62001-02-19 12:56:39 +1100776 # Try to use $ssldir/include if it exists, otherwise
777 # $ssldir
778 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000779 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100780 else
Damien Millerb68af622001-03-28 21:05:26 +1000781 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millera64b57a2001-01-17 10:44:13 +1100782 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100783 fi
Damien Millera22ba012000-03-02 23:09:20 +1100784fi
Damien Miller3b512e12000-05-17 23:29:18 +1000785LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000786
Damien Miller3b512e12000-05-17 23:29:18 +1000787# Now test RSA support
788saved_LIBS="$LIBS"
789AC_MSG_CHECKING([for RSA support])
790for WANTS_RSAREF in "" 1 ; do
791 if test -z "$WANTS_RSAREF" ; then
792 LIBS="$saved_LIBS"
793 else
794 LIBS="$saved_LIBS -lRSAglue -lrsaref"
795 fi
796 AC_TRY_RUN([
797#include <string.h>
798#include <openssl/rand.h>
799#include <openssl/rsa.h>
800#include <openssl/bn.h>
801#include <openssl/sha.h>
802int main(void)
803{
804 int num; RSA *key; static unsigned char p_in[] = "blahblah";
805 unsigned char c[256], p[256];
806 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
807 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
808 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
809 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
810}
811 ],
812 [
813 rsa_works=1
814 break;
815 ], [])
816done
Ben Lindstrom23fec142001-06-09 02:16:28 +0000817LIBS="$saved_LIBS"
Damien Miller3b512e12000-05-17 23:29:18 +1000818
819if test ! -z "$no_rsa" ; then
820 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000821 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000822else
823 if test -z "$rsa_works" ; then
824 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000825 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000826 else
827 if test -z "$WANTS_RSAREF" ; then
828 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000829 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000830 else
Damien Miller7b22d652000-06-18 14:07:04 +1000831 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000832 AC_MSG_RESULT(using RSAref)
Ben Lindstrom23fec142001-06-09 02:16:28 +0000833 LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
Damien Miller3b512e12000-05-17 23:29:18 +1000834 fi
835 fi
836fi
Damien Millera22ba012000-03-02 23:09:20 +1100837
Damien Millerec932372002-01-22 22:16:03 +1100838# Sanity check OpenSSL headers
839AC_MSG_CHECKING([whether OpenSSL's headers match the library])
840AC_TRY_RUN(
841 [
842#include <string.h>
843#include <openssl/opensslv.h>
844int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
845 ],
846 [
847 AC_MSG_RESULT(yes)
848 ],
849 [
850 AC_MSG_RESULT(no)
851 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
852 ]
853)
854
Damien Millera64b57a2001-01-17 10:44:13 +1100855# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
856# version in OpenSSL. Skip this for PAM
857if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100858 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100859fi
860
Damien Miller6c21c512002-01-22 21:57:53 +1100861
862### Configure cryptographic random number support
863
864# Check wheter OpenSSL seeds itself
865AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
866AC_TRY_RUN(
867 [
868#include <string.h>
869#include <openssl/rand.h>
870int main(void) { return(RAND_status() == 1 ? 0 : 1); }
871 ],
872 [
873 OPENSSL_SEEDS_ITSELF=yes
874 AC_MSG_RESULT(yes)
875 ],
876 [
877 AC_MSG_RESULT(no)
878 # Default to use of the rand helper if OpenSSL doesn't
879 # seed itself
880 USE_RAND_HELPER=yes
881 ]
882)
883
884
885# Do we want to force the use of the rand helper?
886AC_ARG_WITH(rand-helper,
887 [ --with-rand-helper Use subprocess to gather strong randomness ],
888 [
889 if test "x$withval" = "xno" ; then
890 # Force use of OpenSSL's internal RNG, even if
891 # the previous test showed it to be unseeded.
892 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
893 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
894 OPENSSL_SEEDS_ITSELF=yes
895 USE_RAND_HELPER=""
896 fi
897 else
898 USE_RAND_HELPER=yes
899 fi
900 ],
901)
902
903# Which randomness source do we use?
904if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
905 # OpenSSL only
906 AC_DEFINE(OPENSSL_PRNG_ONLY)
907 RAND_MSG="OpenSSL internal ONLY"
908 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800909elif test ! -z "$USE_RAND_HELPER" ; then
910 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100911 RAND_MSG="ssh-rand-helper"
912 INSTALL_SSH_RAND_HELPER="yes"
913fi
914AC_SUBST(INSTALL_SSH_RAND_HELPER)
915
916### Configuration of ssh-rand-helper
917
918# PRNGD TCP socket
919AC_ARG_WITH(prngd-port,
920 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
921 [
Damien Millere996d722002-01-23 11:20:59 +1100922 case "$withval" in
923 no)
924 withval=""
925 ;;
926 [[0-9]]*)
927 ;;
928 *)
929 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
930 ;;
931 esac
932 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100933 PRNGD_PORT="$withval"
934 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
935 fi
936 ]
937)
938
939# PRNGD Unix domain socket
940AC_ARG_WITH(prngd-socket,
941 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
942 [
Damien Millere996d722002-01-23 11:20:59 +1100943 case "$withval" in
944 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100945 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100946 ;;
947 no)
948 withval=""
949 ;;
950 /*)
951 ;;
952 *)
953 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
954 ;;
955 esac
956
957 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100958 if test ! -z "$PRNGD_PORT" ; then
959 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
960 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100961 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100962 AC_MSG_WARN(Entropy socket is not readable)
963 fi
964 PRNGD_SOCKET="$withval"
965 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
966 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800967 ],
968 [
969 # Check for existing socket only if we don't have a random device already
970 if test "$USE_RAND_HELPER" = yes ; then
971 AC_MSG_CHECKING(for PRNGD/EGD socket)
972 # Insert other locations here
973 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
974 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
975 PRNGD_SOCKET="$sock"
976 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
977 break;
978 fi
979 done
980 if test ! -z "$PRNGD_SOCKET" ; then
981 AC_MSG_RESULT($PRNGD_SOCKET)
982 else
983 AC_MSG_RESULT(not found)
984 fi
985 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100986 ]
987)
988
989# Change default command timeout for hashing entropy source
990entropy_timeout=200
991AC_ARG_WITH(entropy-timeout,
992 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
993 [
994 if test "x$withval" != "xno" ; then
995 entropy_timeout=$withval
996 fi
997 ]
998)
999
1000AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1001
Tim Rice88f2ab52002-03-17 12:17:34 -08001002# We do this little dance with the search path to insure
1003# that programs that we select for use by installed programs
1004# (which may be run by the super-user) come from trusted
1005# locations before they come from the user's private area.
1006# This should help avoid accidentally configuring some
1007# random version of a program in someone's personal bin.
1008
1009OPATH=$PATH
1010PATH=/bin:/usr/bin
Tim Rice49e457c2002-03-31 11:23:06 -08001011/bin/test -L /bin && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001012test -d /sbin && PATH=$PATH:/sbin
1013test -d /usr/sbin && PATH=$PATH:/usr/sbin
1014PATH=$PATH:/etc:$OPATH
1015
Damien Miller6c21c512002-01-22 21:57:53 +11001016# These programs are used by the command hashing source to gather entropy
1017OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1018OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1019OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1020OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1021OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1022OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1023OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1024OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1025OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1026OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1027OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1028OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1029OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1030OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1031OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1032OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001033# restore PATH
1034PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001035
1036# Where does ssh-rand-helper get its randomness from?
1037INSTALL_SSH_PRNG_CMDS=""
1038if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1039 if test ! -z "$PRNGD_PORT" ; then
1040 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1041 elif test ! -z "$PRNGD_SOCKET" ; then
1042 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1043 else
1044 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1045 RAND_HELPER_CMDHASH=yes
1046 INSTALL_SSH_PRNG_CMDS="yes"
1047 fi
1048fi
1049AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1050
1051
Ben Lindstromb5628642000-10-18 00:02:25 +00001052# Cheap hack to ensure NEWS-OS libraries are arranged right.
1053if test ! -z "$SONY" ; then
1054 LIBS="$LIBS -liberty";
1055fi
1056
Damien Millera22ba012000-03-02 23:09:20 +11001057# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001058AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001059AC_CHECK_SIZEOF(short int, 2)
1060AC_CHECK_SIZEOF(int, 4)
1061AC_CHECK_SIZEOF(long int, 4)
1062AC_CHECK_SIZEOF(long long int, 8)
1063
Damien Millera22ba012000-03-02 23:09:20 +11001064# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001065AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1066 AC_TRY_COMPILE(
1067 [ #include <sys/types.h> ],
1068 [ u_int a; a = 1;],
1069 [ ac_cv_have_u_int="yes" ],
1070 [ ac_cv_have_u_int="no" ]
1071 )
1072])
1073if test "x$ac_cv_have_u_int" = "xyes" ; then
1074 AC_DEFINE(HAVE_U_INT)
1075 have_u_int=1
1076fi
1077
Damien Miller61e50f12000-05-08 20:49:37 +10001078AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1079 AC_TRY_COMPILE(
1080 [ #include <sys/types.h> ],
1081 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1082 [ ac_cv_have_intxx_t="yes" ],
1083 [ ac_cv_have_intxx_t="no" ]
1084 )
1085])
1086if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1087 AC_DEFINE(HAVE_INTXX_T)
1088 have_intxx_t=1
1089fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001090
1091if (test -z "$have_intxx_t" && \
1092 test "x$ac_cv_header_stdint_h" = "xyes")
1093then
1094 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1095 AC_TRY_COMPILE(
1096 [ #include <stdint.h> ],
1097 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1098 [
1099 AC_DEFINE(HAVE_INTXX_T)
1100 AC_MSG_RESULT(yes)
1101 ],
1102 [ AC_MSG_RESULT(no) ]
1103 )
1104fi
1105
Damien Miller578783e2000-09-23 14:12:24 +11001106AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1107 AC_TRY_COMPILE(
1108 [ #include <sys/types.h> ],
1109 [ int64_t a; a = 1;],
1110 [ ac_cv_have_int64_t="yes" ],
1111 [ ac_cv_have_int64_t="no" ]
1112 )
1113])
1114if test "x$ac_cv_have_int64_t" = "xyes" ; then
1115 AC_DEFINE(HAVE_INT64_T)
1116 have_int64_t=1
1117fi
1118
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001119if test -z "$have_int64_t" ; then
1120 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1121 AC_TRY_COMPILE(
1122 [ #include <sys/socket.h> ],
1123 [ int64_t a; a = 1],
1124 [
1125 AC_DEFINE(HAVE_INT64_T)
1126 AC_MSG_RESULT(yes)
1127 ],
1128 [ AC_MSG_RESULT(no) ]
1129 )
1130fi
1131
Tim Rice4cec93f2002-02-26 08:40:48 -08001132if test -z "$have_int64_t" ; then
1133 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1134 AC_TRY_COMPILE(
1135 [ #include <sys/bitypes.h> ],
1136 [ int64_t a; a = 1],
1137 [
1138 AC_DEFINE(HAVE_INT64_T)
1139 AC_MSG_RESULT(yes)
1140 ],
1141 [ AC_MSG_RESULT(no) ]
1142 )
1143fi
1144
Damien Miller61e50f12000-05-08 20:49:37 +10001145AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1146 AC_TRY_COMPILE(
1147 [ #include <sys/types.h> ],
1148 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1149 [ ac_cv_have_u_intxx_t="yes" ],
1150 [ ac_cv_have_u_intxx_t="no" ]
1151 )
1152])
1153if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1154 AC_DEFINE(HAVE_U_INTXX_T)
1155 have_u_intxx_t=1
1156fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001157
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001158if test -z "$have_u_intxx_t" ; then
1159 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1160 AC_TRY_COMPILE(
1161 [ #include <sys/socket.h> ],
1162 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1163 [
1164 AC_DEFINE(HAVE_U_INTXX_T)
1165 AC_MSG_RESULT(yes)
1166 ],
1167 [ AC_MSG_RESULT(no) ]
1168 )
1169fi
1170
Damien Miller578783e2000-09-23 14:12:24 +11001171AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1172 AC_TRY_COMPILE(
1173 [ #include <sys/types.h> ],
1174 [ u_int64_t a; a = 1;],
1175 [ ac_cv_have_u_int64_t="yes" ],
1176 [ ac_cv_have_u_int64_t="no" ]
1177 )
1178])
1179if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1180 AC_DEFINE(HAVE_U_INT64_T)
1181 have_u_int64_t=1
1182fi
1183
Tim Rice4cec93f2002-02-26 08:40:48 -08001184if test -z "$have_u_int64_t" ; then
1185 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1186 AC_TRY_COMPILE(
1187 [ #include <sys/bitypes.h> ],
1188 [ u_int64_t a; a = 1],
1189 [
1190 AC_DEFINE(HAVE_U_INT64_T)
1191 AC_MSG_RESULT(yes)
1192 ],
1193 [ AC_MSG_RESULT(no) ]
1194 )
1195fi
1196
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001197if test -z "$have_u_intxx_t" ; then
1198 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1199 AC_TRY_COMPILE(
1200 [
1201#include <sys/types.h>
1202 ],
1203 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1204 [ ac_cv_have_uintxx_t="yes" ],
1205 [ ac_cv_have_uintxx_t="no" ]
1206 )
1207 ])
1208 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1209 AC_DEFINE(HAVE_UINTXX_T)
1210 fi
1211fi
1212
1213if test -z "$have_uintxx_t" ; then
1214 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1215 AC_TRY_COMPILE(
1216 [ #include <stdint.h> ],
1217 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1218 [
1219 AC_DEFINE(HAVE_UINTXX_T)
1220 AC_MSG_RESULT(yes)
1221 ],
1222 [ AC_MSG_RESULT(no) ]
1223 )
1224fi
1225
Damien Milleredb82922000-06-20 13:25:52 +10001226if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1227 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001228then
1229 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1230 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001231 [
1232#include <sys/bitypes.h>
1233 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001234 [
Damien Miller70494d12000-04-03 15:57:06 +10001235 int8_t a; int16_t b; int32_t c;
1236 u_int8_t e; u_int16_t f; u_int32_t g;
1237 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001238 ],
1239 [
1240 AC_DEFINE(HAVE_U_INTXX_T)
1241 AC_DEFINE(HAVE_INTXX_T)
1242 AC_MSG_RESULT(yes)
1243 ],
1244 [AC_MSG_RESULT(no)]
1245 )
1246fi
1247
Damien Miller58be7382001-09-15 21:31:54 +10001248
1249AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1250 AC_TRY_COMPILE(
1251 [
1252#include <sys/types.h>
1253 ],
1254 [ u_char foo; foo = 125; ],
1255 [ ac_cv_have_u_char="yes" ],
1256 [ ac_cv_have_u_char="no" ]
1257 )
1258])
1259if test "x$ac_cv_have_u_char" = "xyes" ; then
1260 AC_DEFINE(HAVE_U_CHAR)
1261fi
1262
Tim Rice13aae5e2001-10-21 17:53:58 -07001263TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001264
Tim Rice200a5c02002-02-26 22:12:34 -08001265AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001266
Damien Miller61e50f12000-05-08 20:49:37 +10001267AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1268 AC_TRY_COMPILE(
1269 [
1270#include <sys/types.h>
1271 ],
1272 [ size_t foo; foo = 1235; ],
1273 [ ac_cv_have_size_t="yes" ],
1274 [ ac_cv_have_size_t="no" ]
1275 )
1276])
1277if test "x$ac_cv_have_size_t" = "xyes" ; then
1278 AC_DEFINE(HAVE_SIZE_T)
1279fi
Damien Miller95058511999-12-29 10:36:45 +11001280
Damien Miller615f9392000-05-17 22:53:33 +10001281AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1282 AC_TRY_COMPILE(
1283 [
1284#include <sys/types.h>
1285 ],
1286 [ ssize_t foo; foo = 1235; ],
1287 [ ac_cv_have_ssize_t="yes" ],
1288 [ ac_cv_have_ssize_t="no" ]
1289 )
1290])
1291if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1292 AC_DEFINE(HAVE_SSIZE_T)
1293fi
1294
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001295AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1296 AC_TRY_COMPILE(
1297 [
1298#include <time.h>
1299 ],
1300 [ clock_t foo; foo = 1235; ],
1301 [ ac_cv_have_clock_t="yes" ],
1302 [ ac_cv_have_clock_t="no" ]
1303 )
1304])
1305if test "x$ac_cv_have_clock_t" = "xyes" ; then
1306 AC_DEFINE(HAVE_CLOCK_T)
1307fi
1308
Damien Millerb54b40e2000-06-23 08:23:34 +10001309AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1310 AC_TRY_COMPILE(
1311 [
1312#include <sys/types.h>
1313#include <sys/socket.h>
1314 ],
1315 [ sa_family_t foo; foo = 1235; ],
1316 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001317 [ AC_TRY_COMPILE(
1318 [
1319#include <sys/types.h>
1320#include <sys/socket.h>
1321#include <netinet/in.h>
1322 ],
1323 [ sa_family_t foo; foo = 1235; ],
1324 [ ac_cv_have_sa_family_t="yes" ],
1325
Damien Millerb54b40e2000-06-23 08:23:34 +10001326 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001327 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001328 )
1329])
1330if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1331 AC_DEFINE(HAVE_SA_FAMILY_T)
1332fi
1333
Damien Miller0f91b4e2000-06-18 15:43:25 +10001334AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1335 AC_TRY_COMPILE(
1336 [
1337#include <sys/types.h>
1338 ],
1339 [ pid_t foo; foo = 1235; ],
1340 [ ac_cv_have_pid_t="yes" ],
1341 [ ac_cv_have_pid_t="no" ]
1342 )
1343])
1344if test "x$ac_cv_have_pid_t" = "xyes" ; then
1345 AC_DEFINE(HAVE_PID_T)
1346fi
1347
1348AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1349 AC_TRY_COMPILE(
1350 [
1351#include <sys/types.h>
1352 ],
1353 [ mode_t foo; foo = 1235; ],
1354 [ ac_cv_have_mode_t="yes" ],
1355 [ ac_cv_have_mode_t="no" ]
1356 )
1357])
1358if test "x$ac_cv_have_mode_t" = "xyes" ; then
1359 AC_DEFINE(HAVE_MODE_T)
1360fi
1361
Damien Miller61e50f12000-05-08 20:49:37 +10001362
1363AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1364 AC_TRY_COMPILE(
1365 [
Damien Miller81171112000-04-23 11:14:01 +10001366#include <sys/types.h>
1367#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001368 ],
1369 [ struct sockaddr_storage s; ],
1370 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1371 [ ac_cv_have_struct_sockaddr_storage="no" ]
1372 )
1373])
1374if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1375 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1376fi
Damien Miller34132e52000-01-14 15:45:46 +11001377
Damien Miller61e50f12000-05-08 20:49:37 +10001378AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1379 AC_TRY_COMPILE(
1380 [
Damien Miller7b22d652000-06-18 14:07:04 +10001381#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001382#include <netinet/in.h>
1383 ],
1384 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1385 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1386 [ ac_cv_have_struct_sockaddr_in6="no" ]
1387 )
1388])
1389if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1390 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1391fi
Damien Miller34132e52000-01-14 15:45:46 +11001392
Damien Miller61e50f12000-05-08 20:49:37 +10001393AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1394 AC_TRY_COMPILE(
1395 [
Damien Miller7b22d652000-06-18 14:07:04 +10001396#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001397#include <netinet/in.h>
1398 ],
1399 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1400 [ ac_cv_have_struct_in6_addr="yes" ],
1401 [ ac_cv_have_struct_in6_addr="no" ]
1402 )
1403])
1404if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1405 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1406fi
Damien Miller34132e52000-01-14 15:45:46 +11001407
Damien Miller61e50f12000-05-08 20:49:37 +10001408AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1409 AC_TRY_COMPILE(
1410 [
Damien Miller81171112000-04-23 11:14:01 +10001411#include <sys/types.h>
1412#include <sys/socket.h>
1413#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001414 ],
1415 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1416 [ ac_cv_have_struct_addrinfo="yes" ],
1417 [ ac_cv_have_struct_addrinfo="no" ]
1418 )
1419])
1420if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1421 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1422fi
1423
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001424AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1425 AC_TRY_COMPILE(
1426 [ #include <sys/time.h> ],
1427 [ struct timeval tv; tv.tv_sec = 1;],
1428 [ ac_cv_have_struct_timeval="yes" ],
1429 [ ac_cv_have_struct_timeval="no" ]
1430 )
1431])
1432if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1433 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1434 have_struct_timeval=1
1435fi
1436
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001437# If we don't have int64_t then we can't compile sftp-server. So don't
1438# even attempt to do it.
1439if test "x$ac_cv_have_int64_t" = "xno" -a \
1440 "x$ac_cv_sizeof_long_int" != "x8" -a \
1441 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1442 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001443else
1444dnl test snprintf (broken on SCO w/gcc)
1445 AC_TRY_RUN(
1446 [
1447#include <stdio.h>
1448#include <string.h>
1449#ifdef HAVE_SNPRINTF
1450main()
1451{
1452 char buf[50];
1453 char expected_out[50];
1454 int mazsize = 50 ;
1455#if (SIZEOF_LONG_INT == 8)
1456 long int num = 0x7fffffffffffffff;
1457#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001458 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001459#endif
1460 strcpy(expected_out, "9223372036854775807");
1461 snprintf(buf, mazsize, "%lld", num);
1462 if(strcmp(buf, expected_out) != 0)
1463 exit(1);
1464 exit(0);
1465}
1466#else
1467main() { exit(0); }
1468#endif
1469 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1470 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001471fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001472AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001473
Damien Miller78315eb2000-09-29 23:01:36 +11001474dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001475OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1476OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1477OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1478OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1479OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001480OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001481OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1482OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001483OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001484OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1485OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1486OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1487OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001488OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1489OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1490OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1491OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001492
1493AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001494
Damien Miller61e50f12000-05-08 20:49:37 +10001495AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1496 ac_cv_have_ss_family_in_struct_ss, [
1497 AC_TRY_COMPILE(
1498 [
Damien Miller81171112000-04-23 11:14:01 +10001499#include <sys/types.h>
1500#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001501 ],
1502 [ struct sockaddr_storage s; s.ss_family = 1; ],
1503 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1504 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1505 )
1506])
1507if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1508 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1509fi
1510
Damien Miller61e50f12000-05-08 20:49:37 +10001511AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1512 ac_cv_have___ss_family_in_struct_ss, [
1513 AC_TRY_COMPILE(
1514 [
Damien Miller81171112000-04-23 11:14:01 +10001515#include <sys/types.h>
1516#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001517 ],
1518 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1519 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1520 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1521 )
1522])
1523if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1524 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1525fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001526
Damien Millerad833b32000-08-23 10:46:23 +10001527AC_CACHE_CHECK([for pw_class field in struct passwd],
1528 ac_cv_have_pw_class_in_struct_passwd, [
1529 AC_TRY_COMPILE(
1530 [
Damien Millerad833b32000-08-23 10:46:23 +10001531#include <pwd.h>
1532 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001533 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001534 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1535 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1536 )
1537])
1538if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1539 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1540fi
1541
Kevin Steves82456952001-06-22 21:14:18 +00001542AC_CACHE_CHECK([for pw_expire field in struct passwd],
1543 ac_cv_have_pw_expire_in_struct_passwd, [
1544 AC_TRY_COMPILE(
1545 [
1546#include <pwd.h>
1547 ],
1548 [ struct passwd p; p.pw_expire = 0; ],
1549 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1550 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1551 )
1552])
1553if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1554 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1555fi
1556
1557AC_CACHE_CHECK([for pw_change field in struct passwd],
1558 ac_cv_have_pw_change_in_struct_passwd, [
1559 AC_TRY_COMPILE(
1560 [
1561#include <pwd.h>
1562 ],
1563 [ struct passwd p; p.pw_change = 0; ],
1564 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1565 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1566 )
1567])
1568if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1569 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1570fi
Damien Miller61e50f12000-05-08 20:49:37 +10001571
Kevin Steves939c9db2002-03-22 17:23:25 +00001572AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1573 ac_cv_have_accrights_in_msghdr, [
1574 AC_TRY_COMPILE(
1575 [
1576#include <sys/socket.h>
1577#include <sys/uio.h>
1578 ],
1579 [ struct msghdr m; m.msg_accrights = 0; ],
1580 [ ac_cv_have_accrights_in_msghdr="yes" ],
1581 [ ac_cv_have_accrights_in_msghdr="no" ]
1582 )
1583])
1584if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1585 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1586fi
1587
Damien Miller61e50f12000-05-08 20:49:37 +10001588AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1589 AC_TRY_LINK([],
1590 [ extern char *__progname; printf("%s", __progname); ],
1591 [ ac_cv_libc_defines___progname="yes" ],
1592 [ ac_cv_libc_defines___progname="no" ]
1593 )
1594])
1595if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1596 AC_DEFINE(HAVE___PROGNAME)
1597fi
1598
Kevin Steves4846f4a2002-03-22 18:19:53 +00001599AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1600 AC_TRY_LINK([
1601#include <stdio.h>
1602],
1603 [ printf("%s", __FUNCTION__); ],
1604 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1605 [ ac_cv_cc_implements___FUNCTION__="no" ]
1606 )
1607])
1608if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1609 AC_DEFINE(HAVE___FUNCTION__)
1610fi
1611
1612AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1613 AC_TRY_LINK([
1614#include <stdio.h>
1615],
1616 [ printf("%s", __func__); ],
1617 [ ac_cv_cc_implements___func__="yes" ],
1618 [ ac_cv_cc_implements___func__="no" ]
1619 )
1620])
1621if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1622 AC_DEFINE(HAVE___func__)
1623fi
1624
Damien Miller4f8e6692001-07-14 13:22:53 +10001625AC_CACHE_CHECK([whether getopt has optreset support],
1626 ac_cv_have_getopt_optreset, [
1627 AC_TRY_LINK(
1628 [
1629#include <getopt.h>
1630 ],
1631 [ extern int optreset; optreset = 0; ],
1632 [ ac_cv_have_getopt_optreset="yes" ],
1633 [ ac_cv_have_getopt_optreset="no" ]
1634 )
1635])
1636if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1637 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1638fi
Damien Millera22ba012000-03-02 23:09:20 +11001639
Damien Millerecbb26d2000-07-15 14:59:14 +10001640AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1641 AC_TRY_LINK([],
1642 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1643 [ ac_cv_libc_defines_sys_errlist="yes" ],
1644 [ ac_cv_libc_defines_sys_errlist="no" ]
1645 )
1646])
1647if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1648 AC_DEFINE(HAVE_SYS_ERRLIST)
1649fi
1650
1651
Damien Miller11fa2cc2000-08-16 10:35:58 +10001652AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1653 AC_TRY_LINK([],
1654 [ extern int sys_nerr; printf("%i", sys_nerr);],
1655 [ ac_cv_libc_defines_sys_nerr="yes" ],
1656 [ ac_cv_libc_defines_sys_nerr="no" ]
1657 )
1658])
1659if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1660 AC_DEFINE(HAVE_SYS_NERR)
1661fi
1662
Damien Miller85de5802001-09-18 14:01:11 +10001663SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001664
1665# Check whether user wants sectok support
1666AC_ARG_WITH(sectok,
1667 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001668 [
1669 if test "x$withval" != "xno" ; then
1670 if test "x$withval" != "xyes" ; then
1671 CPPFLAGS="$CPPFLAGS -I${withval}"
1672 LDFLAGS="$LDFLAGS -L${withval}"
1673 if test ! -z "$need_dash_r" ; then
1674 LDFLAGS="$LDFLAGS -R${withval}"
1675 fi
1676 if test ! -z "$blibpath" ; then
1677 blibpath="$blibpath:${withval}"
1678 fi
1679 fi
1680 AC_CHECK_HEADERS(sectok.h)
1681 if test "$ac_cv_header_sectok_h" != yes; then
1682 AC_MSG_ERROR(Can't find sectok.h)
1683 fi
1684 AC_CHECK_LIB(sectok, sectok_open)
1685 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1686 AC_MSG_ERROR(Can't find libsectok)
1687 fi
1688 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001689 AC_DEFINE(USE_SECTOK)
1690 SCARD_MSG="yes, using sectok"
1691 fi
1692 ]
1693)
1694
1695# Check whether user wants OpenSC support
1696AC_ARG_WITH(opensc,
1697 [ --with-opensc Enable smartcard support using OpenSC],
1698 [
1699 if test "x$withval" != "xno" ; then
1700 if test "x$withval" != "xyes" ; then
1701 CPPFLAGS="$CPPFLAGS -I${withval}"
1702 LDFLAGS="$LDFLAGS -L${withval}"
1703 if test ! -z "$need_dash_r" ; then
1704 LDFLAGS="$LDFLAGS -R${withval}"
1705 fi
1706 if test ! -z "$blibpath" ; then
1707 blibpath="$blibpath:${withval}"
1708 fi
1709 fi
1710 AC_CHECK_HEADERS(opensc-pkcs15.h)
1711 if test "$ac_cv_header_opensc_pkcs15_h" != yes; then
1712 AC_MSG_ERROR(Can't find opensc-pkcs15.h)
1713 fi
1714 AC_CHECK_LIB(opensc, sc_pkcs15_bind)
1715 if test "$ac_cv_lib_opensc_sc_pkcs15_bind" != yes; then
1716 AC_MSG_ERROR(Can't find libopensc)
1717 fi
1718 AC_DEFINE(SMARTCARD)
1719 AC_DEFINE(USE_OPENSC)
1720 SCARD_MSG="yes, using OpenSC"
Damien Miller85de5802001-09-18 14:01:11 +10001721 fi
1722 ]
1723)
1724
1725# Check whether user wants Kerberos support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001726KRB4_MSG="no"
1727AC_ARG_WITH(kerberos4,
1728 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1729 [
1730 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001731 if test "x$withval" != "xyes" ; then
1732 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1733 LDFLAGS="$LDFLAGS -L${withval}/lib"
1734 if test ! -z "$need_dash_r" ; then
1735 LDFLAGS="$LDFLAGS -R${withval}/lib"
1736 fi
1737 if test ! -z "$blibpath" ; then
1738 blibpath="$blibpath:${withval}/lib"
1739 fi
1740 else
1741 if test -d /usr/include/kerberosIV ; then
1742 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1743 fi
1744 fi
1745
1746 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001747 if test "$ac_cv_header_krb_h" != yes; then
1748 AC_MSG_WARN([Cannot find krb.h, build may fail])
1749 fi
Damien Miller98344742001-03-28 14:37:06 +10001750 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001751 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001752 AC_CHECK_LIB(krb4, main)
1753 if test "$ac_cv_lib_krb4_main" != yes; then
1754 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1755 else
1756 KLIBS="-lkrb4"
1757 fi
1758 else
1759 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001760 fi
Damien Miller98344742001-03-28 14:37:06 +10001761 AC_CHECK_LIB(des, des_cbc_encrypt)
1762 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1763 AC_CHECK_LIB(des425, des_cbc_encrypt)
1764 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1765 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1766 else
1767 KLIBS="-ldes425"
1768 fi
1769 else
1770 KLIBS="-ldes"
1771 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001772 AC_CHECK_LIB(resolv, dn_expand, , )
1773 KRB4=yes
1774 KRB4_MSG="yes"
1775 AC_DEFINE(KRB4)
1776 fi
1777 ]
1778)
1779
1780# Check whether user wants AFS support
1781AFS_MSG="no"
1782AC_ARG_WITH(afs,
1783 [ --with-afs=PATH Enable AFS support],
1784 [
1785 if test "x$withval" != "xno" ; then
1786
1787 if test "x$withval" != "xyes" ; then
1788 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1789 LDFLAGS="$LDFLAGS -L${withval}/lib"
1790 fi
1791
1792 if test -z "$KRB4" ; then
1793 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1794 fi
1795
1796 LIBS="-lkafs $LIBS"
1797 if test ! -z "$AFS_LIBS" ; then
1798 LIBS="$LIBS $AFS_LIBS"
1799 fi
1800 AC_DEFINE(AFS)
1801 AFS_MSG="yes"
1802 fi
1803 ]
1804)
1805LIBS="$LIBS $KLIBS"
1806
Damien Millera22ba012000-03-02 23:09:20 +11001807# Looking for programs, paths and files
1808AC_ARG_WITH(rsh,
1809 [ --with-rsh=PATH Specify path to remote shell program ],
1810 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001811 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001812 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001813 fi
1814 ],
1815 [
1816 AC_PATH_PROG(rsh_path, rsh)
1817 ]
1818)
1819
1820AC_ARG_WITH(xauth,
1821 [ --with-xauth=PATH Specify path to xauth program ],
1822 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001823 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001824 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001825 fi
1826 ],
1827 [
Damien Miller78315eb2000-09-29 23:01:36 +11001828 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 +10001829 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001830 xauth_path="/usr/openwin/bin/xauth"
1831 fi
1832 ]
1833)
1834
Damien Millera19cf472000-11-29 13:28:50 +11001835if test -z "$xauth_path" ; then
1836 XAUTH_PATH="undefined"
1837 AC_SUBST(XAUTH_PATH)
1838else
Damien Millera22ba012000-03-02 23:09:20 +11001839 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001840 XAUTH_PATH=$xauth_path
1841 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001842fi
1843if test ! -z "$rsh_path" ; then
1844 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1845fi
1846
1847# Check for mail directory (last resort if we cannot get it from headers)
1848if test ! -z "$MAIL" ; then
1849 maildir=`dirname $MAIL`
1850 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1851fi
1852
Damien Millera22ba012000-03-02 23:09:20 +11001853if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +11001854 AC_CHECK_FILE("/dev/ptmx",
1855 [
1856 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1857 have_dev_ptmx=1
1858 ]
1859 )
Damien Millera22ba012000-03-02 23:09:20 +11001860fi
Damien Miller204ad072000-03-02 23:56:12 +11001861AC_CHECK_FILE("/dev/ptc",
1862 [
1863 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1864 have_dev_ptc=1
1865 ]
1866)
1867
Damien Millera22ba012000-03-02 23:09:20 +11001868# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001869AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001870 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001871 [
Damien Miller897741e2001-04-16 10:41:46 +10001872 case "$withval" in
1873 man|cat|doc)
1874 MANTYPE=$withval
1875 ;;
1876 *)
1877 AC_MSG_ERROR(invalid man type: $withval)
1878 ;;
1879 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001880 ]
1881)
Ben Lindstrombc709922001-04-18 18:04:21 +00001882if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001883 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001884 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1885 MANTYPE=doc
1886 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1887 MANTYPE=man
1888 else
1889 MANTYPE=cat
1890 fi
1891fi
Damien Miller670a4b82000-01-22 13:53:11 +11001892AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001893if test "$MANTYPE" = "doc"; then
1894 mansubdir=man;
1895else
1896 mansubdir=$MANTYPE;
1897fi
1898AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001899
Damien Millera22ba012000-03-02 23:09:20 +11001900# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001901MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001902AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001903 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001904 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001905 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001906 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001907 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001908 fi
1909 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001910)
1911
Damien Millera22ba012000-03-02 23:09:20 +11001912# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001913AC_ARG_WITH(shadow,
1914 [ --without-shadow Disable shadow password support],
1915 [
1916 if test "x$withval" = "xno" ; then
1917 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001918 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001919 fi
1920 ]
1921)
1922
Damien Miller1f335fb2000-06-26 11:31:33 +10001923if test -z "$disable_shadow" ; then
1924 AC_MSG_CHECKING([if the systems has expire shadow information])
1925 AC_TRY_COMPILE(
1926 [
1927#include <sys/types.h>
1928#include <shadow.h>
1929 struct spwd sp;
1930 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1931 [ sp_expire_available=yes ], []
1932 )
1933
1934 if test "x$sp_expire_available" = "xyes" ; then
1935 AC_MSG_RESULT(yes)
1936 AC_DEFINE(HAS_SHADOW_EXPIRE)
1937 else
1938 AC_MSG_RESULT(no)
1939 fi
1940fi
1941
Damien Millera22ba012000-03-02 23:09:20 +11001942# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001943if test ! -z "$IPADDR_IN_DISPLAY" ; then
1944 DISPLAY_HACK_MSG="yes"
1945 AC_DEFINE(IPADDR_IN_DISPLAY)
1946else
1947 DISPLAY_HACK_MSG="no"
1948 AC_ARG_WITH(ipaddr-display,
1949 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1950 [
1951 if test "x$withval" != "xno" ; then
1952 AC_DEFINE(IPADDR_IN_DISPLAY)
1953 DISPLAY_HACK_MSG="yes"
1954 fi
1955 ]
1956 )
1957fi
Damien Miller76112de1999-12-21 11:18:08 +11001958
Damien Millera22ba012000-03-02 23:09:20 +11001959# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001960SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001961AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11001962 [ --with-default-path=PATH Specify default \$PATH environment for server],
1963 [
1964 if test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001965 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001966 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001967 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001968 ],
1969 [
1970 AC_TRY_RUN(
1971 [
1972/* find out what STDPATH is */
1973#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001974#ifdef HAVE_PATHS_H
1975# include <paths.h>
1976#endif
1977#ifndef _PATH_STDPATH
1978# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1979#endif
1980#include <sys/types.h>
1981#include <sys/stat.h>
1982#include <fcntl.h>
1983#define DATA "conftest.stdpath"
1984
1985main()
1986{
1987 FILE *fd;
1988 int rc;
1989
1990 fd = fopen(DATA,"w");
1991 if(fd == NULL)
1992 exit(1);
1993
1994 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1995 exit(1);
1996
1997 exit(0);
1998}
1999 ], [ user_path=`cat conftest.stdpath` ],
2000 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2001 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2002 )
2003# make sure $bindir is in USER_PATH so scp will work
2004 t_bindir=`eval echo ${bindir}`
2005 case $t_bindir in
2006 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2007 esac
2008 case $t_bindir in
2009 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2010 esac
2011 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2012 if test $? -ne 0 ; then
2013 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2014 if test $? -ne 0 ; then
2015 user_path=$user_path:$t_bindir
2016 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2017 fi
2018 fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002019 ]
2020)
Tim Rice59ea0a02001-03-10 13:50:45 -08002021AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2022AC_SUBST(user_path)
Damien Miller5a3e6831999-12-27 09:48:56 +11002023
Damien Millera22ba012000-03-02 23:09:20 +11002024# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002025IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002026AC_ARG_WITH(ipv4-default,
2027 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2028 [
2029 if test "x$withval" != "xno" ; then
2030 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002031 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002032 fi
2033 ]
2034)
2035
Damien Miller61e50f12000-05-08 20:49:37 +10002036AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002037IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002038AC_ARG_WITH(4in6,
2039 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2040 [
2041 if test "x$withval" != "xno" ; then
2042 AC_MSG_RESULT(yes)
2043 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002044 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002045 else
2046 AC_MSG_RESULT(no)
2047 fi
2048 ],[
2049 if test "x$inet6_default_4in6" = "xyes"; then
2050 AC_MSG_RESULT([yes (default)])
2051 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002052 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002053 else
2054 AC_MSG_RESULT([no (default)])
2055 fi
2056 ]
2057)
2058
Damien Miller60396b02001-02-18 17:01:00 +11002059# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002060BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002061AC_ARG_WITH(bsd-auth,
2062 [ --with-bsd-auth Enable BSD auth support],
2063 [
2064 if test "x$withval" != "xno" ; then
2065 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002066 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002067 fi
2068 ]
2069)
2070
Damien Miller78315eb2000-09-29 23:01:36 +11002071AC_MSG_CHECKING(whether to install ssh as suid root)
2072AC_ARG_ENABLE(suid-ssh,
2073[ --enable-suid-ssh Install ssh as suid root (default)
2074 --disable-suid-ssh Install ssh without suid bit],
2075[ case "$enableval" in
2076 no)
2077 AC_MSG_RESULT(no)
2078 SSHMODE=0711
2079 ;;
2080 *) AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00002081 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11002082 ;;
2083 esac ],
2084 AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00002085 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11002086)
2087AC_SUBST(SSHMODE)
2088
2089
Damien Millera22ba012000-03-02 23:09:20 +11002090# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002091piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002092# make sure the directory exists
2093if test ! -d $piddir ; then
2094 piddir=`eval echo ${sysconfdir}`
2095 case $piddir in
2096 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2097 esac
2098fi
2099
Tim Rice88f2ab52002-03-17 12:17:34 -08002100AC_ARG_WITH(pid-dir,
2101 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2102 [
2103 if test "x$withval" != "xno" ; then
2104 piddir=$withval
2105 if test ! -d $piddir ; then
2106 AC_MSG_WARN([** no $piddir directory on this system **])
2107 fi
2108 fi
2109 ]
2110)
2111
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002112AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002113AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002114
andre2ff7b5d2000-06-03 14:57:40 +00002115dnl allow user to disable some login recording features
2116AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002117 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002118 [ AC_DEFINE(DISABLE_LASTLOG) ]
2119)
2120AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002121 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002122 [ AC_DEFINE(DISABLE_UTMP) ]
2123)
2124AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002125 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002126 [ AC_DEFINE(DISABLE_UTMPX) ]
2127)
2128AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002129 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002130 [ AC_DEFINE(DISABLE_WTMP) ]
2131)
2132AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002133 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002134 [ AC_DEFINE(DISABLE_WTMPX) ]
2135)
2136AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002137 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002138 [ AC_DEFINE(DISABLE_LOGIN) ]
2139)
2140AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002141 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002142 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2143)
2144AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002145 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002146 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2147)
2148AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002149 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002150 [
2151 if test "x$withval" = "xno" ; then
2152 AC_DEFINE(DISABLE_LASTLOG)
2153 else
2154 conf_lastlog_location=$withval
2155 fi
2156 ]
2157)
andre2ff7b5d2000-06-03 14:57:40 +00002158
2159dnl lastlog, [uw]tmpx? detection
2160dnl NOTE: set the paths in the platform section to avoid the
2161dnl need for command-line parameters
2162dnl lastlog and [uw]tmp are subject to a file search if all else fails
2163
2164dnl lastlog detection
2165dnl NOTE: the code itself will detect if lastlog is a directory
2166AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2167AC_TRY_COMPILE([
2168#include <sys/types.h>
2169#include <utmp.h>
2170#ifdef HAVE_LASTLOG_H
2171# include <lastlog.h>
2172#endif
Damien Miller2994e082000-06-04 15:51:47 +10002173#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002174# include <paths.h>
2175#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002176#ifdef HAVE_LOGIN_H
2177# include <login.h>
2178#endif
andre2ff7b5d2000-06-03 14:57:40 +00002179 ],
2180 [ char *lastlog = LASTLOG_FILE; ],
2181 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002182 [
2183 AC_MSG_RESULT(no)
2184 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2185 AC_TRY_COMPILE([
2186#include <sys/types.h>
2187#include <utmp.h>
2188#ifdef HAVE_LASTLOG_H
2189# include <lastlog.h>
2190#endif
2191#ifdef HAVE_PATHS_H
2192# include <paths.h>
2193#endif
2194 ],
2195 [ char *lastlog = _PATH_LASTLOG; ],
2196 [ AC_MSG_RESULT(yes) ],
2197 [
andree441aa32000-06-12 22:34:38 +00002198 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002199 system_lastlog_path=no
2200 ])
2201 ]
andre2ff7b5d2000-06-03 14:57:40 +00002202)
Damien Miller2994e082000-06-04 15:51:47 +10002203
andre2ff7b5d2000-06-03 14:57:40 +00002204if test -z "$conf_lastlog_location"; then
2205 if test x"$system_lastlog_path" = x"no" ; then
2206 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002207 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002208 conf_lastlog_location=$f
2209 fi
2210 done
2211 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002212 AC_MSG_WARN([** Cannot find lastlog **])
2213 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002214 fi
2215 fi
2216fi
2217
2218if test -n "$conf_lastlog_location"; then
2219 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2220fi
2221
2222dnl utmp detection
2223AC_MSG_CHECKING([if your system defines UTMP_FILE])
2224AC_TRY_COMPILE([
2225#include <sys/types.h>
2226#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002227#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002228# include <paths.h>
2229#endif
2230 ],
2231 [ char *utmp = UTMP_FILE; ],
2232 [ AC_MSG_RESULT(yes) ],
2233 [ AC_MSG_RESULT(no)
2234 system_utmp_path=no ]
2235)
2236if test -z "$conf_utmp_location"; then
2237 if test x"$system_utmp_path" = x"no" ; then
2238 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2239 if test -f $f ; then
2240 conf_utmp_location=$f
2241 fi
2242 done
2243 if test -z "$conf_utmp_location"; then
2244 AC_DEFINE(DISABLE_UTMP)
2245 fi
2246 fi
2247fi
2248if test -n "$conf_utmp_location"; then
2249 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2250fi
2251
2252dnl wtmp detection
2253AC_MSG_CHECKING([if your system defines WTMP_FILE])
2254AC_TRY_COMPILE([
2255#include <sys/types.h>
2256#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002257#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002258# include <paths.h>
2259#endif
2260 ],
2261 [ char *wtmp = WTMP_FILE; ],
2262 [ AC_MSG_RESULT(yes) ],
2263 [ AC_MSG_RESULT(no)
2264 system_wtmp_path=no ]
2265)
2266if test -z "$conf_wtmp_location"; then
2267 if test x"$system_wtmp_path" = x"no" ; then
2268 for f in /usr/adm/wtmp /var/log/wtmp; do
2269 if test -f $f ; then
2270 conf_wtmp_location=$f
2271 fi
2272 done
2273 if test -z "$conf_wtmp_location"; then
2274 AC_DEFINE(DISABLE_WTMP)
2275 fi
2276 fi
2277fi
2278if test -n "$conf_wtmp_location"; then
2279 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2280fi
2281
2282
2283dnl utmpx detection - I don't know any system so perverse as to require
2284dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2285dnl there, though.
2286AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2287AC_TRY_COMPILE([
2288#include <sys/types.h>
2289#include <utmp.h>
2290#ifdef HAVE_UTMPX_H
2291#include <utmpx.h>
2292#endif
Damien Miller2994e082000-06-04 15:51:47 +10002293#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002294# include <paths.h>
2295#endif
2296 ],
2297 [ char *utmpx = UTMPX_FILE; ],
2298 [ AC_MSG_RESULT(yes) ],
2299 [ AC_MSG_RESULT(no)
2300 system_utmpx_path=no ]
2301)
2302if test -z "$conf_utmpx_location"; then
2303 if test x"$system_utmpx_path" = x"no" ; then
2304 AC_DEFINE(DISABLE_UTMPX)
2305 fi
2306else
2307 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2308fi
2309
2310dnl wtmpx detection
2311AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2312AC_TRY_COMPILE([
2313#include <sys/types.h>
2314#include <utmp.h>
2315#ifdef HAVE_UTMPX_H
2316#include <utmpx.h>
2317#endif
Damien Miller2994e082000-06-04 15:51:47 +10002318#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002319# include <paths.h>
2320#endif
2321 ],
2322 [ char *wtmpx = WTMPX_FILE; ],
2323 [ AC_MSG_RESULT(yes) ],
2324 [ AC_MSG_RESULT(no)
2325 system_wtmpx_path=no ]
2326)
2327if test -z "$conf_wtmpx_location"; then
2328 if test x"$system_wtmpx_path" = x"no" ; then
2329 AC_DEFINE(DISABLE_WTMPX)
2330 fi
2331else
2332 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2333fi
2334
Damien Miller4018c192000-04-30 09:30:44 +10002335
Damien Miller29ea30d2000-03-17 10:54:15 +11002336if test ! -z "$blibpath" ; then
2337 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2338 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2339fi
2340
Tim Rice4cec93f2002-02-26 08:40:48 -08002341dnl remove pam and dl because they are in $LIBPAM
2342if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002343 LIBS=`echo $LIBS | sed 's/-lpam //'`
2344fi
2345if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2346 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002347fi
2348
Damien Millerbac2d8a2000-09-05 16:13:06 +11002349AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002350AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2351AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002352
Damien Miller7b22d652000-06-18 14:07:04 +10002353# Print summary of options
2354
Damien Miller7b22d652000-06-18 14:07:04 +10002355# Someone please show me a better way :)
2356A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2357B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2358C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2359D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002360E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002361F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002362G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Tim Rice59ea0a02001-03-10 13:50:45 -08002363H=`eval echo ${user_path}` ; H=`eval echo ${H}`
Damien Miller7b22d652000-06-18 14:07:04 +10002364
2365echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002366echo "OpenSSH has been configured with the following options:"
Damien Miller7b22d652000-06-18 14:07:04 +10002367echo " User binaries: $B"
2368echo " System binaries: $C"
2369echo " Configuration files: $D"
2370echo " Askpass program: $E"
2371echo " Manual pages: $F"
2372echo " PID file: $G"
Tim Rice59ea0a02001-03-10 13:50:45 -08002373echo " sshd default user PATH: $H"
Damien Miller897741e2001-04-16 10:41:46 +10002374echo " Manpage format: $MANTYPE"
Damien Miller7b22d652000-06-18 14:07:04 +10002375echo " PAM support: ${PAM_MSG}"
2376echo " KerberosIV support: $KRB4_MSG"
Damien Miller85de5802001-09-18 14:01:11 +10002377echo " Smartcard support: $SCARD_MSG"
Damien Miller7b22d652000-06-18 14:07:04 +10002378echo " AFS support: $AFS_MSG"
2379echo " S/KEY support: $SKEY_MSG"
2380echo " TCP Wrappers support: $TCPW_MSG"
2381echo " MD5 password support: $MD5_MSG"
2382echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2383echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2384echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002385echo " BSD Auth support: $BSD_AUTH_MSG"
2386echo " Random number source: $RAND_MSG"
2387if test ! -z "$USE_RAND_HELPER" ; then
2388 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002389fi
2390
Damien Miller7b22d652000-06-18 14:07:04 +10002391echo ""
2392
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002393echo " Host: ${host}"
2394echo " Compiler: ${CC}"
2395echo " Compiler flags: ${CFLAGS}"
2396echo "Preprocessor flags: ${CPPFLAGS}"
2397echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002398echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002399
2400echo ""
2401
Damien Miller82cf0ce2000-12-20 13:34:48 +11002402if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002403 echo "PAM is enabled. You may need to install a PAM control file "
2404 echo "for sshd, otherwise password authentication may fail. "
2405 echo "Example PAM control files can be found in the contrib/ "
2406 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002407 echo ""
2408fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002409
2410if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002411 echo "sftp-server will be disabled. Your compiler does not "
2412 echo "support 64bit integers."
2413 echo ""
2414fi
2415
2416if test ! -z "$RAND_HELPER_CMDHASH" ; then
2417 echo "WARNING: you are using the builtin random number collection "
2418 echo "service. Please read WARNING.RNG and request that your OS "
2419 echo "vendor includes kernel-based random number collection in "
2420 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002421 echo ""
2422fi
Damien Miller60396b02001-02-18 17:01:00 +11002423