blob: 28843226d3c772179ace11ca0a58b50f6c08017c [file] [log] [blame]
Tim Ricee991e3c2001-08-07 15:29:07 -07001# $Id: configure.in,v 1.306 2001/08/07 22:29:08 tim Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Damien Millerab18c411999-11-11 10:40:23 +11003AC_INIT(ssh.c)
Damien Miller7f6ea021999-10-28 13:25:17 +10004
5AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11006AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11007AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11008AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +10009
Damien Millera22ba012000-03-02 23:09:20 +110010# Checks for programs.
Damien Millerab18c411999-11-11 10:40:23 +110011AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100012AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110013AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000014AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070015AC_PATH_PROGS(PERL, perl5 perl)
Damien Millere79334a1999-12-29 10:03:37 +110016AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100017AC_PATH_PROG(ENT, ent)
18AC_SUBST(ENT)
Damien Miller78315eb2000-09-29 23:01:36 +110019AC_PATH_PROGS(FILEPRIV, filepriv, true, /sbin:/usr/sbin)
Damien Miller4864e8f2001-02-08 10:07:08 +110020AC_PATH_PROG(TEST_MINUS_S_SH, bash)
21AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
22AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110023
Damien Miller3f62aba2000-11-29 11:56:35 +110024if test -z "$AR" ; then
25 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
26fi
27
Damien Millerad833b32000-08-23 10:46:23 +100028# Use LOGIN_PROGRAM from environment if possible
29if test ! -z "$LOGIN_PROGRAM" ; then
30 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
31else
32 # Search for login
33 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
34 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
35 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
36 fi
37fi
38
Damien Miller166bd442000-03-16 10:48:25 +110039if test -z "$LD" ; then
40 LD=$CC
41fi
42AC_SUBST(LD)
43
Damien Miller166bd442000-03-16 10:48:25 +110044AC_C_INLINE
Damien Miller649d9992001-06-27 23:35:51 +100045if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
46 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110047fi
48
Damien Millera22ba012000-03-02 23:09:20 +110049# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110050case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110051*-*-aix*)
52 AFS_LIBS="-lld"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000053 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110054 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100055 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Miller29ea30d2000-03-17 10:54:15 +110056 blibpath="/usr/lib:/lib:/usr/local/lib"
57 fi
Damien Millerd2c208a2000-05-17 22:00:02 +100058 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
Damien Millereca71f82000-01-20 22:38:27 +110059 AC_DEFINE(BROKEN_GETADDRINFO)
andre60f3c982000-06-03 16:18:19 +000060 dnl AIX handles lastlog as part of its login message
61 AC_DEFINE(DISABLE_LASTLOG)
Damien Miller75b1d102000-01-07 14:01:41 +110062 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110063*-*-cygwin*)
Damien Milleref767ac2000-10-17 23:14:08 +110064 LIBS="$LIBS -lregex /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110065 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +000066 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +110067 AC_DEFINE(DISABLE_SHADOW)
68 AC_DEFINE(IPV4_DEFAULT)
69 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +000070 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Damien Millerbac2d8a2000-09-05 16:13:06 +110071 no_libsocket=1
72 no_libnsl=1
73 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000074*-*-dgux*)
75 AC_DEFINE(IP_TOS_IS_BROKEN)
76 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +000077*-*-darwin*)
78 AC_DEFINE(BROKEN_GETADDRINFO)
79 ;;
Damien Miller76112de1999-12-21 11:18:08 +110080*-*-hpux10*)
81 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +100082 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +110083 fi
Kevin Steves315f8b72001-06-28 00:24:41 +000084 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +110085 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +100086 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110087 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110088 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000089 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves315f8b72001-06-28 00:24:41 +000090 LIBS="$LIBS -lxnet -lsec"
Damien Miller76112de1999-12-21 11:18:08 +110091 ;;
Damien Miller1bead332000-04-30 00:47:29 +100092*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +000093 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +110094 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +110095 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +110096 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110097 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110098 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000099 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000100 LIBS="$LIBS -lxnet -lsec"
Damien Miller1bead332000-04-30 00:47:29 +1000101 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100102*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000103 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000104 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100105 PATH="$PATH:/usr/etc"
Damien Miller1808f382000-01-06 12:03:12 +1100106 no_libsocket=1
107 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000108 AC_DEFINE(BROKEN_INET_NTOA)
Damien Miller1808f382000-01-06 12:03:12 +1100109 ;;
110*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000111 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000112 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100113 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000114 AC_DEFINE(WITH_IRIX_ARRAY)
115 AC_DEFINE(WITH_IRIX_PROJECT)
116 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom4a1d9162000-11-21 10:45:31 +0000117 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100118 no_libsocket=1
119 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000120 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100121 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100122*-*-linux*)
123 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100124 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100125 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000126 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100127 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100128 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000129mips-sony-bsd|mips-sony-newsos4)
130 AC_DEFINE(HAVE_NEWS4)
131 SONY=1
132 AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT),
Damien Miller5dfe9762001-02-16 12:05:39 +1100133 AC_MSG_ERROR([*** libiberty missing - please install first or check config.log ***])
Ben Lindstromb5628642000-10-18 00:02:25 +0000134 )
135 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100136*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100137 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100138 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100139*-*-freebsd*)
140 check_for_libcrypt_later=1
141 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000142*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000143 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100144 conf_utmp_location=/etc/utmp
145 conf_wtmp_location=/usr/adm/wtmp
146 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000147 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000148 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000149 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100150 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000151 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000152 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000153 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100154*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000155 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000156 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100157 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100158 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000159 AC_DEFINE(LOGIN_NEEDS_UTMPX)
160 AC_DEFINE(LOGIN_NEEDS_TERM)
andre2ff7b5d2000-06-03 14:57:40 +0000161 # hardwire lastlog location (can't detect it on some versions)
162 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000163 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
164 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
165 if test "$sol2ver" -ge 8; then
166 AC_MSG_RESULT(yes)
167 AC_DEFINE(DISABLE_UTMP)
168 AC_DEFINE(DISABLE_WTMP)
169 else
170 AC_MSG_RESULT(no)
171 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100172 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000173*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000174 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000175 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100176 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller877d8ea2001-02-18 15:29:28 +1100177 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000178 conf_utmp_location=/etc/utmp
179 conf_wtmp_location=/var/adm/wtmp
180 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000181 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000182 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000183*-ncr-sysv*)
184 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
185 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000186 LIBS="$LIBS -lc89 -lnsl -lgen -lsocket"
Ben Lindstrom34328342001-04-23 22:39:42 +0000187 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000188 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000189*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000190 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller2ae714f2000-07-11 09:29:50 +1000191 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100192 IPADDR_IN_DISPLAY=yes
193 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000194 AC_DEFINE(IP_TOS_IS_BROKEN)
Kevin Steves52dd4682001-03-08 18:26:57 +0000195 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Millerb2dc28e2000-07-12 09:18:33 +1000196 LIBS="$LIBS -lgen -lnsl -lucb"
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"
Damien Miller78315eb2000-09-29 23:01:36 +1100201 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"
Damien Miller78315eb2000-09-29 23:01:36 +1100207 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 LIBS="$LIBS -lgen -lsocket"
214 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100215*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000216 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100217 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Ben Lindstrom980754c2000-11-12 00:04:24 +0000218 LIBS="$LIBS -lgen -lsocket -los -lprot -lx -ltinfo -lm"
Damien Miller78315eb2000-09-29 23:01:36 +1100219 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100220 RANLIB=true
221 no_dev_ptmx=1
222 AC_DEFINE(BROKEN_SYS_TERMIO_H)
223 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100224 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000225 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000226 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Millerfbd884a2001-02-27 08:39:07 +1100227 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100228 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700229 MANTYPE=man
Damien Miller78315eb2000-09-29 23:01:36 +1100230 ;;
231*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000232 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000233 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100234 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000235 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100236 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100237 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100238 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000239 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom42717bf2000-12-28 15:46:20 +0000240 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller217f5672001-02-16 12:12:41 +1100241 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700242 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000243 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000244*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700245 no_libsocket=1
246 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000247 AC_DEFINE(USE_PIPES)
Tim Ricee991e3c2001-08-07 15:29:07 -0700248 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
249 LIBS="$LIBS -lgen -lrsc"
250 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000251*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000252 AC_MSG_CHECKING(for Digital Unix SIA)
253 no_osfsia=""
254 AC_ARG_WITH(osfsia,
255 [ --with-osfsia Enable Digital Unix SIA],
256 [
257 if test "x$withval" = "xno" ; then
258 AC_MSG_RESULT(disabled)
259 no_osfsia=1
260 fi
261 ],
262 )
263 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000264 if test -f /etc/sia/matrix.conf; then
265 AC_MSG_RESULT(yes)
266 AC_DEFINE(HAVE_OSF_SIA)
267 AC_DEFINE(DISABLE_LOGIN)
268 LIBS="$LIBS -lsecurity -ldb -lm -laud"
269 else
270 AC_MSG_RESULT(no)
271 fi
272 fi
273 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100274esac
275
Damien Millere37bfc12000-06-05 09:37:43 +1000276# Allow user to specify flags
277AC_ARG_WITH(cflags,
278 [ --with-cflags Specify additional flags to pass to compiler],
279 [
280 if test "x$withval" != "xno" ; then
281 CFLAGS="$CFLAGS $withval"
282 fi
283 ]
284)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000285AC_ARG_WITH(cppflags,
286 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
287 [
288 if test "x$withval" != "xno"; then
289 CPPFLAGS="$CPPFLAGS $withval"
290 fi
291 ]
292)
Damien Millere37bfc12000-06-05 09:37:43 +1000293AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000294 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000295 [
296 if test "x$withval" != "xno" ; then
297 LDFLAGS="$LDFLAGS $withval"
298 fi
299 ]
300)
301AC_ARG_WITH(libs,
302 [ --with-libs Specify additional libraries to link with],
303 [
304 if test "x$withval" != "xno" ; then
305 LIBS="$LIBS $withval"
306 fi
307 ]
308)
309
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000310AC_ARG_WITH(pcre,
311 [ --with-pcre Override built in regex library with pcre],
312 [
313
314 AC_CHECK_LIB(pcre, pcre_info,
315 [
316 AC_DEFINE(HAVE_LIBPCRE)
317 LIBS="$LIBS -lpcreposix -lpcre"
318 no_comp_check="yes"
319 ],
320 [ AC_MSG_ERROR([*** Can not locate pcre libraries.]) ]
321 )
322 ]
323)
Damien Millere37bfc12000-06-05 09:37:43 +1000324
Damien Millera22ba012000-03-02 23:09:20 +1100325# Checks for libraries.
Damien Miller22d5aa72001-02-18 12:49:57 +1100326if test -z "$no_libnsl" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000327 AC_CHECK_LIB(nsl, yp_match, , )
328fi
Damien Miller22d5aa72001-02-18 12:49:57 +1100329if test -z "$no_libsocket" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000330 AC_CHECK_LIB(socket, main, , )
331fi
332
Damien Millerdf288022001-02-18 13:07:07 +1100333dnl SCO OS3 needs this for libwrap
334AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
335
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000336AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
Damien Miller5dfe9762001-02-16 12:05:39 +1100337AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Millerab18c411999-11-11 10:40:23 +1100338AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Miller6f9c3372000-10-25 10:06:04 +1100339
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000340# We don't want to check if we did an pcre override.
341if test -z "$no_comp_check" ; then
342 AC_CHECK_FUNC(regcomp,
343 [ AC_DEFINE(HAVE_REGCOMP)],
344 [
345 AC_CHECK_LIB(pcre, pcre_info,
346 [
347 AC_DEFINE(HAVE_LIBPCRE)
348 LIBS="$LIBS -lpcreposix -lpcre"
349 ],
350 [
351 AC_MSG_ERROR([*** No regex library found.])
352 ])
353 ]
354 )
355fi
Damien Millerab18c411999-11-11 10:40:23 +1100356
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000357dnl UnixWare 2.x
358AC_CHECK_FUNC(strcasecmp,
359 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
360)
361AC_CHECK_FUNC(utimes,
362 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
363)
Damien Millerab18c411999-11-11 10:40:23 +1100364
Ben Lindstrom8697e082001-02-24 21:41:10 +0000365AC_FUNC_STRFTIME
366
Damien Millera22ba012000-03-02 23:09:20 +1100367# Checks for header files.
Ben Lindstrom68c3ce12001-06-10 17:24:51 +0000368AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h getopt.h glob.h lastlog.h libgen.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h regex.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/queue.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h sys/un.h stddef.h time.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
Damien Miller3c027682001-03-14 11:39:45 +1100369
370# Check for ALTDIRFUNC glob() extension
371AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
372AC_EGREP_CPP(FOUNDIT,
373 [
374 #include <glob.h>
375 #ifdef GLOB_ALTDIRFUNC
376 FOUNDIT
377 #endif
378 ],
379 [
380 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
381 AC_MSG_RESULT(yes)
382 ],
383 [
384 AC_MSG_RESULT(no)
385 ]
386)
Damien Millerab18c411999-11-11 10:40:23 +1100387
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000388# Check for g.gl_matchc glob() extension
389AC_MSG_CHECKING(for gl_matchc field in glob_t)
390AC_EGREP_CPP(FOUNDIT,
391 [
392 #include <glob.h>
393 int main(void){glob_t g; g.gl_matchc = 1;}
394 ],
395 [
396 AC_DEFINE(GLOB_HAS_GL_MATCHC)
397 AC_MSG_RESULT(yes)
398 ],
399 [
400 AC_MSG_RESULT(no)
401 ]
402)
403
Damien Miller18bb4732001-03-28 14:35:30 +1000404AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
405AC_TRY_RUN(
406 [
407#include <sys/types.h>
408#include <dirent.h>
409int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
410 ],
411 [AC_MSG_RESULT(yes)],
412 [
413 AC_MSG_RESULT(no)
414 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
415 ]
416)
417
Damien Millerc547bf12001-02-16 10:18:12 +1100418# Check whether user wants S/Key support
419SKEY_MSG="no"
420AC_ARG_WITH(skey,
421 [ --with-skey=PATH Enable S/Key support],
422 [
423 if test "x$withval" != "xno" ; then
424
425 if test "x$withval" != "xyes" ; then
426 CPPFLAGS="$CPPFLAGS -I${withval}/include"
427 LDFLAGS="$LDFLAGS -L${withval}/lib"
428 fi
429
430 AC_DEFINE(SKEY)
431 LIBS="-lskey $LIBS"
432 SKEY_MSG="yes"
433
434 AC_CHECK_FUNC(skey_keyinfo,
435 [],
436 [
437 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
438 ])
439 fi
440 ]
441)
442
443# Check whether user wants TCP wrappers support
444TCPW_MSG="no"
445AC_ARG_WITH(tcp-wrappers,
446 [ --with-tcp-wrappers Enable tcpwrappers support],
447 [
448 if test "x$withval" != "xno" ; then
449 saved_LIBS="$LIBS"
450 LIBS="-lwrap $LIBS"
451 AC_MSG_CHECKING(for libwrap)
452 AC_TRY_LINK(
453 [
454#include <tcpd.h>
455 int deny_severity = 0, allow_severity = 0;
456 ],
457 [hosts_access(0);],
458 [
459 AC_MSG_RESULT(yes)
460 AC_DEFINE(LIBWRAP)
461 TCPW_MSG="yes"
462 ],
463 [
464 AC_MSG_ERROR([*** libwrap missing])
465 ]
466 )
467 fi
468 ]
469)
470
Damien Millerad833b32000-08-23 10:46:23 +1000471dnl Checks for library functions.
Tim Ricee991e3c2001-08-07 15:29:07 -0700472AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa clock dirname fchown fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getopt getnameinfo getrlimit getrusage getttyent glob inet_aton inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty readpassphrase realpath rresvport_af setdtablesize setenv setegid seteuid setlogin setproctitle setresgid setreuid setrlimit setsid setvbuf sigaction sigvec snprintf strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp utimes vsnprintf vhangup vis waitpid _getpty __b64_ntop)
Damien Millerad833b32000-08-23 10:46:23 +1000473dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000474AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000475dnl Checks for libutil functions
Ben Lindstrome2fb8d32000-12-28 00:07:07 +0000476AC_CHECK_HEADERS(libutil.h)
andre2ff7b5d2000-06-03 14:57:40 +0000477AC_CHECK_FUNCS(login logout updwtmp logwtmp)
Damien Millerad833b32000-08-23 10:46:23 +1000478dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000479AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000480AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000481dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000482AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000483AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100484
Damien Miller5fc85652000-07-09 23:53:07 +1000485AC_CHECK_FUNC(getuserattr,
486 [AC_DEFINE(HAVE_GETUSERATTR)],
487 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
488)
489
Damien Miller04f80141999-11-19 15:32:34 +1100490AC_CHECK_FUNC(login,
491 [AC_DEFINE(HAVE_LOGIN)],
492 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
493)
494
495AC_CHECK_FUNC(daemon,
496 [AC_DEFINE(HAVE_DAEMON)],
497 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
498)
499
Damien Miller9fb07e42000-03-05 16:22:59 +1100500AC_CHECK_FUNC(getpagesize,
501 [AC_DEFINE(HAVE_GETPAGESIZE)],
502 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
503)
504
Damien Millercb170cb2000-07-01 16:52:55 +1000505# Check for broken snprintf
506if test "x$ac_cv_func_snprintf" = "xyes" ; then
507 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
508 AC_TRY_RUN(
509 [
510#include <stdio.h>
511int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
512 ],
513 [AC_MSG_RESULT(yes)],
514 [
515 AC_MSG_RESULT(no)
516 AC_DEFINE(BROKEN_SNPRINTF)
517 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
518 ]
519 )
520fi
521
Damien Miller606f8802000-09-16 15:39:56 +1100522AC_FUNC_GETPGRP
523
Damien Millera64b57a2001-01-17 10:44:13 +1100524# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000525PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100526AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100527 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100528 [
Damien Millera64b57a2001-01-17 10:44:13 +1100529 if test "x$withval" != "xno" ; then
530 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
531 AC_MSG_ERROR([PAM headers not found])
532 fi
533
534 AC_CHECK_LIB(dl, dlopen, , )
535 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
536 AC_CHECK_FUNCS(pam_getenvlist)
537
538 disable_shadow=yes
539 PAM_MSG="yes"
540
541 AC_DEFINE(USE_PAM)
Damien Millera22ba012000-03-02 23:09:20 +1100542 fi
543 ]
544)
Damien Millera22ba012000-03-02 23:09:20 +1100545
Damien Millera64b57a2001-01-17 10:44:13 +1100546# Check for older PAM
547if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100548 # Check PAM strerror arguments (old PAM)
549 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
550 AC_TRY_COMPILE(
551 [
Damien Miller81171112000-04-23 11:14:01 +1000552#include <stdlib.h>
553#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100554 ],
555 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
556 [AC_MSG_RESULT(no)],
557 [
558 AC_DEFINE(HAVE_OLD_PAM)
559 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000560 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100561 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100562 )
Damien Millera22ba012000-03-02 23:09:20 +1100563fi
564
565# The big search for OpenSSL
566AC_ARG_WITH(ssl-dir,
567 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
568 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000569 if test "x$withval" != "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100570 tryssldir=$withval
571 fi
572 ]
573)
574
575saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100576saved_LDFLAGS="$LDFLAGS"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000577saved_CPPFLAGS="$CPPFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100578if test "x$prefix" != "xNONE" ; then
579 tryssldir="$tryssldir $prefix"
580fi
Damien Miller61e50f12000-05-08 20:49:37 +1000581AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera1b61e12000-09-16 17:02:16 +1100582 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 +1100583 CPPFLAGS="$saved_CPPFLAGS"
584 LDFLAGS="$saved_LDFLAGS"
Damien Miller3b512e12000-05-17 23:29:18 +1000585 LIBS="$saved_LIBS -lcrypto"
Damien Millerccdefb62001-02-19 12:56:39 +1100586
587 # Skip directories if they don't exist
588 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
589 continue;
590 fi
591 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
592 # Try to use $ssldir/lib if it exists, otherwise
593 # $ssldir
594 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000595 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100596 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000597 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100598 fi
599 else
Damien Millerb68af622001-03-28 21:05:26 +1000600 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100601 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000602 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100603 fi
604 fi
605 # Try to use $ssldir/include if it exists, otherwise
606 # $ssldir
607 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000608 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100609 else
Damien Millerb68af622001-03-28 21:05:26 +1000610 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100611 fi
612 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000613
Damien Miller3b512e12000-05-17 23:29:18 +1000614 # Basic test to check for compatible version and correct linking
615 # *does not* test for RSA - that comes later.
616 AC_TRY_RUN(
617 [
Damien Millere59ce622000-05-01 20:54:17 +1000618#include <string.h>
619#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000620int main(void)
621{
Damien Miller3b512e12000-05-17 23:29:18 +1000622 char a[2048];
623 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000624 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000625 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000626}
Damien Miller3b512e12000-05-17 23:29:18 +1000627 ],
628 [
629 found_crypto=1
630 break;
631 ], []
632 )
Damien Miller61e50f12000-05-08 20:49:37 +1000633
634 if test ! -z "$found_crypto" ; then
635 break;
636 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100637 done
638
Damien Miller61e50f12000-05-08 20:49:37 +1000639 if test -z "$found_crypto" ; then
Damien Miller5dfe9762001-02-16 12:05:39 +1100640 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
Damien Millerb85dcad2000-03-11 11:37:00 +1100641 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000642 if test -z "$ssldir" ; then
643 ssldir="(system)"
644 fi
Damien Millera22ba012000-03-02 23:09:20 +1100645
Damien Miller61e50f12000-05-08 20:49:37 +1000646 ac_cv_openssldir=$ssldir
647])
648
Damien Milleredb82922000-06-20 13:25:52 +1000649if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000650 AC_DEFINE(HAVE_OPENSSL)
651 dnl Need to recover ssldir - test above runs in subshell
652 ssldir=$ac_cv_openssldir
Damien Millera64b57a2001-01-17 10:44:13 +1100653 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
Damien Millerccdefb62001-02-19 12:56:39 +1100654 # Try to use $ssldir/lib if it exists, otherwise
655 # $ssldir
656 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000657 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100658 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000659 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100660 fi
661 else
Damien Millerb68af622001-03-28 21:05:26 +1000662 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100663 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000664 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100665 fi
Damien Millera64b57a2001-01-17 10:44:13 +1100666 fi
Damien Millerccdefb62001-02-19 12:56:39 +1100667 # Try to use $ssldir/include if it exists, otherwise
668 # $ssldir
669 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000670 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100671 else
Damien Millerb68af622001-03-28 21:05:26 +1000672 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millera64b57a2001-01-17 10:44:13 +1100673 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100674 fi
Damien Millera22ba012000-03-02 23:09:20 +1100675fi
Damien Miller3b512e12000-05-17 23:29:18 +1000676LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000677
Damien Miller3b512e12000-05-17 23:29:18 +1000678# Now test RSA support
679saved_LIBS="$LIBS"
680AC_MSG_CHECKING([for RSA support])
681for WANTS_RSAREF in "" 1 ; do
682 if test -z "$WANTS_RSAREF" ; then
683 LIBS="$saved_LIBS"
684 else
685 LIBS="$saved_LIBS -lRSAglue -lrsaref"
686 fi
687 AC_TRY_RUN([
688#include <string.h>
689#include <openssl/rand.h>
690#include <openssl/rsa.h>
691#include <openssl/bn.h>
692#include <openssl/sha.h>
693int main(void)
694{
695 int num; RSA *key; static unsigned char p_in[] = "blahblah";
696 unsigned char c[256], p[256];
697 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
698 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
699 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
700 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
701}
702 ],
703 [
704 rsa_works=1
705 break;
706 ], [])
707done
Ben Lindstrom23fec142001-06-09 02:16:28 +0000708LIBS="$saved_LIBS"
Damien Miller3b512e12000-05-17 23:29:18 +1000709
710if test ! -z "$no_rsa" ; then
711 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000712 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000713else
714 if test -z "$rsa_works" ; then
715 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000716 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000717 else
718 if test -z "$WANTS_RSAREF" ; then
719 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000720 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000721 else
Damien Miller7b22d652000-06-18 14:07:04 +1000722 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000723 AC_MSG_RESULT(using RSAref)
Ben Lindstrom23fec142001-06-09 02:16:28 +0000724 LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
Damien Miller3b512e12000-05-17 23:29:18 +1000725 fi
726 fi
727fi
Damien Millera22ba012000-03-02 23:09:20 +1100728
Damien Millera64b57a2001-01-17 10:44:13 +1100729# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
730# version in OpenSSL. Skip this for PAM
731if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100732 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100733fi
734
Ben Lindstromb5628642000-10-18 00:02:25 +0000735# Cheap hack to ensure NEWS-OS libraries are arranged right.
736if test ! -z "$SONY" ; then
737 LIBS="$LIBS -liberty";
738fi
739
Damien Millera22ba012000-03-02 23:09:20 +1100740# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100741AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100742AC_CHECK_SIZEOF(short int, 2)
743AC_CHECK_SIZEOF(int, 4)
744AC_CHECK_SIZEOF(long int, 4)
745AC_CHECK_SIZEOF(long long int, 8)
746
Damien Millera22ba012000-03-02 23:09:20 +1100747# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +1100748AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
749 AC_TRY_COMPILE(
750 [ #include <sys/types.h> ],
751 [ u_int a; a = 1;],
752 [ ac_cv_have_u_int="yes" ],
753 [ ac_cv_have_u_int="no" ]
754 )
755])
756if test "x$ac_cv_have_u_int" = "xyes" ; then
757 AC_DEFINE(HAVE_U_INT)
758 have_u_int=1
759fi
760
Damien Miller61e50f12000-05-08 20:49:37 +1000761AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
762 AC_TRY_COMPILE(
763 [ #include <sys/types.h> ],
764 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
765 [ ac_cv_have_intxx_t="yes" ],
766 [ ac_cv_have_intxx_t="no" ]
767 )
768])
769if test "x$ac_cv_have_intxx_t" = "xyes" ; then
770 AC_DEFINE(HAVE_INTXX_T)
771 have_intxx_t=1
772fi
773
Damien Miller578783e2000-09-23 14:12:24 +1100774AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
775 AC_TRY_COMPILE(
776 [ #include <sys/types.h> ],
777 [ int64_t a; a = 1;],
778 [ ac_cv_have_int64_t="yes" ],
779 [ ac_cv_have_int64_t="no" ]
780 )
781])
782if test "x$ac_cv_have_int64_t" = "xyes" ; then
783 AC_DEFINE(HAVE_INT64_T)
784 have_int64_t=1
785fi
786
Damien Miller61e50f12000-05-08 20:49:37 +1000787AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
788 AC_TRY_COMPILE(
789 [ #include <sys/types.h> ],
790 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
791 [ ac_cv_have_u_intxx_t="yes" ],
792 [ ac_cv_have_u_intxx_t="no" ]
793 )
794])
795if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
796 AC_DEFINE(HAVE_U_INTXX_T)
797 have_u_intxx_t=1
798fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100799
Damien Miller578783e2000-09-23 14:12:24 +1100800AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
801 AC_TRY_COMPILE(
802 [ #include <sys/types.h> ],
803 [ u_int64_t a; a = 1;],
804 [ ac_cv_have_u_int64_t="yes" ],
805 [ ac_cv_have_u_int64_t="no" ]
806 )
807])
808if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
809 AC_DEFINE(HAVE_U_INT64_T)
810 have_u_int64_t=1
811fi
812
Damien Milleredb82922000-06-20 13:25:52 +1000813if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
814 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +1100815then
816 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
817 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +1000818 [
819#include <sys/bitypes.h>
820 ],
Damien Millerb29ea912000-01-15 14:12:03 +1100821 [
Damien Miller70494d12000-04-03 15:57:06 +1000822 int8_t a; int16_t b; int32_t c;
823 u_int8_t e; u_int16_t f; u_int32_t g;
824 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +1100825 ],
826 [
827 AC_DEFINE(HAVE_U_INTXX_T)
828 AC_DEFINE(HAVE_INTXX_T)
829 AC_MSG_RESULT(yes)
830 ],
831 [AC_MSG_RESULT(no)]
832 )
833fi
834
Damien Millerd6121d22000-03-17 23:26:46 +1100835if test -z "$have_u_intxx_t" ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000836 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
837 AC_TRY_COMPILE(
838 [
839#include <sys/types.h>
840 ],
841 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
842 [ ac_cv_have_uintxx_t="yes" ],
843 [ ac_cv_have_uintxx_t="no" ]
844 )
845 ])
846 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
847 AC_DEFINE(HAVE_UINTXX_T)
848 fi
Damien Millerd6121d22000-03-17 23:26:46 +1100849fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100850
Damien Miller61e50f12000-05-08 20:49:37 +1000851AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
852 AC_TRY_COMPILE(
853 [
Damien Miller81171112000-04-23 11:14:01 +1000854#include <sys/types.h>
855#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000856 ],
857 [socklen_t foo; foo = 1235;],
858 [ ac_cv_have_socklen_t="yes" ],
859 [ ac_cv_have_socklen_t="no" ]
860 )
861])
862if test "x$ac_cv_have_socklen_t" = "xyes" ; then
863 AC_DEFINE(HAVE_SOCKLEN_T)
864fi
Damien Miller74d0d4a1999-12-29 02:24:35 +1100865
Damien Miller61e50f12000-05-08 20:49:37 +1000866AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
867 AC_TRY_COMPILE(
868 [
869#include <sys/types.h>
870 ],
871 [ size_t foo; foo = 1235; ],
872 [ ac_cv_have_size_t="yes" ],
873 [ ac_cv_have_size_t="no" ]
874 )
875])
876if test "x$ac_cv_have_size_t" = "xyes" ; then
877 AC_DEFINE(HAVE_SIZE_T)
878fi
Damien Miller95058511999-12-29 10:36:45 +1100879
Damien Miller615f9392000-05-17 22:53:33 +1000880AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
881 AC_TRY_COMPILE(
882 [
883#include <sys/types.h>
884 ],
885 [ ssize_t foo; foo = 1235; ],
886 [ ac_cv_have_ssize_t="yes" ],
887 [ ac_cv_have_ssize_t="no" ]
888 )
889])
890if test "x$ac_cv_have_ssize_t" = "xyes" ; then
891 AC_DEFINE(HAVE_SSIZE_T)
892fi
893
Ben Lindstrom0d5af602001-01-09 00:50:29 +0000894AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
895 AC_TRY_COMPILE(
896 [
897#include <time.h>
898 ],
899 [ clock_t foo; foo = 1235; ],
900 [ ac_cv_have_clock_t="yes" ],
901 [ ac_cv_have_clock_t="no" ]
902 )
903])
904if test "x$ac_cv_have_clock_t" = "xyes" ; then
905 AC_DEFINE(HAVE_CLOCK_T)
906fi
907
Damien Millerb54b40e2000-06-23 08:23:34 +1000908AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
909 AC_TRY_COMPILE(
910 [
911#include <sys/types.h>
912#include <sys/socket.h>
913 ],
914 [ sa_family_t foo; foo = 1235; ],
915 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +1100916 [ AC_TRY_COMPILE(
917 [
918#include <sys/types.h>
919#include <sys/socket.h>
920#include <netinet/in.h>
921 ],
922 [ sa_family_t foo; foo = 1235; ],
923 [ ac_cv_have_sa_family_t="yes" ],
924
Damien Millerb54b40e2000-06-23 08:23:34 +1000925 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +1100926 )]
Damien Millerb54b40e2000-06-23 08:23:34 +1000927 )
928])
929if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
930 AC_DEFINE(HAVE_SA_FAMILY_T)
931fi
932
Damien Miller0f91b4e2000-06-18 15:43:25 +1000933AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
934 AC_TRY_COMPILE(
935 [
936#include <sys/types.h>
937 ],
938 [ pid_t foo; foo = 1235; ],
939 [ ac_cv_have_pid_t="yes" ],
940 [ ac_cv_have_pid_t="no" ]
941 )
942])
943if test "x$ac_cv_have_pid_t" = "xyes" ; then
944 AC_DEFINE(HAVE_PID_T)
945fi
946
947AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
948 AC_TRY_COMPILE(
949 [
950#include <sys/types.h>
951 ],
952 [ mode_t foo; foo = 1235; ],
953 [ ac_cv_have_mode_t="yes" ],
954 [ ac_cv_have_mode_t="no" ]
955 )
956])
957if test "x$ac_cv_have_mode_t" = "xyes" ; then
958 AC_DEFINE(HAVE_MODE_T)
959fi
960
Damien Miller61e50f12000-05-08 20:49:37 +1000961
962AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
963 AC_TRY_COMPILE(
964 [
Damien Miller81171112000-04-23 11:14:01 +1000965#include <sys/types.h>
966#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000967 ],
968 [ struct sockaddr_storage s; ],
969 [ ac_cv_have_struct_sockaddr_storage="yes" ],
970 [ ac_cv_have_struct_sockaddr_storage="no" ]
971 )
972])
973if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
974 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
975fi
Damien Miller34132e52000-01-14 15:45:46 +1100976
Damien Miller61e50f12000-05-08 20:49:37 +1000977AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
978 AC_TRY_COMPILE(
979 [
Damien Miller7b22d652000-06-18 14:07:04 +1000980#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000981#include <netinet/in.h>
982 ],
983 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
984 [ ac_cv_have_struct_sockaddr_in6="yes" ],
985 [ ac_cv_have_struct_sockaddr_in6="no" ]
986 )
987])
988if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
989 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
990fi
Damien Miller34132e52000-01-14 15:45:46 +1100991
Damien Miller61e50f12000-05-08 20:49:37 +1000992AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
993 AC_TRY_COMPILE(
994 [
Damien Miller7b22d652000-06-18 14:07:04 +1000995#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000996#include <netinet/in.h>
997 ],
998 [ struct in6_addr s; s.s6_addr[0] = 0; ],
999 [ ac_cv_have_struct_in6_addr="yes" ],
1000 [ ac_cv_have_struct_in6_addr="no" ]
1001 )
1002])
1003if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1004 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1005fi
Damien Miller34132e52000-01-14 15:45:46 +11001006
Damien Miller61e50f12000-05-08 20:49:37 +10001007AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1008 AC_TRY_COMPILE(
1009 [
Damien Miller81171112000-04-23 11:14:01 +10001010#include <sys/types.h>
1011#include <sys/socket.h>
1012#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001013 ],
1014 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1015 [ ac_cv_have_struct_addrinfo="yes" ],
1016 [ ac_cv_have_struct_addrinfo="no" ]
1017 )
1018])
1019if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1020 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1021fi
1022
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001023AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1024 AC_TRY_COMPILE(
1025 [ #include <sys/time.h> ],
1026 [ struct timeval tv; tv.tv_sec = 1;],
1027 [ ac_cv_have_struct_timeval="yes" ],
1028 [ ac_cv_have_struct_timeval="no" ]
1029 )
1030])
1031if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1032 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1033 have_struct_timeval=1
1034fi
1035
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001036# If we don't have int64_t then we can't compile sftp-server. So don't
1037# even attempt to do it.
1038if test "x$ac_cv_have_int64_t" = "xno" -a \
1039 "x$ac_cv_sizeof_long_int" != "x8" -a \
1040 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1041 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001042else
1043dnl test snprintf (broken on SCO w/gcc)
1044 AC_TRY_RUN(
1045 [
1046#include <stdio.h>
1047#include <string.h>
1048#ifdef HAVE_SNPRINTF
1049main()
1050{
1051 char buf[50];
1052 char expected_out[50];
1053 int mazsize = 50 ;
1054#if (SIZEOF_LONG_INT == 8)
1055 long int num = 0x7fffffffffffffff;
1056#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001057 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001058#endif
1059 strcpy(expected_out, "9223372036854775807");
1060 snprintf(buf, mazsize, "%lld", num);
1061 if(strcmp(buf, expected_out) != 0)
1062 exit(1);
1063 exit(0);
1064}
1065#else
1066main() { exit(0); }
1067#endif
1068 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1069 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001070fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001071AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001072
Damien Miller78315eb2000-09-29 23:01:36 +11001073dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001074OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1075OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1076OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1077OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1078OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001079OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001080OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1081OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001082OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001083OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1084OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1085OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1086OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001087OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1088OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1089OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1090OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Damien Miller78315eb2000-09-29 23:01:36 +11001091AC_STRUCT_ST_BLKSIZE
andre2ff7b5d2000-06-03 14:57:40 +00001092
Damien Miller942da032000-08-18 13:59:06 +10001093AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
1094 ac_cv_have_sun_len_in_struct_sockaddr_un, [
1095 AC_TRY_COMPILE(
1096 [
1097#include <sys/types.h>
1098#include <sys/socket.h>
1099 ],
1100 [ struct sockaddr_un s; s.sun_len = 1; ],
1101 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
1102 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
1103 )
1104])
1105if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
1106 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
1107fi
1108
Damien Miller61e50f12000-05-08 20:49:37 +10001109AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1110 ac_cv_have_ss_family_in_struct_ss, [
1111 AC_TRY_COMPILE(
1112 [
Damien Miller81171112000-04-23 11:14:01 +10001113#include <sys/types.h>
1114#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001115 ],
1116 [ struct sockaddr_storage s; s.ss_family = 1; ],
1117 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1118 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1119 )
1120])
1121if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1122 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1123fi
1124
Damien Miller61e50f12000-05-08 20:49:37 +10001125AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1126 ac_cv_have___ss_family_in_struct_ss, [
1127 AC_TRY_COMPILE(
1128 [
Damien Miller81171112000-04-23 11:14:01 +10001129#include <sys/types.h>
1130#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001131 ],
1132 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1133 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1134 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1135 )
1136])
1137if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1138 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1139fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001140
Damien Millerad833b32000-08-23 10:46:23 +10001141AC_CACHE_CHECK([for pw_class field in struct passwd],
1142 ac_cv_have_pw_class_in_struct_passwd, [
1143 AC_TRY_COMPILE(
1144 [
Damien Millerad833b32000-08-23 10:46:23 +10001145#include <pwd.h>
1146 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001147 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001148 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1149 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1150 )
1151])
1152if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1153 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1154fi
1155
Kevin Steves82456952001-06-22 21:14:18 +00001156AC_CACHE_CHECK([for pw_expire field in struct passwd],
1157 ac_cv_have_pw_expire_in_struct_passwd, [
1158 AC_TRY_COMPILE(
1159 [
1160#include <pwd.h>
1161 ],
1162 [ struct passwd p; p.pw_expire = 0; ],
1163 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1164 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1165 )
1166])
1167if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1168 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1169fi
1170
1171AC_CACHE_CHECK([for pw_change field in struct passwd],
1172 ac_cv_have_pw_change_in_struct_passwd, [
1173 AC_TRY_COMPILE(
1174 [
1175#include <pwd.h>
1176 ],
1177 [ struct passwd p; p.pw_change = 0; ],
1178 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1179 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1180 )
1181])
1182if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1183 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1184fi
Damien Miller61e50f12000-05-08 20:49:37 +10001185
1186AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1187 AC_TRY_LINK([],
1188 [ extern char *__progname; printf("%s", __progname); ],
1189 [ ac_cv_libc_defines___progname="yes" ],
1190 [ ac_cv_libc_defines___progname="no" ]
1191 )
1192])
1193if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1194 AC_DEFINE(HAVE___PROGNAME)
1195fi
1196
Damien Miller4f8e6692001-07-14 13:22:53 +10001197AC_CACHE_CHECK([whether getopt has optreset support],
1198 ac_cv_have_getopt_optreset, [
1199 AC_TRY_LINK(
1200 [
1201#include <getopt.h>
1202 ],
1203 [ extern int optreset; optreset = 0; ],
1204 [ ac_cv_have_getopt_optreset="yes" ],
1205 [ ac_cv_have_getopt_optreset="no" ]
1206 )
1207])
1208if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1209 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1210fi
Damien Millera22ba012000-03-02 23:09:20 +11001211
Damien Millerecbb26d2000-07-15 14:59:14 +10001212AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1213 AC_TRY_LINK([],
1214 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1215 [ ac_cv_libc_defines_sys_errlist="yes" ],
1216 [ ac_cv_libc_defines_sys_errlist="no" ]
1217 )
1218])
1219if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1220 AC_DEFINE(HAVE_SYS_ERRLIST)
1221fi
1222
1223
Damien Miller11fa2cc2000-08-16 10:35:58 +10001224AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1225 AC_TRY_LINK([],
1226 [ extern int sys_nerr; printf("%i", sys_nerr);],
1227 [ ac_cv_libc_defines_sys_nerr="yes" ],
1228 [ ac_cv_libc_defines_sys_nerr="no" ]
1229 )
1230])
1231if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1232 AC_DEFINE(HAVE_SYS_NERR)
1233fi
1234
1235
Damien Millerc79bc0d2001-03-28 13:03:42 +10001236# Check whether user wants Kerberos support
1237KRB4_MSG="no"
1238AC_ARG_WITH(kerberos4,
1239 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1240 [
1241 if test "x$withval" != "xno" ; then
1242
1243 if test "x$withval" != "xyes" ; then
1244 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1245 LDFLAGS="$LDFLAGS -L${withval}/lib"
1246 if test ! -z "$need_dash_r" ; then
1247 LDFLAGS="$LDFLAGS -R${withval}/lib"
1248 fi
1249 if test ! -z "$blibpath" ; then
1250 blibpath="$blibpath:${withval}/lib"
1251 fi
1252 else
1253 if test -d /usr/include/kerberosIV ; then
1254 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1255 fi
1256 fi
1257
1258 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001259 if test "$ac_cv_header_krb_h" != yes; then
1260 AC_MSG_WARN([Cannot find krb.h, build may fail])
1261 fi
Damien Miller98344742001-03-28 14:37:06 +10001262 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001263 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001264 AC_CHECK_LIB(krb4, main)
1265 if test "$ac_cv_lib_krb4_main" != yes; then
1266 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1267 else
1268 KLIBS="-lkrb4"
1269 fi
1270 else
1271 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001272 fi
Damien Miller98344742001-03-28 14:37:06 +10001273 AC_CHECK_LIB(des, des_cbc_encrypt)
1274 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1275 AC_CHECK_LIB(des425, des_cbc_encrypt)
1276 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1277 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1278 else
1279 KLIBS="-ldes425"
1280 fi
1281 else
1282 KLIBS="-ldes"
1283 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001284 AC_CHECK_LIB(resolv, dn_expand, , )
1285 KRB4=yes
1286 KRB4_MSG="yes"
1287 AC_DEFINE(KRB4)
1288 fi
1289 ]
1290)
1291
1292# Check whether user wants AFS support
1293AFS_MSG="no"
1294AC_ARG_WITH(afs,
1295 [ --with-afs=PATH Enable AFS support],
1296 [
1297 if test "x$withval" != "xno" ; then
1298
1299 if test "x$withval" != "xyes" ; then
1300 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1301 LDFLAGS="$LDFLAGS -L${withval}/lib"
1302 fi
1303
1304 if test -z "$KRB4" ; then
1305 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1306 fi
1307
1308 LIBS="-lkafs $LIBS"
1309 if test ! -z "$AFS_LIBS" ; then
1310 LIBS="$LIBS $AFS_LIBS"
1311 fi
1312 AC_DEFINE(AFS)
1313 AFS_MSG="yes"
1314 fi
1315 ]
1316)
1317LIBS="$LIBS $KLIBS"
1318
Damien Millera22ba012000-03-02 23:09:20 +11001319# Looking for programs, paths and files
1320AC_ARG_WITH(rsh,
1321 [ --with-rsh=PATH Specify path to remote shell program ],
1322 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001323 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001324 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001325 fi
1326 ],
1327 [
1328 AC_PATH_PROG(rsh_path, rsh)
1329 ]
1330)
1331
1332AC_ARG_WITH(xauth,
1333 [ --with-xauth=PATH Specify path to xauth program ],
1334 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001335 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001336 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001337 fi
1338 ],
1339 [
Damien Miller78315eb2000-09-29 23:01:36 +11001340 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 +10001341 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001342 xauth_path="/usr/openwin/bin/xauth"
1343 fi
1344 ]
1345)
1346
Damien Millera19cf472000-11-29 13:28:50 +11001347if test -z "$xauth_path" ; then
1348 XAUTH_PATH="undefined"
1349 AC_SUBST(XAUTH_PATH)
1350else
Damien Millera22ba012000-03-02 23:09:20 +11001351 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001352 XAUTH_PATH=$xauth_path
1353 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001354fi
1355if test ! -z "$rsh_path" ; then
1356 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1357fi
1358
1359# Check for mail directory (last resort if we cannot get it from headers)
1360if test ! -z "$MAIL" ; then
1361 maildir=`dirname $MAIL`
1362 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1363fi
1364
Damien Millera22ba012000-03-02 23:09:20 +11001365if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +11001366 AC_CHECK_FILE("/dev/ptmx",
1367 [
1368 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1369 have_dev_ptmx=1
1370 ]
1371 )
Damien Millera22ba012000-03-02 23:09:20 +11001372fi
Damien Miller204ad072000-03-02 23:56:12 +11001373AC_CHECK_FILE("/dev/ptc",
1374 [
1375 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1376 have_dev_ptc=1
1377 ]
1378)
1379
Damien Millera22ba012000-03-02 23:09:20 +11001380# Options from here on. Some of these are preset by platform above
1381
Damien Millera22ba012000-03-02 23:09:20 +11001382# Check for user-specified random device, otherwise check /dev/urandom
1383AC_ARG_WITH(random,
Damien Miller0736c4d2001-01-25 10:51:46 +11001384 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
Damien Millera22ba012000-03-02 23:09:20 +11001385 [
Damien Miller040f3832000-04-03 14:50:43 +10001386 if test "x$withval" != "xno" ; then
1387 RANDOM_POOL="$withval";
1388 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1389 fi
Damien Millera22ba012000-03-02 23:09:20 +11001390 ],
1391 [
1392 # Check for random device
1393 AC_CHECK_FILE("/dev/urandom",
1394 [
1395 RANDOM_POOL="/dev/urandom";
1396 AC_SUBST(RANDOM_POOL)
1397 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1398 ]
1399 )
1400 ]
1401)
1402
Damien Millerd0ccb982001-03-04 00:29:20 +11001403# Check for PRNGD/EGD pool file
1404AC_ARG_WITH(prngd-port,
1405 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1406 [
1407 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1408 PRNGD_PORT="$withval"
1409 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1410 fi
1411 ]
1412)
1413
1414# Check for PRNGD/EGD pool file
1415AC_ARG_WITH(prngd-socket,
1416 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
Damien Millera22ba012000-03-02 23:09:20 +11001417 [
Damien Miller040f3832000-04-03 14:50:43 +10001418 if test "x$withval" != "xno" ; then
Damien Millerd0ccb982001-03-04 00:29:20 +11001419 PRNGD_SOCKET="$withval"
1420 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller040f3832000-04-03 14:50:43 +10001421 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001422 ],
1423 [
1424 # Check for existing socket only if we don't have a random device already
1425 if test -z "$RANDOM_POOL" ; then
1426 AC_MSG_CHECKING(for PRNGD/EGD socket)
1427 # Insert other locations here
Tim Ricebee3f222001-03-11 17:32:12 -08001428 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
Damien Millerd0ccb982001-03-04 00:29:20 +11001429 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1430 PRNGD_SOCKET="$sock"
1431 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller0736c4d2001-01-25 10:51:46 +11001432 break;
1433 fi
1434 done
Damien Millerd0ccb982001-03-04 00:29:20 +11001435 if test ! -z "$PRNGD_SOCKET" ; then
1436 AC_MSG_RESULT($PRNGD_SOCKET)
Damien Miller4864e8f2001-02-08 10:07:08 +11001437 else
1438 AC_MSG_RESULT(not found)
1439 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001440 fi
Damien Millera22ba012000-03-02 23:09:20 +11001441 ]
1442)
1443
Damien Miller0736c4d2001-01-25 10:51:46 +11001444
Damien Miller0437b332000-05-02 09:56:41 +10001445# detect pathnames for entropy gathering commands, if we need them
1446INSTALL_SSH_PRNG_CMDS=""
1447rm -f prng_commands
Damien Millerd0ccb982001-03-04 00:29:20 +11001448if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
Damien Miller11e37f62000-04-08 18:23:30 +10001449 # Use these commands to collect entropy
Damien Miller61e50f12000-05-08 20:49:37 +10001450 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1451 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1452 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1453 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
Ben Lindstromd9e08242001-07-22 19:32:00 +00001454 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
Damien Miller61e50f12000-05-08 20:49:37 +10001455 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
Ben Lindstrom6db66ff2001-08-06 23:29:16 +00001456 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
Damien Miller61e50f12000-05-08 20:49:37 +10001457 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1458 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1459 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1460 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1461 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1462 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1463 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1464 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1465 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Damien Miller0437b332000-05-02 09:56:41 +10001466
1467 INSTALL_SSH_PRNG_CMDS="yes"
Damien Miller11e37f62000-04-08 18:23:30 +10001468fi
Damien Miller0437b332000-05-02 09:56:41 +10001469AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1470
Damien Miller11e37f62000-04-08 18:23:30 +10001471
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001472AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001473 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001474 [
Damien Miller897741e2001-04-16 10:41:46 +10001475 case "$withval" in
1476 man|cat|doc)
1477 MANTYPE=$withval
1478 ;;
1479 *)
1480 AC_MSG_ERROR(invalid man type: $withval)
1481 ;;
1482 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001483 ]
1484)
Ben Lindstrombc709922001-04-18 18:04:21 +00001485if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001486 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001487 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1488 MANTYPE=doc
1489 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1490 MANTYPE=man
1491 else
1492 MANTYPE=cat
1493 fi
1494fi
Damien Miller670a4b82000-01-22 13:53:11 +11001495AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001496if test "$MANTYPE" = "doc"; then
1497 mansubdir=man;
1498else
1499 mansubdir=$MANTYPE;
1500fi
1501AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001502
Damien Millera22ba012000-03-02 23:09:20 +11001503# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001504MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001505AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001506 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001507 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001508 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001509 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001510 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001511 fi
1512 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001513)
1514
Damien Millera22ba012000-03-02 23:09:20 +11001515# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001516AC_ARG_WITH(shadow,
1517 [ --without-shadow Disable shadow password support],
1518 [
1519 if test "x$withval" = "xno" ; then
1520 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001521 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001522 fi
1523 ]
1524)
1525
Damien Miller1f335fb2000-06-26 11:31:33 +10001526if test -z "$disable_shadow" ; then
1527 AC_MSG_CHECKING([if the systems has expire shadow information])
1528 AC_TRY_COMPILE(
1529 [
1530#include <sys/types.h>
1531#include <shadow.h>
1532 struct spwd sp;
1533 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1534 [ sp_expire_available=yes ], []
1535 )
1536
1537 if test "x$sp_expire_available" = "xyes" ; then
1538 AC_MSG_RESULT(yes)
1539 AC_DEFINE(HAS_SHADOW_EXPIRE)
1540 else
1541 AC_MSG_RESULT(no)
1542 fi
1543fi
1544
Damien Millera22ba012000-03-02 23:09:20 +11001545# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001546if test ! -z "$IPADDR_IN_DISPLAY" ; then
1547 DISPLAY_HACK_MSG="yes"
1548 AC_DEFINE(IPADDR_IN_DISPLAY)
1549else
1550 DISPLAY_HACK_MSG="no"
1551 AC_ARG_WITH(ipaddr-display,
1552 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1553 [
1554 if test "x$withval" != "xno" ; then
1555 AC_DEFINE(IPADDR_IN_DISPLAY)
1556 DISPLAY_HACK_MSG="yes"
1557 fi
1558 ]
1559 )
1560fi
Damien Miller76112de1999-12-21 11:18:08 +11001561
Damien Millera22ba012000-03-02 23:09:20 +11001562# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001563SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001564AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11001565 [ --with-default-path=PATH Specify default \$PATH environment for server],
1566 [
1567 if test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001568 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001569 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001570 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001571 ],
1572 [
1573 AC_TRY_RUN(
1574 [
1575/* find out what STDPATH is */
1576#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001577#ifdef HAVE_PATHS_H
1578# include <paths.h>
1579#endif
1580#ifndef _PATH_STDPATH
1581# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1582#endif
1583#include <sys/types.h>
1584#include <sys/stat.h>
1585#include <fcntl.h>
1586#define DATA "conftest.stdpath"
1587
1588main()
1589{
1590 FILE *fd;
1591 int rc;
1592
1593 fd = fopen(DATA,"w");
1594 if(fd == NULL)
1595 exit(1);
1596
1597 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1598 exit(1);
1599
1600 exit(0);
1601}
1602 ], [ user_path=`cat conftest.stdpath` ],
1603 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1604 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1605 )
1606# make sure $bindir is in USER_PATH so scp will work
1607 t_bindir=`eval echo ${bindir}`
1608 case $t_bindir in
1609 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1610 esac
1611 case $t_bindir in
1612 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1613 esac
1614 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1615 if test $? -ne 0 ; then
1616 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1617 if test $? -ne 0 ; then
1618 user_path=$user_path:$t_bindir
1619 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1620 fi
1621 fi
Damien Miller5a3e6831999-12-27 09:48:56 +11001622 ]
1623)
Tim Rice59ea0a02001-03-10 13:50:45 -08001624AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1625AC_SUBST(user_path)
Damien Miller5a3e6831999-12-27 09:48:56 +11001626
Damien Millera22ba012000-03-02 23:09:20 +11001627# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10001628IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11001629AC_ARG_WITH(ipv4-default,
1630 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1631 [
1632 if test "x$withval" != "xno" ; then
1633 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10001634 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11001635 fi
1636 ]
1637)
1638
Damien Miller61e50f12000-05-08 20:49:37 +10001639AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10001640IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11001641AC_ARG_WITH(4in6,
1642 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1643 [
1644 if test "x$withval" != "xno" ; then
1645 AC_MSG_RESULT(yes)
1646 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001647 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001648 else
1649 AC_MSG_RESULT(no)
1650 fi
1651 ],[
1652 if test "x$inet6_default_4in6" = "xyes"; then
1653 AC_MSG_RESULT([yes (default)])
1654 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001655 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001656 else
1657 AC_MSG_RESULT([no (default)])
1658 fi
1659 ]
1660)
1661
Damien Miller60396b02001-02-18 17:01:00 +11001662# Whether to enable BSD auth support
1663AC_ARG_WITH(bsd-auth,
1664 [ --with-bsd-auth Enable BSD auth support],
1665 [
1666 if test "x$withval" != "xno" ; then
1667 AC_DEFINE(BSD_AUTH)
1668 bsd_auth=yes
1669 fi
1670 ]
1671)
1672
Damien Miller78315eb2000-09-29 23:01:36 +11001673AC_MSG_CHECKING(whether to install ssh as suid root)
1674AC_ARG_ENABLE(suid-ssh,
1675[ --enable-suid-ssh Install ssh as suid root (default)
1676 --disable-suid-ssh Install ssh without suid bit],
1677[ case "$enableval" in
1678 no)
1679 AC_MSG_RESULT(no)
1680 SSHMODE=0711
1681 ;;
1682 *) AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00001683 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11001684 ;;
1685 esac ],
1686 AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00001687 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11001688)
1689AC_SUBST(SSHMODE)
1690
1691
Damien Millera22ba012000-03-02 23:09:20 +11001692# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11001693piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +11001694AC_ARG_WITH(pid-dir,
1695 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1696 [
1697 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +11001698 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +11001699 fi
1700 ]
1701)
Damien Miller4018c192000-04-30 09:30:44 +10001702
Damien Miller78315eb2000-09-29 23:01:36 +11001703# make sure the directory exists
1704if test ! -d $piddir ; then
1705 piddir=`eval echo ${sysconfdir}`
1706 case $piddir in
1707 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1708 esac
1709fi
1710
Ben Lindstrom226cfa02001-01-22 05:34:40 +00001711AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11001712AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11001713
andre2ff7b5d2000-06-03 14:57:40 +00001714dnl allow user to disable some login recording features
1715AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001716 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001717 [ AC_DEFINE(DISABLE_LASTLOG) ]
1718)
1719AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00001720 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001721 [ AC_DEFINE(DISABLE_UTMP) ]
1722)
1723AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00001724 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001725 [ AC_DEFINE(DISABLE_UTMPX) ]
1726)
1727AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00001728 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001729 [ AC_DEFINE(DISABLE_WTMP) ]
1730)
1731AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00001732 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001733 [ AC_DEFINE(DISABLE_WTMPX) ]
1734)
1735AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00001736 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001737 [ AC_DEFINE(DISABLE_LOGIN) ]
1738)
1739AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00001740 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001741 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1742)
1743AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00001744 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001745 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1746)
1747AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001748 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11001749 [
1750 if test "x$withval" = "xno" ; then
1751 AC_DEFINE(DISABLE_LASTLOG)
1752 else
1753 conf_lastlog_location=$withval
1754 fi
1755 ]
1756)
andre2ff7b5d2000-06-03 14:57:40 +00001757
1758dnl lastlog, [uw]tmpx? detection
1759dnl NOTE: set the paths in the platform section to avoid the
1760dnl need for command-line parameters
1761dnl lastlog and [uw]tmp are subject to a file search if all else fails
1762
1763dnl lastlog detection
1764dnl NOTE: the code itself will detect if lastlog is a directory
1765AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1766AC_TRY_COMPILE([
1767#include <sys/types.h>
1768#include <utmp.h>
1769#ifdef HAVE_LASTLOG_H
1770# include <lastlog.h>
1771#endif
Damien Miller2994e082000-06-04 15:51:47 +10001772#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001773# include <paths.h>
1774#endif
1775 ],
1776 [ char *lastlog = LASTLOG_FILE; ],
1777 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10001778 [
1779 AC_MSG_RESULT(no)
1780 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1781 AC_TRY_COMPILE([
1782#include <sys/types.h>
1783#include <utmp.h>
1784#ifdef HAVE_LASTLOG_H
1785# include <lastlog.h>
1786#endif
1787#ifdef HAVE_PATHS_H
1788# include <paths.h>
1789#endif
1790 ],
1791 [ char *lastlog = _PATH_LASTLOG; ],
1792 [ AC_MSG_RESULT(yes) ],
1793 [
andree441aa32000-06-12 22:34:38 +00001794 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10001795 system_lastlog_path=no
1796 ])
1797 ]
andre2ff7b5d2000-06-03 14:57:40 +00001798)
Damien Miller2994e082000-06-04 15:51:47 +10001799
andre2ff7b5d2000-06-03 14:57:40 +00001800if test -z "$conf_lastlog_location"; then
1801 if test x"$system_lastlog_path" = x"no" ; then
1802 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10001803 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00001804 conf_lastlog_location=$f
1805 fi
1806 done
1807 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00001808 AC_MSG_WARN([** Cannot find lastlog **])
1809 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00001810 fi
1811 fi
1812fi
1813
1814if test -n "$conf_lastlog_location"; then
1815 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1816fi
1817
1818dnl utmp detection
1819AC_MSG_CHECKING([if your system defines UTMP_FILE])
1820AC_TRY_COMPILE([
1821#include <sys/types.h>
1822#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001823#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001824# include <paths.h>
1825#endif
1826 ],
1827 [ char *utmp = UTMP_FILE; ],
1828 [ AC_MSG_RESULT(yes) ],
1829 [ AC_MSG_RESULT(no)
1830 system_utmp_path=no ]
1831)
1832if test -z "$conf_utmp_location"; then
1833 if test x"$system_utmp_path" = x"no" ; then
1834 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1835 if test -f $f ; then
1836 conf_utmp_location=$f
1837 fi
1838 done
1839 if test -z "$conf_utmp_location"; then
1840 AC_DEFINE(DISABLE_UTMP)
1841 fi
1842 fi
1843fi
1844if test -n "$conf_utmp_location"; then
1845 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1846fi
1847
1848dnl wtmp detection
1849AC_MSG_CHECKING([if your system defines WTMP_FILE])
1850AC_TRY_COMPILE([
1851#include <sys/types.h>
1852#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001853#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001854# include <paths.h>
1855#endif
1856 ],
1857 [ char *wtmp = WTMP_FILE; ],
1858 [ AC_MSG_RESULT(yes) ],
1859 [ AC_MSG_RESULT(no)
1860 system_wtmp_path=no ]
1861)
1862if test -z "$conf_wtmp_location"; then
1863 if test x"$system_wtmp_path" = x"no" ; then
1864 for f in /usr/adm/wtmp /var/log/wtmp; do
1865 if test -f $f ; then
1866 conf_wtmp_location=$f
1867 fi
1868 done
1869 if test -z "$conf_wtmp_location"; then
1870 AC_DEFINE(DISABLE_WTMP)
1871 fi
1872 fi
1873fi
1874if test -n "$conf_wtmp_location"; then
1875 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1876fi
1877
1878
1879dnl utmpx detection - I don't know any system so perverse as to require
1880dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1881dnl there, though.
1882AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1883AC_TRY_COMPILE([
1884#include <sys/types.h>
1885#include <utmp.h>
1886#ifdef HAVE_UTMPX_H
1887#include <utmpx.h>
1888#endif
Damien Miller2994e082000-06-04 15:51:47 +10001889#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001890# include <paths.h>
1891#endif
1892 ],
1893 [ char *utmpx = UTMPX_FILE; ],
1894 [ AC_MSG_RESULT(yes) ],
1895 [ AC_MSG_RESULT(no)
1896 system_utmpx_path=no ]
1897)
1898if test -z "$conf_utmpx_location"; then
1899 if test x"$system_utmpx_path" = x"no" ; then
1900 AC_DEFINE(DISABLE_UTMPX)
1901 fi
1902else
1903 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1904fi
1905
1906dnl wtmpx detection
1907AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1908AC_TRY_COMPILE([
1909#include <sys/types.h>
1910#include <utmp.h>
1911#ifdef HAVE_UTMPX_H
1912#include <utmpx.h>
1913#endif
Damien Miller2994e082000-06-04 15:51:47 +10001914#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001915# include <paths.h>
1916#endif
1917 ],
1918 [ char *wtmpx = WTMPX_FILE; ],
1919 [ AC_MSG_RESULT(yes) ],
1920 [ AC_MSG_RESULT(no)
1921 system_wtmpx_path=no ]
1922)
1923if test -z "$conf_wtmpx_location"; then
1924 if test x"$system_wtmpx_path" = x"no" ; then
1925 AC_DEFINE(DISABLE_WTMPX)
1926 fi
1927else
1928 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1929fi
1930
Damien Miller4018c192000-04-30 09:30:44 +10001931
1932# Change default command timeout for builtin PRNG
Damien Miller14c12cb2000-06-07 22:20:23 +10001933entropy_timeout=200
Damien Miller4018c192000-04-30 09:30:44 +10001934AC_ARG_WITH(entropy-timeout,
1935 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1936 [
1937 if test "x$withval" != "xno" ; then
1938 entropy_timeout=$withval
1939 fi
1940 ]
1941)
1942AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1943
1944
Damien Miller29ea30d2000-03-17 10:54:15 +11001945if test ! -z "$blibpath" ; then
1946 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1947 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1948fi
1949
Damien Millerbac2d8a2000-09-05 16:13:06 +11001950AC_EXEEXT
1951
Ben Lindstrom3c06f6a2001-01-31 21:52:01 +00001952AC_OUTPUT(Makefile openbsd-compat/Makefile ssh_prng_cmds)
Damien Miller0437b332000-05-02 09:56:41 +10001953
Damien Miller7b22d652000-06-18 14:07:04 +10001954# Print summary of options
1955
Damien Miller7b22d652000-06-18 14:07:04 +10001956if test ! -z "$RANDOM_POOL" ; then
1957 RAND_MSG="Device ($RANDOM_POOL)"
1958else
Damien Millerd0ccb982001-03-04 00:29:20 +11001959 if test ! -z "$PRNGD_PORT" ; then
1960 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
1961 elif test ! -z "$PRNGD_SOCKET" ; then
1962 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
Damien Miller7b22d652000-06-18 14:07:04 +10001963 else
1964 RAND_MSG="Builtin (timeout $entropy_timeout)"
Damien Miller6f9c3372000-10-25 10:06:04 +11001965 BUILTIN_RNG=1
Damien Miller7b22d652000-06-18 14:07:04 +10001966 fi
1967fi
1968
1969# Someone please show me a better way :)
1970A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1971B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1972C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1973D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00001974E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00001975F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10001976G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Tim Rice59ea0a02001-03-10 13:50:45 -08001977H=`eval echo ${user_path}` ; H=`eval echo ${H}`
Damien Miller7b22d652000-06-18 14:07:04 +10001978
1979echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00001980echo "OpenSSH has been configured with the following options:"
Damien Miller7b22d652000-06-18 14:07:04 +10001981echo " User binaries: $B"
1982echo " System binaries: $C"
1983echo " Configuration files: $D"
1984echo " Askpass program: $E"
1985echo " Manual pages: $F"
1986echo " PID file: $G"
Tim Rice59ea0a02001-03-10 13:50:45 -08001987echo " sshd default user PATH: $H"
Damien Miller7b22d652000-06-18 14:07:04 +10001988echo " Random number collection: $RAND_MSG"
Damien Miller897741e2001-04-16 10:41:46 +10001989echo " Manpage format: $MANTYPE"
Damien Miller7b22d652000-06-18 14:07:04 +10001990echo " PAM support: ${PAM_MSG}"
1991echo " KerberosIV support: $KRB4_MSG"
1992echo " AFS support: $AFS_MSG"
1993echo " S/KEY support: $SKEY_MSG"
1994echo " TCP Wrappers support: $TCPW_MSG"
1995echo " MD5 password support: $MD5_MSG"
1996echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1997echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1998echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1999
Damien Miller60396b02001-02-18 17:01:00 +11002000if test ! -z "$bsd_auth"; then
2001 echo " BSD Auth support: yes"
2002fi
2003
Damien Miller7b22d652000-06-18 14:07:04 +10002004echo ""
2005
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002006echo " Host: ${host}"
2007echo " Compiler: ${CC}"
2008echo " Compiler flags: ${CFLAGS}"
2009echo "Preprocessor flags: ${CPPFLAGS}"
2010echo " Linker flags: ${LDFLAGS}"
2011echo " Libraries: ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002012
2013echo ""
2014
Damien Miller82cf0ce2000-12-20 13:34:48 +11002015if test "x$PAM_MSG" = "xyes" ; then
2016 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
2017 echo "otherwise password authentication may fail. Example PAM control files"
2018 echo "can be found in the contrib/ subdirectory"
2019 echo ""
2020fi
2021
Damien Miller6f9c3372000-10-25 10:06:04 +11002022if test ! -z "$BUILTIN_RNG" ; then
2023 echo "WARNING: you are using the builtin random number collection service."
2024 echo "Please read WARNING.RNG and request that your OS vendor includes"
2025 echo "/dev/random in future versions of their OS."
2026 echo ""
2027fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002028
2029if test ! -z "$NO_SFTP"; then
2030 echo "sftp-server will be disabled. Your compiler does not support"
2031 echo "64bit integers."
2032 echo ""
2033fi
Damien Miller60396b02001-02-18 17:01:00 +11002034