blob: 10f238a25cf9b2300af65ba671745a8c1074d157 [file] [log] [blame]
Kevin Steves7ff91122002-04-07 19:22:54 +00001# $Id: configure.ac,v 1.39 2002/04/07 19:22:54 stevesk 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 Lindstrom8ff2a8d2002-04-06 18:58:31 +0000117 AC_CHECK_FUNC(jlimit_startjob, [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
Ben Lindstromb5628642000-10-18 00:02:25 +0000130 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100131*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100132 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100133 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100134*-*-freebsd*)
135 check_for_libcrypt_later=1
136 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000137*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000138 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100139 conf_utmp_location=/etc/utmp
140 conf_wtmp_location=/usr/adm/wtmp
141 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000142 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000143 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000144 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100145 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000146 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000147 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000148 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100149*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000150 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000151 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100152 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100153 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000154 AC_DEFINE(LOGIN_NEEDS_UTMPX)
155 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000156 AC_DEFINE(PAM_TTY_KLUDGE)
andre2ff7b5d2000-06-03 14:57:40 +0000157 # hardwire lastlog location (can't detect it on some versions)
158 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000159 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
160 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
161 if test "$sol2ver" -ge 8; then
162 AC_MSG_RESULT(yes)
163 AC_DEFINE(DISABLE_UTMP)
164 AC_DEFINE(DISABLE_WTMP)
165 else
166 AC_MSG_RESULT(no)
167 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100168 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000169*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000170 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000171 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100172 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000173 conf_utmp_location=/etc/utmp
174 conf_wtmp_location=/var/adm/wtmp
175 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000176 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000177 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000178*-ncr-sysv*)
179 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
180 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700181 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000182 AC_DEFINE(USE_PIPES)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000183 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000184*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000185 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700186 # /usr/ucblib MUST NOT be searched on ReliantUNIX
187 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100188 IPADDR_IN_DISPLAY=yes
189 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000190 AC_DEFINE(IP_TOS_IS_BROKEN)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700191 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
192 # Attention: always take care to bind libsocket and libnsl before libc,
193 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000194 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100195*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000196 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100197 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Ricea4f7ae12001-09-17 14:34:33 -0700198# enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100199 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100200 ;;
201*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000202 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100203 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Ricea4f7ae12001-09-17 14:34:33 -0700204# enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100205 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100206 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100207*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000208 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100209 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100210 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100211*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000212 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100213 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700214 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller78315eb2000-09-29 23:01:36 +1100215 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100216 RANLIB=true
217 no_dev_ptmx=1
218 AC_DEFINE(BROKEN_SYS_TERMIO_H)
219 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100220 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000221 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100222 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100223 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700224 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700225 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100226 ;;
227*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000228 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000229 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100230 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000231 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100232 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100233 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100234 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000235 AC_DEFINE(DISABLE_SHADOW)
Damien Miller217f5672001-02-16 12:12:41 +1100236 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700237 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000238 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000239*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700240 no_libsocket=1
241 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000242 AC_DEFINE(USE_PIPES)
Tim Ricee991e3c2001-08-07 15:29:07 -0700243 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
244 LIBS="$LIBS -lgen -lrsc"
245 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000246*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000247 AC_MSG_CHECKING(for Digital Unix SIA)
248 no_osfsia=""
249 AC_ARG_WITH(osfsia,
250 [ --with-osfsia Enable Digital Unix SIA],
251 [
252 if test "x$withval" = "xno" ; then
253 AC_MSG_RESULT(disabled)
254 no_osfsia=1
255 fi
256 ],
257 )
258 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000259 if test -f /etc/sia/matrix.conf; then
260 AC_MSG_RESULT(yes)
261 AC_DEFINE(HAVE_OSF_SIA)
262 AC_DEFINE(DISABLE_LOGIN)
263 LIBS="$LIBS -lsecurity -ldb -lm -laud"
264 else
265 AC_MSG_RESULT(no)
266 fi
267 fi
268 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000269
270*-*-nto-qnx)
271 AC_DEFINE(USE_PIPES)
272 AC_DEFINE(NO_X11_UNIX_SOCKETS)
273 AC_DEFINE(MISSING_NFDBITS)
274 AC_DEFINE(MISSING_HOWMANY)
275 AC_DEFINE(MISSING_FD_MASK)
276 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100277esac
278
Damien Millere37bfc12000-06-05 09:37:43 +1000279# Allow user to specify flags
280AC_ARG_WITH(cflags,
281 [ --with-cflags Specify additional flags to pass to compiler],
282 [
283 if test "x$withval" != "xno" ; then
284 CFLAGS="$CFLAGS $withval"
285 fi
286 ]
287)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000288AC_ARG_WITH(cppflags,
289 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
290 [
291 if test "x$withval" != "xno"; then
292 CPPFLAGS="$CPPFLAGS $withval"
293 fi
294 ]
295)
Damien Millere37bfc12000-06-05 09:37:43 +1000296AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000297 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000298 [
299 if test "x$withval" != "xno" ; then
300 LDFLAGS="$LDFLAGS $withval"
301 fi
302 ]
303)
304AC_ARG_WITH(libs,
305 [ --with-libs Specify additional libraries to link with],
306 [
307 if test "x$withval" != "xno" ; then
308 LIBS="$LIBS $withval"
309 fi
310 ]
311)
312
Tim Rice4cec93f2002-02-26 08:40:48 -0800313# Checks for header files.
314AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
315 getopt.h glob.h lastlog.h limits.h login.h \
316 login_cap.h maillock.h netdb.h netgroup.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000317 netinet/in_systm.h paths.h pty.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000318 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800319 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000320 sys/mman.h sys/select.h sys/stat.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800321 sys/stropts.h sys/sysmacros.h sys/time.h \
Kevin Steves117b06d2002-03-30 17:55:21 +0000322 sys/un.h time.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800323 util.h utime.h utmp.h utmpx.h)
324
Damien Millera22ba012000-03-02 23:09:20 +1100325# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700326AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
327AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000328
Damien Millerdf288022001-02-18 13:07:07 +1100329dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700330if test "x$with_tcp_wrappers" != "xno" ; then
331 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
332 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
333 fi
334fi
Damien Millerdf288022001-02-18 13:07:07 +1100335
Tim Rice13aae5e2001-10-21 17:53:58 -0700336AC_CHECK_FUNC(getspnam, ,
337 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700338
Damien Miller150c8b52002-02-13 23:06:56 +1100339AC_ARG_WITH(rpath,
340 [ --without-rpath Disable auto-added -R linker paths],
341 [
342 if test "x$withval" = "xno" ; then
343 need_dash_r=""
344 fi
345 if test "x$withval" = "xyes" ; then
346 need_dash_r=1
347 fi
348 ]
349)
350
Tim Rice13aae5e2001-10-21 17:53:58 -0700351dnl zlib is required
352AC_ARG_WITH(zlib,
353 [ --with-zlib=PATH Use zlib in PATH],
354 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000355 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100356 AC_MSG_ERROR([*** zlib is required ***])
357 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700358 if test -d "$withval/lib"; then
359 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700360 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700361 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700362 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700363 fi
364 else
365 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700366 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700367 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700368 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700369 fi
370 fi
371 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700372 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700373 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700374 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700375 fi
376 ]
377)
378
Tim Rice17b93e52001-10-23 22:36:54 -0700379AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100380
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000381dnl UnixWare 2.x
382AC_CHECK_FUNC(strcasecmp,
383 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
384)
385AC_CHECK_FUNC(utimes,
386 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
387)
Damien Millerab18c411999-11-11 10:40:23 +1100388
Tim Ricee589a292001-11-03 11:09:32 -0800389dnl Checks for libutil functions
390AC_CHECK_HEADERS(libutil.h)
391AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
392AC_CHECK_FUNCS(logout updwtmp logwtmp)
393
Ben Lindstrom8697e082001-02-24 21:41:10 +0000394AC_FUNC_STRFTIME
395
Damien Miller3c027682001-03-14 11:39:45 +1100396# Check for ALTDIRFUNC glob() extension
397AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
398AC_EGREP_CPP(FOUNDIT,
399 [
400 #include <glob.h>
401 #ifdef GLOB_ALTDIRFUNC
402 FOUNDIT
403 #endif
404 ],
405 [
406 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
407 AC_MSG_RESULT(yes)
408 ],
409 [
410 AC_MSG_RESULT(no)
411 ]
412)
Damien Millerab18c411999-11-11 10:40:23 +1100413
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000414# Check for g.gl_matchc glob() extension
415AC_MSG_CHECKING(for gl_matchc field in glob_t)
416AC_EGREP_CPP(FOUNDIT,
417 [
418 #include <glob.h>
419 int main(void){glob_t g; g.gl_matchc = 1;}
420 ],
421 [
422 AC_DEFINE(GLOB_HAS_GL_MATCHC)
423 AC_MSG_RESULT(yes)
424 ],
425 [
426 AC_MSG_RESULT(no)
427 ]
428)
429
Damien Miller18bb4732001-03-28 14:35:30 +1000430AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
431AC_TRY_RUN(
432 [
433#include <sys/types.h>
434#include <dirent.h>
435int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
436 ],
437 [AC_MSG_RESULT(yes)],
438 [
439 AC_MSG_RESULT(no)
440 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
441 ]
442)
443
Damien Millerc547bf12001-02-16 10:18:12 +1100444# Check whether user wants S/Key support
445SKEY_MSG="no"
446AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700447 [ --with-skey[[=PATH]] Enable S/Key support
448 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100449 [
450 if test "x$withval" != "xno" ; then
451
452 if test "x$withval" != "xyes" ; then
453 CPPFLAGS="$CPPFLAGS -I${withval}/include"
454 LDFLAGS="$LDFLAGS -L${withval}/lib"
455 fi
456
457 AC_DEFINE(SKEY)
458 LIBS="-lskey $LIBS"
459 SKEY_MSG="yes"
460
Tim Rice4cec93f2002-02-26 08:40:48 -0800461 AC_MSG_CHECKING([for s/key support])
462 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100463 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800464#include <stdio.h>
465#include <skey.h>
466int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
467 ],
468 [AC_MSG_RESULT(yes)],
469 [
470 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100471 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
472 ])
473 fi
474 ]
475)
476
477# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700478TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100479AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700480 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
481 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100482 [
483 if test "x$withval" != "xno" ; then
484 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700485 saved_LDFLAGS="$LDFLAGS"
486 saved_CPPFLAGS="$CPPFLAGS"
487 if test -n "${withval}" -a "${withval}" != "yes"; then
488 if test -d "${withval}/lib"; then
489 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700490 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700491 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700492 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700493 fi
494 else
495 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700496 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700497 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700498 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700499 fi
500 fi
501 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700502 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700503 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700504 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700505 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700506 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800507 LIBWRAP="-lwrap"
508 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100509 AC_MSG_CHECKING(for libwrap)
510 AC_TRY_LINK(
511 [
512#include <tcpd.h>
513 int deny_severity = 0, allow_severity = 0;
514 ],
515 [hosts_access(0);],
516 [
517 AC_MSG_RESULT(yes)
518 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800519 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700520 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100521 ],
522 [
523 AC_MSG_ERROR([*** libwrap missing])
524 ]
525 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800526 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100527 fi
528 ]
529)
530
Damien Millerad833b32000-08-23 10:46:23 +1000531dnl Checks for library functions.
Ben Lindstromfdee8ef2002-04-06 23:52:02 +0000532AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
Tim Rice13aae5e2001-10-21 17:53:58 -0700533 clock fchmod fchown freeaddrinfo futimes gai_strerror \
534 getaddrinfo getcwd getgrouplist getnameinfo getopt \
535 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
536 inet_ntop innetgr login_getcapbool md5_crypt memmove \
Kevin Steves86b9fe62002-04-07 17:08:53 +0000537 mkdtemp mmap openpty readpassphrase realpath \
Tim Rice13aae5e2001-10-21 17:53:58 -0700538 rresvport_af setdtablesize setegid setenv seteuid \
539 setlogin setproctitle setresgid setreuid setrlimit \
540 setsid setvbuf sigaction sigvec snprintf strerror \
541 strlcat strlcpy strmode strsep sysconf tcgetpgrp utimes \
542 vhangup vsnprintf waitpid __b64_ntop _getpty)
543
544dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700545AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700546 AC_CHECK_LIB(gen, dirname,[
547 AC_CACHE_CHECK([for broken dirname],
548 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700549 save_LIBS="$LIBS"
550 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700551 AC_TRY_RUN(
552 [
553#include <libgen.h>
554#include <string.h>
555
556int main(int argc, char **argv) {
557 char *s, buf[32];
558
559 strncpy(buf,"/etc", 32);
560 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700561 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700562 exit(1);
563 } else {
564 exit(0);
565 }
566}
567 ],
568 [ ac_cv_have_broken_dirname="no" ],
569 [ ac_cv_have_broken_dirname="yes" ]
570 )
Tim Rice17b93e52001-10-23 22:36:54 -0700571 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700572 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700573 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700574 LIBS="$LIBS -lgen"
575 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700576 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700577 fi
578 ])
579])
580
Damien Millerad833b32000-08-23 10:46:23 +1000581dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000582AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000583dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000584AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000585AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000586dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000587AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000588AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100589
Damien Miller5fc85652000-07-09 23:53:07 +1000590AC_CHECK_FUNC(getuserattr,
591 [AC_DEFINE(HAVE_GETUSERATTR)],
592 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
593)
594
Damien Miller04f80141999-11-19 15:32:34 +1100595AC_CHECK_FUNC(daemon,
596 [AC_DEFINE(HAVE_DAEMON)],
597 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
598)
599
Damien Miller9fb07e42000-03-05 16:22:59 +1100600AC_CHECK_FUNC(getpagesize,
601 [AC_DEFINE(HAVE_GETPAGESIZE)],
602 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
603)
604
Damien Millercb170cb2000-07-01 16:52:55 +1000605# Check for broken snprintf
606if test "x$ac_cv_func_snprintf" = "xyes" ; then
607 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
608 AC_TRY_RUN(
609 [
610#include <stdio.h>
611int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
612 ],
613 [AC_MSG_RESULT(yes)],
614 [
615 AC_MSG_RESULT(no)
616 AC_DEFINE(BROKEN_SNPRINTF)
617 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
618 ]
619 )
620fi
621
Damien Miller606f8802000-09-16 15:39:56 +1100622AC_FUNC_GETPGRP
623
Damien Millera64b57a2001-01-17 10:44:13 +1100624# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000625PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100626AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100627 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100628 [
Damien Millera64b57a2001-01-17 10:44:13 +1100629 if test "x$withval" != "xno" ; then
630 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
631 AC_MSG_ERROR([PAM headers not found])
632 fi
633
634 AC_CHECK_LIB(dl, dlopen, , )
635 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
636 AC_CHECK_FUNCS(pam_getenvlist)
637
638 disable_shadow=yes
639 PAM_MSG="yes"
640
641 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800642 if test $ac_cv_lib_dl_dlopen = yes; then
643 LIBPAM="-lpam -ldl"
644 else
645 LIBPAM="-lpam"
646 fi
647 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100648 fi
649 ]
650)
Damien Millera22ba012000-03-02 23:09:20 +1100651
Damien Millera64b57a2001-01-17 10:44:13 +1100652# Check for older PAM
653if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100654 # Check PAM strerror arguments (old PAM)
655 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
656 AC_TRY_COMPILE(
657 [
Damien Miller81171112000-04-23 11:14:01 +1000658#include <stdlib.h>
659#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100660 ],
661 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
662 [AC_MSG_RESULT(no)],
663 [
664 AC_DEFINE(HAVE_OLD_PAM)
665 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000666 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100667 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100668 )
Damien Millera22ba012000-03-02 23:09:20 +1100669fi
670
671# The big search for OpenSSL
672AC_ARG_WITH(ssl-dir,
673 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
674 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000675 if test "x$withval" != "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100676 tryssldir=$withval
677 fi
678 ]
679)
680
681saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100682saved_LDFLAGS="$LDFLAGS"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000683saved_CPPFLAGS="$CPPFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100684if test "x$prefix" != "xNONE" ; then
685 tryssldir="$tryssldir $prefix"
686fi
Damien Miller61e50f12000-05-08 20:49:37 +1000687AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera1b61e12000-09-16 17:02:16 +1100688 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 +1100689 CPPFLAGS="$saved_CPPFLAGS"
690 LDFLAGS="$saved_LDFLAGS"
Damien Miller3b512e12000-05-17 23:29:18 +1000691 LIBS="$saved_LIBS -lcrypto"
Damien Millerccdefb62001-02-19 12:56:39 +1100692
693 # Skip directories if they don't exist
694 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
695 continue;
696 fi
697 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
698 # Try to use $ssldir/lib if it exists, otherwise
699 # $ssldir
700 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000701 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100702 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000703 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100704 fi
705 else
Damien Millerb68af622001-03-28 21:05:26 +1000706 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100707 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000708 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100709 fi
710 fi
711 # Try to use $ssldir/include if it exists, otherwise
712 # $ssldir
713 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000714 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100715 else
Damien Millerb68af622001-03-28 21:05:26 +1000716 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100717 fi
718 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000719
Damien Miller3b512e12000-05-17 23:29:18 +1000720 # Basic test to check for compatible version and correct linking
721 # *does not* test for RSA - that comes later.
722 AC_TRY_RUN(
723 [
Damien Millere59ce622000-05-01 20:54:17 +1000724#include <string.h>
725#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000726int main(void)
727{
Damien Miller3b512e12000-05-17 23:29:18 +1000728 char a[2048];
729 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000730 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000731 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000732}
Damien Miller3b512e12000-05-17 23:29:18 +1000733 ],
734 [
735 found_crypto=1
736 break;
737 ], []
738 )
Damien Miller61e50f12000-05-08 20:49:37 +1000739
740 if test ! -z "$found_crypto" ; then
741 break;
742 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100743 done
744
Damien Miller61e50f12000-05-08 20:49:37 +1000745 if test -z "$found_crypto" ; then
Damien Miller5dfe9762001-02-16 12:05:39 +1100746 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
Damien Millerb85dcad2000-03-11 11:37:00 +1100747 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000748 if test -z "$ssldir" ; then
749 ssldir="(system)"
750 fi
Damien Millera22ba012000-03-02 23:09:20 +1100751
Damien Miller61e50f12000-05-08 20:49:37 +1000752 ac_cv_openssldir=$ssldir
753])
754
Damien Milleredb82922000-06-20 13:25:52 +1000755if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000756 AC_DEFINE(HAVE_OPENSSL)
757 dnl Need to recover ssldir - test above runs in subshell
758 ssldir=$ac_cv_openssldir
Damien Millera64b57a2001-01-17 10:44:13 +1100759 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
Damien Millerccdefb62001-02-19 12:56:39 +1100760 # Try to use $ssldir/lib if it exists, otherwise
761 # $ssldir
762 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000763 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100764 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000765 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100766 fi
767 else
Damien Millerb68af622001-03-28 21:05:26 +1000768 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100769 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000770 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100771 fi
Damien Millera64b57a2001-01-17 10:44:13 +1100772 fi
Damien Millerccdefb62001-02-19 12:56:39 +1100773 # Try to use $ssldir/include if it exists, otherwise
774 # $ssldir
775 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000776 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100777 else
Damien Millerb68af622001-03-28 21:05:26 +1000778 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millera64b57a2001-01-17 10:44:13 +1100779 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100780 fi
Damien Millera22ba012000-03-02 23:09:20 +1100781fi
Damien Miller3b512e12000-05-17 23:29:18 +1000782LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000783
Damien Miller3b512e12000-05-17 23:29:18 +1000784# Now test RSA support
785saved_LIBS="$LIBS"
786AC_MSG_CHECKING([for RSA support])
787for WANTS_RSAREF in "" 1 ; do
788 if test -z "$WANTS_RSAREF" ; then
789 LIBS="$saved_LIBS"
790 else
791 LIBS="$saved_LIBS -lRSAglue -lrsaref"
792 fi
793 AC_TRY_RUN([
794#include <string.h>
795#include <openssl/rand.h>
796#include <openssl/rsa.h>
797#include <openssl/bn.h>
798#include <openssl/sha.h>
799int main(void)
800{
801 int num; RSA *key; static unsigned char p_in[] = "blahblah";
802 unsigned char c[256], p[256];
803 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
804 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
805 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
806 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
807}
808 ],
809 [
810 rsa_works=1
811 break;
812 ], [])
813done
Ben Lindstrom23fec142001-06-09 02:16:28 +0000814LIBS="$saved_LIBS"
Damien Miller3b512e12000-05-17 23:29:18 +1000815
816if test ! -z "$no_rsa" ; then
817 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000818 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000819else
820 if test -z "$rsa_works" ; then
821 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000822 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000823 else
824 if test -z "$WANTS_RSAREF" ; then
825 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000826 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000827 else
Damien Miller7b22d652000-06-18 14:07:04 +1000828 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000829 AC_MSG_RESULT(using RSAref)
Ben Lindstrom23fec142001-06-09 02:16:28 +0000830 LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
Damien Miller3b512e12000-05-17 23:29:18 +1000831 fi
832 fi
833fi
Damien Millera22ba012000-03-02 23:09:20 +1100834
Damien Millerec932372002-01-22 22:16:03 +1100835# Sanity check OpenSSL headers
836AC_MSG_CHECKING([whether OpenSSL's headers match the library])
837AC_TRY_RUN(
838 [
839#include <string.h>
840#include <openssl/opensslv.h>
841int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
842 ],
843 [
844 AC_MSG_RESULT(yes)
845 ],
846 [
847 AC_MSG_RESULT(no)
848 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
849 ]
850)
851
Damien Millera64b57a2001-01-17 10:44:13 +1100852# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
853# version in OpenSSL. Skip this for PAM
854if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100855 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100856fi
857
Damien Miller6c21c512002-01-22 21:57:53 +1100858
859### Configure cryptographic random number support
860
861# Check wheter OpenSSL seeds itself
862AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
863AC_TRY_RUN(
864 [
865#include <string.h>
866#include <openssl/rand.h>
867int main(void) { return(RAND_status() == 1 ? 0 : 1); }
868 ],
869 [
870 OPENSSL_SEEDS_ITSELF=yes
871 AC_MSG_RESULT(yes)
872 ],
873 [
874 AC_MSG_RESULT(no)
875 # Default to use of the rand helper if OpenSSL doesn't
876 # seed itself
877 USE_RAND_HELPER=yes
878 ]
879)
880
881
882# Do we want to force the use of the rand helper?
883AC_ARG_WITH(rand-helper,
884 [ --with-rand-helper Use subprocess to gather strong randomness ],
885 [
886 if test "x$withval" = "xno" ; then
887 # Force use of OpenSSL's internal RNG, even if
888 # the previous test showed it to be unseeded.
889 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
890 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
891 OPENSSL_SEEDS_ITSELF=yes
892 USE_RAND_HELPER=""
893 fi
894 else
895 USE_RAND_HELPER=yes
896 fi
897 ],
898)
899
900# Which randomness source do we use?
901if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
902 # OpenSSL only
903 AC_DEFINE(OPENSSL_PRNG_ONLY)
904 RAND_MSG="OpenSSL internal ONLY"
905 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800906elif test ! -z "$USE_RAND_HELPER" ; then
907 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100908 RAND_MSG="ssh-rand-helper"
909 INSTALL_SSH_RAND_HELPER="yes"
910fi
911AC_SUBST(INSTALL_SSH_RAND_HELPER)
912
913### Configuration of ssh-rand-helper
914
915# PRNGD TCP socket
916AC_ARG_WITH(prngd-port,
917 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
918 [
Damien Millere996d722002-01-23 11:20:59 +1100919 case "$withval" in
920 no)
921 withval=""
922 ;;
923 [[0-9]]*)
924 ;;
925 *)
926 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
927 ;;
928 esac
929 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100930 PRNGD_PORT="$withval"
931 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
932 fi
933 ]
934)
935
936# PRNGD Unix domain socket
937AC_ARG_WITH(prngd-socket,
938 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
939 [
Damien Millere996d722002-01-23 11:20:59 +1100940 case "$withval" in
941 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100942 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100943 ;;
944 no)
945 withval=""
946 ;;
947 /*)
948 ;;
949 *)
950 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
951 ;;
952 esac
953
954 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100955 if test ! -z "$PRNGD_PORT" ; then
956 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
957 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100958 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100959 AC_MSG_WARN(Entropy socket is not readable)
960 fi
961 PRNGD_SOCKET="$withval"
962 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
963 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800964 ],
965 [
966 # Check for existing socket only if we don't have a random device already
967 if test "$USE_RAND_HELPER" = yes ; then
968 AC_MSG_CHECKING(for PRNGD/EGD socket)
969 # Insert other locations here
970 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
971 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
972 PRNGD_SOCKET="$sock"
973 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
974 break;
975 fi
976 done
977 if test ! -z "$PRNGD_SOCKET" ; then
978 AC_MSG_RESULT($PRNGD_SOCKET)
979 else
980 AC_MSG_RESULT(not found)
981 fi
982 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100983 ]
984)
985
986# Change default command timeout for hashing entropy source
987entropy_timeout=200
988AC_ARG_WITH(entropy-timeout,
989 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
990 [
991 if test "x$withval" != "xno" ; then
992 entropy_timeout=$withval
993 fi
994 ]
995)
Damien Miller6c21c512002-01-22 21:57:53 +1100996AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
997
Kevin Steves7ff91122002-04-07 19:22:54 +0000998ssh_privsep_user=sshd
999AC_ARG_WITH(privsep-user,
1000 [ --with-privsep-user Specify non-privileged user for privilege separation],
1001 [
1002 if test -n "$withval"; then
1003 ssh_privsep_user=$withval
1004 fi
1005 ]
1006)
1007AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, $ssh_privsep_user)
1008
Tim Rice88f2ab52002-03-17 12:17:34 -08001009# We do this little dance with the search path to insure
1010# that programs that we select for use by installed programs
1011# (which may be run by the super-user) come from trusted
1012# locations before they come from the user's private area.
1013# This should help avoid accidentally configuring some
1014# random version of a program in someone's personal bin.
1015
1016OPATH=$PATH
1017PATH=/bin:/usr/bin
Ben Lindstrom03188012002-04-06 20:30:07 +00001018/bin/test -L /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001019test -d /sbin && PATH=$PATH:/sbin
1020test -d /usr/sbin && PATH=$PATH:/usr/sbin
1021PATH=$PATH:/etc:$OPATH
1022
Damien Miller6c21c512002-01-22 21:57:53 +11001023# These programs are used by the command hashing source to gather entropy
1024OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1025OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1026OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1027OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1028OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1029OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1030OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1031OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1032OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1033OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1034OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1035OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1036OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1037OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1038OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1039OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001040# restore PATH
1041PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001042
1043# Where does ssh-rand-helper get its randomness from?
1044INSTALL_SSH_PRNG_CMDS=""
1045if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1046 if test ! -z "$PRNGD_PORT" ; then
1047 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1048 elif test ! -z "$PRNGD_SOCKET" ; then
1049 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1050 else
1051 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1052 RAND_HELPER_CMDHASH=yes
1053 INSTALL_SSH_PRNG_CMDS="yes"
1054 fi
1055fi
1056AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1057
1058
Ben Lindstromb5628642000-10-18 00:02:25 +00001059# Cheap hack to ensure NEWS-OS libraries are arranged right.
1060if test ! -z "$SONY" ; then
1061 LIBS="$LIBS -liberty";
1062fi
1063
Damien Millera22ba012000-03-02 23:09:20 +11001064# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001065AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001066AC_CHECK_SIZEOF(short int, 2)
1067AC_CHECK_SIZEOF(int, 4)
1068AC_CHECK_SIZEOF(long int, 4)
1069AC_CHECK_SIZEOF(long long int, 8)
1070
Damien Millera22ba012000-03-02 23:09:20 +11001071# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001072AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1073 AC_TRY_COMPILE(
1074 [ #include <sys/types.h> ],
1075 [ u_int a; a = 1;],
1076 [ ac_cv_have_u_int="yes" ],
1077 [ ac_cv_have_u_int="no" ]
1078 )
1079])
1080if test "x$ac_cv_have_u_int" = "xyes" ; then
1081 AC_DEFINE(HAVE_U_INT)
1082 have_u_int=1
1083fi
1084
Damien Miller61e50f12000-05-08 20:49:37 +10001085AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1086 AC_TRY_COMPILE(
1087 [ #include <sys/types.h> ],
1088 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1089 [ ac_cv_have_intxx_t="yes" ],
1090 [ ac_cv_have_intxx_t="no" ]
1091 )
1092])
1093if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1094 AC_DEFINE(HAVE_INTXX_T)
1095 have_intxx_t=1
1096fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001097
1098if (test -z "$have_intxx_t" && \
1099 test "x$ac_cv_header_stdint_h" = "xyes")
1100then
1101 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1102 AC_TRY_COMPILE(
1103 [ #include <stdint.h> ],
1104 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1105 [
1106 AC_DEFINE(HAVE_INTXX_T)
1107 AC_MSG_RESULT(yes)
1108 ],
1109 [ AC_MSG_RESULT(no) ]
1110 )
1111fi
1112
Damien Miller578783e2000-09-23 14:12:24 +11001113AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1114 AC_TRY_COMPILE(
1115 [ #include <sys/types.h> ],
1116 [ int64_t a; a = 1;],
1117 [ ac_cv_have_int64_t="yes" ],
1118 [ ac_cv_have_int64_t="no" ]
1119 )
1120])
1121if test "x$ac_cv_have_int64_t" = "xyes" ; then
1122 AC_DEFINE(HAVE_INT64_T)
1123 have_int64_t=1
1124fi
1125
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001126if test -z "$have_int64_t" ; then
1127 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1128 AC_TRY_COMPILE(
1129 [ #include <sys/socket.h> ],
1130 [ int64_t a; a = 1],
1131 [
1132 AC_DEFINE(HAVE_INT64_T)
1133 AC_MSG_RESULT(yes)
1134 ],
1135 [ AC_MSG_RESULT(no) ]
1136 )
1137fi
1138
Tim Rice4cec93f2002-02-26 08:40:48 -08001139if test -z "$have_int64_t" ; then
1140 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1141 AC_TRY_COMPILE(
1142 [ #include <sys/bitypes.h> ],
1143 [ int64_t a; a = 1],
1144 [
1145 AC_DEFINE(HAVE_INT64_T)
1146 AC_MSG_RESULT(yes)
1147 ],
1148 [ AC_MSG_RESULT(no) ]
1149 )
1150fi
1151
Damien Miller61e50f12000-05-08 20:49:37 +10001152AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1153 AC_TRY_COMPILE(
1154 [ #include <sys/types.h> ],
1155 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1156 [ ac_cv_have_u_intxx_t="yes" ],
1157 [ ac_cv_have_u_intxx_t="no" ]
1158 )
1159])
1160if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1161 AC_DEFINE(HAVE_U_INTXX_T)
1162 have_u_intxx_t=1
1163fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001164
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001165if test -z "$have_u_intxx_t" ; then
1166 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1167 AC_TRY_COMPILE(
1168 [ #include <sys/socket.h> ],
1169 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1170 [
1171 AC_DEFINE(HAVE_U_INTXX_T)
1172 AC_MSG_RESULT(yes)
1173 ],
1174 [ AC_MSG_RESULT(no) ]
1175 )
1176fi
1177
Damien Miller578783e2000-09-23 14:12:24 +11001178AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1179 AC_TRY_COMPILE(
1180 [ #include <sys/types.h> ],
1181 [ u_int64_t a; a = 1;],
1182 [ ac_cv_have_u_int64_t="yes" ],
1183 [ ac_cv_have_u_int64_t="no" ]
1184 )
1185])
1186if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1187 AC_DEFINE(HAVE_U_INT64_T)
1188 have_u_int64_t=1
1189fi
1190
Tim Rice4cec93f2002-02-26 08:40:48 -08001191if test -z "$have_u_int64_t" ; then
1192 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1193 AC_TRY_COMPILE(
1194 [ #include <sys/bitypes.h> ],
1195 [ u_int64_t a; a = 1],
1196 [
1197 AC_DEFINE(HAVE_U_INT64_T)
1198 AC_MSG_RESULT(yes)
1199 ],
1200 [ AC_MSG_RESULT(no) ]
1201 )
1202fi
1203
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001204if test -z "$have_u_intxx_t" ; then
1205 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1206 AC_TRY_COMPILE(
1207 [
1208#include <sys/types.h>
1209 ],
1210 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1211 [ ac_cv_have_uintxx_t="yes" ],
1212 [ ac_cv_have_uintxx_t="no" ]
1213 )
1214 ])
1215 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1216 AC_DEFINE(HAVE_UINTXX_T)
1217 fi
1218fi
1219
1220if test -z "$have_uintxx_t" ; then
1221 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1222 AC_TRY_COMPILE(
1223 [ #include <stdint.h> ],
1224 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1225 [
1226 AC_DEFINE(HAVE_UINTXX_T)
1227 AC_MSG_RESULT(yes)
1228 ],
1229 [ AC_MSG_RESULT(no) ]
1230 )
1231fi
1232
Damien Milleredb82922000-06-20 13:25:52 +10001233if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1234 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001235then
1236 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1237 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001238 [
1239#include <sys/bitypes.h>
1240 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001241 [
Damien Miller70494d12000-04-03 15:57:06 +10001242 int8_t a; int16_t b; int32_t c;
1243 u_int8_t e; u_int16_t f; u_int32_t g;
1244 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001245 ],
1246 [
1247 AC_DEFINE(HAVE_U_INTXX_T)
1248 AC_DEFINE(HAVE_INTXX_T)
1249 AC_MSG_RESULT(yes)
1250 ],
1251 [AC_MSG_RESULT(no)]
1252 )
1253fi
1254
Damien Miller58be7382001-09-15 21:31:54 +10001255
1256AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1257 AC_TRY_COMPILE(
1258 [
1259#include <sys/types.h>
1260 ],
1261 [ u_char foo; foo = 125; ],
1262 [ ac_cv_have_u_char="yes" ],
1263 [ ac_cv_have_u_char="no" ]
1264 )
1265])
1266if test "x$ac_cv_have_u_char" = "xyes" ; then
1267 AC_DEFINE(HAVE_U_CHAR)
1268fi
1269
Tim Rice13aae5e2001-10-21 17:53:58 -07001270TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001271
Tim Rice200a5c02002-02-26 22:12:34 -08001272AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001273
Damien Miller61e50f12000-05-08 20:49:37 +10001274AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1275 AC_TRY_COMPILE(
1276 [
1277#include <sys/types.h>
1278 ],
1279 [ size_t foo; foo = 1235; ],
1280 [ ac_cv_have_size_t="yes" ],
1281 [ ac_cv_have_size_t="no" ]
1282 )
1283])
1284if test "x$ac_cv_have_size_t" = "xyes" ; then
1285 AC_DEFINE(HAVE_SIZE_T)
1286fi
Damien Miller95058511999-12-29 10:36:45 +11001287
Damien Miller615f9392000-05-17 22:53:33 +10001288AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1289 AC_TRY_COMPILE(
1290 [
1291#include <sys/types.h>
1292 ],
1293 [ ssize_t foo; foo = 1235; ],
1294 [ ac_cv_have_ssize_t="yes" ],
1295 [ ac_cv_have_ssize_t="no" ]
1296 )
1297])
1298if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1299 AC_DEFINE(HAVE_SSIZE_T)
1300fi
1301
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001302AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1303 AC_TRY_COMPILE(
1304 [
1305#include <time.h>
1306 ],
1307 [ clock_t foo; foo = 1235; ],
1308 [ ac_cv_have_clock_t="yes" ],
1309 [ ac_cv_have_clock_t="no" ]
1310 )
1311])
1312if test "x$ac_cv_have_clock_t" = "xyes" ; then
1313 AC_DEFINE(HAVE_CLOCK_T)
1314fi
1315
Damien Millerb54b40e2000-06-23 08:23:34 +10001316AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1317 AC_TRY_COMPILE(
1318 [
1319#include <sys/types.h>
1320#include <sys/socket.h>
1321 ],
1322 [ sa_family_t foo; foo = 1235; ],
1323 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001324 [ AC_TRY_COMPILE(
1325 [
1326#include <sys/types.h>
1327#include <sys/socket.h>
1328#include <netinet/in.h>
1329 ],
1330 [ sa_family_t foo; foo = 1235; ],
1331 [ ac_cv_have_sa_family_t="yes" ],
1332
Damien Millerb54b40e2000-06-23 08:23:34 +10001333 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001334 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001335 )
1336])
1337if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1338 AC_DEFINE(HAVE_SA_FAMILY_T)
1339fi
1340
Damien Miller0f91b4e2000-06-18 15:43:25 +10001341AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1342 AC_TRY_COMPILE(
1343 [
1344#include <sys/types.h>
1345 ],
1346 [ pid_t foo; foo = 1235; ],
1347 [ ac_cv_have_pid_t="yes" ],
1348 [ ac_cv_have_pid_t="no" ]
1349 )
1350])
1351if test "x$ac_cv_have_pid_t" = "xyes" ; then
1352 AC_DEFINE(HAVE_PID_T)
1353fi
1354
1355AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1356 AC_TRY_COMPILE(
1357 [
1358#include <sys/types.h>
1359 ],
1360 [ mode_t foo; foo = 1235; ],
1361 [ ac_cv_have_mode_t="yes" ],
1362 [ ac_cv_have_mode_t="no" ]
1363 )
1364])
1365if test "x$ac_cv_have_mode_t" = "xyes" ; then
1366 AC_DEFINE(HAVE_MODE_T)
1367fi
1368
Damien Miller61e50f12000-05-08 20:49:37 +10001369
1370AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1371 AC_TRY_COMPILE(
1372 [
Damien Miller81171112000-04-23 11:14:01 +10001373#include <sys/types.h>
1374#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001375 ],
1376 [ struct sockaddr_storage s; ],
1377 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1378 [ ac_cv_have_struct_sockaddr_storage="no" ]
1379 )
1380])
1381if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1382 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1383fi
Damien Miller34132e52000-01-14 15:45:46 +11001384
Damien Miller61e50f12000-05-08 20:49:37 +10001385AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1386 AC_TRY_COMPILE(
1387 [
Damien Miller7b22d652000-06-18 14:07:04 +10001388#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001389#include <netinet/in.h>
1390 ],
1391 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1392 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1393 [ ac_cv_have_struct_sockaddr_in6="no" ]
1394 )
1395])
1396if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1397 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1398fi
Damien Miller34132e52000-01-14 15:45:46 +11001399
Damien Miller61e50f12000-05-08 20:49:37 +10001400AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1401 AC_TRY_COMPILE(
1402 [
Damien Miller7b22d652000-06-18 14:07:04 +10001403#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001404#include <netinet/in.h>
1405 ],
1406 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1407 [ ac_cv_have_struct_in6_addr="yes" ],
1408 [ ac_cv_have_struct_in6_addr="no" ]
1409 )
1410])
1411if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1412 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1413fi
Damien Miller34132e52000-01-14 15:45:46 +11001414
Damien Miller61e50f12000-05-08 20:49:37 +10001415AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1416 AC_TRY_COMPILE(
1417 [
Damien Miller81171112000-04-23 11:14:01 +10001418#include <sys/types.h>
1419#include <sys/socket.h>
1420#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001421 ],
1422 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1423 [ ac_cv_have_struct_addrinfo="yes" ],
1424 [ ac_cv_have_struct_addrinfo="no" ]
1425 )
1426])
1427if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1428 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1429fi
1430
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001431AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1432 AC_TRY_COMPILE(
1433 [ #include <sys/time.h> ],
1434 [ struct timeval tv; tv.tv_sec = 1;],
1435 [ ac_cv_have_struct_timeval="yes" ],
1436 [ ac_cv_have_struct_timeval="no" ]
1437 )
1438])
1439if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1440 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1441 have_struct_timeval=1
1442fi
1443
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001444# If we don't have int64_t then we can't compile sftp-server. So don't
1445# even attempt to do it.
1446if test "x$ac_cv_have_int64_t" = "xno" -a \
1447 "x$ac_cv_sizeof_long_int" != "x8" -a \
1448 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1449 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001450else
1451dnl test snprintf (broken on SCO w/gcc)
1452 AC_TRY_RUN(
1453 [
1454#include <stdio.h>
1455#include <string.h>
1456#ifdef HAVE_SNPRINTF
1457main()
1458{
1459 char buf[50];
1460 char expected_out[50];
1461 int mazsize = 50 ;
1462#if (SIZEOF_LONG_INT == 8)
1463 long int num = 0x7fffffffffffffff;
1464#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001465 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001466#endif
1467 strcpy(expected_out, "9223372036854775807");
1468 snprintf(buf, mazsize, "%lld", num);
1469 if(strcmp(buf, expected_out) != 0)
1470 exit(1);
1471 exit(0);
1472}
1473#else
1474main() { exit(0); }
1475#endif
1476 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1477 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001478fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001479AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001480
Damien Miller78315eb2000-09-29 23:01:36 +11001481dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001482OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1483OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1484OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1485OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1486OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001487OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001488OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1489OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001490OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001491OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1492OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1493OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1494OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001495OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1496OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1497OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1498OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001499
1500AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001501
Damien Miller61e50f12000-05-08 20:49:37 +10001502AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1503 ac_cv_have_ss_family_in_struct_ss, [
1504 AC_TRY_COMPILE(
1505 [
Damien Miller81171112000-04-23 11:14:01 +10001506#include <sys/types.h>
1507#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001508 ],
1509 [ struct sockaddr_storage s; s.ss_family = 1; ],
1510 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1511 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1512 )
1513])
1514if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1515 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1516fi
1517
Damien Miller61e50f12000-05-08 20:49:37 +10001518AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1519 ac_cv_have___ss_family_in_struct_ss, [
1520 AC_TRY_COMPILE(
1521 [
Damien Miller81171112000-04-23 11:14:01 +10001522#include <sys/types.h>
1523#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001524 ],
1525 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1526 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1527 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1528 )
1529])
1530if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1531 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1532fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001533
Damien Millerad833b32000-08-23 10:46:23 +10001534AC_CACHE_CHECK([for pw_class field in struct passwd],
1535 ac_cv_have_pw_class_in_struct_passwd, [
1536 AC_TRY_COMPILE(
1537 [
Damien Millerad833b32000-08-23 10:46:23 +10001538#include <pwd.h>
1539 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001540 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001541 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1542 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1543 )
1544])
1545if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1546 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1547fi
1548
Kevin Steves82456952001-06-22 21:14:18 +00001549AC_CACHE_CHECK([for pw_expire field in struct passwd],
1550 ac_cv_have_pw_expire_in_struct_passwd, [
1551 AC_TRY_COMPILE(
1552 [
1553#include <pwd.h>
1554 ],
1555 [ struct passwd p; p.pw_expire = 0; ],
1556 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1557 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1558 )
1559])
1560if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1561 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1562fi
1563
1564AC_CACHE_CHECK([for pw_change field in struct passwd],
1565 ac_cv_have_pw_change_in_struct_passwd, [
1566 AC_TRY_COMPILE(
1567 [
1568#include <pwd.h>
1569 ],
1570 [ struct passwd p; p.pw_change = 0; ],
1571 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1572 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1573 )
1574])
1575if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1576 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1577fi
Damien Miller61e50f12000-05-08 20:49:37 +10001578
Kevin Steves939c9db2002-03-22 17:23:25 +00001579AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1580 ac_cv_have_accrights_in_msghdr, [
1581 AC_TRY_COMPILE(
1582 [
1583#include <sys/socket.h>
1584#include <sys/uio.h>
1585 ],
1586 [ struct msghdr m; m.msg_accrights = 0; ],
1587 [ ac_cv_have_accrights_in_msghdr="yes" ],
1588 [ ac_cv_have_accrights_in_msghdr="no" ]
1589 )
1590])
1591if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1592 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1593fi
1594
Kevin Stevesa44e0352002-04-07 16:18:03 +00001595AC_CACHE_CHECK([for msg_control field in struct msghdr],
1596 ac_cv_have_control_in_msghdr, [
1597 AC_TRY_COMPILE(
1598 [
1599#include <sys/socket.h>
1600#include <sys/uio.h>
1601 ],
1602 [ struct msghdr m; m.msg_control = 0; ],
1603 [ ac_cv_have_control_in_msghdr="yes" ],
1604 [ ac_cv_have_control_in_msghdr="no" ]
1605 )
1606])
1607if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1608 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1609fi
1610
Damien Miller61e50f12000-05-08 20:49:37 +10001611AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1612 AC_TRY_LINK([],
1613 [ extern char *__progname; printf("%s", __progname); ],
1614 [ ac_cv_libc_defines___progname="yes" ],
1615 [ ac_cv_libc_defines___progname="no" ]
1616 )
1617])
1618if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1619 AC_DEFINE(HAVE___PROGNAME)
1620fi
1621
Kevin Steves4846f4a2002-03-22 18:19:53 +00001622AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1623 AC_TRY_LINK([
1624#include <stdio.h>
1625],
1626 [ printf("%s", __FUNCTION__); ],
1627 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1628 [ ac_cv_cc_implements___FUNCTION__="no" ]
1629 )
1630])
1631if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1632 AC_DEFINE(HAVE___FUNCTION__)
1633fi
1634
1635AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1636 AC_TRY_LINK([
1637#include <stdio.h>
1638],
1639 [ printf("%s", __func__); ],
1640 [ ac_cv_cc_implements___func__="yes" ],
1641 [ ac_cv_cc_implements___func__="no" ]
1642 )
1643])
1644if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1645 AC_DEFINE(HAVE___func__)
1646fi
1647
Damien Miller4f8e6692001-07-14 13:22:53 +10001648AC_CACHE_CHECK([whether getopt has optreset support],
1649 ac_cv_have_getopt_optreset, [
1650 AC_TRY_LINK(
1651 [
1652#include <getopt.h>
1653 ],
1654 [ extern int optreset; optreset = 0; ],
1655 [ ac_cv_have_getopt_optreset="yes" ],
1656 [ ac_cv_have_getopt_optreset="no" ]
1657 )
1658])
1659if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1660 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1661fi
Damien Millera22ba012000-03-02 23:09:20 +11001662
Damien Millerecbb26d2000-07-15 14:59:14 +10001663AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1664 AC_TRY_LINK([],
1665 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1666 [ ac_cv_libc_defines_sys_errlist="yes" ],
1667 [ ac_cv_libc_defines_sys_errlist="no" ]
1668 )
1669])
1670if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1671 AC_DEFINE(HAVE_SYS_ERRLIST)
1672fi
1673
1674
Damien Miller11fa2cc2000-08-16 10:35:58 +10001675AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1676 AC_TRY_LINK([],
1677 [ extern int sys_nerr; printf("%i", sys_nerr);],
1678 [ ac_cv_libc_defines_sys_nerr="yes" ],
1679 [ ac_cv_libc_defines_sys_nerr="no" ]
1680 )
1681])
1682if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1683 AC_DEFINE(HAVE_SYS_NERR)
1684fi
1685
Damien Miller85de5802001-09-18 14:01:11 +10001686SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001687
1688# Check whether user wants sectok support
1689AC_ARG_WITH(sectok,
1690 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001691 [
1692 if test "x$withval" != "xno" ; then
1693 if test "x$withval" != "xyes" ; then
1694 CPPFLAGS="$CPPFLAGS -I${withval}"
1695 LDFLAGS="$LDFLAGS -L${withval}"
1696 if test ! -z "$need_dash_r" ; then
1697 LDFLAGS="$LDFLAGS -R${withval}"
1698 fi
1699 if test ! -z "$blibpath" ; then
1700 blibpath="$blibpath:${withval}"
1701 fi
1702 fi
1703 AC_CHECK_HEADERS(sectok.h)
1704 if test "$ac_cv_header_sectok_h" != yes; then
1705 AC_MSG_ERROR(Can't find sectok.h)
1706 fi
1707 AC_CHECK_LIB(sectok, sectok_open)
1708 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1709 AC_MSG_ERROR(Can't find libsectok)
1710 fi
1711 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001712 AC_DEFINE(USE_SECTOK)
1713 SCARD_MSG="yes, using sectok"
1714 fi
1715 ]
1716)
1717
1718# Check whether user wants OpenSC support
1719AC_ARG_WITH(opensc,
1720 [ --with-opensc Enable smartcard support using OpenSC],
1721 [
1722 if test "x$withval" != "xno" ; then
1723 if test "x$withval" != "xyes" ; then
1724 CPPFLAGS="$CPPFLAGS -I${withval}"
1725 LDFLAGS="$LDFLAGS -L${withval}"
1726 if test ! -z "$need_dash_r" ; then
1727 LDFLAGS="$LDFLAGS -R${withval}"
1728 fi
1729 if test ! -z "$blibpath" ; then
1730 blibpath="$blibpath:${withval}"
1731 fi
1732 fi
1733 AC_CHECK_HEADERS(opensc-pkcs15.h)
1734 if test "$ac_cv_header_opensc_pkcs15_h" != yes; then
1735 AC_MSG_ERROR(Can't find opensc-pkcs15.h)
1736 fi
1737 AC_CHECK_LIB(opensc, sc_pkcs15_bind)
1738 if test "$ac_cv_lib_opensc_sc_pkcs15_bind" != yes; then
1739 AC_MSG_ERROR(Can't find libopensc)
1740 fi
1741 AC_DEFINE(SMARTCARD)
1742 AC_DEFINE(USE_OPENSC)
1743 SCARD_MSG="yes, using OpenSC"
Damien Miller85de5802001-09-18 14:01:11 +10001744 fi
1745 ]
1746)
1747
1748# Check whether user wants Kerberos support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001749KRB4_MSG="no"
1750AC_ARG_WITH(kerberos4,
1751 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1752 [
1753 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001754 if test "x$withval" != "xyes" ; then
1755 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1756 LDFLAGS="$LDFLAGS -L${withval}/lib"
1757 if test ! -z "$need_dash_r" ; then
1758 LDFLAGS="$LDFLAGS -R${withval}/lib"
1759 fi
1760 if test ! -z "$blibpath" ; then
1761 blibpath="$blibpath:${withval}/lib"
1762 fi
1763 else
1764 if test -d /usr/include/kerberosIV ; then
1765 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1766 fi
1767 fi
1768
1769 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001770 if test "$ac_cv_header_krb_h" != yes; then
1771 AC_MSG_WARN([Cannot find krb.h, build may fail])
1772 fi
Damien Miller98344742001-03-28 14:37:06 +10001773 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001774 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001775 AC_CHECK_LIB(krb4, main)
1776 if test "$ac_cv_lib_krb4_main" != yes; then
1777 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1778 else
1779 KLIBS="-lkrb4"
1780 fi
1781 else
1782 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001783 fi
Damien Miller98344742001-03-28 14:37:06 +10001784 AC_CHECK_LIB(des, des_cbc_encrypt)
1785 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1786 AC_CHECK_LIB(des425, des_cbc_encrypt)
1787 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1788 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1789 else
1790 KLIBS="-ldes425"
1791 fi
1792 else
1793 KLIBS="-ldes"
1794 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001795 AC_CHECK_LIB(resolv, dn_expand, , )
1796 KRB4=yes
1797 KRB4_MSG="yes"
1798 AC_DEFINE(KRB4)
1799 fi
1800 ]
1801)
1802
1803# Check whether user wants AFS support
1804AFS_MSG="no"
1805AC_ARG_WITH(afs,
1806 [ --with-afs=PATH Enable AFS support],
1807 [
1808 if test "x$withval" != "xno" ; then
1809
1810 if test "x$withval" != "xyes" ; then
1811 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1812 LDFLAGS="$LDFLAGS -L${withval}/lib"
1813 fi
1814
1815 if test -z "$KRB4" ; then
1816 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1817 fi
1818
1819 LIBS="-lkafs $LIBS"
1820 if test ! -z "$AFS_LIBS" ; then
1821 LIBS="$LIBS $AFS_LIBS"
1822 fi
1823 AC_DEFINE(AFS)
1824 AFS_MSG="yes"
1825 fi
1826 ]
1827)
1828LIBS="$LIBS $KLIBS"
1829
Damien Millera22ba012000-03-02 23:09:20 +11001830# Looking for programs, paths and files
1831AC_ARG_WITH(rsh,
1832 [ --with-rsh=PATH Specify path to remote shell program ],
1833 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001834 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001835 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001836 fi
1837 ],
1838 [
1839 AC_PATH_PROG(rsh_path, rsh)
1840 ]
1841)
1842
1843AC_ARG_WITH(xauth,
1844 [ --with-xauth=PATH Specify path to xauth program ],
1845 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001846 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001847 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001848 fi
1849 ],
1850 [
Damien Miller78315eb2000-09-29 23:01:36 +11001851 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 +10001852 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001853 xauth_path="/usr/openwin/bin/xauth"
1854 fi
1855 ]
1856)
1857
Damien Millera19cf472000-11-29 13:28:50 +11001858if test -z "$xauth_path" ; then
1859 XAUTH_PATH="undefined"
1860 AC_SUBST(XAUTH_PATH)
1861else
Damien Millera22ba012000-03-02 23:09:20 +11001862 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001863 XAUTH_PATH=$xauth_path
1864 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001865fi
1866if test ! -z "$rsh_path" ; then
1867 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1868fi
1869
1870# Check for mail directory (last resort if we cannot get it from headers)
1871if test ! -z "$MAIL" ; then
1872 maildir=`dirname $MAIL`
1873 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1874fi
1875
Damien Millera22ba012000-03-02 23:09:20 +11001876if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +11001877 AC_CHECK_FILE("/dev/ptmx",
1878 [
1879 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1880 have_dev_ptmx=1
1881 ]
1882 )
Damien Millera22ba012000-03-02 23:09:20 +11001883fi
Damien Miller204ad072000-03-02 23:56:12 +11001884AC_CHECK_FILE("/dev/ptc",
1885 [
1886 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1887 have_dev_ptc=1
1888 ]
1889)
1890
Damien Millera22ba012000-03-02 23:09:20 +11001891# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001892AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001893 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001894 [
Damien Miller897741e2001-04-16 10:41:46 +10001895 case "$withval" in
1896 man|cat|doc)
1897 MANTYPE=$withval
1898 ;;
1899 *)
1900 AC_MSG_ERROR(invalid man type: $withval)
1901 ;;
1902 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001903 ]
1904)
Ben Lindstrombc709922001-04-18 18:04:21 +00001905if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001906 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001907 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1908 MANTYPE=doc
1909 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1910 MANTYPE=man
1911 else
1912 MANTYPE=cat
1913 fi
1914fi
Damien Miller670a4b82000-01-22 13:53:11 +11001915AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001916if test "$MANTYPE" = "doc"; then
1917 mansubdir=man;
1918else
1919 mansubdir=$MANTYPE;
1920fi
1921AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001922
Damien Millera22ba012000-03-02 23:09:20 +11001923# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001924MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001925AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001926 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001927 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001928 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001929 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001930 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001931 fi
1932 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001933)
1934
Damien Millera22ba012000-03-02 23:09:20 +11001935# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001936AC_ARG_WITH(shadow,
1937 [ --without-shadow Disable shadow password support],
1938 [
1939 if test "x$withval" = "xno" ; then
1940 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001941 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001942 fi
1943 ]
1944)
1945
Damien Miller1f335fb2000-06-26 11:31:33 +10001946if test -z "$disable_shadow" ; then
1947 AC_MSG_CHECKING([if the systems has expire shadow information])
1948 AC_TRY_COMPILE(
1949 [
1950#include <sys/types.h>
1951#include <shadow.h>
1952 struct spwd sp;
1953 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1954 [ sp_expire_available=yes ], []
1955 )
1956
1957 if test "x$sp_expire_available" = "xyes" ; then
1958 AC_MSG_RESULT(yes)
1959 AC_DEFINE(HAS_SHADOW_EXPIRE)
1960 else
1961 AC_MSG_RESULT(no)
1962 fi
1963fi
1964
Damien Millera22ba012000-03-02 23:09:20 +11001965# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001966if test ! -z "$IPADDR_IN_DISPLAY" ; then
1967 DISPLAY_HACK_MSG="yes"
1968 AC_DEFINE(IPADDR_IN_DISPLAY)
1969else
1970 DISPLAY_HACK_MSG="no"
1971 AC_ARG_WITH(ipaddr-display,
1972 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1973 [
1974 if test "x$withval" != "xno" ; then
1975 AC_DEFINE(IPADDR_IN_DISPLAY)
1976 DISPLAY_HACK_MSG="yes"
1977 fi
1978 ]
1979 )
1980fi
Damien Miller76112de1999-12-21 11:18:08 +11001981
Damien Millera22ba012000-03-02 23:09:20 +11001982# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001983SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001984AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11001985 [ --with-default-path=PATH Specify default \$PATH environment for server],
1986 [
1987 if test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001988 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001989 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001990 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001991 ],
1992 [
1993 AC_TRY_RUN(
1994 [
1995/* find out what STDPATH is */
1996#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001997#ifdef HAVE_PATHS_H
1998# include <paths.h>
1999#endif
2000#ifndef _PATH_STDPATH
2001# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2002#endif
2003#include <sys/types.h>
2004#include <sys/stat.h>
2005#include <fcntl.h>
2006#define DATA "conftest.stdpath"
2007
2008main()
2009{
2010 FILE *fd;
2011 int rc;
2012
2013 fd = fopen(DATA,"w");
2014 if(fd == NULL)
2015 exit(1);
2016
2017 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2018 exit(1);
2019
2020 exit(0);
2021}
2022 ], [ user_path=`cat conftest.stdpath` ],
2023 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2024 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2025 )
2026# make sure $bindir is in USER_PATH so scp will work
2027 t_bindir=`eval echo ${bindir}`
2028 case $t_bindir in
2029 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2030 esac
2031 case $t_bindir in
2032 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2033 esac
2034 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2035 if test $? -ne 0 ; then
2036 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2037 if test $? -ne 0 ; then
2038 user_path=$user_path:$t_bindir
2039 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2040 fi
2041 fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002042 ]
2043)
Tim Rice59ea0a02001-03-10 13:50:45 -08002044AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2045AC_SUBST(user_path)
Damien Miller5a3e6831999-12-27 09:48:56 +11002046
Damien Millera22ba012000-03-02 23:09:20 +11002047# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002048IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002049AC_ARG_WITH(ipv4-default,
2050 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2051 [
2052 if test "x$withval" != "xno" ; then
2053 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002054 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002055 fi
2056 ]
2057)
2058
Damien Miller61e50f12000-05-08 20:49:37 +10002059AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002060IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002061AC_ARG_WITH(4in6,
2062 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2063 [
2064 if test "x$withval" != "xno" ; then
2065 AC_MSG_RESULT(yes)
2066 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002067 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002068 else
2069 AC_MSG_RESULT(no)
2070 fi
2071 ],[
2072 if test "x$inet6_default_4in6" = "xyes"; then
2073 AC_MSG_RESULT([yes (default)])
2074 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002075 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002076 else
2077 AC_MSG_RESULT([no (default)])
2078 fi
2079 ]
2080)
2081
Damien Miller60396b02001-02-18 17:01:00 +11002082# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002083BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002084AC_ARG_WITH(bsd-auth,
2085 [ --with-bsd-auth Enable BSD auth support],
2086 [
2087 if test "x$withval" != "xno" ; then
2088 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002089 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002090 fi
2091 ]
2092)
2093
Damien Miller78315eb2000-09-29 23:01:36 +11002094AC_MSG_CHECKING(whether to install ssh as suid root)
2095AC_ARG_ENABLE(suid-ssh,
2096[ --enable-suid-ssh Install ssh as suid root (default)
2097 --disable-suid-ssh Install ssh without suid bit],
2098[ case "$enableval" in
2099 no)
2100 AC_MSG_RESULT(no)
2101 SSHMODE=0711
2102 ;;
2103 *) AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00002104 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11002105 ;;
2106 esac ],
2107 AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00002108 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11002109)
2110AC_SUBST(SSHMODE)
2111
2112
Damien Millera22ba012000-03-02 23:09:20 +11002113# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002114piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002115# make sure the directory exists
2116if test ! -d $piddir ; then
2117 piddir=`eval echo ${sysconfdir}`
2118 case $piddir in
2119 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2120 esac
2121fi
2122
Tim Rice88f2ab52002-03-17 12:17:34 -08002123AC_ARG_WITH(pid-dir,
2124 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2125 [
2126 if test "x$withval" != "xno" ; then
2127 piddir=$withval
2128 if test ! -d $piddir ; then
2129 AC_MSG_WARN([** no $piddir directory on this system **])
2130 fi
2131 fi
2132 ]
2133)
2134
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002135AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002136AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002137
andre2ff7b5d2000-06-03 14:57:40 +00002138dnl allow user to disable some login recording features
2139AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002140 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002141 [ AC_DEFINE(DISABLE_LASTLOG) ]
2142)
2143AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002144 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002145 [ AC_DEFINE(DISABLE_UTMP) ]
2146)
2147AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002148 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002149 [ AC_DEFINE(DISABLE_UTMPX) ]
2150)
2151AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002152 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002153 [ AC_DEFINE(DISABLE_WTMP) ]
2154)
2155AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002156 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002157 [ AC_DEFINE(DISABLE_WTMPX) ]
2158)
2159AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002160 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002161 [ AC_DEFINE(DISABLE_LOGIN) ]
2162)
2163AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002164 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002165 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2166)
2167AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002168 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002169 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2170)
2171AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002172 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002173 [
2174 if test "x$withval" = "xno" ; then
2175 AC_DEFINE(DISABLE_LASTLOG)
2176 else
2177 conf_lastlog_location=$withval
2178 fi
2179 ]
2180)
andre2ff7b5d2000-06-03 14:57:40 +00002181
2182dnl lastlog, [uw]tmpx? detection
2183dnl NOTE: set the paths in the platform section to avoid the
2184dnl need for command-line parameters
2185dnl lastlog and [uw]tmp are subject to a file search if all else fails
2186
2187dnl lastlog detection
2188dnl NOTE: the code itself will detect if lastlog is a directory
2189AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2190AC_TRY_COMPILE([
2191#include <sys/types.h>
2192#include <utmp.h>
2193#ifdef HAVE_LASTLOG_H
2194# include <lastlog.h>
2195#endif
Damien Miller2994e082000-06-04 15:51:47 +10002196#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002197# include <paths.h>
2198#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002199#ifdef HAVE_LOGIN_H
2200# include <login.h>
2201#endif
andre2ff7b5d2000-06-03 14:57:40 +00002202 ],
2203 [ char *lastlog = LASTLOG_FILE; ],
2204 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002205 [
2206 AC_MSG_RESULT(no)
2207 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2208 AC_TRY_COMPILE([
2209#include <sys/types.h>
2210#include <utmp.h>
2211#ifdef HAVE_LASTLOG_H
2212# include <lastlog.h>
2213#endif
2214#ifdef HAVE_PATHS_H
2215# include <paths.h>
2216#endif
2217 ],
2218 [ char *lastlog = _PATH_LASTLOG; ],
2219 [ AC_MSG_RESULT(yes) ],
2220 [
andree441aa32000-06-12 22:34:38 +00002221 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002222 system_lastlog_path=no
2223 ])
2224 ]
andre2ff7b5d2000-06-03 14:57:40 +00002225)
Damien Miller2994e082000-06-04 15:51:47 +10002226
andre2ff7b5d2000-06-03 14:57:40 +00002227if test -z "$conf_lastlog_location"; then
2228 if test x"$system_lastlog_path" = x"no" ; then
2229 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002230 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002231 conf_lastlog_location=$f
2232 fi
2233 done
2234 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002235 AC_MSG_WARN([** Cannot find lastlog **])
2236 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002237 fi
2238 fi
2239fi
2240
2241if test -n "$conf_lastlog_location"; then
2242 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2243fi
2244
2245dnl utmp detection
2246AC_MSG_CHECKING([if your system defines UTMP_FILE])
2247AC_TRY_COMPILE([
2248#include <sys/types.h>
2249#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002250#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002251# include <paths.h>
2252#endif
2253 ],
2254 [ char *utmp = UTMP_FILE; ],
2255 [ AC_MSG_RESULT(yes) ],
2256 [ AC_MSG_RESULT(no)
2257 system_utmp_path=no ]
2258)
2259if test -z "$conf_utmp_location"; then
2260 if test x"$system_utmp_path" = x"no" ; then
2261 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2262 if test -f $f ; then
2263 conf_utmp_location=$f
2264 fi
2265 done
2266 if test -z "$conf_utmp_location"; then
2267 AC_DEFINE(DISABLE_UTMP)
2268 fi
2269 fi
2270fi
2271if test -n "$conf_utmp_location"; then
2272 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2273fi
2274
2275dnl wtmp detection
2276AC_MSG_CHECKING([if your system defines WTMP_FILE])
2277AC_TRY_COMPILE([
2278#include <sys/types.h>
2279#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002280#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002281# include <paths.h>
2282#endif
2283 ],
2284 [ char *wtmp = WTMP_FILE; ],
2285 [ AC_MSG_RESULT(yes) ],
2286 [ AC_MSG_RESULT(no)
2287 system_wtmp_path=no ]
2288)
2289if test -z "$conf_wtmp_location"; then
2290 if test x"$system_wtmp_path" = x"no" ; then
2291 for f in /usr/adm/wtmp /var/log/wtmp; do
2292 if test -f $f ; then
2293 conf_wtmp_location=$f
2294 fi
2295 done
2296 if test -z "$conf_wtmp_location"; then
2297 AC_DEFINE(DISABLE_WTMP)
2298 fi
2299 fi
2300fi
2301if test -n "$conf_wtmp_location"; then
2302 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2303fi
2304
2305
2306dnl utmpx detection - I don't know any system so perverse as to require
2307dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2308dnl there, though.
2309AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2310AC_TRY_COMPILE([
2311#include <sys/types.h>
2312#include <utmp.h>
2313#ifdef HAVE_UTMPX_H
2314#include <utmpx.h>
2315#endif
Damien Miller2994e082000-06-04 15:51:47 +10002316#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002317# include <paths.h>
2318#endif
2319 ],
2320 [ char *utmpx = UTMPX_FILE; ],
2321 [ AC_MSG_RESULT(yes) ],
2322 [ AC_MSG_RESULT(no)
2323 system_utmpx_path=no ]
2324)
2325if test -z "$conf_utmpx_location"; then
2326 if test x"$system_utmpx_path" = x"no" ; then
2327 AC_DEFINE(DISABLE_UTMPX)
2328 fi
2329else
2330 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2331fi
2332
2333dnl wtmpx detection
2334AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2335AC_TRY_COMPILE([
2336#include <sys/types.h>
2337#include <utmp.h>
2338#ifdef HAVE_UTMPX_H
2339#include <utmpx.h>
2340#endif
Damien Miller2994e082000-06-04 15:51:47 +10002341#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002342# include <paths.h>
2343#endif
2344 ],
2345 [ char *wtmpx = WTMPX_FILE; ],
2346 [ AC_MSG_RESULT(yes) ],
2347 [ AC_MSG_RESULT(no)
2348 system_wtmpx_path=no ]
2349)
2350if test -z "$conf_wtmpx_location"; then
2351 if test x"$system_wtmpx_path" = x"no" ; then
2352 AC_DEFINE(DISABLE_WTMPX)
2353 fi
2354else
2355 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2356fi
2357
Damien Miller4018c192000-04-30 09:30:44 +10002358
Damien Miller29ea30d2000-03-17 10:54:15 +11002359if test ! -z "$blibpath" ; then
2360 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2361 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2362fi
2363
Tim Rice4cec93f2002-02-26 08:40:48 -08002364dnl remove pam and dl because they are in $LIBPAM
2365if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002366 LIBS=`echo $LIBS | sed 's/-lpam //'`
2367fi
2368if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2369 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002370fi
2371
Damien Millerbac2d8a2000-09-05 16:13:06 +11002372AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002373AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2374AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002375
Damien Miller7b22d652000-06-18 14:07:04 +10002376# Print summary of options
2377
Damien Miller7b22d652000-06-18 14:07:04 +10002378# Someone please show me a better way :)
2379A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2380B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2381C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2382D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002383E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002384F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002385G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Tim Rice59ea0a02001-03-10 13:50:45 -08002386H=`eval echo ${user_path}` ; H=`eval echo ${H}`
Damien Miller7b22d652000-06-18 14:07:04 +10002387
2388echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002389echo "OpenSSH has been configured with the following options:"
Damien Miller7b22d652000-06-18 14:07:04 +10002390echo " User binaries: $B"
2391echo " System binaries: $C"
2392echo " Configuration files: $D"
2393echo " Askpass program: $E"
2394echo " Manual pages: $F"
2395echo " PID file: $G"
Tim Rice59ea0a02001-03-10 13:50:45 -08002396echo " sshd default user PATH: $H"
Damien Miller897741e2001-04-16 10:41:46 +10002397echo " Manpage format: $MANTYPE"
Damien Miller7b22d652000-06-18 14:07:04 +10002398echo " PAM support: ${PAM_MSG}"
2399echo " KerberosIV support: $KRB4_MSG"
Damien Miller85de5802001-09-18 14:01:11 +10002400echo " Smartcard support: $SCARD_MSG"
Damien Miller7b22d652000-06-18 14:07:04 +10002401echo " AFS support: $AFS_MSG"
2402echo " S/KEY support: $SKEY_MSG"
2403echo " TCP Wrappers support: $TCPW_MSG"
2404echo " MD5 password support: $MD5_MSG"
2405echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2406echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2407echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002408echo " BSD Auth support: $BSD_AUTH_MSG"
2409echo " Random number source: $RAND_MSG"
2410if test ! -z "$USE_RAND_HELPER" ; then
2411 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002412fi
2413
Damien Miller7b22d652000-06-18 14:07:04 +10002414echo ""
2415
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002416echo " Host: ${host}"
2417echo " Compiler: ${CC}"
2418echo " Compiler flags: ${CFLAGS}"
2419echo "Preprocessor flags: ${CPPFLAGS}"
2420echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002421echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002422
2423echo ""
2424
Damien Miller82cf0ce2000-12-20 13:34:48 +11002425if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002426 echo "PAM is enabled. You may need to install a PAM control file "
2427 echo "for sshd, otherwise password authentication may fail. "
2428 echo "Example PAM control files can be found in the contrib/ "
2429 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002430 echo ""
2431fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002432
2433if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002434 echo "sftp-server will be disabled. Your compiler does not "
2435 echo "support 64bit integers."
2436 echo ""
2437fi
2438
2439if test ! -z "$RAND_HELPER_CMDHASH" ; then
2440 echo "WARNING: you are using the builtin random number collection "
2441 echo "service. Please read WARNING.RNG and request that your OS "
2442 echo "vendor includes kernel-based random number collection in "
2443 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002444 echo ""
2445fi
Damien Miller60396b02001-02-18 17:01:00 +11002446