blob: e447d342f40785db9d1ff7543147495e349efb2e [file] [log] [blame]
Ben Lindstrom34328342001-04-23 22:39:42 +00001# $Id: configure.in,v 1.280 2001/04/23 22:39:42 mouring 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)
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 ;;
Damien Miller76112de1999-12-21 11:18:08 +110077*-*-hpux10*)
78 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +100079 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +110080 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000081 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110082 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +100083 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110084 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110085 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000086 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Damien Miller8a1e6a62000-09-16 15:55:52 +110087 LIBS="$LIBS -lsec"
Damien Miller76112de1999-12-21 11:18:08 +110088 ;;
Damien Miller1bead332000-04-30 00:47:29 +100089*-*-hpux11*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000090 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110091 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +110092 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +110093 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110094 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110095 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000096 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Damien Miller8a1e6a62000-09-16 15:55:52 +110097 LIBS="$LIBS -lsec"
Damien Miller1bead332000-04-30 00:47:29 +100098 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +110099*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000100 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000101 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100102 PATH="$PATH:/usr/etc"
Damien Miller1808f382000-01-06 12:03:12 +1100103 no_libsocket=1
104 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000105 AC_DEFINE(BROKEN_INET_NTOA)
Damien Miller1808f382000-01-06 12:03:12 +1100106 ;;
107*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000108 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000109 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100110 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000111 AC_DEFINE(WITH_IRIX_ARRAY)
112 AC_DEFINE(WITH_IRIX_PROJECT)
113 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom4a1d9162000-11-21 10:45:31 +0000114 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100115 no_libsocket=1
116 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000117 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100118 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100119*-*-linux*)
120 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100121 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100122 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000123 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100124 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100125 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000126mips-sony-bsd|mips-sony-newsos4)
127 AC_DEFINE(HAVE_NEWS4)
128 SONY=1
129 AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT),
Damien Miller5dfe9762001-02-16 12:05:39 +1100130 AC_MSG_ERROR([*** libiberty missing - please install first or check config.log ***])
Ben Lindstromb5628642000-10-18 00:02:25 +0000131 )
132 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100133*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100134 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100135 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100136*-*-freebsd*)
137 check_for_libcrypt_later=1
138 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000139*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000140 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100141 conf_utmp_location=/etc/utmp
142 conf_wtmp_location=/usr/adm/wtmp
143 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000144 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000145 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000146 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100147 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000148 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000149 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000150 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100151*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000152 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000153 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100154 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100155 AC_DEFINE(PAM_SUN_CODEBASE)
andre2ff7b5d2000-06-03 14:57:40 +0000156 # hardwire lastlog location (can't detect it on some versions)
157 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000158 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
159 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
160 if test "$sol2ver" -ge 8; then
161 AC_MSG_RESULT(yes)
162 AC_DEFINE(DISABLE_UTMP)
163 AC_DEFINE(DISABLE_WTMP)
164 else
165 AC_MSG_RESULT(no)
166 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100167 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000168*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000169 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000170 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100171 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller877d8ea2001-02-18 15:29:28 +1100172 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000173 conf_utmp_location=/etc/utmp
174 conf_wtmp_location=/var/adm/wtmp
175 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000176 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000177 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000178*-ncr-sysv*)
179 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
180 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000181 LIBS="$LIBS -lc89 -lnsl -lgen -lsocket"
Ben Lindstrom34328342001-04-23 22:39:42 +0000182 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000183 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000184*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000185 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller2ae714f2000-07-11 09:29:50 +1000186 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100187 IPADDR_IN_DISPLAY=yes
188 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000189 AC_DEFINE(IP_TOS_IS_BROKEN)
Kevin Steves52dd4682001-03-08 18:26:57 +0000190 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Millerb2dc28e2000-07-12 09:18:33 +1000191 LIBS="$LIBS -lgen -lnsl -lucb"
Damien Miller2ae714f2000-07-11 09:29:50 +1000192 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100193*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000194 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100195 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller78315eb2000-09-29 23:01:36 +1100196 enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100197 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100198 ;;
199*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000200 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100201 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller78315eb2000-09-29 23:01:36 +1100202 enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100203 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100204 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100205*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000206 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100207 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100208 LIBS="$LIBS -lgen -lsocket"
209 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100210*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000211 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100212 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Ben Lindstrom980754c2000-11-12 00:04:24 +0000213 LIBS="$LIBS -lgen -lsocket -los -lprot -lx -ltinfo -lm"
Damien Miller78315eb2000-09-29 23:01:36 +1100214 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100215 RANLIB=true
216 no_dev_ptmx=1
217 AC_DEFINE(BROKEN_SYS_TERMIO_H)
218 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100219 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000220 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000221 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Millerfbd884a2001-02-27 08:39:07 +1100222 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100223 AC_CHECK_FUNCS(getluid setluid)
Damien Miller78315eb2000-09-29 23:01:36 +1100224 ;;
225*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000226 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000227 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100228 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000229 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100230 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100231 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100232 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000233 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom42717bf2000-12-28 15:46:20 +0000234 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller217f5672001-02-16 12:12:41 +1100235 AC_CHECK_FUNCS(getluid setluid)
Damien Millera66626b2000-06-13 18:57:53 +1000236 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000237*-dec-osf*)
Damien Millerb8c656e2000-06-28 15:22:41 +1000238 if test ! -z "USE_SIA" ; then
239 AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
240 if test -f /etc/sia/matrix.conf; then
241 AC_MSG_RESULT(yes)
242 AC_DEFINE(HAVE_OSF_SIA)
243 AC_DEFINE(DISABLE_LOGIN)
244 LIBS="$LIBS -lsecurity -ldb -lm -laud"
245 else
246 AC_MSG_RESULT(no)
247 fi
248 fi
249 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100250esac
251
Damien Millere37bfc12000-06-05 09:37:43 +1000252# Allow user to specify flags
253AC_ARG_WITH(cflags,
254 [ --with-cflags Specify additional flags to pass to compiler],
255 [
256 if test "x$withval" != "xno" ; then
257 CFLAGS="$CFLAGS $withval"
258 fi
259 ]
260)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000261AC_ARG_WITH(cppflags,
262 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
263 [
264 if test "x$withval" != "xno"; then
265 CPPFLAGS="$CPPFLAGS $withval"
266 fi
267 ]
268)
Damien Millere37bfc12000-06-05 09:37:43 +1000269AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000270 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000271 [
272 if test "x$withval" != "xno" ; then
273 LDFLAGS="$LDFLAGS $withval"
274 fi
275 ]
276)
277AC_ARG_WITH(libs,
278 [ --with-libs Specify additional libraries to link with],
279 [
280 if test "x$withval" != "xno" ; then
281 LIBS="$LIBS $withval"
282 fi
283 ]
284)
285
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000286AC_ARG_WITH(pcre,
287 [ --with-pcre Override built in regex library with pcre],
288 [
289
290 AC_CHECK_LIB(pcre, pcre_info,
291 [
292 AC_DEFINE(HAVE_LIBPCRE)
293 LIBS="$LIBS -lpcreposix -lpcre"
294 no_comp_check="yes"
295 ],
296 [ AC_MSG_ERROR([*** Can not locate pcre libraries.]) ]
297 )
298 ]
299)
Damien Millere37bfc12000-06-05 09:37:43 +1000300
Damien Millera22ba012000-03-02 23:09:20 +1100301# Checks for libraries.
Damien Miller22d5aa72001-02-18 12:49:57 +1100302if test -z "$no_libnsl" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000303 AC_CHECK_LIB(nsl, yp_match, , )
304fi
Damien Miller22d5aa72001-02-18 12:49:57 +1100305if test -z "$no_libsocket" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000306 AC_CHECK_LIB(socket, main, , )
307fi
308
Damien Millerdf288022001-02-18 13:07:07 +1100309dnl SCO OS3 needs this for libwrap
310AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
311
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000312AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
Damien Miller5dfe9762001-02-16 12:05:39 +1100313AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Millerab18c411999-11-11 10:40:23 +1100314AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Miller6f9c3372000-10-25 10:06:04 +1100315
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000316# We don't want to check if we did an pcre override.
317if test -z "$no_comp_check" ; then
318 AC_CHECK_FUNC(regcomp,
319 [ AC_DEFINE(HAVE_REGCOMP)],
320 [
321 AC_CHECK_LIB(pcre, pcre_info,
322 [
323 AC_DEFINE(HAVE_LIBPCRE)
324 LIBS="$LIBS -lpcreposix -lpcre"
325 ],
326 [
327 AC_MSG_ERROR([*** No regex library found.])
328 ])
329 ]
330 )
331fi
Damien Millerab18c411999-11-11 10:40:23 +1100332
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000333dnl UnixWare 2.x
334AC_CHECK_FUNC(strcasecmp,
335 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
336)
337AC_CHECK_FUNC(utimes,
338 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
339)
Damien Millerab18c411999-11-11 10:40:23 +1100340
Ben Lindstrom8697e082001-02-24 21:41:10 +0000341AC_FUNC_STRFTIME
342
Damien Millera22ba012000-03-02 23:09:20 +1100343# Checks for header files.
Damien Miller3c027682001-03-14 11:39:45 +1100344AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.h glob.h lastlog.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)
345
346# Check for ALTDIRFUNC glob() extension
347AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
348AC_EGREP_CPP(FOUNDIT,
349 [
350 #include <glob.h>
351 #ifdef GLOB_ALTDIRFUNC
352 FOUNDIT
353 #endif
354 ],
355 [
356 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
357 AC_MSG_RESULT(yes)
358 ],
359 [
360 AC_MSG_RESULT(no)
361 ]
362)
Damien Millerab18c411999-11-11 10:40:23 +1100363
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000364# Check for g.gl_matchc glob() extension
365AC_MSG_CHECKING(for gl_matchc field in glob_t)
366AC_EGREP_CPP(FOUNDIT,
367 [
368 #include <glob.h>
369 int main(void){glob_t g; g.gl_matchc = 1;}
370 ],
371 [
372 AC_DEFINE(GLOB_HAS_GL_MATCHC)
373 AC_MSG_RESULT(yes)
374 ],
375 [
376 AC_MSG_RESULT(no)
377 ]
378)
379
Damien Miller18bb4732001-03-28 14:35:30 +1000380AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
381AC_TRY_RUN(
382 [
383#include <sys/types.h>
384#include <dirent.h>
385int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
386 ],
387 [AC_MSG_RESULT(yes)],
388 [
389 AC_MSG_RESULT(no)
390 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
391 ]
392)
393
Damien Millerc547bf12001-02-16 10:18:12 +1100394# Check whether user wants S/Key support
395SKEY_MSG="no"
396AC_ARG_WITH(skey,
397 [ --with-skey=PATH Enable S/Key support],
398 [
399 if test "x$withval" != "xno" ; then
400
401 if test "x$withval" != "xyes" ; then
402 CPPFLAGS="$CPPFLAGS -I${withval}/include"
403 LDFLAGS="$LDFLAGS -L${withval}/lib"
404 fi
405
406 AC_DEFINE(SKEY)
407 LIBS="-lskey $LIBS"
408 SKEY_MSG="yes"
409
410 AC_CHECK_FUNC(skey_keyinfo,
411 [],
412 [
413 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
414 ])
415 fi
416 ]
417)
418
419# Check whether user wants TCP wrappers support
420TCPW_MSG="no"
421AC_ARG_WITH(tcp-wrappers,
422 [ --with-tcp-wrappers Enable tcpwrappers support],
423 [
424 if test "x$withval" != "xno" ; then
425 saved_LIBS="$LIBS"
426 LIBS="-lwrap $LIBS"
427 AC_MSG_CHECKING(for libwrap)
428 AC_TRY_LINK(
429 [
430#include <tcpd.h>
431 int deny_severity = 0, allow_severity = 0;
432 ],
433 [hosts_access(0);],
434 [
435 AC_MSG_RESULT(yes)
436 AC_DEFINE(LIBWRAP)
437 TCPW_MSG="yes"
438 ],
439 [
440 AC_MSG_ERROR([*** libwrap missing])
441 ]
442 )
443 fi
444 ]
445)
446
Damien Millerad833b32000-08-23 10:46:23 +1000447dnl Checks for library functions.
Ben Lindstrom09988722001-04-12 21:35:52 +0000448AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa clock 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 realpath rresvport_af setdtablesize setenv setegid seteuid setlogin setproctitle setresgid setreuid setrlimit setsid 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 +1000449dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000450AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000451dnl Checks for libutil functions
Ben Lindstrome2fb8d32000-12-28 00:07:07 +0000452AC_CHECK_HEADERS(libutil.h)
andre2ff7b5d2000-06-03 14:57:40 +0000453AC_CHECK_FUNCS(login logout updwtmp logwtmp)
Damien Millerad833b32000-08-23 10:46:23 +1000454dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000455AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000456AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000457dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000458AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000459AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100460
Damien Miller5fc85652000-07-09 23:53:07 +1000461AC_CHECK_FUNC(getuserattr,
462 [AC_DEFINE(HAVE_GETUSERATTR)],
463 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
464)
465
Damien Miller04f80141999-11-19 15:32:34 +1100466AC_CHECK_FUNC(login,
467 [AC_DEFINE(HAVE_LOGIN)],
468 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
469)
470
471AC_CHECK_FUNC(daemon,
472 [AC_DEFINE(HAVE_DAEMON)],
473 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
474)
475
Damien Miller9fb07e42000-03-05 16:22:59 +1100476AC_CHECK_FUNC(getpagesize,
477 [AC_DEFINE(HAVE_GETPAGESIZE)],
478 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
479)
480
Damien Millercb170cb2000-07-01 16:52:55 +1000481# Check for broken snprintf
482if test "x$ac_cv_func_snprintf" = "xyes" ; then
483 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
484 AC_TRY_RUN(
485 [
486#include <stdio.h>
487int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
488 ],
489 [AC_MSG_RESULT(yes)],
490 [
491 AC_MSG_RESULT(no)
492 AC_DEFINE(BROKEN_SNPRINTF)
493 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
494 ]
495 )
496fi
497
Damien Miller606f8802000-09-16 15:39:56 +1100498AC_FUNC_GETPGRP
499
Damien Millera64b57a2001-01-17 10:44:13 +1100500# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000501PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100502AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100503 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100504 [
Damien Millera64b57a2001-01-17 10:44:13 +1100505 if test "x$withval" != "xno" ; then
506 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
507 AC_MSG_ERROR([PAM headers not found])
508 fi
509
510 AC_CHECK_LIB(dl, dlopen, , )
511 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
512 AC_CHECK_FUNCS(pam_getenvlist)
513
514 disable_shadow=yes
515 PAM_MSG="yes"
516
517 AC_DEFINE(USE_PAM)
Damien Millera22ba012000-03-02 23:09:20 +1100518 fi
519 ]
520)
Damien Millera22ba012000-03-02 23:09:20 +1100521
Damien Millera64b57a2001-01-17 10:44:13 +1100522# Check for older PAM
523if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100524 # Check PAM strerror arguments (old PAM)
525 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
526 AC_TRY_COMPILE(
527 [
Damien Miller81171112000-04-23 11:14:01 +1000528#include <stdlib.h>
529#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100530 ],
531 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
532 [AC_MSG_RESULT(no)],
533 [
534 AC_DEFINE(HAVE_OLD_PAM)
535 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000536 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100537 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100538 )
Damien Millera22ba012000-03-02 23:09:20 +1100539fi
540
541# The big search for OpenSSL
542AC_ARG_WITH(ssl-dir,
543 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
544 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000545 if test "x$withval" != "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100546 tryssldir=$withval
547 fi
548 ]
549)
550
551saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100552saved_LDFLAGS="$LDFLAGS"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000553saved_CPPFLAGS="$CPPFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100554if test "x$prefix" != "xNONE" ; then
555 tryssldir="$tryssldir $prefix"
556fi
Damien Miller61e50f12000-05-08 20:49:37 +1000557AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera1b61e12000-09-16 17:02:16 +1100558 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 +1100559 CPPFLAGS="$saved_CPPFLAGS"
560 LDFLAGS="$saved_LDFLAGS"
Damien Miller3b512e12000-05-17 23:29:18 +1000561 LIBS="$saved_LIBS -lcrypto"
Damien Millerccdefb62001-02-19 12:56:39 +1100562
563 # Skip directories if they don't exist
564 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
565 continue;
566 fi
567 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
568 # Try to use $ssldir/lib if it exists, otherwise
569 # $ssldir
570 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000571 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100572 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000573 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100574 fi
575 else
Damien Millerb68af622001-03-28 21:05:26 +1000576 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100577 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000578 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100579 fi
580 fi
581 # Try to use $ssldir/include if it exists, otherwise
582 # $ssldir
583 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000584 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100585 else
Damien Millerb68af622001-03-28 21:05:26 +1000586 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100587 fi
588 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000589
Damien Miller3b512e12000-05-17 23:29:18 +1000590 # Basic test to check for compatible version and correct linking
591 # *does not* test for RSA - that comes later.
592 AC_TRY_RUN(
593 [
Damien Millere59ce622000-05-01 20:54:17 +1000594#include <string.h>
595#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000596int main(void)
597{
Damien Miller3b512e12000-05-17 23:29:18 +1000598 char a[2048];
599 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000600 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000601 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000602}
Damien Miller3b512e12000-05-17 23:29:18 +1000603 ],
604 [
605 found_crypto=1
606 break;
607 ], []
608 )
Damien Miller61e50f12000-05-08 20:49:37 +1000609
610 if test ! -z "$found_crypto" ; then
611 break;
612 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100613 done
614
Damien Miller61e50f12000-05-08 20:49:37 +1000615 if test -z "$found_crypto" ; then
Damien Miller5dfe9762001-02-16 12:05:39 +1100616 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
Damien Millerb85dcad2000-03-11 11:37:00 +1100617 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000618 if test -z "$ssldir" ; then
619 ssldir="(system)"
620 fi
Damien Millera22ba012000-03-02 23:09:20 +1100621
Damien Miller61e50f12000-05-08 20:49:37 +1000622 ac_cv_openssldir=$ssldir
623])
624
Damien Milleredb82922000-06-20 13:25:52 +1000625if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000626 AC_DEFINE(HAVE_OPENSSL)
627 dnl Need to recover ssldir - test above runs in subshell
628 ssldir=$ac_cv_openssldir
Damien Millera64b57a2001-01-17 10:44:13 +1100629 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
Damien Millerccdefb62001-02-19 12:56:39 +1100630 # Try to use $ssldir/lib if it exists, otherwise
631 # $ssldir
632 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000633 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100634 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000635 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100636 fi
637 else
Damien Millerb68af622001-03-28 21:05:26 +1000638 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100639 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000640 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100641 fi
Damien Millera64b57a2001-01-17 10:44:13 +1100642 fi
Damien Millerccdefb62001-02-19 12:56:39 +1100643 # Try to use $ssldir/include if it exists, otherwise
644 # $ssldir
645 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000646 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100647 else
Damien Millerb68af622001-03-28 21:05:26 +1000648 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millera64b57a2001-01-17 10:44:13 +1100649 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100650 fi
Damien Millera22ba012000-03-02 23:09:20 +1100651fi
Damien Miller3b512e12000-05-17 23:29:18 +1000652LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000653
Damien Miller3b512e12000-05-17 23:29:18 +1000654# Now test RSA support
655saved_LIBS="$LIBS"
656AC_MSG_CHECKING([for RSA support])
657for WANTS_RSAREF in "" 1 ; do
658 if test -z "$WANTS_RSAREF" ; then
659 LIBS="$saved_LIBS"
660 else
661 LIBS="$saved_LIBS -lRSAglue -lrsaref"
662 fi
663 AC_TRY_RUN([
664#include <string.h>
665#include <openssl/rand.h>
666#include <openssl/rsa.h>
667#include <openssl/bn.h>
668#include <openssl/sha.h>
669int main(void)
670{
671 int num; RSA *key; static unsigned char p_in[] = "blahblah";
672 unsigned char c[256], p[256];
673 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
674 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
675 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
676 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
677}
678 ],
679 [
680 rsa_works=1
681 break;
682 ], [])
683done
684
685if test ! -z "$no_rsa" ; then
686 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000687 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000688else
689 if test -z "$rsa_works" ; then
690 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000691 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000692 else
693 if test -z "$WANTS_RSAREF" ; then
694 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000695 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000696 else
Damien Miller7b22d652000-06-18 14:07:04 +1000697 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000698 AC_MSG_RESULT(using RSAref)
699 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
700 fi
701 fi
702fi
Damien Millera22ba012000-03-02 23:09:20 +1100703
Damien Millera64b57a2001-01-17 10:44:13 +1100704# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
705# version in OpenSSL. Skip this for PAM
706if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100707 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100708fi
709
Ben Lindstromb5628642000-10-18 00:02:25 +0000710# Cheap hack to ensure NEWS-OS libraries are arranged right.
711if test ! -z "$SONY" ; then
712 LIBS="$LIBS -liberty";
713fi
714
Damien Millera22ba012000-03-02 23:09:20 +1100715# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100716AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100717AC_CHECK_SIZEOF(short int, 2)
718AC_CHECK_SIZEOF(int, 4)
719AC_CHECK_SIZEOF(long int, 4)
720AC_CHECK_SIZEOF(long long int, 8)
721
Damien Millera22ba012000-03-02 23:09:20 +1100722# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +1100723AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
724 AC_TRY_COMPILE(
725 [ #include <sys/types.h> ],
726 [ u_int a; a = 1;],
727 [ ac_cv_have_u_int="yes" ],
728 [ ac_cv_have_u_int="no" ]
729 )
730])
731if test "x$ac_cv_have_u_int" = "xyes" ; then
732 AC_DEFINE(HAVE_U_INT)
733 have_u_int=1
734fi
735
Damien Miller61e50f12000-05-08 20:49:37 +1000736AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
737 AC_TRY_COMPILE(
738 [ #include <sys/types.h> ],
739 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
740 [ ac_cv_have_intxx_t="yes" ],
741 [ ac_cv_have_intxx_t="no" ]
742 )
743])
744if test "x$ac_cv_have_intxx_t" = "xyes" ; then
745 AC_DEFINE(HAVE_INTXX_T)
746 have_intxx_t=1
747fi
748
Damien Miller578783e2000-09-23 14:12:24 +1100749AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
750 AC_TRY_COMPILE(
751 [ #include <sys/types.h> ],
752 [ int64_t a; a = 1;],
753 [ ac_cv_have_int64_t="yes" ],
754 [ ac_cv_have_int64_t="no" ]
755 )
756])
757if test "x$ac_cv_have_int64_t" = "xyes" ; then
758 AC_DEFINE(HAVE_INT64_T)
759 have_int64_t=1
760fi
761
Damien Miller61e50f12000-05-08 20:49:37 +1000762AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
763 AC_TRY_COMPILE(
764 [ #include <sys/types.h> ],
765 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
766 [ ac_cv_have_u_intxx_t="yes" ],
767 [ ac_cv_have_u_intxx_t="no" ]
768 )
769])
770if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
771 AC_DEFINE(HAVE_U_INTXX_T)
772 have_u_intxx_t=1
773fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100774
Damien Miller578783e2000-09-23 14:12:24 +1100775AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
776 AC_TRY_COMPILE(
777 [ #include <sys/types.h> ],
778 [ u_int64_t a; a = 1;],
779 [ ac_cv_have_u_int64_t="yes" ],
780 [ ac_cv_have_u_int64_t="no" ]
781 )
782])
783if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
784 AC_DEFINE(HAVE_U_INT64_T)
785 have_u_int64_t=1
786fi
787
Damien Milleredb82922000-06-20 13:25:52 +1000788if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
789 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +1100790then
791 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
792 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +1000793 [
794#include <sys/bitypes.h>
795 ],
Damien Millerb29ea912000-01-15 14:12:03 +1100796 [
Damien Miller70494d12000-04-03 15:57:06 +1000797 int8_t a; int16_t b; int32_t c;
798 u_int8_t e; u_int16_t f; u_int32_t g;
799 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +1100800 ],
801 [
802 AC_DEFINE(HAVE_U_INTXX_T)
803 AC_DEFINE(HAVE_INTXX_T)
804 AC_MSG_RESULT(yes)
805 ],
806 [AC_MSG_RESULT(no)]
807 )
808fi
809
Damien Millerd6121d22000-03-17 23:26:46 +1100810if test -z "$have_u_intxx_t" ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000811 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
812 AC_TRY_COMPILE(
813 [
814#include <sys/types.h>
815 ],
816 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
817 [ ac_cv_have_uintxx_t="yes" ],
818 [ ac_cv_have_uintxx_t="no" ]
819 )
820 ])
821 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
822 AC_DEFINE(HAVE_UINTXX_T)
823 fi
Damien Millerd6121d22000-03-17 23:26:46 +1100824fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100825
Damien Miller61e50f12000-05-08 20:49:37 +1000826AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
827 AC_TRY_COMPILE(
828 [
Damien Miller81171112000-04-23 11:14:01 +1000829#include <sys/types.h>
830#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000831 ],
832 [socklen_t foo; foo = 1235;],
833 [ ac_cv_have_socklen_t="yes" ],
834 [ ac_cv_have_socklen_t="no" ]
835 )
836])
837if test "x$ac_cv_have_socklen_t" = "xyes" ; then
838 AC_DEFINE(HAVE_SOCKLEN_T)
839fi
Damien Miller74d0d4a1999-12-29 02:24:35 +1100840
Damien Miller61e50f12000-05-08 20:49:37 +1000841AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
842 AC_TRY_COMPILE(
843 [
844#include <sys/types.h>
845 ],
846 [ size_t foo; foo = 1235; ],
847 [ ac_cv_have_size_t="yes" ],
848 [ ac_cv_have_size_t="no" ]
849 )
850])
851if test "x$ac_cv_have_size_t" = "xyes" ; then
852 AC_DEFINE(HAVE_SIZE_T)
853fi
Damien Miller95058511999-12-29 10:36:45 +1100854
Damien Miller615f9392000-05-17 22:53:33 +1000855AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
856 AC_TRY_COMPILE(
857 [
858#include <sys/types.h>
859 ],
860 [ ssize_t foo; foo = 1235; ],
861 [ ac_cv_have_ssize_t="yes" ],
862 [ ac_cv_have_ssize_t="no" ]
863 )
864])
865if test "x$ac_cv_have_ssize_t" = "xyes" ; then
866 AC_DEFINE(HAVE_SSIZE_T)
867fi
868
Ben Lindstrom0d5af602001-01-09 00:50:29 +0000869AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
870 AC_TRY_COMPILE(
871 [
872#include <time.h>
873 ],
874 [ clock_t foo; foo = 1235; ],
875 [ ac_cv_have_clock_t="yes" ],
876 [ ac_cv_have_clock_t="no" ]
877 )
878])
879if test "x$ac_cv_have_clock_t" = "xyes" ; then
880 AC_DEFINE(HAVE_CLOCK_T)
881fi
882
Damien Millerb54b40e2000-06-23 08:23:34 +1000883AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
884 AC_TRY_COMPILE(
885 [
886#include <sys/types.h>
887#include <sys/socket.h>
888 ],
889 [ sa_family_t foo; foo = 1235; ],
890 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +1100891 [ AC_TRY_COMPILE(
892 [
893#include <sys/types.h>
894#include <sys/socket.h>
895#include <netinet/in.h>
896 ],
897 [ sa_family_t foo; foo = 1235; ],
898 [ ac_cv_have_sa_family_t="yes" ],
899
Damien Millerb54b40e2000-06-23 08:23:34 +1000900 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +1100901 )]
Damien Millerb54b40e2000-06-23 08:23:34 +1000902 )
903])
904if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
905 AC_DEFINE(HAVE_SA_FAMILY_T)
906fi
907
Damien Miller0f91b4e2000-06-18 15:43:25 +1000908AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
909 AC_TRY_COMPILE(
910 [
911#include <sys/types.h>
912 ],
913 [ pid_t foo; foo = 1235; ],
914 [ ac_cv_have_pid_t="yes" ],
915 [ ac_cv_have_pid_t="no" ]
916 )
917])
918if test "x$ac_cv_have_pid_t" = "xyes" ; then
919 AC_DEFINE(HAVE_PID_T)
920fi
921
922AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
923 AC_TRY_COMPILE(
924 [
925#include <sys/types.h>
926 ],
927 [ mode_t foo; foo = 1235; ],
928 [ ac_cv_have_mode_t="yes" ],
929 [ ac_cv_have_mode_t="no" ]
930 )
931])
932if test "x$ac_cv_have_mode_t" = "xyes" ; then
933 AC_DEFINE(HAVE_MODE_T)
934fi
935
Damien Miller61e50f12000-05-08 20:49:37 +1000936
937AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
938 AC_TRY_COMPILE(
939 [
Damien Miller81171112000-04-23 11:14:01 +1000940#include <sys/types.h>
941#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000942 ],
943 [ struct sockaddr_storage s; ],
944 [ ac_cv_have_struct_sockaddr_storage="yes" ],
945 [ ac_cv_have_struct_sockaddr_storage="no" ]
946 )
947])
948if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
949 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
950fi
Damien Miller34132e52000-01-14 15:45:46 +1100951
Damien Miller61e50f12000-05-08 20:49:37 +1000952AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
953 AC_TRY_COMPILE(
954 [
Damien Miller7b22d652000-06-18 14:07:04 +1000955#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000956#include <netinet/in.h>
957 ],
958 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
959 [ ac_cv_have_struct_sockaddr_in6="yes" ],
960 [ ac_cv_have_struct_sockaddr_in6="no" ]
961 )
962])
963if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
964 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
965fi
Damien Miller34132e52000-01-14 15:45:46 +1100966
Damien Miller61e50f12000-05-08 20:49:37 +1000967AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
968 AC_TRY_COMPILE(
969 [
Damien Miller7b22d652000-06-18 14:07:04 +1000970#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000971#include <netinet/in.h>
972 ],
973 [ struct in6_addr s; s.s6_addr[0] = 0; ],
974 [ ac_cv_have_struct_in6_addr="yes" ],
975 [ ac_cv_have_struct_in6_addr="no" ]
976 )
977])
978if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
979 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
980fi
Damien Miller34132e52000-01-14 15:45:46 +1100981
Damien Miller61e50f12000-05-08 20:49:37 +1000982AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
983 AC_TRY_COMPILE(
984 [
Damien Miller81171112000-04-23 11:14:01 +1000985#include <sys/types.h>
986#include <sys/socket.h>
987#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000988 ],
989 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
990 [ ac_cv_have_struct_addrinfo="yes" ],
991 [ ac_cv_have_struct_addrinfo="no" ]
992 )
993])
994if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
995 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
996fi
997
Ben Lindstrom42202bc2001-01-15 02:34:37 +0000998AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
999 AC_TRY_COMPILE(
1000 [ #include <sys/time.h> ],
1001 [ struct timeval tv; tv.tv_sec = 1;],
1002 [ ac_cv_have_struct_timeval="yes" ],
1003 [ ac_cv_have_struct_timeval="no" ]
1004 )
1005])
1006if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1007 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1008 have_struct_timeval=1
1009fi
1010
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001011# If we don't have int64_t then we can't compile sftp-server. So don't
1012# even attempt to do it.
1013if test "x$ac_cv_have_int64_t" = "xno" -a \
1014 "x$ac_cv_sizeof_long_int" != "x8" -a \
1015 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1016 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001017else
1018dnl test snprintf (broken on SCO w/gcc)
1019 AC_TRY_RUN(
1020 [
1021#include <stdio.h>
1022#include <string.h>
1023#ifdef HAVE_SNPRINTF
1024main()
1025{
1026 char buf[50];
1027 char expected_out[50];
1028 int mazsize = 50 ;
1029#if (SIZEOF_LONG_INT == 8)
1030 long int num = 0x7fffffffffffffff;
1031#else
1032 long long num = 0x7fffffffffffffff;
1033#endif
1034 strcpy(expected_out, "9223372036854775807");
1035 snprintf(buf, mazsize, "%lld", num);
1036 if(strcmp(buf, expected_out) != 0)
1037 exit(1);
1038 exit(0);
1039}
1040#else
1041main() { exit(0); }
1042#endif
1043 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1044 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001045fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001046AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001047
Damien Miller78315eb2000-09-29 23:01:36 +11001048dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001049OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1050OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1051OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1052OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1053OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001054OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001055OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1056OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001057OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001058OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1059OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1060OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1061OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001062OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1063OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1064OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1065OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Damien Miller78315eb2000-09-29 23:01:36 +11001066AC_STRUCT_ST_BLKSIZE
andre2ff7b5d2000-06-03 14:57:40 +00001067
Damien Miller942da032000-08-18 13:59:06 +10001068AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
1069 ac_cv_have_sun_len_in_struct_sockaddr_un, [
1070 AC_TRY_COMPILE(
1071 [
1072#include <sys/types.h>
1073#include <sys/socket.h>
1074 ],
1075 [ struct sockaddr_un s; s.sun_len = 1; ],
1076 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
1077 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
1078 )
1079])
1080if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
1081 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
1082fi
1083
Damien Miller61e50f12000-05-08 20:49:37 +10001084AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1085 ac_cv_have_ss_family_in_struct_ss, [
1086 AC_TRY_COMPILE(
1087 [
Damien Miller81171112000-04-23 11:14:01 +10001088#include <sys/types.h>
1089#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001090 ],
1091 [ struct sockaddr_storage s; s.ss_family = 1; ],
1092 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1093 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1094 )
1095])
1096if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1097 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
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
Damien Millerbf1c9b21999-12-09 10:16:54 +11001115
Damien Millerad833b32000-08-23 10:46:23 +10001116AC_CACHE_CHECK([for pw_class field in struct passwd],
1117 ac_cv_have_pw_class_in_struct_passwd, [
1118 AC_TRY_COMPILE(
1119 [
Damien Millerad833b32000-08-23 10:46:23 +10001120#include <pwd.h>
1121 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001122 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001123 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1124 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1125 )
1126])
1127if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1128 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1129fi
1130
Damien Miller61e50f12000-05-08 20:49:37 +10001131
1132AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1133 AC_TRY_LINK([],
1134 [ extern char *__progname; printf("%s", __progname); ],
1135 [ ac_cv_libc_defines___progname="yes" ],
1136 [ ac_cv_libc_defines___progname="no" ]
1137 )
1138])
1139if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1140 AC_DEFINE(HAVE___PROGNAME)
1141fi
1142
Damien Millera22ba012000-03-02 23:09:20 +11001143
Damien Millerecbb26d2000-07-15 14:59:14 +10001144AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1145 AC_TRY_LINK([],
1146 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1147 [ ac_cv_libc_defines_sys_errlist="yes" ],
1148 [ ac_cv_libc_defines_sys_errlist="no" ]
1149 )
1150])
1151if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1152 AC_DEFINE(HAVE_SYS_ERRLIST)
1153fi
1154
1155
Damien Miller11fa2cc2000-08-16 10:35:58 +10001156AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1157 AC_TRY_LINK([],
1158 [ extern int sys_nerr; printf("%i", sys_nerr);],
1159 [ ac_cv_libc_defines_sys_nerr="yes" ],
1160 [ ac_cv_libc_defines_sys_nerr="no" ]
1161 )
1162])
1163if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1164 AC_DEFINE(HAVE_SYS_NERR)
1165fi
1166
1167
Damien Millerc79bc0d2001-03-28 13:03:42 +10001168# Check whether user wants Kerberos support
1169KRB4_MSG="no"
1170AC_ARG_WITH(kerberos4,
1171 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1172 [
1173 if test "x$withval" != "xno" ; then
1174
1175 if test "x$withval" != "xyes" ; then
1176 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1177 LDFLAGS="$LDFLAGS -L${withval}/lib"
1178 if test ! -z "$need_dash_r" ; then
1179 LDFLAGS="$LDFLAGS -R${withval}/lib"
1180 fi
1181 if test ! -z "$blibpath" ; then
1182 blibpath="$blibpath:${withval}/lib"
1183 fi
1184 else
1185 if test -d /usr/include/kerberosIV ; then
1186 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1187 fi
1188 fi
1189
1190 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001191 if test "$ac_cv_header_krb_h" != yes; then
1192 AC_MSG_WARN([Cannot find krb.h, build may fail])
1193 fi
Damien Miller98344742001-03-28 14:37:06 +10001194 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001195 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001196 AC_CHECK_LIB(krb4, main)
1197 if test "$ac_cv_lib_krb4_main" != yes; then
1198 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1199 else
1200 KLIBS="-lkrb4"
1201 fi
1202 else
1203 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001204 fi
Damien Miller98344742001-03-28 14:37:06 +10001205 AC_CHECK_LIB(des, des_cbc_encrypt)
1206 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1207 AC_CHECK_LIB(des425, des_cbc_encrypt)
1208 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1209 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1210 else
1211 KLIBS="-ldes425"
1212 fi
1213 else
1214 KLIBS="-ldes"
1215 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001216 AC_CHECK_LIB(resolv, dn_expand, , )
1217 KRB4=yes
1218 KRB4_MSG="yes"
1219 AC_DEFINE(KRB4)
1220 fi
1221 ]
1222)
1223
1224# Check whether user wants AFS support
1225AFS_MSG="no"
1226AC_ARG_WITH(afs,
1227 [ --with-afs=PATH Enable AFS support],
1228 [
1229 if test "x$withval" != "xno" ; then
1230
1231 if test "x$withval" != "xyes" ; then
1232 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1233 LDFLAGS="$LDFLAGS -L${withval}/lib"
1234 fi
1235
1236 if test -z "$KRB4" ; then
1237 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1238 fi
1239
1240 LIBS="-lkafs $LIBS"
1241 if test ! -z "$AFS_LIBS" ; then
1242 LIBS="$LIBS $AFS_LIBS"
1243 fi
1244 AC_DEFINE(AFS)
1245 AFS_MSG="yes"
1246 fi
1247 ]
1248)
1249LIBS="$LIBS $KLIBS"
1250
Damien Millera22ba012000-03-02 23:09:20 +11001251# Looking for programs, paths and files
1252AC_ARG_WITH(rsh,
1253 [ --with-rsh=PATH Specify path to remote shell program ],
1254 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001255 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001256 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001257 fi
1258 ],
1259 [
1260 AC_PATH_PROG(rsh_path, rsh)
1261 ]
1262)
1263
1264AC_ARG_WITH(xauth,
1265 [ --with-xauth=PATH Specify path to xauth program ],
1266 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001267 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001268 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001269 fi
1270 ],
1271 [
Damien Miller78315eb2000-09-29 23:01:36 +11001272 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 +10001273 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001274 xauth_path="/usr/openwin/bin/xauth"
1275 fi
1276 ]
1277)
1278
Damien Millera19cf472000-11-29 13:28:50 +11001279if test -z "$xauth_path" ; then
1280 XAUTH_PATH="undefined"
1281 AC_SUBST(XAUTH_PATH)
1282else
Damien Millera22ba012000-03-02 23:09:20 +11001283 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001284 XAUTH_PATH=$xauth_path
1285 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001286fi
1287if test ! -z "$rsh_path" ; then
1288 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1289fi
1290
1291# Check for mail directory (last resort if we cannot get it from headers)
1292if test ! -z "$MAIL" ; then
1293 maildir=`dirname $MAIL`
1294 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1295fi
1296
Damien Millera22ba012000-03-02 23:09:20 +11001297if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +11001298 AC_CHECK_FILE("/dev/ptmx",
1299 [
1300 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1301 have_dev_ptmx=1
1302 ]
1303 )
Damien Millera22ba012000-03-02 23:09:20 +11001304fi
Damien Miller204ad072000-03-02 23:56:12 +11001305AC_CHECK_FILE("/dev/ptc",
1306 [
1307 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1308 have_dev_ptc=1
1309 ]
1310)
1311
Damien Millera22ba012000-03-02 23:09:20 +11001312# Options from here on. Some of these are preset by platform above
1313
Damien Millera22ba012000-03-02 23:09:20 +11001314# Check for user-specified random device, otherwise check /dev/urandom
1315AC_ARG_WITH(random,
Damien Miller0736c4d2001-01-25 10:51:46 +11001316 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
Damien Millera22ba012000-03-02 23:09:20 +11001317 [
Damien Miller040f3832000-04-03 14:50:43 +10001318 if test "x$withval" != "xno" ; then
1319 RANDOM_POOL="$withval";
1320 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1321 fi
Damien Millera22ba012000-03-02 23:09:20 +11001322 ],
1323 [
1324 # Check for random device
1325 AC_CHECK_FILE("/dev/urandom",
1326 [
1327 RANDOM_POOL="/dev/urandom";
1328 AC_SUBST(RANDOM_POOL)
1329 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1330 ]
1331 )
1332 ]
1333)
1334
Damien Millerd0ccb982001-03-04 00:29:20 +11001335# Check for PRNGD/EGD pool file
1336AC_ARG_WITH(prngd-port,
1337 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1338 [
1339 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1340 PRNGD_PORT="$withval"
1341 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1342 fi
1343 ]
1344)
1345
1346# Check for PRNGD/EGD pool file
1347AC_ARG_WITH(prngd-socket,
1348 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
Damien Millera22ba012000-03-02 23:09:20 +11001349 [
Damien Miller040f3832000-04-03 14:50:43 +10001350 if test "x$withval" != "xno" ; then
Damien Millerd0ccb982001-03-04 00:29:20 +11001351 PRNGD_SOCKET="$withval"
1352 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller040f3832000-04-03 14:50:43 +10001353 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001354 ],
1355 [
1356 # Check for existing socket only if we don't have a random device already
1357 if test -z "$RANDOM_POOL" ; then
1358 AC_MSG_CHECKING(for PRNGD/EGD socket)
1359 # Insert other locations here
Tim Ricebee3f222001-03-11 17:32:12 -08001360 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
Damien Millerd0ccb982001-03-04 00:29:20 +11001361 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1362 PRNGD_SOCKET="$sock"
1363 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller0736c4d2001-01-25 10:51:46 +11001364 break;
1365 fi
1366 done
Damien Millerd0ccb982001-03-04 00:29:20 +11001367 if test ! -z "$PRNGD_SOCKET" ; then
1368 AC_MSG_RESULT($PRNGD_SOCKET)
Damien Miller4864e8f2001-02-08 10:07:08 +11001369 else
1370 AC_MSG_RESULT(not found)
1371 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001372 fi
Damien Millera22ba012000-03-02 23:09:20 +11001373 ]
1374)
1375
Damien Miller0736c4d2001-01-25 10:51:46 +11001376
Damien Miller0437b332000-05-02 09:56:41 +10001377# detect pathnames for entropy gathering commands, if we need them
1378INSTALL_SSH_PRNG_CMDS=""
1379rm -f prng_commands
Damien Millerd0ccb982001-03-04 00:29:20 +11001380if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
Damien Miller11e37f62000-04-08 18:23:30 +10001381 # Use these commands to collect entropy
Damien Miller61e50f12000-05-08 20:49:37 +10001382 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1383 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1384 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1385 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1386 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1387 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1388 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1389 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1390 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1391 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1392 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1393 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1394 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1395 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Damien Miller0437b332000-05-02 09:56:41 +10001396
1397 INSTALL_SSH_PRNG_CMDS="yes"
Damien Miller11e37f62000-04-08 18:23:30 +10001398fi
Damien Miller0437b332000-05-02 09:56:41 +10001399AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1400
Damien Miller11e37f62000-04-08 18:23:30 +10001401
Damien Miller670a4b82000-01-22 13:53:11 +11001402AC_ARG_WITH(catman,
Damien Miller897741e2001-04-16 10:41:46 +10001403 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001404 [
Damien Miller897741e2001-04-16 10:41:46 +10001405 case "$withval" in
1406 man|cat|doc)
1407 MANTYPE=$withval
1408 ;;
1409 *)
1410 AC_MSG_ERROR(invalid man type: $withval)
1411 ;;
1412 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001413 ]
1414)
Ben Lindstrombc709922001-04-18 18:04:21 +00001415if test -z "$MANTYPE"; then
Tim Riceb8fbb8e2001-04-21 14:31:52 -07001416 AC_PATH_PROGS(NROFF, nroff awf, /bin/false)
Ben Lindstrombc709922001-04-18 18:04:21 +00001417 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1418 MANTYPE=doc
1419 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1420 MANTYPE=man
1421 else
1422 MANTYPE=cat
1423 fi
1424fi
Damien Miller670a4b82000-01-22 13:53:11 +11001425AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001426if test "$MANTYPE" = "doc"; then
1427 mansubdir=man;
1428else
1429 mansubdir=$MANTYPE;
1430fi
1431AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001432
Damien Millera22ba012000-03-02 23:09:20 +11001433# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001434MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001435AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001436 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001437 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001438 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001439 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001440 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001441 fi
1442 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001443)
1444
Damien Millera22ba012000-03-02 23:09:20 +11001445# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001446AC_ARG_WITH(shadow,
1447 [ --without-shadow Disable shadow password support],
1448 [
1449 if test "x$withval" = "xno" ; then
1450 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001451 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001452 fi
1453 ]
1454)
1455
Damien Miller1f335fb2000-06-26 11:31:33 +10001456if test -z "$disable_shadow" ; then
1457 AC_MSG_CHECKING([if the systems has expire shadow information])
1458 AC_TRY_COMPILE(
1459 [
1460#include <sys/types.h>
1461#include <shadow.h>
1462 struct spwd sp;
1463 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1464 [ sp_expire_available=yes ], []
1465 )
1466
1467 if test "x$sp_expire_available" = "xyes" ; then
1468 AC_MSG_RESULT(yes)
1469 AC_DEFINE(HAS_SHADOW_EXPIRE)
1470 else
1471 AC_MSG_RESULT(no)
1472 fi
1473fi
1474
Damien Millera22ba012000-03-02 23:09:20 +11001475# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001476if test ! -z "$IPADDR_IN_DISPLAY" ; then
1477 DISPLAY_HACK_MSG="yes"
1478 AC_DEFINE(IPADDR_IN_DISPLAY)
1479else
1480 DISPLAY_HACK_MSG="no"
1481 AC_ARG_WITH(ipaddr-display,
1482 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1483 [
1484 if test "x$withval" != "xno" ; then
1485 AC_DEFINE(IPADDR_IN_DISPLAY)
1486 DISPLAY_HACK_MSG="yes"
1487 fi
1488 ]
1489 )
1490fi
Damien Miller76112de1999-12-21 11:18:08 +11001491
Damien Millera22ba012000-03-02 23:09:20 +11001492# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001493SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001494AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11001495 [ --with-default-path=PATH Specify default \$PATH environment for server],
1496 [
1497 if test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001498 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001499 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001500 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001501 ],
1502 [
1503 AC_TRY_RUN(
1504 [
1505/* find out what STDPATH is */
1506#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001507#ifdef HAVE_PATHS_H
1508# include <paths.h>
1509#endif
1510#ifndef _PATH_STDPATH
1511# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1512#endif
1513#include <sys/types.h>
1514#include <sys/stat.h>
1515#include <fcntl.h>
1516#define DATA "conftest.stdpath"
1517
1518main()
1519{
1520 FILE *fd;
1521 int rc;
1522
1523 fd = fopen(DATA,"w");
1524 if(fd == NULL)
1525 exit(1);
1526
1527 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1528 exit(1);
1529
1530 exit(0);
1531}
1532 ], [ user_path=`cat conftest.stdpath` ],
1533 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1534 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1535 )
1536# make sure $bindir is in USER_PATH so scp will work
1537 t_bindir=`eval echo ${bindir}`
1538 case $t_bindir in
1539 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1540 esac
1541 case $t_bindir in
1542 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1543 esac
1544 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1545 if test $? -ne 0 ; then
1546 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1547 if test $? -ne 0 ; then
1548 user_path=$user_path:$t_bindir
1549 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1550 fi
1551 fi
Damien Miller5a3e6831999-12-27 09:48:56 +11001552 ]
1553)
Tim Rice59ea0a02001-03-10 13:50:45 -08001554AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1555AC_SUBST(user_path)
Damien Miller5a3e6831999-12-27 09:48:56 +11001556
Damien Millera22ba012000-03-02 23:09:20 +11001557# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10001558IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11001559AC_ARG_WITH(ipv4-default,
1560 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1561 [
1562 if test "x$withval" != "xno" ; then
1563 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10001564 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11001565 fi
1566 ]
1567)
1568
Damien Miller61e50f12000-05-08 20:49:37 +10001569AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10001570IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11001571AC_ARG_WITH(4in6,
1572 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1573 [
1574 if test "x$withval" != "xno" ; then
1575 AC_MSG_RESULT(yes)
1576 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001577 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001578 else
1579 AC_MSG_RESULT(no)
1580 fi
1581 ],[
1582 if test "x$inet6_default_4in6" = "xyes"; then
1583 AC_MSG_RESULT([yes (default)])
1584 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001585 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001586 else
1587 AC_MSG_RESULT([no (default)])
1588 fi
1589 ]
1590)
1591
Damien Miller60396b02001-02-18 17:01:00 +11001592# Whether to enable BSD auth support
1593AC_ARG_WITH(bsd-auth,
1594 [ --with-bsd-auth Enable BSD auth support],
1595 [
1596 if test "x$withval" != "xno" ; then
1597 AC_DEFINE(BSD_AUTH)
1598 bsd_auth=yes
1599 fi
1600 ]
1601)
1602
Damien Miller78315eb2000-09-29 23:01:36 +11001603AC_MSG_CHECKING(whether to install ssh as suid root)
1604AC_ARG_ENABLE(suid-ssh,
1605[ --enable-suid-ssh Install ssh as suid root (default)
1606 --disable-suid-ssh Install ssh without suid bit],
1607[ case "$enableval" in
1608 no)
1609 AC_MSG_RESULT(no)
1610 SSHMODE=0711
1611 ;;
1612 *) AC_MSG_RESULT(yes)
1613 SSHMODE=04711
1614 ;;
1615 esac ],
1616 AC_MSG_RESULT(yes)
1617 SSHMODE=04711
1618)
1619AC_SUBST(SSHMODE)
1620
1621
Damien Millera22ba012000-03-02 23:09:20 +11001622# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11001623piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +11001624AC_ARG_WITH(pid-dir,
1625 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1626 [
1627 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +11001628 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +11001629 fi
1630 ]
1631)
Damien Miller4018c192000-04-30 09:30:44 +10001632
Damien Miller78315eb2000-09-29 23:01:36 +11001633# make sure the directory exists
1634if test ! -d $piddir ; then
1635 piddir=`eval echo ${sysconfdir}`
1636 case $piddir in
1637 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1638 esac
1639fi
1640
Ben Lindstrom226cfa02001-01-22 05:34:40 +00001641AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11001642AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11001643
andre2ff7b5d2000-06-03 14:57:40 +00001644dnl allow user to disable some login recording features
1645AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001646 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001647 [ AC_DEFINE(DISABLE_LASTLOG) ]
1648)
1649AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00001650 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001651 [ AC_DEFINE(DISABLE_UTMP) ]
1652)
1653AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00001654 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001655 [ AC_DEFINE(DISABLE_UTMPX) ]
1656)
1657AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00001658 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001659 [ AC_DEFINE(DISABLE_WTMP) ]
1660)
1661AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00001662 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001663 [ AC_DEFINE(DISABLE_WTMPX) ]
1664)
1665AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00001666 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001667 [ AC_DEFINE(DISABLE_LOGIN) ]
1668)
1669AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00001670 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001671 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1672)
1673AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00001674 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001675 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1676)
1677AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001678 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11001679 [
1680 if test "x$withval" = "xno" ; then
1681 AC_DEFINE(DISABLE_LASTLOG)
1682 else
1683 conf_lastlog_location=$withval
1684 fi
1685 ]
1686)
andre2ff7b5d2000-06-03 14:57:40 +00001687
1688dnl lastlog, [uw]tmpx? detection
1689dnl NOTE: set the paths in the platform section to avoid the
1690dnl need for command-line parameters
1691dnl lastlog and [uw]tmp are subject to a file search if all else fails
1692
1693dnl lastlog detection
1694dnl NOTE: the code itself will detect if lastlog is a directory
1695AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1696AC_TRY_COMPILE([
1697#include <sys/types.h>
1698#include <utmp.h>
1699#ifdef HAVE_LASTLOG_H
1700# include <lastlog.h>
1701#endif
Damien Miller2994e082000-06-04 15:51:47 +10001702#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001703# include <paths.h>
1704#endif
1705 ],
1706 [ char *lastlog = LASTLOG_FILE; ],
1707 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10001708 [
1709 AC_MSG_RESULT(no)
1710 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1711 AC_TRY_COMPILE([
1712#include <sys/types.h>
1713#include <utmp.h>
1714#ifdef HAVE_LASTLOG_H
1715# include <lastlog.h>
1716#endif
1717#ifdef HAVE_PATHS_H
1718# include <paths.h>
1719#endif
1720 ],
1721 [ char *lastlog = _PATH_LASTLOG; ],
1722 [ AC_MSG_RESULT(yes) ],
1723 [
andree441aa32000-06-12 22:34:38 +00001724 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10001725 system_lastlog_path=no
1726 ])
1727 ]
andre2ff7b5d2000-06-03 14:57:40 +00001728)
Damien Miller2994e082000-06-04 15:51:47 +10001729
andre2ff7b5d2000-06-03 14:57:40 +00001730if test -z "$conf_lastlog_location"; then
1731 if test x"$system_lastlog_path" = x"no" ; then
1732 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10001733 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00001734 conf_lastlog_location=$f
1735 fi
1736 done
1737 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00001738 AC_MSG_WARN([** Cannot find lastlog **])
1739 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00001740 fi
1741 fi
1742fi
1743
1744if test -n "$conf_lastlog_location"; then
1745 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1746fi
1747
1748dnl utmp detection
1749AC_MSG_CHECKING([if your system defines UTMP_FILE])
1750AC_TRY_COMPILE([
1751#include <sys/types.h>
1752#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001753#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001754# include <paths.h>
1755#endif
1756 ],
1757 [ char *utmp = UTMP_FILE; ],
1758 [ AC_MSG_RESULT(yes) ],
1759 [ AC_MSG_RESULT(no)
1760 system_utmp_path=no ]
1761)
1762if test -z "$conf_utmp_location"; then
1763 if test x"$system_utmp_path" = x"no" ; then
1764 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1765 if test -f $f ; then
1766 conf_utmp_location=$f
1767 fi
1768 done
1769 if test -z "$conf_utmp_location"; then
1770 AC_DEFINE(DISABLE_UTMP)
1771 fi
1772 fi
1773fi
1774if test -n "$conf_utmp_location"; then
1775 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1776fi
1777
1778dnl wtmp detection
1779AC_MSG_CHECKING([if your system defines WTMP_FILE])
1780AC_TRY_COMPILE([
1781#include <sys/types.h>
1782#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001783#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001784# include <paths.h>
1785#endif
1786 ],
1787 [ char *wtmp = WTMP_FILE; ],
1788 [ AC_MSG_RESULT(yes) ],
1789 [ AC_MSG_RESULT(no)
1790 system_wtmp_path=no ]
1791)
1792if test -z "$conf_wtmp_location"; then
1793 if test x"$system_wtmp_path" = x"no" ; then
1794 for f in /usr/adm/wtmp /var/log/wtmp; do
1795 if test -f $f ; then
1796 conf_wtmp_location=$f
1797 fi
1798 done
1799 if test -z "$conf_wtmp_location"; then
1800 AC_DEFINE(DISABLE_WTMP)
1801 fi
1802 fi
1803fi
1804if test -n "$conf_wtmp_location"; then
1805 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1806fi
1807
1808
1809dnl utmpx detection - I don't know any system so perverse as to require
1810dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1811dnl there, though.
1812AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1813AC_TRY_COMPILE([
1814#include <sys/types.h>
1815#include <utmp.h>
1816#ifdef HAVE_UTMPX_H
1817#include <utmpx.h>
1818#endif
Damien Miller2994e082000-06-04 15:51:47 +10001819#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001820# include <paths.h>
1821#endif
1822 ],
1823 [ char *utmpx = UTMPX_FILE; ],
1824 [ AC_MSG_RESULT(yes) ],
1825 [ AC_MSG_RESULT(no)
1826 system_utmpx_path=no ]
1827)
1828if test -z "$conf_utmpx_location"; then
1829 if test x"$system_utmpx_path" = x"no" ; then
1830 AC_DEFINE(DISABLE_UTMPX)
1831 fi
1832else
1833 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1834fi
1835
1836dnl wtmpx detection
1837AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1838AC_TRY_COMPILE([
1839#include <sys/types.h>
1840#include <utmp.h>
1841#ifdef HAVE_UTMPX_H
1842#include <utmpx.h>
1843#endif
Damien Miller2994e082000-06-04 15:51:47 +10001844#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001845# include <paths.h>
1846#endif
1847 ],
1848 [ char *wtmpx = WTMPX_FILE; ],
1849 [ AC_MSG_RESULT(yes) ],
1850 [ AC_MSG_RESULT(no)
1851 system_wtmpx_path=no ]
1852)
1853if test -z "$conf_wtmpx_location"; then
1854 if test x"$system_wtmpx_path" = x"no" ; then
1855 AC_DEFINE(DISABLE_WTMPX)
1856 fi
1857else
1858 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1859fi
1860
Damien Miller4018c192000-04-30 09:30:44 +10001861
1862# Change default command timeout for builtin PRNG
Damien Miller14c12cb2000-06-07 22:20:23 +10001863entropy_timeout=200
Damien Miller4018c192000-04-30 09:30:44 +10001864AC_ARG_WITH(entropy-timeout,
1865 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1866 [
1867 if test "x$withval" != "xno" ; then
1868 entropy_timeout=$withval
1869 fi
1870 ]
1871)
1872AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1873
1874
Damien Miller29ea30d2000-03-17 10:54:15 +11001875if test ! -z "$blibpath" ; then
1876 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1877 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1878fi
1879
Damien Millerbac2d8a2000-09-05 16:13:06 +11001880AC_EXEEXT
1881
Ben Lindstrom3c06f6a2001-01-31 21:52:01 +00001882AC_OUTPUT(Makefile openbsd-compat/Makefile ssh_prng_cmds)
Damien Miller0437b332000-05-02 09:56:41 +10001883
Damien Miller7b22d652000-06-18 14:07:04 +10001884# Print summary of options
1885
Damien Miller7b22d652000-06-18 14:07:04 +10001886if test ! -z "$RANDOM_POOL" ; then
1887 RAND_MSG="Device ($RANDOM_POOL)"
1888else
Damien Millerd0ccb982001-03-04 00:29:20 +11001889 if test ! -z "$PRNGD_PORT" ; then
1890 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
1891 elif test ! -z "$PRNGD_SOCKET" ; then
1892 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
Damien Miller7b22d652000-06-18 14:07:04 +10001893 else
1894 RAND_MSG="Builtin (timeout $entropy_timeout)"
Damien Miller6f9c3372000-10-25 10:06:04 +11001895 BUILTIN_RNG=1
Damien Miller7b22d652000-06-18 14:07:04 +10001896 fi
1897fi
1898
1899# Someone please show me a better way :)
1900A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1901B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1902C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1903D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00001904E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00001905F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10001906G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Tim Rice59ea0a02001-03-10 13:50:45 -08001907H=`eval echo ${user_path}` ; H=`eval echo ${H}`
Damien Miller7b22d652000-06-18 14:07:04 +10001908
1909echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00001910echo "OpenSSH has been configured with the following options:"
Damien Miller7b22d652000-06-18 14:07:04 +10001911echo " User binaries: $B"
1912echo " System binaries: $C"
1913echo " Configuration files: $D"
1914echo " Askpass program: $E"
1915echo " Manual pages: $F"
1916echo " PID file: $G"
Tim Rice59ea0a02001-03-10 13:50:45 -08001917echo " sshd default user PATH: $H"
Damien Miller7b22d652000-06-18 14:07:04 +10001918echo " Random number collection: $RAND_MSG"
Damien Miller897741e2001-04-16 10:41:46 +10001919echo " Manpage format: $MANTYPE"
Damien Miller7b22d652000-06-18 14:07:04 +10001920echo " PAM support: ${PAM_MSG}"
1921echo " KerberosIV support: $KRB4_MSG"
1922echo " AFS support: $AFS_MSG"
1923echo " S/KEY support: $SKEY_MSG"
1924echo " TCP Wrappers support: $TCPW_MSG"
1925echo " MD5 password support: $MD5_MSG"
1926echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1927echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1928echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1929
Damien Miller60396b02001-02-18 17:01:00 +11001930if test ! -z "$bsd_auth"; then
1931 echo " BSD Auth support: yes"
1932fi
1933
Damien Miller7b22d652000-06-18 14:07:04 +10001934echo ""
1935
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00001936echo " Host: ${host}"
1937echo " Compiler: ${CC}"
1938echo " Compiler flags: ${CFLAGS}"
1939echo "Preprocessor flags: ${CPPFLAGS}"
1940echo " Linker flags: ${LDFLAGS}"
1941echo " Libraries: ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10001942
1943echo ""
1944
Damien Miller82cf0ce2000-12-20 13:34:48 +11001945if test "x$PAM_MSG" = "xyes" ; then
1946 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
1947 echo "otherwise password authentication may fail. Example PAM control files"
1948 echo "can be found in the contrib/ subdirectory"
1949 echo ""
1950fi
1951
Damien Miller6f9c3372000-10-25 10:06:04 +11001952if test ! -z "$BUILTIN_RNG" ; then
1953 echo "WARNING: you are using the builtin random number collection service."
1954 echo "Please read WARNING.RNG and request that your OS vendor includes"
1955 echo "/dev/random in future versions of their OS."
1956 echo ""
1957fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001958
1959if test ! -z "$NO_SFTP"; then
1960 echo "sftp-server will be disabled. Your compiler does not support"
1961 echo "64bit integers."
1962 echo ""
1963fi
Damien Miller60396b02001-02-18 17:01:00 +11001964