blob: 199c1a6942e3753d5ee52259fdc703f1ffed547e [file] [log] [blame]
Damien Millerc8a38682001-06-25 18:09:16 +10001# $Id: configure.in,v 1.292 2001/06/25 08:09:17 djm 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
44# C Compiler features
45AC_C_INLINE
46if test "$GCC" = "yes"; then
47 CFLAGS="$CFLAGS -Wall"
48fi
49
Damien Millera22ba012000-03-02 23:09:20 +110050# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110051case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110052*-*-aix*)
53 AFS_LIBS="-lld"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000054 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110055 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100056 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Miller29ea30d2000-03-17 10:54:15 +110057 blibpath="/usr/lib:/lib:/usr/local/lib"
58 fi
Damien Millerd2c208a2000-05-17 22:00:02 +100059 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
Damien Millereca71f82000-01-20 22:38:27 +110060 AC_DEFINE(BROKEN_GETADDRINFO)
andre60f3c982000-06-03 16:18:19 +000061 dnl AIX handles lastlog as part of its login message
62 AC_DEFINE(DISABLE_LASTLOG)
Damien Miller75b1d102000-01-07 14:01:41 +110063 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110064*-*-cygwin*)
Damien Milleref767ac2000-10-17 23:14:08 +110065 LIBS="$LIBS -lregex /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110066 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +000067 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +110068 AC_DEFINE(DISABLE_SHADOW)
69 AC_DEFINE(IPV4_DEFAULT)
70 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +000071 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Damien Millerbac2d8a2000-09-05 16:13:06 +110072 no_libsocket=1
73 no_libnsl=1
74 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000075*-*-dgux*)
76 AC_DEFINE(IP_TOS_IS_BROKEN)
77 ;;
Damien Miller76112de1999-12-21 11:18:08 +110078*-*-hpux10*)
79 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +100080 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +110081 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000082 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110083 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +100084 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110085 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110086 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000087 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Damien Miller8a1e6a62000-09-16 15:55:52 +110088 LIBS="$LIBS -lsec"
Damien Miller76112de1999-12-21 11:18:08 +110089 ;;
Damien Miller1bead332000-04-30 00:47:29 +100090*-*-hpux11*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000091 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110092 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +110093 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +110094 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110095 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110096 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000097 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Damien Miller8a1e6a62000-09-16 15:55:52 +110098 LIBS="$LIBS -lsec"
Damien Miller1bead332000-04-30 00:47:29 +100099 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100100*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000101 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000102 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100103 PATH="$PATH:/usr/etc"
Damien Miller1808f382000-01-06 12:03:12 +1100104 no_libsocket=1
105 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000106 AC_DEFINE(BROKEN_INET_NTOA)
Damien Miller1808f382000-01-06 12:03:12 +1100107 ;;
108*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000109 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000110 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100111 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000112 AC_DEFINE(WITH_IRIX_ARRAY)
113 AC_DEFINE(WITH_IRIX_PROJECT)
114 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom4a1d9162000-11-21 10:45:31 +0000115 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100116 no_libsocket=1
117 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000118 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100119 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100120*-*-linux*)
121 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100122 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100123 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000124 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100125 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100126 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000127mips-sony-bsd|mips-sony-newsos4)
128 AC_DEFINE(HAVE_NEWS4)
129 SONY=1
130 AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT),
Damien Miller5dfe9762001-02-16 12:05:39 +1100131 AC_MSG_ERROR([*** libiberty missing - please install first or check config.log ***])
Ben Lindstromb5628642000-10-18 00:02:25 +0000132 )
133 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100134*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100135 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100136 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100137*-*-freebsd*)
138 check_for_libcrypt_later=1
139 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000140*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000141 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100142 conf_utmp_location=/etc/utmp
143 conf_wtmp_location=/usr/adm/wtmp
144 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000145 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000146 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000147 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100148 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000149 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000150 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000151 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100152*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000153 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000154 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100155 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100156 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000157 AC_DEFINE(LOGIN_NEEDS_UTMPX)
158 AC_DEFINE(LOGIN_NEEDS_TERM)
andre2ff7b5d2000-06-03 14:57:40 +0000159 # hardwire lastlog location (can't detect it on some versions)
160 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000161 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
162 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
163 if test "$sol2ver" -ge 8; then
164 AC_MSG_RESULT(yes)
165 AC_DEFINE(DISABLE_UTMP)
166 AC_DEFINE(DISABLE_WTMP)
167 else
168 AC_MSG_RESULT(no)
169 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100170 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000171*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000172 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000173 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100174 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller877d8ea2001-02-18 15:29:28 +1100175 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
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"
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000184 LIBS="$LIBS -lc89 -lnsl -lgen -lsocket"
Ben Lindstrom34328342001-04-23 22:39:42 +0000185 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
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"
Damien Miller2ae714f2000-07-11 09:29:50 +1000189 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100190 IPADDR_IN_DISPLAY=yes
191 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000192 AC_DEFINE(IP_TOS_IS_BROKEN)
Kevin Steves52dd4682001-03-08 18:26:57 +0000193 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Millerb2dc28e2000-07-12 09:18:33 +1000194 LIBS="$LIBS -lgen -lnsl -lucb"
Damien Miller2ae714f2000-07-11 09:29:50 +1000195 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100196*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000197 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100198 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller78315eb2000-09-29 23:01:36 +1100199 enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100200 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100201 ;;
202*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000203 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100204 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller78315eb2000-09-29 23:01:36 +1100205 enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100206 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100207 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100208*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000209 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100210 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100211 LIBS="$LIBS -lgen -lsocket"
212 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100213*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000214 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100215 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Ben Lindstrom980754c2000-11-12 00:04:24 +0000216 LIBS="$LIBS -lgen -lsocket -los -lprot -lx -ltinfo -lm"
Damien Miller78315eb2000-09-29 23:01:36 +1100217 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100218 RANLIB=true
219 no_dev_ptmx=1
220 AC_DEFINE(BROKEN_SYS_TERMIO_H)
221 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100222 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000223 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000224 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
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
Damien Miller78315eb2000-09-29 23:01:36 +1100228 ;;
229*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000230 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000231 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100232 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000233 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100234 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100235 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100236 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000237 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom42717bf2000-12-28 15:46:20 +0000238 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
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 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000242*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000243 AC_MSG_CHECKING(for Digital Unix SIA)
244 no_osfsia=""
245 AC_ARG_WITH(osfsia,
246 [ --with-osfsia Enable Digital Unix SIA],
247 [
248 if test "x$withval" = "xno" ; then
249 AC_MSG_RESULT(disabled)
250 no_osfsia=1
251 fi
252 ],
253 )
254 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000255 if test -f /etc/sia/matrix.conf; then
256 AC_MSG_RESULT(yes)
257 AC_DEFINE(HAVE_OSF_SIA)
258 AC_DEFINE(DISABLE_LOGIN)
259 LIBS="$LIBS -lsecurity -ldb -lm -laud"
260 else
261 AC_MSG_RESULT(no)
262 fi
263 fi
264 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100265esac
266
Damien Millere37bfc12000-06-05 09:37:43 +1000267# Allow user to specify flags
268AC_ARG_WITH(cflags,
269 [ --with-cflags Specify additional flags to pass to compiler],
270 [
271 if test "x$withval" != "xno" ; then
272 CFLAGS="$CFLAGS $withval"
273 fi
274 ]
275)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000276AC_ARG_WITH(cppflags,
277 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
278 [
279 if test "x$withval" != "xno"; then
280 CPPFLAGS="$CPPFLAGS $withval"
281 fi
282 ]
283)
Damien Millere37bfc12000-06-05 09:37:43 +1000284AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000285 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000286 [
287 if test "x$withval" != "xno" ; then
288 LDFLAGS="$LDFLAGS $withval"
289 fi
290 ]
291)
292AC_ARG_WITH(libs,
293 [ --with-libs Specify additional libraries to link with],
294 [
295 if test "x$withval" != "xno" ; then
296 LIBS="$LIBS $withval"
297 fi
298 ]
299)
300
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000301AC_ARG_WITH(pcre,
302 [ --with-pcre Override built in regex library with pcre],
303 [
304
305 AC_CHECK_LIB(pcre, pcre_info,
306 [
307 AC_DEFINE(HAVE_LIBPCRE)
308 LIBS="$LIBS -lpcreposix -lpcre"
309 no_comp_check="yes"
310 ],
311 [ AC_MSG_ERROR([*** Can not locate pcre libraries.]) ]
312 )
313 ]
314)
Damien Millere37bfc12000-06-05 09:37:43 +1000315
Damien Millera22ba012000-03-02 23:09:20 +1100316# Checks for libraries.
Damien Miller22d5aa72001-02-18 12:49:57 +1100317if test -z "$no_libnsl" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000318 AC_CHECK_LIB(nsl, yp_match, , )
319fi
Damien Miller22d5aa72001-02-18 12:49:57 +1100320if test -z "$no_libsocket" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000321 AC_CHECK_LIB(socket, main, , )
322fi
323
Damien Millerdf288022001-02-18 13:07:07 +1100324dnl SCO OS3 needs this for libwrap
325AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
326
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000327AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
Damien Miller5dfe9762001-02-16 12:05:39 +1100328AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Millerab18c411999-11-11 10:40:23 +1100329AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Miller6f9c3372000-10-25 10:06:04 +1100330
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000331# We don't want to check if we did an pcre override.
332if test -z "$no_comp_check" ; then
333 AC_CHECK_FUNC(regcomp,
334 [ AC_DEFINE(HAVE_REGCOMP)],
335 [
336 AC_CHECK_LIB(pcre, pcre_info,
337 [
338 AC_DEFINE(HAVE_LIBPCRE)
339 LIBS="$LIBS -lpcreposix -lpcre"
340 ],
341 [
342 AC_MSG_ERROR([*** No regex library found.])
343 ])
344 ]
345 )
346fi
Damien Millerab18c411999-11-11 10:40:23 +1100347
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000348dnl UnixWare 2.x
349AC_CHECK_FUNC(strcasecmp,
350 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
351)
352AC_CHECK_FUNC(utimes,
353 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
354)
Damien Millerab18c411999-11-11 10:40:23 +1100355
Ben Lindstrom8697e082001-02-24 21:41:10 +0000356AC_FUNC_STRFTIME
357
Damien Millera22ba012000-03-02 23:09:20 +1100358# Checks for header files.
Ben Lindstrom68c3ce12001-06-10 17:24:51 +0000359AC_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 +1100360
361# Check for ALTDIRFUNC glob() extension
362AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
363AC_EGREP_CPP(FOUNDIT,
364 [
365 #include <glob.h>
366 #ifdef GLOB_ALTDIRFUNC
367 FOUNDIT
368 #endif
369 ],
370 [
371 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
372 AC_MSG_RESULT(yes)
373 ],
374 [
375 AC_MSG_RESULT(no)
376 ]
377)
Damien Millerab18c411999-11-11 10:40:23 +1100378
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000379# Check for g.gl_matchc glob() extension
380AC_MSG_CHECKING(for gl_matchc field in glob_t)
381AC_EGREP_CPP(FOUNDIT,
382 [
383 #include <glob.h>
384 int main(void){glob_t g; g.gl_matchc = 1;}
385 ],
386 [
387 AC_DEFINE(GLOB_HAS_GL_MATCHC)
388 AC_MSG_RESULT(yes)
389 ],
390 [
391 AC_MSG_RESULT(no)
392 ]
393)
394
Damien Miller18bb4732001-03-28 14:35:30 +1000395AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
396AC_TRY_RUN(
397 [
398#include <sys/types.h>
399#include <dirent.h>
400int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
401 ],
402 [AC_MSG_RESULT(yes)],
403 [
404 AC_MSG_RESULT(no)
405 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
406 ]
407)
408
Damien Millerc547bf12001-02-16 10:18:12 +1100409# Check whether user wants S/Key support
410SKEY_MSG="no"
411AC_ARG_WITH(skey,
412 [ --with-skey=PATH Enable S/Key support],
413 [
414 if test "x$withval" != "xno" ; then
415
416 if test "x$withval" != "xyes" ; then
417 CPPFLAGS="$CPPFLAGS -I${withval}/include"
418 LDFLAGS="$LDFLAGS -L${withval}/lib"
419 fi
420
421 AC_DEFINE(SKEY)
422 LIBS="-lskey $LIBS"
423 SKEY_MSG="yes"
424
425 AC_CHECK_FUNC(skey_keyinfo,
426 [],
427 [
428 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
429 ])
430 fi
431 ]
432)
433
434# Check whether user wants TCP wrappers support
435TCPW_MSG="no"
436AC_ARG_WITH(tcp-wrappers,
437 [ --with-tcp-wrappers Enable tcpwrappers support],
438 [
439 if test "x$withval" != "xno" ; then
440 saved_LIBS="$LIBS"
441 LIBS="-lwrap $LIBS"
442 AC_MSG_CHECKING(for libwrap)
443 AC_TRY_LINK(
444 [
445#include <tcpd.h>
446 int deny_severity = 0, allow_severity = 0;
447 ],
448 [hosts_access(0);],
449 [
450 AC_MSG_RESULT(yes)
451 AC_DEFINE(LIBWRAP)
452 TCPW_MSG="yes"
453 ],
454 [
455 AC_MSG_ERROR([*** libwrap missing])
456 ]
457 )
458 fi
459 ]
460)
461
Damien Millerad833b32000-08-23 10:46:23 +1000462dnl Checks for library functions.
Damien Millerc8a38682001-06-25 18:09:16 +1000463AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa clock dirname fchown fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getnameinfo getrlimit getrusage getttyent getusershell 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 strtok_r sysconf tcgetpgrp utimes vsnprintf vhangup vis waitpid _getpty __b64_ntop)
Damien Millerad833b32000-08-23 10:46:23 +1000464dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000465AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000466dnl Checks for libutil functions
Ben Lindstrome2fb8d32000-12-28 00:07:07 +0000467AC_CHECK_HEADERS(libutil.h)
andre2ff7b5d2000-06-03 14:57:40 +0000468AC_CHECK_FUNCS(login logout updwtmp logwtmp)
Damien Millerad833b32000-08-23 10:46:23 +1000469dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000470AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000471AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000472dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000473AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000474AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100475
Damien Miller5fc85652000-07-09 23:53:07 +1000476AC_CHECK_FUNC(getuserattr,
477 [AC_DEFINE(HAVE_GETUSERATTR)],
478 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
479)
480
Damien Miller04f80141999-11-19 15:32:34 +1100481AC_CHECK_FUNC(login,
482 [AC_DEFINE(HAVE_LOGIN)],
483 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
484)
485
486AC_CHECK_FUNC(daemon,
487 [AC_DEFINE(HAVE_DAEMON)],
488 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
489)
490
Damien Miller9fb07e42000-03-05 16:22:59 +1100491AC_CHECK_FUNC(getpagesize,
492 [AC_DEFINE(HAVE_GETPAGESIZE)],
493 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
494)
495
Damien Millercb170cb2000-07-01 16:52:55 +1000496# Check for broken snprintf
497if test "x$ac_cv_func_snprintf" = "xyes" ; then
498 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
499 AC_TRY_RUN(
500 [
501#include <stdio.h>
502int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
503 ],
504 [AC_MSG_RESULT(yes)],
505 [
506 AC_MSG_RESULT(no)
507 AC_DEFINE(BROKEN_SNPRINTF)
508 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
509 ]
510 )
511fi
512
Damien Miller606f8802000-09-16 15:39:56 +1100513AC_FUNC_GETPGRP
514
Damien Millera64b57a2001-01-17 10:44:13 +1100515# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000516PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100517AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100518 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100519 [
Damien Millera64b57a2001-01-17 10:44:13 +1100520 if test "x$withval" != "xno" ; then
521 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
522 AC_MSG_ERROR([PAM headers not found])
523 fi
524
525 AC_CHECK_LIB(dl, dlopen, , )
526 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
527 AC_CHECK_FUNCS(pam_getenvlist)
528
529 disable_shadow=yes
530 PAM_MSG="yes"
531
532 AC_DEFINE(USE_PAM)
Damien Millera22ba012000-03-02 23:09:20 +1100533 fi
534 ]
535)
Damien Millera22ba012000-03-02 23:09:20 +1100536
Damien Millera64b57a2001-01-17 10:44:13 +1100537# Check for older PAM
538if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100539 # Check PAM strerror arguments (old PAM)
540 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
541 AC_TRY_COMPILE(
542 [
Damien Miller81171112000-04-23 11:14:01 +1000543#include <stdlib.h>
544#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100545 ],
546 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
547 [AC_MSG_RESULT(no)],
548 [
549 AC_DEFINE(HAVE_OLD_PAM)
550 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000551 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100552 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100553 )
Damien Millera22ba012000-03-02 23:09:20 +1100554fi
555
556# The big search for OpenSSL
557AC_ARG_WITH(ssl-dir,
558 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
559 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000560 if test "x$withval" != "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100561 tryssldir=$withval
562 fi
563 ]
564)
565
566saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100567saved_LDFLAGS="$LDFLAGS"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000568saved_CPPFLAGS="$CPPFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100569if test "x$prefix" != "xNONE" ; then
570 tryssldir="$tryssldir $prefix"
571fi
Damien Miller61e50f12000-05-08 20:49:37 +1000572AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera1b61e12000-09-16 17:02:16 +1100573 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 +1100574 CPPFLAGS="$saved_CPPFLAGS"
575 LDFLAGS="$saved_LDFLAGS"
Damien Miller3b512e12000-05-17 23:29:18 +1000576 LIBS="$saved_LIBS -lcrypto"
Damien Millerccdefb62001-02-19 12:56:39 +1100577
578 # Skip directories if they don't exist
579 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
580 continue;
581 fi
582 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
583 # Try to use $ssldir/lib if it exists, otherwise
584 # $ssldir
585 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000586 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100587 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000588 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100589 fi
590 else
Damien Millerb68af622001-03-28 21:05:26 +1000591 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100592 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000593 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100594 fi
595 fi
596 # Try to use $ssldir/include if it exists, otherwise
597 # $ssldir
598 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000599 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100600 else
Damien Millerb68af622001-03-28 21:05:26 +1000601 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100602 fi
603 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000604
Damien Miller3b512e12000-05-17 23:29:18 +1000605 # Basic test to check for compatible version and correct linking
606 # *does not* test for RSA - that comes later.
607 AC_TRY_RUN(
608 [
Damien Millere59ce622000-05-01 20:54:17 +1000609#include <string.h>
610#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000611int main(void)
612{
Damien Miller3b512e12000-05-17 23:29:18 +1000613 char a[2048];
614 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000615 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000616 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000617}
Damien Miller3b512e12000-05-17 23:29:18 +1000618 ],
619 [
620 found_crypto=1
621 break;
622 ], []
623 )
Damien Miller61e50f12000-05-08 20:49:37 +1000624
625 if test ! -z "$found_crypto" ; then
626 break;
627 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100628 done
629
Damien Miller61e50f12000-05-08 20:49:37 +1000630 if test -z "$found_crypto" ; then
Damien Miller5dfe9762001-02-16 12:05:39 +1100631 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
Damien Millerb85dcad2000-03-11 11:37:00 +1100632 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000633 if test -z "$ssldir" ; then
634 ssldir="(system)"
635 fi
Damien Millera22ba012000-03-02 23:09:20 +1100636
Damien Miller61e50f12000-05-08 20:49:37 +1000637 ac_cv_openssldir=$ssldir
638])
639
Damien Milleredb82922000-06-20 13:25:52 +1000640if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000641 AC_DEFINE(HAVE_OPENSSL)
642 dnl Need to recover ssldir - test above runs in subshell
643 ssldir=$ac_cv_openssldir
Damien Millera64b57a2001-01-17 10:44:13 +1100644 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
Damien Millerccdefb62001-02-19 12:56:39 +1100645 # Try to use $ssldir/lib if it exists, otherwise
646 # $ssldir
647 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000648 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100649 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000650 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100651 fi
652 else
Damien Millerb68af622001-03-28 21:05:26 +1000653 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100654 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000655 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100656 fi
Damien Millera64b57a2001-01-17 10:44:13 +1100657 fi
Damien Millerccdefb62001-02-19 12:56:39 +1100658 # Try to use $ssldir/include if it exists, otherwise
659 # $ssldir
660 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000661 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100662 else
Damien Millerb68af622001-03-28 21:05:26 +1000663 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millera64b57a2001-01-17 10:44:13 +1100664 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100665 fi
Damien Millera22ba012000-03-02 23:09:20 +1100666fi
Damien Miller3b512e12000-05-17 23:29:18 +1000667LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000668
Damien Miller3b512e12000-05-17 23:29:18 +1000669# Now test RSA support
670saved_LIBS="$LIBS"
671AC_MSG_CHECKING([for RSA support])
672for WANTS_RSAREF in "" 1 ; do
673 if test -z "$WANTS_RSAREF" ; then
674 LIBS="$saved_LIBS"
675 else
676 LIBS="$saved_LIBS -lRSAglue -lrsaref"
677 fi
678 AC_TRY_RUN([
679#include <string.h>
680#include <openssl/rand.h>
681#include <openssl/rsa.h>
682#include <openssl/bn.h>
683#include <openssl/sha.h>
684int main(void)
685{
686 int num; RSA *key; static unsigned char p_in[] = "blahblah";
687 unsigned char c[256], p[256];
688 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
689 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
690 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
691 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
692}
693 ],
694 [
695 rsa_works=1
696 break;
697 ], [])
698done
Ben Lindstrom23fec142001-06-09 02:16:28 +0000699LIBS="$saved_LIBS"
Damien Miller3b512e12000-05-17 23:29:18 +1000700
701if test ! -z "$no_rsa" ; then
702 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000703 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000704else
705 if test -z "$rsa_works" ; then
706 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000707 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000708 else
709 if test -z "$WANTS_RSAREF" ; then
710 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000711 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000712 else
Damien Miller7b22d652000-06-18 14:07:04 +1000713 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000714 AC_MSG_RESULT(using RSAref)
Ben Lindstrom23fec142001-06-09 02:16:28 +0000715 LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
Damien Miller3b512e12000-05-17 23:29:18 +1000716 fi
717 fi
718fi
Damien Millera22ba012000-03-02 23:09:20 +1100719
Damien Millera64b57a2001-01-17 10:44:13 +1100720# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
721# version in OpenSSL. Skip this for PAM
722if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100723 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100724fi
725
Ben Lindstromb5628642000-10-18 00:02:25 +0000726# Cheap hack to ensure NEWS-OS libraries are arranged right.
727if test ! -z "$SONY" ; then
728 LIBS="$LIBS -liberty";
729fi
730
Damien Millera22ba012000-03-02 23:09:20 +1100731# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100732AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100733AC_CHECK_SIZEOF(short int, 2)
734AC_CHECK_SIZEOF(int, 4)
735AC_CHECK_SIZEOF(long int, 4)
736AC_CHECK_SIZEOF(long long int, 8)
737
Damien Millera22ba012000-03-02 23:09:20 +1100738# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +1100739AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
740 AC_TRY_COMPILE(
741 [ #include <sys/types.h> ],
742 [ u_int a; a = 1;],
743 [ ac_cv_have_u_int="yes" ],
744 [ ac_cv_have_u_int="no" ]
745 )
746])
747if test "x$ac_cv_have_u_int" = "xyes" ; then
748 AC_DEFINE(HAVE_U_INT)
749 have_u_int=1
750fi
751
Damien Miller61e50f12000-05-08 20:49:37 +1000752AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
753 AC_TRY_COMPILE(
754 [ #include <sys/types.h> ],
755 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
756 [ ac_cv_have_intxx_t="yes" ],
757 [ ac_cv_have_intxx_t="no" ]
758 )
759])
760if test "x$ac_cv_have_intxx_t" = "xyes" ; then
761 AC_DEFINE(HAVE_INTXX_T)
762 have_intxx_t=1
763fi
764
Damien Miller578783e2000-09-23 14:12:24 +1100765AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
766 AC_TRY_COMPILE(
767 [ #include <sys/types.h> ],
768 [ int64_t a; a = 1;],
769 [ ac_cv_have_int64_t="yes" ],
770 [ ac_cv_have_int64_t="no" ]
771 )
772])
773if test "x$ac_cv_have_int64_t" = "xyes" ; then
774 AC_DEFINE(HAVE_INT64_T)
775 have_int64_t=1
776fi
777
Damien Miller61e50f12000-05-08 20:49:37 +1000778AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
779 AC_TRY_COMPILE(
780 [ #include <sys/types.h> ],
781 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
782 [ ac_cv_have_u_intxx_t="yes" ],
783 [ ac_cv_have_u_intxx_t="no" ]
784 )
785])
786if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
787 AC_DEFINE(HAVE_U_INTXX_T)
788 have_u_intxx_t=1
789fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100790
Damien Miller578783e2000-09-23 14:12:24 +1100791AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
792 AC_TRY_COMPILE(
793 [ #include <sys/types.h> ],
794 [ u_int64_t a; a = 1;],
795 [ ac_cv_have_u_int64_t="yes" ],
796 [ ac_cv_have_u_int64_t="no" ]
797 )
798])
799if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
800 AC_DEFINE(HAVE_U_INT64_T)
801 have_u_int64_t=1
802fi
803
Damien Milleredb82922000-06-20 13:25:52 +1000804if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
805 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +1100806then
807 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
808 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +1000809 [
810#include <sys/bitypes.h>
811 ],
Damien Millerb29ea912000-01-15 14:12:03 +1100812 [
Damien Miller70494d12000-04-03 15:57:06 +1000813 int8_t a; int16_t b; int32_t c;
814 u_int8_t e; u_int16_t f; u_int32_t g;
815 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +1100816 ],
817 [
818 AC_DEFINE(HAVE_U_INTXX_T)
819 AC_DEFINE(HAVE_INTXX_T)
820 AC_MSG_RESULT(yes)
821 ],
822 [AC_MSG_RESULT(no)]
823 )
824fi
825
Damien Millerd6121d22000-03-17 23:26:46 +1100826if test -z "$have_u_intxx_t" ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000827 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
828 AC_TRY_COMPILE(
829 [
830#include <sys/types.h>
831 ],
832 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
833 [ ac_cv_have_uintxx_t="yes" ],
834 [ ac_cv_have_uintxx_t="no" ]
835 )
836 ])
837 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
838 AC_DEFINE(HAVE_UINTXX_T)
839 fi
Damien Millerd6121d22000-03-17 23:26:46 +1100840fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100841
Damien Miller61e50f12000-05-08 20:49:37 +1000842AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
843 AC_TRY_COMPILE(
844 [
Damien Miller81171112000-04-23 11:14:01 +1000845#include <sys/types.h>
846#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000847 ],
848 [socklen_t foo; foo = 1235;],
849 [ ac_cv_have_socklen_t="yes" ],
850 [ ac_cv_have_socklen_t="no" ]
851 )
852])
853if test "x$ac_cv_have_socklen_t" = "xyes" ; then
854 AC_DEFINE(HAVE_SOCKLEN_T)
855fi
Damien Miller74d0d4a1999-12-29 02:24:35 +1100856
Damien Miller61e50f12000-05-08 20:49:37 +1000857AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
858 AC_TRY_COMPILE(
859 [
860#include <sys/types.h>
861 ],
862 [ size_t foo; foo = 1235; ],
863 [ ac_cv_have_size_t="yes" ],
864 [ ac_cv_have_size_t="no" ]
865 )
866])
867if test "x$ac_cv_have_size_t" = "xyes" ; then
868 AC_DEFINE(HAVE_SIZE_T)
869fi
Damien Miller95058511999-12-29 10:36:45 +1100870
Damien Miller615f9392000-05-17 22:53:33 +1000871AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
872 AC_TRY_COMPILE(
873 [
874#include <sys/types.h>
875 ],
876 [ ssize_t foo; foo = 1235; ],
877 [ ac_cv_have_ssize_t="yes" ],
878 [ ac_cv_have_ssize_t="no" ]
879 )
880])
881if test "x$ac_cv_have_ssize_t" = "xyes" ; then
882 AC_DEFINE(HAVE_SSIZE_T)
883fi
884
Ben Lindstrom0d5af602001-01-09 00:50:29 +0000885AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
886 AC_TRY_COMPILE(
887 [
888#include <time.h>
889 ],
890 [ clock_t foo; foo = 1235; ],
891 [ ac_cv_have_clock_t="yes" ],
892 [ ac_cv_have_clock_t="no" ]
893 )
894])
895if test "x$ac_cv_have_clock_t" = "xyes" ; then
896 AC_DEFINE(HAVE_CLOCK_T)
897fi
898
Damien Millerb54b40e2000-06-23 08:23:34 +1000899AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
900 AC_TRY_COMPILE(
901 [
902#include <sys/types.h>
903#include <sys/socket.h>
904 ],
905 [ sa_family_t foo; foo = 1235; ],
906 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +1100907 [ AC_TRY_COMPILE(
908 [
909#include <sys/types.h>
910#include <sys/socket.h>
911#include <netinet/in.h>
912 ],
913 [ sa_family_t foo; foo = 1235; ],
914 [ ac_cv_have_sa_family_t="yes" ],
915
Damien Millerb54b40e2000-06-23 08:23:34 +1000916 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +1100917 )]
Damien Millerb54b40e2000-06-23 08:23:34 +1000918 )
919])
920if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
921 AC_DEFINE(HAVE_SA_FAMILY_T)
922fi
923
Damien Miller0f91b4e2000-06-18 15:43:25 +1000924AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
925 AC_TRY_COMPILE(
926 [
927#include <sys/types.h>
928 ],
929 [ pid_t foo; foo = 1235; ],
930 [ ac_cv_have_pid_t="yes" ],
931 [ ac_cv_have_pid_t="no" ]
932 )
933])
934if test "x$ac_cv_have_pid_t" = "xyes" ; then
935 AC_DEFINE(HAVE_PID_T)
936fi
937
938AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
939 AC_TRY_COMPILE(
940 [
941#include <sys/types.h>
942 ],
943 [ mode_t foo; foo = 1235; ],
944 [ ac_cv_have_mode_t="yes" ],
945 [ ac_cv_have_mode_t="no" ]
946 )
947])
948if test "x$ac_cv_have_mode_t" = "xyes" ; then
949 AC_DEFINE(HAVE_MODE_T)
950fi
951
Damien Miller61e50f12000-05-08 20:49:37 +1000952
953AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
954 AC_TRY_COMPILE(
955 [
Damien Miller81171112000-04-23 11:14:01 +1000956#include <sys/types.h>
957#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000958 ],
959 [ struct sockaddr_storage s; ],
960 [ ac_cv_have_struct_sockaddr_storage="yes" ],
961 [ ac_cv_have_struct_sockaddr_storage="no" ]
962 )
963])
964if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
965 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
966fi
Damien Miller34132e52000-01-14 15:45:46 +1100967
Damien Miller61e50f12000-05-08 20:49:37 +1000968AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
969 AC_TRY_COMPILE(
970 [
Damien Miller7b22d652000-06-18 14:07:04 +1000971#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000972#include <netinet/in.h>
973 ],
974 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
975 [ ac_cv_have_struct_sockaddr_in6="yes" ],
976 [ ac_cv_have_struct_sockaddr_in6="no" ]
977 )
978])
979if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
980 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
981fi
Damien Miller34132e52000-01-14 15:45:46 +1100982
Damien Miller61e50f12000-05-08 20:49:37 +1000983AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
984 AC_TRY_COMPILE(
985 [
Damien Miller7b22d652000-06-18 14:07:04 +1000986#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000987#include <netinet/in.h>
988 ],
989 [ struct in6_addr s; s.s6_addr[0] = 0; ],
990 [ ac_cv_have_struct_in6_addr="yes" ],
991 [ ac_cv_have_struct_in6_addr="no" ]
992 )
993])
994if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
995 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
996fi
Damien Miller34132e52000-01-14 15:45:46 +1100997
Damien Miller61e50f12000-05-08 20:49:37 +1000998AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
999 AC_TRY_COMPILE(
1000 [
Damien Miller81171112000-04-23 11:14:01 +10001001#include <sys/types.h>
1002#include <sys/socket.h>
1003#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001004 ],
1005 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1006 [ ac_cv_have_struct_addrinfo="yes" ],
1007 [ ac_cv_have_struct_addrinfo="no" ]
1008 )
1009])
1010if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1011 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1012fi
1013
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001014AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1015 AC_TRY_COMPILE(
1016 [ #include <sys/time.h> ],
1017 [ struct timeval tv; tv.tv_sec = 1;],
1018 [ ac_cv_have_struct_timeval="yes" ],
1019 [ ac_cv_have_struct_timeval="no" ]
1020 )
1021])
1022if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1023 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1024 have_struct_timeval=1
1025fi
1026
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001027# If we don't have int64_t then we can't compile sftp-server. So don't
1028# even attempt to do it.
1029if test "x$ac_cv_have_int64_t" = "xno" -a \
1030 "x$ac_cv_sizeof_long_int" != "x8" -a \
1031 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1032 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001033else
1034dnl test snprintf (broken on SCO w/gcc)
1035 AC_TRY_RUN(
1036 [
1037#include <stdio.h>
1038#include <string.h>
1039#ifdef HAVE_SNPRINTF
1040main()
1041{
1042 char buf[50];
1043 char expected_out[50];
1044 int mazsize = 50 ;
1045#if (SIZEOF_LONG_INT == 8)
1046 long int num = 0x7fffffffffffffff;
1047#else
1048 long long num = 0x7fffffffffffffff;
1049#endif
1050 strcpy(expected_out, "9223372036854775807");
1051 snprintf(buf, mazsize, "%lld", num);
1052 if(strcmp(buf, expected_out) != 0)
1053 exit(1);
1054 exit(0);
1055}
1056#else
1057main() { exit(0); }
1058#endif
1059 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1060 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001061fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001062AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001063
Damien Miller78315eb2000-09-29 23:01:36 +11001064dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001065OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1066OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1067OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1068OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1069OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001070OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001071OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1072OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001073OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001074OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1075OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1076OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1077OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001078OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1079OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1080OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1081OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Damien Miller78315eb2000-09-29 23:01:36 +11001082AC_STRUCT_ST_BLKSIZE
andre2ff7b5d2000-06-03 14:57:40 +00001083
Damien Miller942da032000-08-18 13:59:06 +10001084AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
1085 ac_cv_have_sun_len_in_struct_sockaddr_un, [
1086 AC_TRY_COMPILE(
1087 [
1088#include <sys/types.h>
1089#include <sys/socket.h>
1090 ],
1091 [ struct sockaddr_un s; s.sun_len = 1; ],
1092 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
1093 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
1094 )
1095])
1096if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
1097 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
1098fi
1099
Damien Miller61e50f12000-05-08 20:49:37 +10001100AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1101 ac_cv_have_ss_family_in_struct_ss, [
1102 AC_TRY_COMPILE(
1103 [
Damien Miller81171112000-04-23 11:14:01 +10001104#include <sys/types.h>
1105#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001106 ],
1107 [ struct sockaddr_storage s; s.ss_family = 1; ],
1108 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1109 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1110 )
1111])
1112if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1113 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1114fi
1115
Damien Miller61e50f12000-05-08 20:49:37 +10001116AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1117 ac_cv_have___ss_family_in_struct_ss, [
1118 AC_TRY_COMPILE(
1119 [
Damien Miller81171112000-04-23 11:14:01 +10001120#include <sys/types.h>
1121#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001122 ],
1123 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1124 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1125 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1126 )
1127])
1128if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1129 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1130fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001131
Damien Millerad833b32000-08-23 10:46:23 +10001132AC_CACHE_CHECK([for pw_class field in struct passwd],
1133 ac_cv_have_pw_class_in_struct_passwd, [
1134 AC_TRY_COMPILE(
1135 [
Damien Millerad833b32000-08-23 10:46:23 +10001136#include <pwd.h>
1137 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001138 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001139 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1140 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1141 )
1142])
1143if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1144 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1145fi
1146
Kevin Steves82456952001-06-22 21:14:18 +00001147AC_CACHE_CHECK([for pw_expire field in struct passwd],
1148 ac_cv_have_pw_expire_in_struct_passwd, [
1149 AC_TRY_COMPILE(
1150 [
1151#include <pwd.h>
1152 ],
1153 [ struct passwd p; p.pw_expire = 0; ],
1154 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1155 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1156 )
1157])
1158if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1159 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1160fi
1161
1162AC_CACHE_CHECK([for pw_change field in struct passwd],
1163 ac_cv_have_pw_change_in_struct_passwd, [
1164 AC_TRY_COMPILE(
1165 [
1166#include <pwd.h>
1167 ],
1168 [ struct passwd p; p.pw_change = 0; ],
1169 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1170 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1171 )
1172])
1173if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1174 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1175fi
Damien Miller61e50f12000-05-08 20:49:37 +10001176
1177AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1178 AC_TRY_LINK([],
1179 [ extern char *__progname; printf("%s", __progname); ],
1180 [ ac_cv_libc_defines___progname="yes" ],
1181 [ ac_cv_libc_defines___progname="no" ]
1182 )
1183])
1184if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1185 AC_DEFINE(HAVE___PROGNAME)
1186fi
1187
Damien Millera22ba012000-03-02 23:09:20 +11001188
Damien Millerecbb26d2000-07-15 14:59:14 +10001189AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1190 AC_TRY_LINK([],
1191 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1192 [ ac_cv_libc_defines_sys_errlist="yes" ],
1193 [ ac_cv_libc_defines_sys_errlist="no" ]
1194 )
1195])
1196if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1197 AC_DEFINE(HAVE_SYS_ERRLIST)
1198fi
1199
1200
Damien Miller11fa2cc2000-08-16 10:35:58 +10001201AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1202 AC_TRY_LINK([],
1203 [ extern int sys_nerr; printf("%i", sys_nerr);],
1204 [ ac_cv_libc_defines_sys_nerr="yes" ],
1205 [ ac_cv_libc_defines_sys_nerr="no" ]
1206 )
1207])
1208if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1209 AC_DEFINE(HAVE_SYS_NERR)
1210fi
1211
1212
Damien Millerc79bc0d2001-03-28 13:03:42 +10001213# Check whether user wants Kerberos support
1214KRB4_MSG="no"
1215AC_ARG_WITH(kerberos4,
1216 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1217 [
1218 if test "x$withval" != "xno" ; then
1219
1220 if test "x$withval" != "xyes" ; then
1221 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1222 LDFLAGS="$LDFLAGS -L${withval}/lib"
1223 if test ! -z "$need_dash_r" ; then
1224 LDFLAGS="$LDFLAGS -R${withval}/lib"
1225 fi
1226 if test ! -z "$blibpath" ; then
1227 blibpath="$blibpath:${withval}/lib"
1228 fi
1229 else
1230 if test -d /usr/include/kerberosIV ; then
1231 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1232 fi
1233 fi
1234
1235 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001236 if test "$ac_cv_header_krb_h" != yes; then
1237 AC_MSG_WARN([Cannot find krb.h, build may fail])
1238 fi
Damien Miller98344742001-03-28 14:37:06 +10001239 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001240 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001241 AC_CHECK_LIB(krb4, main)
1242 if test "$ac_cv_lib_krb4_main" != yes; then
1243 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1244 else
1245 KLIBS="-lkrb4"
1246 fi
1247 else
1248 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001249 fi
Damien Miller98344742001-03-28 14:37:06 +10001250 AC_CHECK_LIB(des, des_cbc_encrypt)
1251 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1252 AC_CHECK_LIB(des425, des_cbc_encrypt)
1253 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1254 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1255 else
1256 KLIBS="-ldes425"
1257 fi
1258 else
1259 KLIBS="-ldes"
1260 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001261 AC_CHECK_LIB(resolv, dn_expand, , )
1262 KRB4=yes
1263 KRB4_MSG="yes"
1264 AC_DEFINE(KRB4)
1265 fi
1266 ]
1267)
1268
1269# Check whether user wants AFS support
1270AFS_MSG="no"
1271AC_ARG_WITH(afs,
1272 [ --with-afs=PATH Enable AFS support],
1273 [
1274 if test "x$withval" != "xno" ; then
1275
1276 if test "x$withval" != "xyes" ; then
1277 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1278 LDFLAGS="$LDFLAGS -L${withval}/lib"
1279 fi
1280
1281 if test -z "$KRB4" ; then
1282 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1283 fi
1284
1285 LIBS="-lkafs $LIBS"
1286 if test ! -z "$AFS_LIBS" ; then
1287 LIBS="$LIBS $AFS_LIBS"
1288 fi
1289 AC_DEFINE(AFS)
1290 AFS_MSG="yes"
1291 fi
1292 ]
1293)
1294LIBS="$LIBS $KLIBS"
1295
Damien Millera22ba012000-03-02 23:09:20 +11001296# Looking for programs, paths and files
1297AC_ARG_WITH(rsh,
1298 [ --with-rsh=PATH Specify path to remote shell program ],
1299 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001300 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001301 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001302 fi
1303 ],
1304 [
1305 AC_PATH_PROG(rsh_path, rsh)
1306 ]
1307)
1308
1309AC_ARG_WITH(xauth,
1310 [ --with-xauth=PATH Specify path to xauth program ],
1311 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001312 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001313 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001314 fi
1315 ],
1316 [
Damien Miller78315eb2000-09-29 23:01:36 +11001317 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 +10001318 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001319 xauth_path="/usr/openwin/bin/xauth"
1320 fi
1321 ]
1322)
1323
Damien Millera19cf472000-11-29 13:28:50 +11001324if test -z "$xauth_path" ; then
1325 XAUTH_PATH="undefined"
1326 AC_SUBST(XAUTH_PATH)
1327else
Damien Millera22ba012000-03-02 23:09:20 +11001328 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001329 XAUTH_PATH=$xauth_path
1330 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001331fi
1332if test ! -z "$rsh_path" ; then
1333 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1334fi
1335
1336# Check for mail directory (last resort if we cannot get it from headers)
1337if test ! -z "$MAIL" ; then
1338 maildir=`dirname $MAIL`
1339 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1340fi
1341
Damien Millera22ba012000-03-02 23:09:20 +11001342if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +11001343 AC_CHECK_FILE("/dev/ptmx",
1344 [
1345 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1346 have_dev_ptmx=1
1347 ]
1348 )
Damien Millera22ba012000-03-02 23:09:20 +11001349fi
Damien Miller204ad072000-03-02 23:56:12 +11001350AC_CHECK_FILE("/dev/ptc",
1351 [
1352 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1353 have_dev_ptc=1
1354 ]
1355)
1356
Damien Millera22ba012000-03-02 23:09:20 +11001357# Options from here on. Some of these are preset by platform above
1358
Damien Millera22ba012000-03-02 23:09:20 +11001359# Check for user-specified random device, otherwise check /dev/urandom
1360AC_ARG_WITH(random,
Damien Miller0736c4d2001-01-25 10:51:46 +11001361 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
Damien Millera22ba012000-03-02 23:09:20 +11001362 [
Damien Miller040f3832000-04-03 14:50:43 +10001363 if test "x$withval" != "xno" ; then
1364 RANDOM_POOL="$withval";
1365 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1366 fi
Damien Millera22ba012000-03-02 23:09:20 +11001367 ],
1368 [
1369 # Check for random device
1370 AC_CHECK_FILE("/dev/urandom",
1371 [
1372 RANDOM_POOL="/dev/urandom";
1373 AC_SUBST(RANDOM_POOL)
1374 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1375 ]
1376 )
1377 ]
1378)
1379
Damien Millerd0ccb982001-03-04 00:29:20 +11001380# Check for PRNGD/EGD pool file
1381AC_ARG_WITH(prngd-port,
1382 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1383 [
1384 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1385 PRNGD_PORT="$withval"
1386 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1387 fi
1388 ]
1389)
1390
1391# Check for PRNGD/EGD pool file
1392AC_ARG_WITH(prngd-socket,
1393 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
Damien Millera22ba012000-03-02 23:09:20 +11001394 [
Damien Miller040f3832000-04-03 14:50:43 +10001395 if test "x$withval" != "xno" ; then
Damien Millerd0ccb982001-03-04 00:29:20 +11001396 PRNGD_SOCKET="$withval"
1397 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller040f3832000-04-03 14:50:43 +10001398 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001399 ],
1400 [
1401 # Check for existing socket only if we don't have a random device already
1402 if test -z "$RANDOM_POOL" ; then
1403 AC_MSG_CHECKING(for PRNGD/EGD socket)
1404 # Insert other locations here
Tim Ricebee3f222001-03-11 17:32:12 -08001405 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
Damien Millerd0ccb982001-03-04 00:29:20 +11001406 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1407 PRNGD_SOCKET="$sock"
1408 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller0736c4d2001-01-25 10:51:46 +11001409 break;
1410 fi
1411 done
Damien Millerd0ccb982001-03-04 00:29:20 +11001412 if test ! -z "$PRNGD_SOCKET" ; then
1413 AC_MSG_RESULT($PRNGD_SOCKET)
Damien Miller4864e8f2001-02-08 10:07:08 +11001414 else
1415 AC_MSG_RESULT(not found)
1416 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001417 fi
Damien Millera22ba012000-03-02 23:09:20 +11001418 ]
1419)
1420
Damien Miller0736c4d2001-01-25 10:51:46 +11001421
Damien Miller0437b332000-05-02 09:56:41 +10001422# detect pathnames for entropy gathering commands, if we need them
1423INSTALL_SSH_PRNG_CMDS=""
1424rm -f prng_commands
Damien Millerd0ccb982001-03-04 00:29:20 +11001425if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
Damien Miller11e37f62000-04-08 18:23:30 +10001426 # Use these commands to collect entropy
Damien Miller61e50f12000-05-08 20:49:37 +10001427 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1428 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1429 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1430 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1431 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1432 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1433 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1434 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1435 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1436 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1437 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1438 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1439 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1440 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Damien Miller0437b332000-05-02 09:56:41 +10001441
1442 INSTALL_SSH_PRNG_CMDS="yes"
Damien Miller11e37f62000-04-08 18:23:30 +10001443fi
Damien Miller0437b332000-05-02 09:56:41 +10001444AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1445
Damien Miller11e37f62000-04-08 18:23:30 +10001446
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001447AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001448 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001449 [
Damien Miller897741e2001-04-16 10:41:46 +10001450 case "$withval" in
1451 man|cat|doc)
1452 MANTYPE=$withval
1453 ;;
1454 *)
1455 AC_MSG_ERROR(invalid man type: $withval)
1456 ;;
1457 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001458 ]
1459)
Ben Lindstrombc709922001-04-18 18:04:21 +00001460if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001461 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001462 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1463 MANTYPE=doc
1464 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1465 MANTYPE=man
1466 else
1467 MANTYPE=cat
1468 fi
1469fi
Damien Miller670a4b82000-01-22 13:53:11 +11001470AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001471if test "$MANTYPE" = "doc"; then
1472 mansubdir=man;
1473else
1474 mansubdir=$MANTYPE;
1475fi
1476AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001477
Damien Millera22ba012000-03-02 23:09:20 +11001478# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001479MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001480AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001481 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001482 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001483 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001484 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001485 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001486 fi
1487 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001488)
1489
Damien Millera22ba012000-03-02 23:09:20 +11001490# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001491AC_ARG_WITH(shadow,
1492 [ --without-shadow Disable shadow password support],
1493 [
1494 if test "x$withval" = "xno" ; then
1495 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001496 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001497 fi
1498 ]
1499)
1500
Damien Miller1f335fb2000-06-26 11:31:33 +10001501if test -z "$disable_shadow" ; then
1502 AC_MSG_CHECKING([if the systems has expire shadow information])
1503 AC_TRY_COMPILE(
1504 [
1505#include <sys/types.h>
1506#include <shadow.h>
1507 struct spwd sp;
1508 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1509 [ sp_expire_available=yes ], []
1510 )
1511
1512 if test "x$sp_expire_available" = "xyes" ; then
1513 AC_MSG_RESULT(yes)
1514 AC_DEFINE(HAS_SHADOW_EXPIRE)
1515 else
1516 AC_MSG_RESULT(no)
1517 fi
1518fi
1519
Damien Millera22ba012000-03-02 23:09:20 +11001520# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001521if test ! -z "$IPADDR_IN_DISPLAY" ; then
1522 DISPLAY_HACK_MSG="yes"
1523 AC_DEFINE(IPADDR_IN_DISPLAY)
1524else
1525 DISPLAY_HACK_MSG="no"
1526 AC_ARG_WITH(ipaddr-display,
1527 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1528 [
1529 if test "x$withval" != "xno" ; then
1530 AC_DEFINE(IPADDR_IN_DISPLAY)
1531 DISPLAY_HACK_MSG="yes"
1532 fi
1533 ]
1534 )
1535fi
Damien Miller76112de1999-12-21 11:18:08 +11001536
Damien Millera22ba012000-03-02 23:09:20 +11001537# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001538SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001539AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11001540 [ --with-default-path=PATH Specify default \$PATH environment for server],
1541 [
1542 if test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001543 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001544 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001545 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001546 ],
1547 [
1548 AC_TRY_RUN(
1549 [
1550/* find out what STDPATH is */
1551#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001552#ifdef HAVE_PATHS_H
1553# include <paths.h>
1554#endif
1555#ifndef _PATH_STDPATH
1556# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1557#endif
1558#include <sys/types.h>
1559#include <sys/stat.h>
1560#include <fcntl.h>
1561#define DATA "conftest.stdpath"
1562
1563main()
1564{
1565 FILE *fd;
1566 int rc;
1567
1568 fd = fopen(DATA,"w");
1569 if(fd == NULL)
1570 exit(1);
1571
1572 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1573 exit(1);
1574
1575 exit(0);
1576}
1577 ], [ user_path=`cat conftest.stdpath` ],
1578 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1579 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1580 )
1581# make sure $bindir is in USER_PATH so scp will work
1582 t_bindir=`eval echo ${bindir}`
1583 case $t_bindir in
1584 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1585 esac
1586 case $t_bindir in
1587 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1588 esac
1589 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1590 if test $? -ne 0 ; then
1591 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1592 if test $? -ne 0 ; then
1593 user_path=$user_path:$t_bindir
1594 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1595 fi
1596 fi
Damien Miller5a3e6831999-12-27 09:48:56 +11001597 ]
1598)
Tim Rice59ea0a02001-03-10 13:50:45 -08001599AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1600AC_SUBST(user_path)
Damien Miller5a3e6831999-12-27 09:48:56 +11001601
Damien Millera22ba012000-03-02 23:09:20 +11001602# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10001603IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11001604AC_ARG_WITH(ipv4-default,
1605 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1606 [
1607 if test "x$withval" != "xno" ; then
1608 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10001609 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11001610 fi
1611 ]
1612)
1613
Damien Miller61e50f12000-05-08 20:49:37 +10001614AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10001615IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11001616AC_ARG_WITH(4in6,
1617 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1618 [
1619 if test "x$withval" != "xno" ; then
1620 AC_MSG_RESULT(yes)
1621 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001622 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001623 else
1624 AC_MSG_RESULT(no)
1625 fi
1626 ],[
1627 if test "x$inet6_default_4in6" = "xyes"; then
1628 AC_MSG_RESULT([yes (default)])
1629 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001630 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001631 else
1632 AC_MSG_RESULT([no (default)])
1633 fi
1634 ]
1635)
1636
Damien Miller60396b02001-02-18 17:01:00 +11001637# Whether to enable BSD auth support
1638AC_ARG_WITH(bsd-auth,
1639 [ --with-bsd-auth Enable BSD auth support],
1640 [
1641 if test "x$withval" != "xno" ; then
1642 AC_DEFINE(BSD_AUTH)
1643 bsd_auth=yes
1644 fi
1645 ]
1646)
1647
Damien Miller78315eb2000-09-29 23:01:36 +11001648AC_MSG_CHECKING(whether to install ssh as suid root)
1649AC_ARG_ENABLE(suid-ssh,
1650[ --enable-suid-ssh Install ssh as suid root (default)
1651 --disable-suid-ssh Install ssh without suid bit],
1652[ case "$enableval" in
1653 no)
1654 AC_MSG_RESULT(no)
1655 SSHMODE=0711
1656 ;;
1657 *) AC_MSG_RESULT(yes)
1658 SSHMODE=04711
1659 ;;
1660 esac ],
1661 AC_MSG_RESULT(yes)
1662 SSHMODE=04711
1663)
1664AC_SUBST(SSHMODE)
1665
1666
Damien Millera22ba012000-03-02 23:09:20 +11001667# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11001668piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +11001669AC_ARG_WITH(pid-dir,
1670 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1671 [
1672 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +11001673 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +11001674 fi
1675 ]
1676)
Damien Miller4018c192000-04-30 09:30:44 +10001677
Damien Miller78315eb2000-09-29 23:01:36 +11001678# make sure the directory exists
1679if test ! -d $piddir ; then
1680 piddir=`eval echo ${sysconfdir}`
1681 case $piddir in
1682 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1683 esac
1684fi
1685
Ben Lindstrom226cfa02001-01-22 05:34:40 +00001686AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11001687AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11001688
andre2ff7b5d2000-06-03 14:57:40 +00001689dnl allow user to disable some login recording features
1690AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001691 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001692 [ AC_DEFINE(DISABLE_LASTLOG) ]
1693)
1694AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00001695 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001696 [ AC_DEFINE(DISABLE_UTMP) ]
1697)
1698AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00001699 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001700 [ AC_DEFINE(DISABLE_UTMPX) ]
1701)
1702AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00001703 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001704 [ AC_DEFINE(DISABLE_WTMP) ]
1705)
1706AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00001707 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001708 [ AC_DEFINE(DISABLE_WTMPX) ]
1709)
1710AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00001711 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001712 [ AC_DEFINE(DISABLE_LOGIN) ]
1713)
1714AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00001715 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001716 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1717)
1718AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00001719 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001720 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1721)
1722AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001723 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11001724 [
1725 if test "x$withval" = "xno" ; then
1726 AC_DEFINE(DISABLE_LASTLOG)
1727 else
1728 conf_lastlog_location=$withval
1729 fi
1730 ]
1731)
andre2ff7b5d2000-06-03 14:57:40 +00001732
1733dnl lastlog, [uw]tmpx? detection
1734dnl NOTE: set the paths in the platform section to avoid the
1735dnl need for command-line parameters
1736dnl lastlog and [uw]tmp are subject to a file search if all else fails
1737
1738dnl lastlog detection
1739dnl NOTE: the code itself will detect if lastlog is a directory
1740AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1741AC_TRY_COMPILE([
1742#include <sys/types.h>
1743#include <utmp.h>
1744#ifdef HAVE_LASTLOG_H
1745# include <lastlog.h>
1746#endif
Damien Miller2994e082000-06-04 15:51:47 +10001747#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001748# include <paths.h>
1749#endif
1750 ],
1751 [ char *lastlog = LASTLOG_FILE; ],
1752 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10001753 [
1754 AC_MSG_RESULT(no)
1755 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1756 AC_TRY_COMPILE([
1757#include <sys/types.h>
1758#include <utmp.h>
1759#ifdef HAVE_LASTLOG_H
1760# include <lastlog.h>
1761#endif
1762#ifdef HAVE_PATHS_H
1763# include <paths.h>
1764#endif
1765 ],
1766 [ char *lastlog = _PATH_LASTLOG; ],
1767 [ AC_MSG_RESULT(yes) ],
1768 [
andree441aa32000-06-12 22:34:38 +00001769 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10001770 system_lastlog_path=no
1771 ])
1772 ]
andre2ff7b5d2000-06-03 14:57:40 +00001773)
Damien Miller2994e082000-06-04 15:51:47 +10001774
andre2ff7b5d2000-06-03 14:57:40 +00001775if test -z "$conf_lastlog_location"; then
1776 if test x"$system_lastlog_path" = x"no" ; then
1777 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10001778 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00001779 conf_lastlog_location=$f
1780 fi
1781 done
1782 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00001783 AC_MSG_WARN([** Cannot find lastlog **])
1784 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00001785 fi
1786 fi
1787fi
1788
1789if test -n "$conf_lastlog_location"; then
1790 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1791fi
1792
1793dnl utmp detection
1794AC_MSG_CHECKING([if your system defines UTMP_FILE])
1795AC_TRY_COMPILE([
1796#include <sys/types.h>
1797#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001798#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001799# include <paths.h>
1800#endif
1801 ],
1802 [ char *utmp = UTMP_FILE; ],
1803 [ AC_MSG_RESULT(yes) ],
1804 [ AC_MSG_RESULT(no)
1805 system_utmp_path=no ]
1806)
1807if test -z "$conf_utmp_location"; then
1808 if test x"$system_utmp_path" = x"no" ; then
1809 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1810 if test -f $f ; then
1811 conf_utmp_location=$f
1812 fi
1813 done
1814 if test -z "$conf_utmp_location"; then
1815 AC_DEFINE(DISABLE_UTMP)
1816 fi
1817 fi
1818fi
1819if test -n "$conf_utmp_location"; then
1820 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1821fi
1822
1823dnl wtmp detection
1824AC_MSG_CHECKING([if your system defines WTMP_FILE])
1825AC_TRY_COMPILE([
1826#include <sys/types.h>
1827#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001828#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001829# include <paths.h>
1830#endif
1831 ],
1832 [ char *wtmp = WTMP_FILE; ],
1833 [ AC_MSG_RESULT(yes) ],
1834 [ AC_MSG_RESULT(no)
1835 system_wtmp_path=no ]
1836)
1837if test -z "$conf_wtmp_location"; then
1838 if test x"$system_wtmp_path" = x"no" ; then
1839 for f in /usr/adm/wtmp /var/log/wtmp; do
1840 if test -f $f ; then
1841 conf_wtmp_location=$f
1842 fi
1843 done
1844 if test -z "$conf_wtmp_location"; then
1845 AC_DEFINE(DISABLE_WTMP)
1846 fi
1847 fi
1848fi
1849if test -n "$conf_wtmp_location"; then
1850 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1851fi
1852
1853
1854dnl utmpx detection - I don't know any system so perverse as to require
1855dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1856dnl there, though.
1857AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1858AC_TRY_COMPILE([
1859#include <sys/types.h>
1860#include <utmp.h>
1861#ifdef HAVE_UTMPX_H
1862#include <utmpx.h>
1863#endif
Damien Miller2994e082000-06-04 15:51:47 +10001864#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001865# include <paths.h>
1866#endif
1867 ],
1868 [ char *utmpx = UTMPX_FILE; ],
1869 [ AC_MSG_RESULT(yes) ],
1870 [ AC_MSG_RESULT(no)
1871 system_utmpx_path=no ]
1872)
1873if test -z "$conf_utmpx_location"; then
1874 if test x"$system_utmpx_path" = x"no" ; then
1875 AC_DEFINE(DISABLE_UTMPX)
1876 fi
1877else
1878 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1879fi
1880
1881dnl wtmpx detection
1882AC_MSG_CHECKING([if your system defines WTMPX_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 *wtmpx = WTMPX_FILE; ],
1894 [ AC_MSG_RESULT(yes) ],
1895 [ AC_MSG_RESULT(no)
1896 system_wtmpx_path=no ]
1897)
1898if test -z "$conf_wtmpx_location"; then
1899 if test x"$system_wtmpx_path" = x"no" ; then
1900 AC_DEFINE(DISABLE_WTMPX)
1901 fi
1902else
1903 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1904fi
1905
Damien Miller4018c192000-04-30 09:30:44 +10001906
1907# Change default command timeout for builtin PRNG
Damien Miller14c12cb2000-06-07 22:20:23 +10001908entropy_timeout=200
Damien Miller4018c192000-04-30 09:30:44 +10001909AC_ARG_WITH(entropy-timeout,
1910 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1911 [
1912 if test "x$withval" != "xno" ; then
1913 entropy_timeout=$withval
1914 fi
1915 ]
1916)
1917AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1918
1919
Damien Miller29ea30d2000-03-17 10:54:15 +11001920if test ! -z "$blibpath" ; then
1921 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1922 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1923fi
1924
Damien Millerbac2d8a2000-09-05 16:13:06 +11001925AC_EXEEXT
1926
Ben Lindstrom3c06f6a2001-01-31 21:52:01 +00001927AC_OUTPUT(Makefile openbsd-compat/Makefile ssh_prng_cmds)
Damien Miller0437b332000-05-02 09:56:41 +10001928
Damien Miller7b22d652000-06-18 14:07:04 +10001929# Print summary of options
1930
Damien Miller7b22d652000-06-18 14:07:04 +10001931if test ! -z "$RANDOM_POOL" ; then
1932 RAND_MSG="Device ($RANDOM_POOL)"
1933else
Damien Millerd0ccb982001-03-04 00:29:20 +11001934 if test ! -z "$PRNGD_PORT" ; then
1935 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
1936 elif test ! -z "$PRNGD_SOCKET" ; then
1937 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
Damien Miller7b22d652000-06-18 14:07:04 +10001938 else
1939 RAND_MSG="Builtin (timeout $entropy_timeout)"
Damien Miller6f9c3372000-10-25 10:06:04 +11001940 BUILTIN_RNG=1
Damien Miller7b22d652000-06-18 14:07:04 +10001941 fi
1942fi
1943
1944# Someone please show me a better way :)
1945A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1946B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1947C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1948D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00001949E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00001950F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10001951G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Tim Rice59ea0a02001-03-10 13:50:45 -08001952H=`eval echo ${user_path}` ; H=`eval echo ${H}`
Damien Miller7b22d652000-06-18 14:07:04 +10001953
1954echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00001955echo "OpenSSH has been configured with the following options:"
Damien Miller7b22d652000-06-18 14:07:04 +10001956echo " User binaries: $B"
1957echo " System binaries: $C"
1958echo " Configuration files: $D"
1959echo " Askpass program: $E"
1960echo " Manual pages: $F"
1961echo " PID file: $G"
Tim Rice59ea0a02001-03-10 13:50:45 -08001962echo " sshd default user PATH: $H"
Damien Miller7b22d652000-06-18 14:07:04 +10001963echo " Random number collection: $RAND_MSG"
Damien Miller897741e2001-04-16 10:41:46 +10001964echo " Manpage format: $MANTYPE"
Damien Miller7b22d652000-06-18 14:07:04 +10001965echo " PAM support: ${PAM_MSG}"
1966echo " KerberosIV support: $KRB4_MSG"
1967echo " AFS support: $AFS_MSG"
1968echo " S/KEY support: $SKEY_MSG"
1969echo " TCP Wrappers support: $TCPW_MSG"
1970echo " MD5 password support: $MD5_MSG"
1971echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1972echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1973echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1974
Damien Miller60396b02001-02-18 17:01:00 +11001975if test ! -z "$bsd_auth"; then
1976 echo " BSD Auth support: yes"
1977fi
1978
Damien Miller7b22d652000-06-18 14:07:04 +10001979echo ""
1980
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00001981echo " Host: ${host}"
1982echo " Compiler: ${CC}"
1983echo " Compiler flags: ${CFLAGS}"
1984echo "Preprocessor flags: ${CPPFLAGS}"
1985echo " Linker flags: ${LDFLAGS}"
1986echo " Libraries: ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10001987
1988echo ""
1989
Damien Miller82cf0ce2000-12-20 13:34:48 +11001990if test "x$PAM_MSG" = "xyes" ; then
1991 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
1992 echo "otherwise password authentication may fail. Example PAM control files"
1993 echo "can be found in the contrib/ subdirectory"
1994 echo ""
1995fi
1996
Damien Miller6f9c3372000-10-25 10:06:04 +11001997if test ! -z "$BUILTIN_RNG" ; then
1998 echo "WARNING: you are using the builtin random number collection service."
1999 echo "Please read WARNING.RNG and request that your OS vendor includes"
2000 echo "/dev/random in future versions of their OS."
2001 echo ""
2002fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002003
2004if test ! -z "$NO_SFTP"; then
2005 echo "sftp-server will be disabled. Your compiler does not support"
2006 echo "64bit integers."
2007 echo ""
2008fi
Damien Miller60396b02001-02-18 17:01:00 +11002009