blob: f4ec16a00ccfbb3bc7858612478dde4b594c1abd [file] [log] [blame]
Damien Millerf1b9d112002-04-23 23:09:19 +10001# $Id: configure.ac,v 1.50 2002/04/23 13:09:19 djm 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)
Damien Millerf5fea442002-04-23 22:52:45 +100064 AC_DEFINE(BROKEN_REALPATH)
andre60f3c982000-06-03 16:18:19 +000065 dnl AIX handles lastlog as part of its login message
66 AC_DEFINE(DISABLE_LASTLOG)
Damien Miller75b1d102000-01-07 14:01:41 +110067 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110068*-*-cygwin*)
Tim Ricefe1d1002001-11-26 17:19:43 -080069 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110070 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +000071 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +110072 AC_DEFINE(DISABLE_SHADOW)
73 AC_DEFINE(IPV4_DEFAULT)
74 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +000075 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Damien Millerbac2d8a2000-09-05 16:13:06 +110076 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000077*-*-dgux*)
78 AC_DEFINE(IP_TOS_IS_BROKEN)
79 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +000080*-*-darwin*)
81 AC_DEFINE(BROKEN_GETADDRINFO)
82 ;;
Damien Miller76112de1999-12-21 11:18:08 +110083*-*-hpux10*)
84 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +100085 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +110086 fi
Kevin Steves315f8b72001-06-28 00:24:41 +000087 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +110088 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +100089 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110090 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110091 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000092 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves315f8b72001-06-28 00:24:41 +000093 LIBS="$LIBS -lxnet -lsec"
Damien Miller76112de1999-12-21 11:18:08 +110094 ;;
Damien Miller1bead332000-04-30 00:47:29 +100095*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +000096 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +110097 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +110098 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +110099 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100100 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100101 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000102 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000103 LIBS="$LIBS -lxnet -lsec"
Damien Miller1bead332000-04-30 00:47:29 +1000104 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100105*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000106 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000107 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100108 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000109 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000110 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller1808f382000-01-06 12:03:12 +1100111 ;;
112*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000113 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000114 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100115 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000116 AC_DEFINE(WITH_IRIX_ARRAY)
117 AC_DEFINE(WITH_IRIX_PROJECT)
118 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000119 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000120 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000121 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100122 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100123*-*-linux*)
124 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100125 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100126 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000127 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100128 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100129 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000130mips-sony-bsd|mips-sony-newsos4)
131 AC_DEFINE(HAVE_NEWS4)
132 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000133 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100134*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100135 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100136 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100137*-*-freebsd*)
138 check_for_libcrypt_later=1
139 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000140*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000141 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100142 conf_utmp_location=/etc/utmp
143 conf_wtmp_location=/usr/adm/wtmp
144 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000145 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000146 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000147 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100148 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000149 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000150 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000151 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100152*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000153 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000154 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100155 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100156 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000157 AC_DEFINE(LOGIN_NEEDS_UTMPX)
158 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000159 AC_DEFINE(PAM_TTY_KLUDGE)
andre2ff7b5d2000-06-03 14:57:40 +0000160 # hardwire lastlog location (can't detect it on some versions)
161 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000162 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
163 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
164 if test "$sol2ver" -ge 8; then
165 AC_MSG_RESULT(yes)
166 AC_DEFINE(DISABLE_UTMP)
167 AC_DEFINE(DISABLE_WTMP)
168 else
169 AC_MSG_RESULT(no)
170 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100171 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000172*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000173 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000174 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100175 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000176 conf_utmp_location=/etc/utmp
177 conf_wtmp_location=/var/adm/wtmp
178 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000179 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000180 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000181*-ncr-sysv*)
182 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
183 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700184 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000185 AC_DEFINE(USE_PIPES)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000186 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000187*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000188 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700189 # /usr/ucblib MUST NOT be searched on ReliantUNIX
190 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100191 IPADDR_IN_DISPLAY=yes
192 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000193 AC_DEFINE(IP_TOS_IS_BROKEN)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700194 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
195 # Attention: always take care to bind libsocket and libnsl before libc,
196 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000197 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100198*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000199 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100200 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Ricea4f7ae12001-09-17 14:34:33 -0700201# enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100202 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100203 ;;
204*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000205 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100206 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Ricea4f7ae12001-09-17 14:34:33 -0700207# enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100208 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100209 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100210*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000211 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100212 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100213 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100214*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000215 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100216 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700217 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller78315eb2000-09-29 23:01:36 +1100218 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100219 RANLIB=true
220 no_dev_ptmx=1
221 AC_DEFINE(BROKEN_SYS_TERMIO_H)
222 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100223 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000224 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100225 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100226 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700227 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700228 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100229 ;;
230*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000231 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000232 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100233 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000234 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100235 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100236 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100237 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000238 AC_DEFINE(DISABLE_SHADOW)
Damien Miller217f5672001-02-16 12:12:41 +1100239 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700240 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000241 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000242*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700243 no_libsocket=1
244 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000245 AC_DEFINE(USE_PIPES)
Tim Ricee991e3c2001-08-07 15:29:07 -0700246 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
247 LIBS="$LIBS -lgen -lrsc"
248 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000249*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000250 AC_MSG_CHECKING(for Digital Unix SIA)
251 no_osfsia=""
252 AC_ARG_WITH(osfsia,
253 [ --with-osfsia Enable Digital Unix SIA],
254 [
255 if test "x$withval" = "xno" ; then
256 AC_MSG_RESULT(disabled)
257 no_osfsia=1
258 fi
259 ],
260 )
261 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000262 if test -f /etc/sia/matrix.conf; then
263 AC_MSG_RESULT(yes)
264 AC_DEFINE(HAVE_OSF_SIA)
265 AC_DEFINE(DISABLE_LOGIN)
266 LIBS="$LIBS -lsecurity -ldb -lm -laud"
267 else
268 AC_MSG_RESULT(no)
269 fi
270 fi
271 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000272
273*-*-nto-qnx)
274 AC_DEFINE(USE_PIPES)
275 AC_DEFINE(NO_X11_UNIX_SOCKETS)
276 AC_DEFINE(MISSING_NFDBITS)
277 AC_DEFINE(MISSING_HOWMANY)
278 AC_DEFINE(MISSING_FD_MASK)
279 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100280esac
281
Damien Millere37bfc12000-06-05 09:37:43 +1000282# Allow user to specify flags
283AC_ARG_WITH(cflags,
284 [ --with-cflags Specify additional flags to pass to compiler],
285 [
286 if test "x$withval" != "xno" ; then
287 CFLAGS="$CFLAGS $withval"
288 fi
289 ]
290)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000291AC_ARG_WITH(cppflags,
292 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
293 [
294 if test "x$withval" != "xno"; then
295 CPPFLAGS="$CPPFLAGS $withval"
296 fi
297 ]
298)
Damien Millere37bfc12000-06-05 09:37:43 +1000299AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000300 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000301 [
302 if test "x$withval" != "xno" ; then
303 LDFLAGS="$LDFLAGS $withval"
304 fi
305 ]
306)
307AC_ARG_WITH(libs,
308 [ --with-libs Specify additional libraries to link with],
309 [
310 if test "x$withval" != "xno" ; then
311 LIBS="$LIBS $withval"
312 fi
313 ]
314)
315
Tim Rice4cec93f2002-02-26 08:40:48 -0800316# Checks for header files.
317AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
318 getopt.h glob.h lastlog.h limits.h login.h \
319 login_cap.h maillock.h netdb.h netgroup.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000320 netinet/in_systm.h paths.h pty.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000321 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800322 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000323 sys/mman.h sys/select.h sys/stat.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800324 sys/stropts.h sys/sysmacros.h sys/time.h \
Kevin Steves117b06d2002-03-30 17:55:21 +0000325 sys/un.h time.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800326 util.h utime.h utmp.h utmpx.h)
327
Damien Millera22ba012000-03-02 23:09:20 +1100328# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700329AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
330AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000331
Damien Millerdf288022001-02-18 13:07:07 +1100332dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700333if test "x$with_tcp_wrappers" != "xno" ; then
334 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
335 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
336 fi
337fi
Damien Millerdf288022001-02-18 13:07:07 +1100338
Tim Rice13aae5e2001-10-21 17:53:58 -0700339AC_CHECK_FUNC(getspnam, ,
340 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700341
Damien Miller150c8b52002-02-13 23:06:56 +1100342AC_ARG_WITH(rpath,
343 [ --without-rpath Disable auto-added -R linker paths],
344 [
345 if test "x$withval" = "xno" ; then
346 need_dash_r=""
347 fi
348 if test "x$withval" = "xyes" ; then
349 need_dash_r=1
350 fi
351 ]
352)
353
Tim Rice13aae5e2001-10-21 17:53:58 -0700354dnl zlib is required
355AC_ARG_WITH(zlib,
356 [ --with-zlib=PATH Use zlib in PATH],
357 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000358 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100359 AC_MSG_ERROR([*** zlib is required ***])
360 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700361 if test -d "$withval/lib"; then
362 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700363 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700364 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700365 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700366 fi
367 else
368 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700369 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700370 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700371 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700372 fi
373 fi
374 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700375 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700376 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700377 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700378 fi
379 ]
380)
381
Tim Rice17b93e52001-10-23 22:36:54 -0700382AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100383
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000384dnl UnixWare 2.x
385AC_CHECK_FUNC(strcasecmp,
386 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
387)
388AC_CHECK_FUNC(utimes,
389 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
390)
Damien Millerab18c411999-11-11 10:40:23 +1100391
Tim Ricee589a292001-11-03 11:09:32 -0800392dnl Checks for libutil functions
393AC_CHECK_HEADERS(libutil.h)
394AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
395AC_CHECK_FUNCS(logout updwtmp logwtmp)
396
Ben Lindstrom8697e082001-02-24 21:41:10 +0000397AC_FUNC_STRFTIME
398
Damien Miller3c027682001-03-14 11:39:45 +1100399# Check for ALTDIRFUNC glob() extension
400AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
401AC_EGREP_CPP(FOUNDIT,
402 [
403 #include <glob.h>
404 #ifdef GLOB_ALTDIRFUNC
405 FOUNDIT
406 #endif
407 ],
408 [
409 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
410 AC_MSG_RESULT(yes)
411 ],
412 [
413 AC_MSG_RESULT(no)
414 ]
415)
Damien Millerab18c411999-11-11 10:40:23 +1100416
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000417# Check for g.gl_matchc glob() extension
418AC_MSG_CHECKING(for gl_matchc field in glob_t)
419AC_EGREP_CPP(FOUNDIT,
420 [
421 #include <glob.h>
422 int main(void){glob_t g; g.gl_matchc = 1;}
423 ],
424 [
425 AC_DEFINE(GLOB_HAS_GL_MATCHC)
426 AC_MSG_RESULT(yes)
427 ],
428 [
429 AC_MSG_RESULT(no)
430 ]
431)
432
Damien Miller18bb4732001-03-28 14:35:30 +1000433AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
434AC_TRY_RUN(
435 [
436#include <sys/types.h>
437#include <dirent.h>
438int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
439 ],
440 [AC_MSG_RESULT(yes)],
441 [
442 AC_MSG_RESULT(no)
443 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
444 ]
445)
446
Damien Millerc547bf12001-02-16 10:18:12 +1100447# Check whether user wants S/Key support
448SKEY_MSG="no"
449AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700450 [ --with-skey[[=PATH]] Enable S/Key support
451 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100452 [
453 if test "x$withval" != "xno" ; then
454
455 if test "x$withval" != "xyes" ; then
456 CPPFLAGS="$CPPFLAGS -I${withval}/include"
457 LDFLAGS="$LDFLAGS -L${withval}/lib"
458 fi
459
460 AC_DEFINE(SKEY)
461 LIBS="-lskey $LIBS"
462 SKEY_MSG="yes"
463
Tim Rice4cec93f2002-02-26 08:40:48 -0800464 AC_MSG_CHECKING([for s/key support])
465 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100466 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800467#include <stdio.h>
468#include <skey.h>
469int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
470 ],
471 [AC_MSG_RESULT(yes)],
472 [
473 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100474 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
475 ])
476 fi
477 ]
478)
479
480# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700481TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100482AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700483 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
484 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100485 [
486 if test "x$withval" != "xno" ; then
487 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700488 saved_LDFLAGS="$LDFLAGS"
489 saved_CPPFLAGS="$CPPFLAGS"
490 if test -n "${withval}" -a "${withval}" != "yes"; then
491 if test -d "${withval}/lib"; then
492 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700493 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700494 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700495 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700496 fi
497 else
498 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700499 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700500 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700501 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700502 fi
503 fi
504 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700505 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700506 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700507 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700508 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700509 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800510 LIBWRAP="-lwrap"
511 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100512 AC_MSG_CHECKING(for libwrap)
513 AC_TRY_LINK(
514 [
515#include <tcpd.h>
516 int deny_severity = 0, allow_severity = 0;
517 ],
518 [hosts_access(0);],
519 [
520 AC_MSG_RESULT(yes)
521 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800522 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700523 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100524 ],
525 [
526 AC_MSG_ERROR([*** libwrap missing])
527 ]
528 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800529 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100530 fi
531 ]
532)
533
Damien Millerad833b32000-08-23 10:46:23 +1000534dnl Checks for library functions.
Ben Lindstromfdee8ef2002-04-06 23:52:02 +0000535AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
Tim Rice13aae5e2001-10-21 17:53:58 -0700536 clock fchmod fchown freeaddrinfo futimes gai_strerror \
537 getaddrinfo getcwd getgrouplist getnameinfo getopt \
538 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
539 inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller594a71b2002-04-23 20:22:59 +1000540 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
541 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
542 setenv seteuid setlogin setproctitle setresgid setreuid setrlimit \
Kevin Stevese0f2ca42002-04-10 23:17:05 +0000543 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Tim Rice13aae5e2001-10-21 17:53:58 -0700544 strlcat strlcpy strmode strsep sysconf tcgetpgrp utimes \
545 vhangup vsnprintf waitpid __b64_ntop _getpty)
546
547dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700548AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700549 AC_CHECK_LIB(gen, dirname,[
550 AC_CACHE_CHECK([for broken dirname],
551 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700552 save_LIBS="$LIBS"
553 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700554 AC_TRY_RUN(
555 [
556#include <libgen.h>
557#include <string.h>
558
559int main(int argc, char **argv) {
560 char *s, buf[32];
561
562 strncpy(buf,"/etc", 32);
563 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700564 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700565 exit(1);
566 } else {
567 exit(0);
568 }
569}
570 ],
571 [ ac_cv_have_broken_dirname="no" ],
572 [ ac_cv_have_broken_dirname="yes" ]
573 )
Tim Rice17b93e52001-10-23 22:36:54 -0700574 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700575 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700576 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700577 LIBS="$LIBS -lgen"
578 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700579 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700580 fi
581 ])
582])
583
Damien Millerad833b32000-08-23 10:46:23 +1000584dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000585AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000586dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000587AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000588AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000589dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000590AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000591AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100592
Damien Miller5fc85652000-07-09 23:53:07 +1000593AC_CHECK_FUNC(getuserattr,
594 [AC_DEFINE(HAVE_GETUSERATTR)],
595 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
596)
597
Damien Miller04f80141999-11-19 15:32:34 +1100598AC_CHECK_FUNC(daemon,
599 [AC_DEFINE(HAVE_DAEMON)],
600 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
601)
602
Damien Miller9fb07e42000-03-05 16:22:59 +1100603AC_CHECK_FUNC(getpagesize,
604 [AC_DEFINE(HAVE_GETPAGESIZE)],
605 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
606)
607
Damien Millercb170cb2000-07-01 16:52:55 +1000608# Check for broken snprintf
609if test "x$ac_cv_func_snprintf" = "xyes" ; then
610 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
611 AC_TRY_RUN(
612 [
613#include <stdio.h>
614int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
615 ],
616 [AC_MSG_RESULT(yes)],
617 [
618 AC_MSG_RESULT(no)
619 AC_DEFINE(BROKEN_SNPRINTF)
620 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
621 ]
622 )
623fi
624
Damien Miller606f8802000-09-16 15:39:56 +1100625AC_FUNC_GETPGRP
626
Damien Millera64b57a2001-01-17 10:44:13 +1100627# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000628PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100629AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100630 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100631 [
Damien Millera64b57a2001-01-17 10:44:13 +1100632 if test "x$withval" != "xno" ; then
633 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
634 AC_MSG_ERROR([PAM headers not found])
635 fi
636
637 AC_CHECK_LIB(dl, dlopen, , )
638 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
639 AC_CHECK_FUNCS(pam_getenvlist)
640
641 disable_shadow=yes
642 PAM_MSG="yes"
643
644 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800645 if test $ac_cv_lib_dl_dlopen = yes; then
646 LIBPAM="-lpam -ldl"
647 else
648 LIBPAM="-lpam"
649 fi
650 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100651 fi
652 ]
653)
Damien Millera22ba012000-03-02 23:09:20 +1100654
Damien Millera64b57a2001-01-17 10:44:13 +1100655# Check for older PAM
656if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100657 # Check PAM strerror arguments (old PAM)
658 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
659 AC_TRY_COMPILE(
660 [
Damien Miller81171112000-04-23 11:14:01 +1000661#include <stdlib.h>
662#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100663 ],
664 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
665 [AC_MSG_RESULT(no)],
666 [
667 AC_DEFINE(HAVE_OLD_PAM)
668 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000669 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100670 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100671 )
Damien Millera22ba012000-03-02 23:09:20 +1100672fi
673
674# The big search for OpenSSL
675AC_ARG_WITH(ssl-dir,
676 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
677 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000678 if test "x$withval" != "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100679 tryssldir=$withval
680 fi
681 ]
682)
683
684saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100685saved_LDFLAGS="$LDFLAGS"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000686saved_CPPFLAGS="$CPPFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100687if test "x$prefix" != "xNONE" ; then
688 tryssldir="$tryssldir $prefix"
689fi
Damien Miller61e50f12000-05-08 20:49:37 +1000690AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera1b61e12000-09-16 17:02:16 +1100691 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
Damien Millerccdefb62001-02-19 12:56:39 +1100692 CPPFLAGS="$saved_CPPFLAGS"
693 LDFLAGS="$saved_LDFLAGS"
Damien Miller3b512e12000-05-17 23:29:18 +1000694 LIBS="$saved_LIBS -lcrypto"
Damien Millerccdefb62001-02-19 12:56:39 +1100695
696 # Skip directories if they don't exist
697 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
698 continue;
699 fi
700 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
701 # Try to use $ssldir/lib if it exists, otherwise
702 # $ssldir
703 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000704 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100705 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000706 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100707 fi
708 else
Damien Millerb68af622001-03-28 21:05:26 +1000709 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100710 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000711 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100712 fi
713 fi
714 # Try to use $ssldir/include if it exists, otherwise
715 # $ssldir
716 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000717 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100718 else
Damien Millerb68af622001-03-28 21:05:26 +1000719 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100720 fi
721 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000722
Damien Miller3b512e12000-05-17 23:29:18 +1000723 # Basic test to check for compatible version and correct linking
724 # *does not* test for RSA - that comes later.
725 AC_TRY_RUN(
726 [
Damien Millere59ce622000-05-01 20:54:17 +1000727#include <string.h>
728#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000729int main(void)
730{
Damien Miller3b512e12000-05-17 23:29:18 +1000731 char a[2048];
732 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000733 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000734 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000735}
Damien Miller3b512e12000-05-17 23:29:18 +1000736 ],
737 [
738 found_crypto=1
739 break;
740 ], []
741 )
Damien Miller61e50f12000-05-08 20:49:37 +1000742
743 if test ! -z "$found_crypto" ; then
744 break;
745 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100746 done
747
Damien Miller61e50f12000-05-08 20:49:37 +1000748 if test -z "$found_crypto" ; then
Damien Miller5dfe9762001-02-16 12:05:39 +1100749 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
Damien Millerb85dcad2000-03-11 11:37:00 +1100750 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000751 if test -z "$ssldir" ; then
752 ssldir="(system)"
753 fi
Damien Millera22ba012000-03-02 23:09:20 +1100754
Damien Miller61e50f12000-05-08 20:49:37 +1000755 ac_cv_openssldir=$ssldir
756])
757
Damien Milleredb82922000-06-20 13:25:52 +1000758if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000759 AC_DEFINE(HAVE_OPENSSL)
760 dnl Need to recover ssldir - test above runs in subshell
761 ssldir=$ac_cv_openssldir
Damien Millera64b57a2001-01-17 10:44:13 +1100762 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
Damien Millerccdefb62001-02-19 12:56:39 +1100763 # Try to use $ssldir/lib if it exists, otherwise
764 # $ssldir
765 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000766 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100767 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000768 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100769 fi
770 else
Damien Millerb68af622001-03-28 21:05:26 +1000771 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100772 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000773 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100774 fi
Damien Millera64b57a2001-01-17 10:44:13 +1100775 fi
Damien Millerccdefb62001-02-19 12:56:39 +1100776 # Try to use $ssldir/include if it exists, otherwise
777 # $ssldir
778 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000779 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100780 else
Damien Millerb68af622001-03-28 21:05:26 +1000781 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millera64b57a2001-01-17 10:44:13 +1100782 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100783 fi
Damien Millera22ba012000-03-02 23:09:20 +1100784fi
Damien Miller3b512e12000-05-17 23:29:18 +1000785LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000786
Damien Miller3b512e12000-05-17 23:29:18 +1000787# Now test RSA support
788saved_LIBS="$LIBS"
789AC_MSG_CHECKING([for RSA support])
790for WANTS_RSAREF in "" 1 ; do
791 if test -z "$WANTS_RSAREF" ; then
792 LIBS="$saved_LIBS"
793 else
794 LIBS="$saved_LIBS -lRSAglue -lrsaref"
795 fi
796 AC_TRY_RUN([
797#include <string.h>
798#include <openssl/rand.h>
799#include <openssl/rsa.h>
800#include <openssl/bn.h>
801#include <openssl/sha.h>
802int main(void)
803{
804 int num; RSA *key; static unsigned char p_in[] = "blahblah";
805 unsigned char c[256], p[256];
806 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
807 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
808 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
809 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
810}
811 ],
812 [
813 rsa_works=1
814 break;
815 ], [])
816done
Ben Lindstrom23fec142001-06-09 02:16:28 +0000817LIBS="$saved_LIBS"
Damien Miller3b512e12000-05-17 23:29:18 +1000818
819if test ! -z "$no_rsa" ; then
820 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000821 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000822else
823 if test -z "$rsa_works" ; then
824 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000825 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000826 else
827 if test -z "$WANTS_RSAREF" ; then
828 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000829 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000830 else
Damien Miller7b22d652000-06-18 14:07:04 +1000831 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000832 AC_MSG_RESULT(using RSAref)
Ben Lindstrom23fec142001-06-09 02:16:28 +0000833 LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
Damien Miller3b512e12000-05-17 23:29:18 +1000834 fi
835 fi
836fi
Damien Millera22ba012000-03-02 23:09:20 +1100837
Damien Millerec932372002-01-22 22:16:03 +1100838# Sanity check OpenSSL headers
839AC_MSG_CHECKING([whether OpenSSL's headers match the library])
840AC_TRY_RUN(
841 [
842#include <string.h>
843#include <openssl/opensslv.h>
844int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
845 ],
846 [
847 AC_MSG_RESULT(yes)
848 ],
849 [
850 AC_MSG_RESULT(no)
851 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
852 ]
853)
854
Damien Millera64b57a2001-01-17 10:44:13 +1100855# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
856# version in OpenSSL. Skip this for PAM
857if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100858 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100859fi
860
Damien Miller6c21c512002-01-22 21:57:53 +1100861
862### Configure cryptographic random number support
863
864# Check wheter OpenSSL seeds itself
865AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
866AC_TRY_RUN(
867 [
868#include <string.h>
869#include <openssl/rand.h>
870int main(void) { return(RAND_status() == 1 ? 0 : 1); }
871 ],
872 [
873 OPENSSL_SEEDS_ITSELF=yes
874 AC_MSG_RESULT(yes)
875 ],
876 [
877 AC_MSG_RESULT(no)
878 # Default to use of the rand helper if OpenSSL doesn't
879 # seed itself
880 USE_RAND_HELPER=yes
881 ]
882)
883
884
885# Do we want to force the use of the rand helper?
886AC_ARG_WITH(rand-helper,
887 [ --with-rand-helper Use subprocess to gather strong randomness ],
888 [
889 if test "x$withval" = "xno" ; then
890 # Force use of OpenSSL's internal RNG, even if
891 # the previous test showed it to be unseeded.
892 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
893 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
894 OPENSSL_SEEDS_ITSELF=yes
895 USE_RAND_HELPER=""
896 fi
897 else
898 USE_RAND_HELPER=yes
899 fi
900 ],
901)
902
903# Which randomness source do we use?
904if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
905 # OpenSSL only
906 AC_DEFINE(OPENSSL_PRNG_ONLY)
907 RAND_MSG="OpenSSL internal ONLY"
908 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800909elif test ! -z "$USE_RAND_HELPER" ; then
910 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100911 RAND_MSG="ssh-rand-helper"
912 INSTALL_SSH_RAND_HELPER="yes"
913fi
914AC_SUBST(INSTALL_SSH_RAND_HELPER)
915
916### Configuration of ssh-rand-helper
917
918# PRNGD TCP socket
919AC_ARG_WITH(prngd-port,
920 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
921 [
Damien Millere996d722002-01-23 11:20:59 +1100922 case "$withval" in
923 no)
924 withval=""
925 ;;
926 [[0-9]]*)
927 ;;
928 *)
929 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
930 ;;
931 esac
932 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100933 PRNGD_PORT="$withval"
934 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
935 fi
936 ]
937)
938
939# PRNGD Unix domain socket
940AC_ARG_WITH(prngd-socket,
941 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
942 [
Damien Millere996d722002-01-23 11:20:59 +1100943 case "$withval" in
944 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100945 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100946 ;;
947 no)
948 withval=""
949 ;;
950 /*)
951 ;;
952 *)
953 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
954 ;;
955 esac
956
957 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100958 if test ! -z "$PRNGD_PORT" ; then
959 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
960 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100961 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100962 AC_MSG_WARN(Entropy socket is not readable)
963 fi
964 PRNGD_SOCKET="$withval"
965 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
966 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800967 ],
968 [
969 # Check for existing socket only if we don't have a random device already
970 if test "$USE_RAND_HELPER" = yes ; then
971 AC_MSG_CHECKING(for PRNGD/EGD socket)
972 # Insert other locations here
973 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
974 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
975 PRNGD_SOCKET="$sock"
976 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
977 break;
978 fi
979 done
980 if test ! -z "$PRNGD_SOCKET" ; then
981 AC_MSG_RESULT($PRNGD_SOCKET)
982 else
983 AC_MSG_RESULT(not found)
984 fi
985 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100986 ]
987)
988
989# Change default command timeout for hashing entropy source
990entropy_timeout=200
991AC_ARG_WITH(entropy-timeout,
992 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
993 [
994 if test "x$withval" != "xno" ; then
995 entropy_timeout=$withval
996 fi
997 ]
998)
Damien Miller6c21c512002-01-22 21:57:53 +1100999AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1000
Kevin Steves7ff91122002-04-07 19:22:54 +00001001ssh_privsep_user=sshd
1002AC_ARG_WITH(privsep-user,
1003 [ --with-privsep-user Specify non-privileged user for privilege separation],
1004 [
1005 if test -n "$withval"; then
1006 ssh_privsep_user=$withval
1007 fi
1008 ]
1009)
Kevin Steves4e0bb522002-04-07 19:44:14 +00001010AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$ssh_privsep_user")
Kevin Steves7ff91122002-04-07 19:22:54 +00001011
Tim Rice88f2ab52002-03-17 12:17:34 -08001012# We do this little dance with the search path to insure
1013# that programs that we select for use by installed programs
1014# (which may be run by the super-user) come from trusted
1015# locations before they come from the user's private area.
1016# This should help avoid accidentally configuring some
1017# random version of a program in someone's personal bin.
1018
1019OPATH=$PATH
1020PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001021test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001022test -d /sbin && PATH=$PATH:/sbin
1023test -d /usr/sbin && PATH=$PATH:/usr/sbin
1024PATH=$PATH:/etc:$OPATH
1025
Damien Miller6c21c512002-01-22 21:57:53 +11001026# These programs are used by the command hashing source to gather entropy
1027OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1028OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1029OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1030OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1031OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1032OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1033OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1034OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1035OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1036OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1037OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1038OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1039OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1040OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1041OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1042OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001043# restore PATH
1044PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001045
1046# Where does ssh-rand-helper get its randomness from?
1047INSTALL_SSH_PRNG_CMDS=""
1048if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1049 if test ! -z "$PRNGD_PORT" ; then
1050 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1051 elif test ! -z "$PRNGD_SOCKET" ; then
1052 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1053 else
1054 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1055 RAND_HELPER_CMDHASH=yes
1056 INSTALL_SSH_PRNG_CMDS="yes"
1057 fi
1058fi
1059AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1060
1061
Ben Lindstromb5628642000-10-18 00:02:25 +00001062# Cheap hack to ensure NEWS-OS libraries are arranged right.
1063if test ! -z "$SONY" ; then
1064 LIBS="$LIBS -liberty";
1065fi
1066
Damien Millera22ba012000-03-02 23:09:20 +11001067# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001068AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001069AC_CHECK_SIZEOF(short int, 2)
1070AC_CHECK_SIZEOF(int, 4)
1071AC_CHECK_SIZEOF(long int, 4)
1072AC_CHECK_SIZEOF(long long int, 8)
1073
Damien Millera22ba012000-03-02 23:09:20 +11001074# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001075AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1076 AC_TRY_COMPILE(
1077 [ #include <sys/types.h> ],
1078 [ u_int a; a = 1;],
1079 [ ac_cv_have_u_int="yes" ],
1080 [ ac_cv_have_u_int="no" ]
1081 )
1082])
1083if test "x$ac_cv_have_u_int" = "xyes" ; then
1084 AC_DEFINE(HAVE_U_INT)
1085 have_u_int=1
1086fi
1087
Damien Miller61e50f12000-05-08 20:49:37 +10001088AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1089 AC_TRY_COMPILE(
1090 [ #include <sys/types.h> ],
1091 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1092 [ ac_cv_have_intxx_t="yes" ],
1093 [ ac_cv_have_intxx_t="no" ]
1094 )
1095])
1096if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1097 AC_DEFINE(HAVE_INTXX_T)
1098 have_intxx_t=1
1099fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001100
1101if (test -z "$have_intxx_t" && \
1102 test "x$ac_cv_header_stdint_h" = "xyes")
1103then
1104 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1105 AC_TRY_COMPILE(
1106 [ #include <stdint.h> ],
1107 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1108 [
1109 AC_DEFINE(HAVE_INTXX_T)
1110 AC_MSG_RESULT(yes)
1111 ],
1112 [ AC_MSG_RESULT(no) ]
1113 )
1114fi
1115
Damien Miller578783e2000-09-23 14:12:24 +11001116AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1117 AC_TRY_COMPILE(
1118 [ #include <sys/types.h> ],
1119 [ int64_t a; a = 1;],
1120 [ ac_cv_have_int64_t="yes" ],
1121 [ ac_cv_have_int64_t="no" ]
1122 )
1123])
1124if test "x$ac_cv_have_int64_t" = "xyes" ; then
1125 AC_DEFINE(HAVE_INT64_T)
1126 have_int64_t=1
1127fi
1128
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001129if test -z "$have_int64_t" ; then
1130 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1131 AC_TRY_COMPILE(
1132 [ #include <sys/socket.h> ],
1133 [ int64_t a; a = 1],
1134 [
1135 AC_DEFINE(HAVE_INT64_T)
1136 AC_MSG_RESULT(yes)
1137 ],
1138 [ AC_MSG_RESULT(no) ]
1139 )
1140fi
1141
Tim Rice4cec93f2002-02-26 08:40:48 -08001142if test -z "$have_int64_t" ; then
1143 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1144 AC_TRY_COMPILE(
1145 [ #include <sys/bitypes.h> ],
1146 [ int64_t a; a = 1],
1147 [
1148 AC_DEFINE(HAVE_INT64_T)
1149 AC_MSG_RESULT(yes)
1150 ],
1151 [ AC_MSG_RESULT(no) ]
1152 )
1153fi
1154
Damien Miller61e50f12000-05-08 20:49:37 +10001155AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1156 AC_TRY_COMPILE(
1157 [ #include <sys/types.h> ],
1158 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1159 [ ac_cv_have_u_intxx_t="yes" ],
1160 [ ac_cv_have_u_intxx_t="no" ]
1161 )
1162])
1163if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1164 AC_DEFINE(HAVE_U_INTXX_T)
1165 have_u_intxx_t=1
1166fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001167
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001168if test -z "$have_u_intxx_t" ; then
1169 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1170 AC_TRY_COMPILE(
1171 [ #include <sys/socket.h> ],
1172 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1173 [
1174 AC_DEFINE(HAVE_U_INTXX_T)
1175 AC_MSG_RESULT(yes)
1176 ],
1177 [ AC_MSG_RESULT(no) ]
1178 )
1179fi
1180
Damien Miller578783e2000-09-23 14:12:24 +11001181AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1182 AC_TRY_COMPILE(
1183 [ #include <sys/types.h> ],
1184 [ u_int64_t a; a = 1;],
1185 [ ac_cv_have_u_int64_t="yes" ],
1186 [ ac_cv_have_u_int64_t="no" ]
1187 )
1188])
1189if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1190 AC_DEFINE(HAVE_U_INT64_T)
1191 have_u_int64_t=1
1192fi
1193
Tim Rice4cec93f2002-02-26 08:40:48 -08001194if test -z "$have_u_int64_t" ; then
1195 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1196 AC_TRY_COMPILE(
1197 [ #include <sys/bitypes.h> ],
1198 [ u_int64_t a; a = 1],
1199 [
1200 AC_DEFINE(HAVE_U_INT64_T)
1201 AC_MSG_RESULT(yes)
1202 ],
1203 [ AC_MSG_RESULT(no) ]
1204 )
1205fi
1206
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001207if test -z "$have_u_intxx_t" ; then
1208 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1209 AC_TRY_COMPILE(
1210 [
1211#include <sys/types.h>
1212 ],
1213 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1214 [ ac_cv_have_uintxx_t="yes" ],
1215 [ ac_cv_have_uintxx_t="no" ]
1216 )
1217 ])
1218 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1219 AC_DEFINE(HAVE_UINTXX_T)
1220 fi
1221fi
1222
1223if test -z "$have_uintxx_t" ; then
1224 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1225 AC_TRY_COMPILE(
1226 [ #include <stdint.h> ],
1227 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1228 [
1229 AC_DEFINE(HAVE_UINTXX_T)
1230 AC_MSG_RESULT(yes)
1231 ],
1232 [ AC_MSG_RESULT(no) ]
1233 )
1234fi
1235
Damien Milleredb82922000-06-20 13:25:52 +10001236if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1237 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001238then
1239 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1240 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001241 [
1242#include <sys/bitypes.h>
1243 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001244 [
Damien Miller70494d12000-04-03 15:57:06 +10001245 int8_t a; int16_t b; int32_t c;
1246 u_int8_t e; u_int16_t f; u_int32_t g;
1247 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001248 ],
1249 [
1250 AC_DEFINE(HAVE_U_INTXX_T)
1251 AC_DEFINE(HAVE_INTXX_T)
1252 AC_MSG_RESULT(yes)
1253 ],
1254 [AC_MSG_RESULT(no)]
1255 )
1256fi
1257
Damien Miller58be7382001-09-15 21:31:54 +10001258
1259AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1260 AC_TRY_COMPILE(
1261 [
1262#include <sys/types.h>
1263 ],
1264 [ u_char foo; foo = 125; ],
1265 [ ac_cv_have_u_char="yes" ],
1266 [ ac_cv_have_u_char="no" ]
1267 )
1268])
1269if test "x$ac_cv_have_u_char" = "xyes" ; then
1270 AC_DEFINE(HAVE_U_CHAR)
1271fi
1272
Tim Rice13aae5e2001-10-21 17:53:58 -07001273TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001274
Tim Rice200a5c02002-02-26 22:12:34 -08001275AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001276
Damien Miller61e50f12000-05-08 20:49:37 +10001277AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1278 AC_TRY_COMPILE(
1279 [
1280#include <sys/types.h>
1281 ],
1282 [ size_t foo; foo = 1235; ],
1283 [ ac_cv_have_size_t="yes" ],
1284 [ ac_cv_have_size_t="no" ]
1285 )
1286])
1287if test "x$ac_cv_have_size_t" = "xyes" ; then
1288 AC_DEFINE(HAVE_SIZE_T)
1289fi
Damien Miller95058511999-12-29 10:36:45 +11001290
Damien Miller615f9392000-05-17 22:53:33 +10001291AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1292 AC_TRY_COMPILE(
1293 [
1294#include <sys/types.h>
1295 ],
1296 [ ssize_t foo; foo = 1235; ],
1297 [ ac_cv_have_ssize_t="yes" ],
1298 [ ac_cv_have_ssize_t="no" ]
1299 )
1300])
1301if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1302 AC_DEFINE(HAVE_SSIZE_T)
1303fi
1304
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001305AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1306 AC_TRY_COMPILE(
1307 [
1308#include <time.h>
1309 ],
1310 [ clock_t foo; foo = 1235; ],
1311 [ ac_cv_have_clock_t="yes" ],
1312 [ ac_cv_have_clock_t="no" ]
1313 )
1314])
1315if test "x$ac_cv_have_clock_t" = "xyes" ; then
1316 AC_DEFINE(HAVE_CLOCK_T)
1317fi
1318
Damien Millerb54b40e2000-06-23 08:23:34 +10001319AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1320 AC_TRY_COMPILE(
1321 [
1322#include <sys/types.h>
1323#include <sys/socket.h>
1324 ],
1325 [ sa_family_t foo; foo = 1235; ],
1326 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001327 [ AC_TRY_COMPILE(
1328 [
1329#include <sys/types.h>
1330#include <sys/socket.h>
1331#include <netinet/in.h>
1332 ],
1333 [ sa_family_t foo; foo = 1235; ],
1334 [ ac_cv_have_sa_family_t="yes" ],
1335
Damien Millerb54b40e2000-06-23 08:23:34 +10001336 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001337 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001338 )
1339])
1340if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1341 AC_DEFINE(HAVE_SA_FAMILY_T)
1342fi
1343
Damien Miller0f91b4e2000-06-18 15:43:25 +10001344AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1345 AC_TRY_COMPILE(
1346 [
1347#include <sys/types.h>
1348 ],
1349 [ pid_t foo; foo = 1235; ],
1350 [ ac_cv_have_pid_t="yes" ],
1351 [ ac_cv_have_pid_t="no" ]
1352 )
1353])
1354if test "x$ac_cv_have_pid_t" = "xyes" ; then
1355 AC_DEFINE(HAVE_PID_T)
1356fi
1357
1358AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1359 AC_TRY_COMPILE(
1360 [
1361#include <sys/types.h>
1362 ],
1363 [ mode_t foo; foo = 1235; ],
1364 [ ac_cv_have_mode_t="yes" ],
1365 [ ac_cv_have_mode_t="no" ]
1366 )
1367])
1368if test "x$ac_cv_have_mode_t" = "xyes" ; then
1369 AC_DEFINE(HAVE_MODE_T)
1370fi
1371
Damien Miller61e50f12000-05-08 20:49:37 +10001372
1373AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1374 AC_TRY_COMPILE(
1375 [
Damien Miller81171112000-04-23 11:14:01 +10001376#include <sys/types.h>
1377#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001378 ],
1379 [ struct sockaddr_storage s; ],
1380 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1381 [ ac_cv_have_struct_sockaddr_storage="no" ]
1382 )
1383])
1384if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1385 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1386fi
Damien Miller34132e52000-01-14 15:45:46 +11001387
Damien Miller61e50f12000-05-08 20:49:37 +10001388AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1389 AC_TRY_COMPILE(
1390 [
Damien Miller7b22d652000-06-18 14:07:04 +10001391#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001392#include <netinet/in.h>
1393 ],
1394 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1395 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1396 [ ac_cv_have_struct_sockaddr_in6="no" ]
1397 )
1398])
1399if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1400 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1401fi
Damien Miller34132e52000-01-14 15:45:46 +11001402
Damien Miller61e50f12000-05-08 20:49:37 +10001403AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1404 AC_TRY_COMPILE(
1405 [
Damien Miller7b22d652000-06-18 14:07:04 +10001406#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001407#include <netinet/in.h>
1408 ],
1409 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1410 [ ac_cv_have_struct_in6_addr="yes" ],
1411 [ ac_cv_have_struct_in6_addr="no" ]
1412 )
1413])
1414if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1415 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1416fi
Damien Miller34132e52000-01-14 15:45:46 +11001417
Damien Miller61e50f12000-05-08 20:49:37 +10001418AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1419 AC_TRY_COMPILE(
1420 [
Damien Miller81171112000-04-23 11:14:01 +10001421#include <sys/types.h>
1422#include <sys/socket.h>
1423#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001424 ],
1425 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1426 [ ac_cv_have_struct_addrinfo="yes" ],
1427 [ ac_cv_have_struct_addrinfo="no" ]
1428 )
1429])
1430if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1431 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1432fi
1433
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001434AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1435 AC_TRY_COMPILE(
1436 [ #include <sys/time.h> ],
1437 [ struct timeval tv; tv.tv_sec = 1;],
1438 [ ac_cv_have_struct_timeval="yes" ],
1439 [ ac_cv_have_struct_timeval="no" ]
1440 )
1441])
1442if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1443 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1444 have_struct_timeval=1
1445fi
1446
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001447# If we don't have int64_t then we can't compile sftp-server. So don't
1448# even attempt to do it.
1449if test "x$ac_cv_have_int64_t" = "xno" -a \
1450 "x$ac_cv_sizeof_long_int" != "x8" -a \
1451 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1452 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001453else
1454dnl test snprintf (broken on SCO w/gcc)
1455 AC_TRY_RUN(
1456 [
1457#include <stdio.h>
1458#include <string.h>
1459#ifdef HAVE_SNPRINTF
1460main()
1461{
1462 char buf[50];
1463 char expected_out[50];
1464 int mazsize = 50 ;
1465#if (SIZEOF_LONG_INT == 8)
1466 long int num = 0x7fffffffffffffff;
1467#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001468 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001469#endif
1470 strcpy(expected_out, "9223372036854775807");
1471 snprintf(buf, mazsize, "%lld", num);
1472 if(strcmp(buf, expected_out) != 0)
1473 exit(1);
1474 exit(0);
1475}
1476#else
1477main() { exit(0); }
1478#endif
1479 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1480 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001481fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001482AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001483
Damien Miller78315eb2000-09-29 23:01:36 +11001484dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001485OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1486OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1487OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1488OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1489OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001490OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001491OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1492OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001493OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001494OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1495OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1496OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1497OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001498OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1499OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1500OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1501OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001502
1503AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001504
Damien Miller61e50f12000-05-08 20:49:37 +10001505AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1506 ac_cv_have_ss_family_in_struct_ss, [
1507 AC_TRY_COMPILE(
1508 [
Damien Miller81171112000-04-23 11:14:01 +10001509#include <sys/types.h>
1510#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001511 ],
1512 [ struct sockaddr_storage s; s.ss_family = 1; ],
1513 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1514 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1515 )
1516])
1517if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1518 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1519fi
1520
Damien Miller61e50f12000-05-08 20:49:37 +10001521AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1522 ac_cv_have___ss_family_in_struct_ss, [
1523 AC_TRY_COMPILE(
1524 [
Damien Miller81171112000-04-23 11:14:01 +10001525#include <sys/types.h>
1526#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001527 ],
1528 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1529 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1530 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1531 )
1532])
1533if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1534 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1535fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001536
Damien Millerad833b32000-08-23 10:46:23 +10001537AC_CACHE_CHECK([for pw_class field in struct passwd],
1538 ac_cv_have_pw_class_in_struct_passwd, [
1539 AC_TRY_COMPILE(
1540 [
Damien Millerad833b32000-08-23 10:46:23 +10001541#include <pwd.h>
1542 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001543 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001544 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1545 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1546 )
1547])
1548if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1549 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1550fi
1551
Kevin Steves82456952001-06-22 21:14:18 +00001552AC_CACHE_CHECK([for pw_expire field in struct passwd],
1553 ac_cv_have_pw_expire_in_struct_passwd, [
1554 AC_TRY_COMPILE(
1555 [
1556#include <pwd.h>
1557 ],
1558 [ struct passwd p; p.pw_expire = 0; ],
1559 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1560 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1561 )
1562])
1563if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1564 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1565fi
1566
1567AC_CACHE_CHECK([for pw_change field in struct passwd],
1568 ac_cv_have_pw_change_in_struct_passwd, [
1569 AC_TRY_COMPILE(
1570 [
1571#include <pwd.h>
1572 ],
1573 [ struct passwd p; p.pw_change = 0; ],
1574 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1575 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1576 )
1577])
1578if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1579 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1580fi
Damien Miller61e50f12000-05-08 20:49:37 +10001581
Kevin Steves939c9db2002-03-22 17:23:25 +00001582AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1583 ac_cv_have_accrights_in_msghdr, [
1584 AC_TRY_COMPILE(
1585 [
Tim Riceae49fe62002-04-12 10:26:21 -07001586#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001587#include <sys/socket.h>
1588#include <sys/uio.h>
1589 ],
1590 [ struct msghdr m; m.msg_accrights = 0; ],
1591 [ ac_cv_have_accrights_in_msghdr="yes" ],
1592 [ ac_cv_have_accrights_in_msghdr="no" ]
1593 )
1594])
1595if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1596 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1597fi
1598
Kevin Stevesa44e0352002-04-07 16:18:03 +00001599AC_CACHE_CHECK([for msg_control field in struct msghdr],
1600 ac_cv_have_control_in_msghdr, [
1601 AC_TRY_COMPILE(
1602 [
Tim Riceae49fe62002-04-12 10:26:21 -07001603#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001604#include <sys/socket.h>
1605#include <sys/uio.h>
1606 ],
1607 [ struct msghdr m; m.msg_control = 0; ],
1608 [ ac_cv_have_control_in_msghdr="yes" ],
1609 [ ac_cv_have_control_in_msghdr="no" ]
1610 )
1611])
1612if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1613 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1614fi
1615
Damien Miller61e50f12000-05-08 20:49:37 +10001616AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1617 AC_TRY_LINK([],
1618 [ extern char *__progname; printf("%s", __progname); ],
1619 [ ac_cv_libc_defines___progname="yes" ],
1620 [ ac_cv_libc_defines___progname="no" ]
1621 )
1622])
1623if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1624 AC_DEFINE(HAVE___PROGNAME)
1625fi
1626
Kevin Steves4846f4a2002-03-22 18:19:53 +00001627AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1628 AC_TRY_LINK([
1629#include <stdio.h>
1630],
1631 [ printf("%s", __FUNCTION__); ],
1632 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1633 [ ac_cv_cc_implements___FUNCTION__="no" ]
1634 )
1635])
1636if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1637 AC_DEFINE(HAVE___FUNCTION__)
1638fi
1639
1640AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1641 AC_TRY_LINK([
1642#include <stdio.h>
1643],
1644 [ printf("%s", __func__); ],
1645 [ ac_cv_cc_implements___func__="yes" ],
1646 [ ac_cv_cc_implements___func__="no" ]
1647 )
1648])
1649if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1650 AC_DEFINE(HAVE___func__)
1651fi
1652
Damien Miller4f8e6692001-07-14 13:22:53 +10001653AC_CACHE_CHECK([whether getopt has optreset support],
1654 ac_cv_have_getopt_optreset, [
1655 AC_TRY_LINK(
1656 [
1657#include <getopt.h>
1658 ],
1659 [ extern int optreset; optreset = 0; ],
1660 [ ac_cv_have_getopt_optreset="yes" ],
1661 [ ac_cv_have_getopt_optreset="no" ]
1662 )
1663])
1664if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1665 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1666fi
Damien Millera22ba012000-03-02 23:09:20 +11001667
Damien Millerecbb26d2000-07-15 14:59:14 +10001668AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1669 AC_TRY_LINK([],
1670 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1671 [ ac_cv_libc_defines_sys_errlist="yes" ],
1672 [ ac_cv_libc_defines_sys_errlist="no" ]
1673 )
1674])
1675if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1676 AC_DEFINE(HAVE_SYS_ERRLIST)
1677fi
1678
1679
Damien Miller11fa2cc2000-08-16 10:35:58 +10001680AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1681 AC_TRY_LINK([],
1682 [ extern int sys_nerr; printf("%i", sys_nerr);],
1683 [ ac_cv_libc_defines_sys_nerr="yes" ],
1684 [ ac_cv_libc_defines_sys_nerr="no" ]
1685 )
1686])
1687if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1688 AC_DEFINE(HAVE_SYS_NERR)
1689fi
1690
Damien Miller85de5802001-09-18 14:01:11 +10001691SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001692
1693# Check whether user wants sectok support
1694AC_ARG_WITH(sectok,
1695 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001696 [
1697 if test "x$withval" != "xno" ; then
1698 if test "x$withval" != "xyes" ; then
1699 CPPFLAGS="$CPPFLAGS -I${withval}"
1700 LDFLAGS="$LDFLAGS -L${withval}"
1701 if test ! -z "$need_dash_r" ; then
1702 LDFLAGS="$LDFLAGS -R${withval}"
1703 fi
1704 if test ! -z "$blibpath" ; then
1705 blibpath="$blibpath:${withval}"
1706 fi
1707 fi
1708 AC_CHECK_HEADERS(sectok.h)
1709 if test "$ac_cv_header_sectok_h" != yes; then
1710 AC_MSG_ERROR(Can't find sectok.h)
1711 fi
1712 AC_CHECK_LIB(sectok, sectok_open)
1713 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1714 AC_MSG_ERROR(Can't find libsectok)
1715 fi
1716 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001717 AC_DEFINE(USE_SECTOK)
1718 SCARD_MSG="yes, using sectok"
1719 fi
1720 ]
1721)
1722
1723# Check whether user wants OpenSC support
1724AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001725 AC_HELP_STRING([--with-opensc=PFX],
1726 [Enable smartcard support using OpenSC]),
1727 opensc_config_prefix="$withval", opensc_config_prefix="")
1728if test x$opensc_config_prefix != x ; then
1729 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1730 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1731 if test "$OPENSC_CONFIG" != "no"; then
1732 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1733 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1734 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1735 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1736 AC_DEFINE(SMARTCARD)
1737 AC_DEFINE(USE_OPENSC)
1738 SCARD_MSG="yes, using OpenSC"
1739 fi
1740fi
Damien Miller85de5802001-09-18 14:01:11 +10001741
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001742# Check whether user wants Kerberos 5 support
1743KRB5_MSG="no"
1744AC_ARG_WITH(kerberos5,
1745 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1746 [
1747 if test "x$withval" != "xno" ; then
1748 if test "x$withval" = "xyes" ; then
1749 KRB5ROOT="/usr/local"
1750 else
1751 KRB5ROOT=${withval}
1752 fi
1753 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1754 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1755 AC_DEFINE(KRB5)
1756 KRB5_MSG="yes"
1757 AC_MSG_CHECKING(whether we are using Heimdal)
1758 AC_TRY_COMPILE([ #include <krb5.h> ],
1759 [ char *tmp = heimdal_version; ],
1760 [ AC_MSG_RESULT(yes)
1761 AC_DEFINE(HEIMDAL)
1762 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1763 ],
1764 [ AC_MSG_RESULT(no)
1765 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1766 ]
1767 )
1768 if test ! -z "$need_dash_r" ; then
1769 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1770 fi
1771 if test ! -z "$blibpath" ; then
1772 blibpath="$blibpath:${KRB5ROOT}/lib"
1773 fi
1774 AC_CHECK_LIB(resolv, dn_expand, , )
1775
1776 KRB5=yes
1777 fi
1778 ]
1779)
1780# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001781KRB4_MSG="no"
1782AC_ARG_WITH(kerberos4,
1783 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1784 [
1785 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001786 if test "x$withval" != "xyes" ; then
1787 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1788 LDFLAGS="$LDFLAGS -L${withval}/lib"
1789 if test ! -z "$need_dash_r" ; then
1790 LDFLAGS="$LDFLAGS -R${withval}/lib"
1791 fi
1792 if test ! -z "$blibpath" ; then
1793 blibpath="$blibpath:${withval}/lib"
1794 fi
1795 else
1796 if test -d /usr/include/kerberosIV ; then
1797 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1798 fi
1799 fi
1800
1801 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001802 if test "$ac_cv_header_krb_h" != yes; then
1803 AC_MSG_WARN([Cannot find krb.h, build may fail])
1804 fi
Damien Miller98344742001-03-28 14:37:06 +10001805 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001806 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001807 AC_CHECK_LIB(krb4, main)
1808 if test "$ac_cv_lib_krb4_main" != yes; then
1809 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1810 else
1811 KLIBS="-lkrb4"
1812 fi
1813 else
1814 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001815 fi
Damien Miller98344742001-03-28 14:37:06 +10001816 AC_CHECK_LIB(des, des_cbc_encrypt)
1817 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1818 AC_CHECK_LIB(des425, des_cbc_encrypt)
1819 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1820 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1821 else
1822 KLIBS="-ldes425"
1823 fi
1824 else
1825 KLIBS="-ldes"
1826 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001827 AC_CHECK_LIB(resolv, dn_expand, , )
1828 KRB4=yes
1829 KRB4_MSG="yes"
1830 AC_DEFINE(KRB4)
1831 fi
1832 ]
1833)
1834
1835# Check whether user wants AFS support
1836AFS_MSG="no"
1837AC_ARG_WITH(afs,
1838 [ --with-afs=PATH Enable AFS support],
1839 [
1840 if test "x$withval" != "xno" ; then
1841
1842 if test "x$withval" != "xyes" ; then
1843 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1844 LDFLAGS="$LDFLAGS -L${withval}/lib"
1845 fi
1846
1847 if test -z "$KRB4" ; then
1848 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1849 fi
1850
1851 LIBS="-lkafs $LIBS"
1852 if test ! -z "$AFS_LIBS" ; then
1853 LIBS="$LIBS $AFS_LIBS"
1854 fi
1855 AC_DEFINE(AFS)
1856 AFS_MSG="yes"
1857 fi
1858 ]
1859)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001860LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001861
Damien Millera22ba012000-03-02 23:09:20 +11001862# Looking for programs, paths and files
1863AC_ARG_WITH(rsh,
1864 [ --with-rsh=PATH Specify path to remote shell program ],
1865 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001866 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001867 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001868 fi
1869 ],
1870 [
1871 AC_PATH_PROG(rsh_path, rsh)
1872 ]
1873)
1874
1875AC_ARG_WITH(xauth,
1876 [ --with-xauth=PATH Specify path to xauth program ],
1877 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001878 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001879 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001880 fi
1881 ],
1882 [
Damien Miller78315eb2000-09-29 23:01:36 +11001883 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 +10001884 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001885 xauth_path="/usr/openwin/bin/xauth"
1886 fi
1887 ]
1888)
1889
Damien Millera19cf472000-11-29 13:28:50 +11001890if test -z "$xauth_path" ; then
1891 XAUTH_PATH="undefined"
1892 AC_SUBST(XAUTH_PATH)
1893else
Damien Millera22ba012000-03-02 23:09:20 +11001894 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001895 XAUTH_PATH=$xauth_path
1896 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001897fi
1898if test ! -z "$rsh_path" ; then
1899 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1900fi
1901
1902# Check for mail directory (last resort if we cannot get it from headers)
1903if test ! -z "$MAIL" ; then
1904 maildir=`dirname $MAIL`
1905 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1906fi
1907
Damien Millera22ba012000-03-02 23:09:20 +11001908if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +11001909 AC_CHECK_FILE("/dev/ptmx",
1910 [
1911 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1912 have_dev_ptmx=1
1913 ]
1914 )
Damien Millera22ba012000-03-02 23:09:20 +11001915fi
Damien Miller204ad072000-03-02 23:56:12 +11001916AC_CHECK_FILE("/dev/ptc",
1917 [
1918 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1919 have_dev_ptc=1
1920 ]
1921)
1922
Damien Millera22ba012000-03-02 23:09:20 +11001923# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001924AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001925 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001926 [
Damien Miller897741e2001-04-16 10:41:46 +10001927 case "$withval" in
1928 man|cat|doc)
1929 MANTYPE=$withval
1930 ;;
1931 *)
1932 AC_MSG_ERROR(invalid man type: $withval)
1933 ;;
1934 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001935 ]
1936)
Ben Lindstrombc709922001-04-18 18:04:21 +00001937if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001938 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001939 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1940 MANTYPE=doc
1941 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1942 MANTYPE=man
1943 else
1944 MANTYPE=cat
1945 fi
1946fi
Damien Miller670a4b82000-01-22 13:53:11 +11001947AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001948if test "$MANTYPE" = "doc"; then
1949 mansubdir=man;
1950else
1951 mansubdir=$MANTYPE;
1952fi
1953AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001954
Damien Millera22ba012000-03-02 23:09:20 +11001955# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001956MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001957AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001958 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001959 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001960 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001961 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001962 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001963 fi
1964 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001965)
1966
Damien Millera22ba012000-03-02 23:09:20 +11001967# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001968AC_ARG_WITH(shadow,
1969 [ --without-shadow Disable shadow password support],
1970 [
1971 if test "x$withval" = "xno" ; then
1972 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001973 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001974 fi
1975 ]
1976)
1977
Damien Miller1f335fb2000-06-26 11:31:33 +10001978if test -z "$disable_shadow" ; then
1979 AC_MSG_CHECKING([if the systems has expire shadow information])
1980 AC_TRY_COMPILE(
1981 [
1982#include <sys/types.h>
1983#include <shadow.h>
1984 struct spwd sp;
1985 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1986 [ sp_expire_available=yes ], []
1987 )
1988
1989 if test "x$sp_expire_available" = "xyes" ; then
1990 AC_MSG_RESULT(yes)
1991 AC_DEFINE(HAS_SHADOW_EXPIRE)
1992 else
1993 AC_MSG_RESULT(no)
1994 fi
1995fi
1996
Damien Millera22ba012000-03-02 23:09:20 +11001997# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001998if test ! -z "$IPADDR_IN_DISPLAY" ; then
1999 DISPLAY_HACK_MSG="yes"
2000 AC_DEFINE(IPADDR_IN_DISPLAY)
2001else
2002 DISPLAY_HACK_MSG="no"
2003 AC_ARG_WITH(ipaddr-display,
2004 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2005 [
2006 if test "x$withval" != "xno" ; then
2007 AC_DEFINE(IPADDR_IN_DISPLAY)
2008 DISPLAY_HACK_MSG="yes"
2009 fi
2010 ]
2011 )
2012fi
Damien Miller76112de1999-12-21 11:18:08 +11002013
Tim Rice43a1c132002-04-17 21:19:14 -07002014dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2015if test $ac_cv_func_login_getcapbool = "yes" -a \
2016 $ac_cv_header_login_cap_h = "yes" ; then
2017 USES_LOGIN_CONF=yes
2018fi
Damien Millera22ba012000-03-02 23:09:20 +11002019# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002020SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002021AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11002022 [ --with-default-path=PATH Specify default \$PATH environment for server],
2023 [
Tim Rice43a1c132002-04-17 21:19:14 -07002024 if test "$USES_LOGIN_CONF" = "yes" ; then
2025 AC_MSG_WARN([
2026--with-default-path=PATH has no effect on this system.
2027Edit /etc/login.conf instead.])
2028 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08002029 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002030 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002031 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002032 ],
Tim Rice43a1c132002-04-17 21:19:14 -07002033 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2034 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2035 else
Tim Rice59ea0a02001-03-10 13:50:45 -08002036 AC_TRY_RUN(
2037 [
2038/* find out what STDPATH is */
2039#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002040#ifdef HAVE_PATHS_H
2041# include <paths.h>
2042#endif
2043#ifndef _PATH_STDPATH
2044# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2045#endif
2046#include <sys/types.h>
2047#include <sys/stat.h>
2048#include <fcntl.h>
2049#define DATA "conftest.stdpath"
2050
2051main()
2052{
2053 FILE *fd;
2054 int rc;
2055
2056 fd = fopen(DATA,"w");
2057 if(fd == NULL)
2058 exit(1);
2059
2060 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2061 exit(1);
2062
2063 exit(0);
2064}
2065 ], [ user_path=`cat conftest.stdpath` ],
2066 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2067 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2068 )
2069# make sure $bindir is in USER_PATH so scp will work
2070 t_bindir=`eval echo ${bindir}`
2071 case $t_bindir in
2072 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2073 esac
2074 case $t_bindir in
2075 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2076 esac
2077 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2078 if test $? -ne 0 ; then
2079 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2080 if test $? -ne 0 ; then
2081 user_path=$user_path:$t_bindir
2082 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2083 fi
2084 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002085 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002086)
Tim Rice43a1c132002-04-17 21:19:14 -07002087if test "$USES_LOGIN_CONF" != "yes" ; then
2088 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2089 AC_SUBST(user_path)
2090fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002091
Damien Millera22ba012000-03-02 23:09:20 +11002092# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002093IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002094AC_ARG_WITH(ipv4-default,
2095 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2096 [
2097 if test "x$withval" != "xno" ; then
2098 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002099 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002100 fi
2101 ]
2102)
2103
Damien Miller61e50f12000-05-08 20:49:37 +10002104AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002105IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002106AC_ARG_WITH(4in6,
2107 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2108 [
2109 if test "x$withval" != "xno" ; then
2110 AC_MSG_RESULT(yes)
2111 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002112 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002113 else
2114 AC_MSG_RESULT(no)
2115 fi
2116 ],[
2117 if test "x$inet6_default_4in6" = "xyes"; then
2118 AC_MSG_RESULT([yes (default)])
2119 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002120 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002121 else
2122 AC_MSG_RESULT([no (default)])
2123 fi
2124 ]
2125)
2126
Damien Miller60396b02001-02-18 17:01:00 +11002127# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002128BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002129AC_ARG_WITH(bsd-auth,
2130 [ --with-bsd-auth Enable BSD auth support],
2131 [
2132 if test "x$withval" != "xno" ; then
2133 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002134 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002135 fi
2136 ]
2137)
2138
Damien Miller78315eb2000-09-29 23:01:36 +11002139AC_MSG_CHECKING(whether to install ssh as suid root)
2140AC_ARG_ENABLE(suid-ssh,
2141[ --enable-suid-ssh Install ssh as suid root (default)
2142 --disable-suid-ssh Install ssh without suid bit],
2143[ case "$enableval" in
2144 no)
2145 AC_MSG_RESULT(no)
2146 SSHMODE=0711
2147 ;;
2148 *) AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00002149 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11002150 ;;
2151 esac ],
2152 AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00002153 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11002154)
2155AC_SUBST(SSHMODE)
2156
2157
Damien Millera22ba012000-03-02 23:09:20 +11002158# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002159piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002160# make sure the directory exists
2161if test ! -d $piddir ; then
2162 piddir=`eval echo ${sysconfdir}`
2163 case $piddir in
2164 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2165 esac
2166fi
2167
Tim Rice88f2ab52002-03-17 12:17:34 -08002168AC_ARG_WITH(pid-dir,
2169 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2170 [
2171 if test "x$withval" != "xno" ; then
2172 piddir=$withval
2173 if test ! -d $piddir ; then
2174 AC_MSG_WARN([** no $piddir directory on this system **])
2175 fi
2176 fi
2177 ]
2178)
2179
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002180AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002181AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002182
andre2ff7b5d2000-06-03 14:57:40 +00002183dnl allow user to disable some login recording features
2184AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002185 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002186 [ AC_DEFINE(DISABLE_LASTLOG) ]
2187)
2188AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002189 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002190 [ AC_DEFINE(DISABLE_UTMP) ]
2191)
2192AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002193 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002194 [ AC_DEFINE(DISABLE_UTMPX) ]
2195)
2196AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002197 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002198 [ AC_DEFINE(DISABLE_WTMP) ]
2199)
2200AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002201 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002202 [ AC_DEFINE(DISABLE_WTMPX) ]
2203)
2204AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002205 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002206 [ AC_DEFINE(DISABLE_LOGIN) ]
2207)
2208AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002209 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002210 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2211)
2212AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002213 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002214 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2215)
2216AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002217 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002218 [
2219 if test "x$withval" = "xno" ; then
2220 AC_DEFINE(DISABLE_LASTLOG)
2221 else
2222 conf_lastlog_location=$withval
2223 fi
2224 ]
2225)
andre2ff7b5d2000-06-03 14:57:40 +00002226
2227dnl lastlog, [uw]tmpx? detection
2228dnl NOTE: set the paths in the platform section to avoid the
2229dnl need for command-line parameters
2230dnl lastlog and [uw]tmp are subject to a file search if all else fails
2231
2232dnl lastlog detection
2233dnl NOTE: the code itself will detect if lastlog is a directory
2234AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2235AC_TRY_COMPILE([
2236#include <sys/types.h>
2237#include <utmp.h>
2238#ifdef HAVE_LASTLOG_H
2239# include <lastlog.h>
2240#endif
Damien Miller2994e082000-06-04 15:51:47 +10002241#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002242# include <paths.h>
2243#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002244#ifdef HAVE_LOGIN_H
2245# include <login.h>
2246#endif
andre2ff7b5d2000-06-03 14:57:40 +00002247 ],
2248 [ char *lastlog = LASTLOG_FILE; ],
2249 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002250 [
2251 AC_MSG_RESULT(no)
2252 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2253 AC_TRY_COMPILE([
2254#include <sys/types.h>
2255#include <utmp.h>
2256#ifdef HAVE_LASTLOG_H
2257# include <lastlog.h>
2258#endif
2259#ifdef HAVE_PATHS_H
2260# include <paths.h>
2261#endif
2262 ],
2263 [ char *lastlog = _PATH_LASTLOG; ],
2264 [ AC_MSG_RESULT(yes) ],
2265 [
andree441aa32000-06-12 22:34:38 +00002266 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002267 system_lastlog_path=no
2268 ])
2269 ]
andre2ff7b5d2000-06-03 14:57:40 +00002270)
Damien Miller2994e082000-06-04 15:51:47 +10002271
andre2ff7b5d2000-06-03 14:57:40 +00002272if test -z "$conf_lastlog_location"; then
2273 if test x"$system_lastlog_path" = x"no" ; then
2274 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002275 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002276 conf_lastlog_location=$f
2277 fi
2278 done
2279 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002280 AC_MSG_WARN([** Cannot find lastlog **])
2281 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002282 fi
2283 fi
2284fi
2285
2286if test -n "$conf_lastlog_location"; then
2287 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2288fi
2289
2290dnl utmp detection
2291AC_MSG_CHECKING([if your system defines UTMP_FILE])
2292AC_TRY_COMPILE([
2293#include <sys/types.h>
2294#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002295#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002296# include <paths.h>
2297#endif
2298 ],
2299 [ char *utmp = UTMP_FILE; ],
2300 [ AC_MSG_RESULT(yes) ],
2301 [ AC_MSG_RESULT(no)
2302 system_utmp_path=no ]
2303)
2304if test -z "$conf_utmp_location"; then
2305 if test x"$system_utmp_path" = x"no" ; then
2306 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2307 if test -f $f ; then
2308 conf_utmp_location=$f
2309 fi
2310 done
2311 if test -z "$conf_utmp_location"; then
2312 AC_DEFINE(DISABLE_UTMP)
2313 fi
2314 fi
2315fi
2316if test -n "$conf_utmp_location"; then
2317 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2318fi
2319
2320dnl wtmp detection
2321AC_MSG_CHECKING([if your system defines WTMP_FILE])
2322AC_TRY_COMPILE([
2323#include <sys/types.h>
2324#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002325#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002326# include <paths.h>
2327#endif
2328 ],
2329 [ char *wtmp = WTMP_FILE; ],
2330 [ AC_MSG_RESULT(yes) ],
2331 [ AC_MSG_RESULT(no)
2332 system_wtmp_path=no ]
2333)
2334if test -z "$conf_wtmp_location"; then
2335 if test x"$system_wtmp_path" = x"no" ; then
2336 for f in /usr/adm/wtmp /var/log/wtmp; do
2337 if test -f $f ; then
2338 conf_wtmp_location=$f
2339 fi
2340 done
2341 if test -z "$conf_wtmp_location"; then
2342 AC_DEFINE(DISABLE_WTMP)
2343 fi
2344 fi
2345fi
2346if test -n "$conf_wtmp_location"; then
2347 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2348fi
2349
2350
2351dnl utmpx detection - I don't know any system so perverse as to require
2352dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2353dnl there, though.
2354AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2355AC_TRY_COMPILE([
2356#include <sys/types.h>
2357#include <utmp.h>
2358#ifdef HAVE_UTMPX_H
2359#include <utmpx.h>
2360#endif
Damien Miller2994e082000-06-04 15:51:47 +10002361#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002362# include <paths.h>
2363#endif
2364 ],
2365 [ char *utmpx = UTMPX_FILE; ],
2366 [ AC_MSG_RESULT(yes) ],
2367 [ AC_MSG_RESULT(no)
2368 system_utmpx_path=no ]
2369)
2370if test -z "$conf_utmpx_location"; then
2371 if test x"$system_utmpx_path" = x"no" ; then
2372 AC_DEFINE(DISABLE_UTMPX)
2373 fi
2374else
2375 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2376fi
2377
2378dnl wtmpx detection
2379AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2380AC_TRY_COMPILE([
2381#include <sys/types.h>
2382#include <utmp.h>
2383#ifdef HAVE_UTMPX_H
2384#include <utmpx.h>
2385#endif
Damien Miller2994e082000-06-04 15:51:47 +10002386#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002387# include <paths.h>
2388#endif
2389 ],
2390 [ char *wtmpx = WTMPX_FILE; ],
2391 [ AC_MSG_RESULT(yes) ],
2392 [ AC_MSG_RESULT(no)
2393 system_wtmpx_path=no ]
2394)
2395if test -z "$conf_wtmpx_location"; then
2396 if test x"$system_wtmpx_path" = x"no" ; then
2397 AC_DEFINE(DISABLE_WTMPX)
2398 fi
2399else
2400 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2401fi
2402
Damien Miller4018c192000-04-30 09:30:44 +10002403
Damien Miller29ea30d2000-03-17 10:54:15 +11002404if test ! -z "$blibpath" ; then
2405 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2406 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2407fi
2408
Tim Rice4cec93f2002-02-26 08:40:48 -08002409dnl remove pam and dl because they are in $LIBPAM
2410if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002411 LIBS=`echo $LIBS | sed 's/-lpam //'`
2412fi
2413if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2414 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002415fi
2416
Damien Millerbac2d8a2000-09-05 16:13:06 +11002417AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002418AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2419AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002420
Damien Miller7b22d652000-06-18 14:07:04 +10002421# Print summary of options
2422
Damien Miller7b22d652000-06-18 14:07:04 +10002423# Someone please show me a better way :)
2424A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2425B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2426C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2427D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002428E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002429F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002430G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Tim Rice59ea0a02001-03-10 13:50:45 -08002431H=`eval echo ${user_path}` ; H=`eval echo ${H}`
Damien Miller7b22d652000-06-18 14:07:04 +10002432
2433echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002434echo "OpenSSH has been configured with the following options:"
Damien Miller7b22d652000-06-18 14:07:04 +10002435echo " User binaries: $B"
2436echo " System binaries: $C"
2437echo " Configuration files: $D"
2438echo " Askpass program: $E"
2439echo " Manual pages: $F"
2440echo " PID file: $G"
Tim Rice43a1c132002-04-17 21:19:14 -07002441if test "$USES_LOGIN_CONF" = "yes" ; then
2442echo " At runtime, sshd will use the path defined in /etc/login.conf"
2443else
Tim Rice59ea0a02001-03-10 13:50:45 -08002444echo " sshd default user PATH: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002445fi
Damien Miller897741e2001-04-16 10:41:46 +10002446echo " Manpage format: $MANTYPE"
Damien Miller7b22d652000-06-18 14:07:04 +10002447echo " PAM support: ${PAM_MSG}"
2448echo " KerberosIV support: $KRB4_MSG"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002449echo " KerberosV support: $KRB5_MSG"
Damien Miller85de5802001-09-18 14:01:11 +10002450echo " Smartcard support: $SCARD_MSG"
Damien Miller7b22d652000-06-18 14:07:04 +10002451echo " AFS support: $AFS_MSG"
2452echo " S/KEY support: $SKEY_MSG"
2453echo " TCP Wrappers support: $TCPW_MSG"
2454echo " MD5 password support: $MD5_MSG"
2455echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2456echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2457echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002458echo " BSD Auth support: $BSD_AUTH_MSG"
2459echo " Random number source: $RAND_MSG"
2460if test ! -z "$USE_RAND_HELPER" ; then
2461 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002462fi
2463
Damien Miller7b22d652000-06-18 14:07:04 +10002464echo ""
2465
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002466echo " Host: ${host}"
2467echo " Compiler: ${CC}"
2468echo " Compiler flags: ${CFLAGS}"
2469echo "Preprocessor flags: ${CPPFLAGS}"
2470echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002471echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002472
2473echo ""
2474
Damien Miller82cf0ce2000-12-20 13:34:48 +11002475if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002476 echo "PAM is enabled. You may need to install a PAM control file "
2477 echo "for sshd, otherwise password authentication may fail. "
2478 echo "Example PAM control files can be found in the contrib/ "
2479 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002480 echo ""
2481fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002482
2483if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002484 echo "sftp-server will be disabled. Your compiler does not "
2485 echo "support 64bit integers."
2486 echo ""
2487fi
2488
2489if test ! -z "$RAND_HELPER_CMDHASH" ; then
2490 echo "WARNING: you are using the builtin random number collection "
2491 echo "service. Please read WARNING.RNG and request that your OS "
2492 echo "vendor includes kernel-based random number collection in "
2493 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002494 echo ""
2495fi
Damien Miller60396b02001-02-18 17:01:00 +11002496