blob: fe6e55933474524efce99484d0082edc546894ef [file] [log] [blame]
Tim Riceb8fbb8e2001-04-21 14:31:52 -07001# $Id: configure.in,v 1.279 2001/04/21 21:31:53 tim Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Damien Millerab18c411999-11-11 10:40:23 +11003AC_INIT(ssh.c)
Damien Miller7f6ea021999-10-28 13:25:17 +10004
5AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11006AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11007AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11008AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +10009
Damien Millera22ba012000-03-02 23:09:20 +110010# Checks for programs.
Damien Millerab18c411999-11-11 10:40:23 +110011AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100012AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110013AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000014AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070015AC_PATH_PROGS(PERL, perl5 perl)
Damien Millere79334a1999-12-29 10:03:37 +110016AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100017AC_PATH_PROG(ENT, ent)
18AC_SUBST(ENT)
Damien Miller78315eb2000-09-29 23:01:36 +110019AC_PATH_PROGS(FILEPRIV, filepriv, true, /sbin:/usr/sbin)
Damien Miller4864e8f2001-02-08 10:07:08 +110020AC_PATH_PROG(TEST_MINUS_S_SH, bash)
21AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
22AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110023
Damien Miller3f62aba2000-11-29 11:56:35 +110024if test -z "$AR" ; then
25 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
26fi
27
Damien Millerad833b32000-08-23 10:46:23 +100028# Use LOGIN_PROGRAM from environment if possible
29if test ! -z "$LOGIN_PROGRAM" ; then
30 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
31else
32 # Search for login
33 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
34 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
35 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
36 fi
37fi
38
Damien Miller166bd442000-03-16 10:48:25 +110039if test -z "$LD" ; then
40 LD=$CC
41fi
42AC_SUBST(LD)
43
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"
182 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000183*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000184 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller2ae714f2000-07-11 09:29:50 +1000185 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100186 IPADDR_IN_DISPLAY=yes
187 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000188 AC_DEFINE(IP_TOS_IS_BROKEN)
Kevin Steves52dd4682001-03-08 18:26:57 +0000189 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Millerb2dc28e2000-07-12 09:18:33 +1000190 LIBS="$LIBS -lgen -lnsl -lucb"
Damien Miller2ae714f2000-07-11 09:29:50 +1000191 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100192*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000193 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100194 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller78315eb2000-09-29 23:01:36 +1100195 enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100196 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100197 ;;
198*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000199 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100200 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller78315eb2000-09-29 23:01:36 +1100201 enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100202 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100203 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100204*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000205 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100206 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100207 LIBS="$LIBS -lgen -lsocket"
208 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100209*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000210 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100211 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Ben Lindstrom980754c2000-11-12 00:04:24 +0000212 LIBS="$LIBS -lgen -lsocket -los -lprot -lx -ltinfo -lm"
Damien Miller78315eb2000-09-29 23:01:36 +1100213 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100214 RANLIB=true
215 no_dev_ptmx=1
216 AC_DEFINE(BROKEN_SYS_TERMIO_H)
217 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100218 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000219 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000220 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Millerfbd884a2001-02-27 08:39:07 +1100221 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100222 AC_CHECK_FUNCS(getluid setluid)
Damien Miller78315eb2000-09-29 23:01:36 +1100223 ;;
224*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000225 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000226 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100227 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000228 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100229 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100230 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100231 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000232 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom42717bf2000-12-28 15:46:20 +0000233 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller217f5672001-02-16 12:12:41 +1100234 AC_CHECK_FUNCS(getluid setluid)
Damien Millera66626b2000-06-13 18:57:53 +1000235 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000236*-dec-osf*)
Damien Millerb8c656e2000-06-28 15:22:41 +1000237 if test ! -z "USE_SIA" ; then
238 AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
239 if test -f /etc/sia/matrix.conf; then
240 AC_MSG_RESULT(yes)
241 AC_DEFINE(HAVE_OSF_SIA)
242 AC_DEFINE(DISABLE_LOGIN)
243 LIBS="$LIBS -lsecurity -ldb -lm -laud"
244 else
245 AC_MSG_RESULT(no)
246 fi
247 fi
248 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100249esac
250
Damien Millere37bfc12000-06-05 09:37:43 +1000251# Allow user to specify flags
252AC_ARG_WITH(cflags,
253 [ --with-cflags Specify additional flags to pass to compiler],
254 [
255 if test "x$withval" != "xno" ; then
256 CFLAGS="$CFLAGS $withval"
257 fi
258 ]
259)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000260AC_ARG_WITH(cppflags,
261 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
262 [
263 if test "x$withval" != "xno"; then
264 CPPFLAGS="$CPPFLAGS $withval"
265 fi
266 ]
267)
Damien Millere37bfc12000-06-05 09:37:43 +1000268AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000269 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000270 [
271 if test "x$withval" != "xno" ; then
272 LDFLAGS="$LDFLAGS $withval"
273 fi
274 ]
275)
276AC_ARG_WITH(libs,
277 [ --with-libs Specify additional libraries to link with],
278 [
279 if test "x$withval" != "xno" ; then
280 LIBS="$LIBS $withval"
281 fi
282 ]
283)
284
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000285AC_ARG_WITH(pcre,
286 [ --with-pcre Override built in regex library with pcre],
287 [
288
289 AC_CHECK_LIB(pcre, pcre_info,
290 [
291 AC_DEFINE(HAVE_LIBPCRE)
292 LIBS="$LIBS -lpcreposix -lpcre"
293 no_comp_check="yes"
294 ],
295 [ AC_MSG_ERROR([*** Can not locate pcre libraries.]) ]
296 )
297 ]
298)
Damien Millere37bfc12000-06-05 09:37:43 +1000299
Damien Millera22ba012000-03-02 23:09:20 +1100300# Checks for libraries.
Damien Miller22d5aa72001-02-18 12:49:57 +1100301if test -z "$no_libnsl" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000302 AC_CHECK_LIB(nsl, yp_match, , )
303fi
Damien Miller22d5aa72001-02-18 12:49:57 +1100304if test -z "$no_libsocket" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000305 AC_CHECK_LIB(socket, main, , )
306fi
307
Damien Millerdf288022001-02-18 13:07:07 +1100308dnl SCO OS3 needs this for libwrap
309AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
310
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000311AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
Damien Miller5dfe9762001-02-16 12:05:39 +1100312AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Millerab18c411999-11-11 10:40:23 +1100313AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Miller6f9c3372000-10-25 10:06:04 +1100314
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000315# We don't want to check if we did an pcre override.
316if test -z "$no_comp_check" ; then
317 AC_CHECK_FUNC(regcomp,
318 [ AC_DEFINE(HAVE_REGCOMP)],
319 [
320 AC_CHECK_LIB(pcre, pcre_info,
321 [
322 AC_DEFINE(HAVE_LIBPCRE)
323 LIBS="$LIBS -lpcreposix -lpcre"
324 ],
325 [
326 AC_MSG_ERROR([*** No regex library found.])
327 ])
328 ]
329 )
330fi
Damien Millerab18c411999-11-11 10:40:23 +1100331
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000332dnl UnixWare 2.x
333AC_CHECK_FUNC(strcasecmp,
334 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
335)
336AC_CHECK_FUNC(utimes,
337 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
338)
Damien Millerab18c411999-11-11 10:40:23 +1100339
Ben Lindstrom8697e082001-02-24 21:41:10 +0000340AC_FUNC_STRFTIME
341
Damien Millera22ba012000-03-02 23:09:20 +1100342# Checks for header files.
Damien Miller3c027682001-03-14 11:39:45 +1100343AC_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)
344
345# Check for ALTDIRFUNC glob() extension
346AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
347AC_EGREP_CPP(FOUNDIT,
348 [
349 #include <glob.h>
350 #ifdef GLOB_ALTDIRFUNC
351 FOUNDIT
352 #endif
353 ],
354 [
355 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
356 AC_MSG_RESULT(yes)
357 ],
358 [
359 AC_MSG_RESULT(no)
360 ]
361)
Damien Millerab18c411999-11-11 10:40:23 +1100362
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000363# Check for g.gl_matchc glob() extension
364AC_MSG_CHECKING(for gl_matchc field in glob_t)
365AC_EGREP_CPP(FOUNDIT,
366 [
367 #include <glob.h>
368 int main(void){glob_t g; g.gl_matchc = 1;}
369 ],
370 [
371 AC_DEFINE(GLOB_HAS_GL_MATCHC)
372 AC_MSG_RESULT(yes)
373 ],
374 [
375 AC_MSG_RESULT(no)
376 ]
377)
378
Damien Miller18bb4732001-03-28 14:35:30 +1000379AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
380AC_TRY_RUN(
381 [
382#include <sys/types.h>
383#include <dirent.h>
384int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
385 ],
386 [AC_MSG_RESULT(yes)],
387 [
388 AC_MSG_RESULT(no)
389 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
390 ]
391)
392
Damien Millerc547bf12001-02-16 10:18:12 +1100393# Check whether user wants S/Key support
394SKEY_MSG="no"
395AC_ARG_WITH(skey,
396 [ --with-skey=PATH Enable S/Key support],
397 [
398 if test "x$withval" != "xno" ; then
399
400 if test "x$withval" != "xyes" ; then
401 CPPFLAGS="$CPPFLAGS -I${withval}/include"
402 LDFLAGS="$LDFLAGS -L${withval}/lib"
403 fi
404
405 AC_DEFINE(SKEY)
406 LIBS="-lskey $LIBS"
407 SKEY_MSG="yes"
408
409 AC_CHECK_FUNC(skey_keyinfo,
410 [],
411 [
412 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
413 ])
414 fi
415 ]
416)
417
418# Check whether user wants TCP wrappers support
419TCPW_MSG="no"
420AC_ARG_WITH(tcp-wrappers,
421 [ --with-tcp-wrappers Enable tcpwrappers support],
422 [
423 if test "x$withval" != "xno" ; then
424 saved_LIBS="$LIBS"
425 LIBS="-lwrap $LIBS"
426 AC_MSG_CHECKING(for libwrap)
427 AC_TRY_LINK(
428 [
429#include <tcpd.h>
430 int deny_severity = 0, allow_severity = 0;
431 ],
432 [hosts_access(0);],
433 [
434 AC_MSG_RESULT(yes)
435 AC_DEFINE(LIBWRAP)
436 TCPW_MSG="yes"
437 ],
438 [
439 AC_MSG_ERROR([*** libwrap missing])
440 ]
441 )
442 fi
443 ]
444)
445
Damien Millerad833b32000-08-23 10:46:23 +1000446dnl Checks for library functions.
Ben Lindstrom09988722001-04-12 21:35:52 +0000447AC_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 +1000448dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000449AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000450dnl Checks for libutil functions
Ben Lindstrome2fb8d32000-12-28 00:07:07 +0000451AC_CHECK_HEADERS(libutil.h)
andre2ff7b5d2000-06-03 14:57:40 +0000452AC_CHECK_FUNCS(login logout updwtmp logwtmp)
Damien Millerad833b32000-08-23 10:46:23 +1000453dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000454AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000455AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000456dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000457AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000458AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100459
Damien Miller5fc85652000-07-09 23:53:07 +1000460AC_CHECK_FUNC(getuserattr,
461 [AC_DEFINE(HAVE_GETUSERATTR)],
462 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
463)
464
Damien Miller04f80141999-11-19 15:32:34 +1100465AC_CHECK_FUNC(login,
466 [AC_DEFINE(HAVE_LOGIN)],
467 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
468)
469
470AC_CHECK_FUNC(daemon,
471 [AC_DEFINE(HAVE_DAEMON)],
472 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
473)
474
Damien Miller9fb07e42000-03-05 16:22:59 +1100475AC_CHECK_FUNC(getpagesize,
476 [AC_DEFINE(HAVE_GETPAGESIZE)],
477 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
478)
479
Damien Millercb170cb2000-07-01 16:52:55 +1000480# Check for broken snprintf
481if test "x$ac_cv_func_snprintf" = "xyes" ; then
482 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
483 AC_TRY_RUN(
484 [
485#include <stdio.h>
486int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
487 ],
488 [AC_MSG_RESULT(yes)],
489 [
490 AC_MSG_RESULT(no)
491 AC_DEFINE(BROKEN_SNPRINTF)
492 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
493 ]
494 )
495fi
496
Damien Miller606f8802000-09-16 15:39:56 +1100497AC_FUNC_GETPGRP
498
Damien Millera64b57a2001-01-17 10:44:13 +1100499# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000500PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100501AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100502 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100503 [
Damien Millera64b57a2001-01-17 10:44:13 +1100504 if test "x$withval" != "xno" ; then
505 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
506 AC_MSG_ERROR([PAM headers not found])
507 fi
508
509 AC_CHECK_LIB(dl, dlopen, , )
510 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
511 AC_CHECK_FUNCS(pam_getenvlist)
512
513 disable_shadow=yes
514 PAM_MSG="yes"
515
516 AC_DEFINE(USE_PAM)
Damien Millera22ba012000-03-02 23:09:20 +1100517 fi
518 ]
519)
Damien Millera22ba012000-03-02 23:09:20 +1100520
Damien Millera64b57a2001-01-17 10:44:13 +1100521# Check for older PAM
522if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100523 # Check PAM strerror arguments (old PAM)
524 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
525 AC_TRY_COMPILE(
526 [
Damien Miller81171112000-04-23 11:14:01 +1000527#include <stdlib.h>
528#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100529 ],
530 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
531 [AC_MSG_RESULT(no)],
532 [
533 AC_DEFINE(HAVE_OLD_PAM)
534 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000535 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100536 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100537 )
Damien Millera22ba012000-03-02 23:09:20 +1100538fi
539
540# The big search for OpenSSL
541AC_ARG_WITH(ssl-dir,
542 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
543 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000544 if test "x$withval" != "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100545 tryssldir=$withval
546 fi
547 ]
548)
549
550saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100551saved_LDFLAGS="$LDFLAGS"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000552saved_CPPFLAGS="$CPPFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100553if test "x$prefix" != "xNONE" ; then
554 tryssldir="$tryssldir $prefix"
555fi
Damien Miller61e50f12000-05-08 20:49:37 +1000556AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera1b61e12000-09-16 17:02:16 +1100557 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 +1100558 CPPFLAGS="$saved_CPPFLAGS"
559 LDFLAGS="$saved_LDFLAGS"
Damien Miller3b512e12000-05-17 23:29:18 +1000560 LIBS="$saved_LIBS -lcrypto"
Damien Millerccdefb62001-02-19 12:56:39 +1100561
562 # Skip directories if they don't exist
563 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
564 continue;
565 fi
566 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
567 # Try to use $ssldir/lib if it exists, otherwise
568 # $ssldir
569 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000570 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100571 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000572 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100573 fi
574 else
Damien Millerb68af622001-03-28 21:05:26 +1000575 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100576 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000577 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100578 fi
579 fi
580 # Try to use $ssldir/include if it exists, otherwise
581 # $ssldir
582 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000583 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100584 else
Damien Millerb68af622001-03-28 21:05:26 +1000585 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100586 fi
587 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000588
Damien Miller3b512e12000-05-17 23:29:18 +1000589 # Basic test to check for compatible version and correct linking
590 # *does not* test for RSA - that comes later.
591 AC_TRY_RUN(
592 [
Damien Millere59ce622000-05-01 20:54:17 +1000593#include <string.h>
594#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000595int main(void)
596{
Damien Miller3b512e12000-05-17 23:29:18 +1000597 char a[2048];
598 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000599 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000600 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000601}
Damien Miller3b512e12000-05-17 23:29:18 +1000602 ],
603 [
604 found_crypto=1
605 break;
606 ], []
607 )
Damien Miller61e50f12000-05-08 20:49:37 +1000608
609 if test ! -z "$found_crypto" ; then
610 break;
611 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100612 done
613
Damien Miller61e50f12000-05-08 20:49:37 +1000614 if test -z "$found_crypto" ; then
Damien Miller5dfe9762001-02-16 12:05:39 +1100615 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
Damien Millerb85dcad2000-03-11 11:37:00 +1100616 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000617 if test -z "$ssldir" ; then
618 ssldir="(system)"
619 fi
Damien Millera22ba012000-03-02 23:09:20 +1100620
Damien Miller61e50f12000-05-08 20:49:37 +1000621 ac_cv_openssldir=$ssldir
622])
623
Damien Milleredb82922000-06-20 13:25:52 +1000624if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000625 AC_DEFINE(HAVE_OPENSSL)
626 dnl Need to recover ssldir - test above runs in subshell
627 ssldir=$ac_cv_openssldir
Damien Millera64b57a2001-01-17 10:44:13 +1100628 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
Damien Millerccdefb62001-02-19 12:56:39 +1100629 # Try to use $ssldir/lib if it exists, otherwise
630 # $ssldir
631 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000632 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100633 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000634 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100635 fi
636 else
Damien Millerb68af622001-03-28 21:05:26 +1000637 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100638 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000639 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100640 fi
Damien Millera64b57a2001-01-17 10:44:13 +1100641 fi
Damien Millerccdefb62001-02-19 12:56:39 +1100642 # Try to use $ssldir/include if it exists, otherwise
643 # $ssldir
644 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000645 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100646 else
Damien Millerb68af622001-03-28 21:05:26 +1000647 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millera64b57a2001-01-17 10:44:13 +1100648 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100649 fi
Damien Millera22ba012000-03-02 23:09:20 +1100650fi
Damien Miller3b512e12000-05-17 23:29:18 +1000651LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000652
Damien Miller3b512e12000-05-17 23:29:18 +1000653# Now test RSA support
654saved_LIBS="$LIBS"
655AC_MSG_CHECKING([for RSA support])
656for WANTS_RSAREF in "" 1 ; do
657 if test -z "$WANTS_RSAREF" ; then
658 LIBS="$saved_LIBS"
659 else
660 LIBS="$saved_LIBS -lRSAglue -lrsaref"
661 fi
662 AC_TRY_RUN([
663#include <string.h>
664#include <openssl/rand.h>
665#include <openssl/rsa.h>
666#include <openssl/bn.h>
667#include <openssl/sha.h>
668int main(void)
669{
670 int num; RSA *key; static unsigned char p_in[] = "blahblah";
671 unsigned char c[256], p[256];
672 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
673 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
674 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
675 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
676}
677 ],
678 [
679 rsa_works=1
680 break;
681 ], [])
682done
683
684if test ! -z "$no_rsa" ; then
685 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000686 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000687else
688 if test -z "$rsa_works" ; then
689 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000690 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000691 else
692 if test -z "$WANTS_RSAREF" ; then
693 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000694 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000695 else
Damien Miller7b22d652000-06-18 14:07:04 +1000696 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000697 AC_MSG_RESULT(using RSAref)
698 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
699 fi
700 fi
701fi
Damien Millera22ba012000-03-02 23:09:20 +1100702
Damien Millera64b57a2001-01-17 10:44:13 +1100703# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
704# version in OpenSSL. Skip this for PAM
705if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100706 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100707fi
708
Ben Lindstromb5628642000-10-18 00:02:25 +0000709# Cheap hack to ensure NEWS-OS libraries are arranged right.
710if test ! -z "$SONY" ; then
711 LIBS="$LIBS -liberty";
712fi
713
Damien Millera22ba012000-03-02 23:09:20 +1100714# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100715AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100716AC_CHECK_SIZEOF(short int, 2)
717AC_CHECK_SIZEOF(int, 4)
718AC_CHECK_SIZEOF(long int, 4)
719AC_CHECK_SIZEOF(long long int, 8)
720
Damien Millera22ba012000-03-02 23:09:20 +1100721# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +1100722AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
723 AC_TRY_COMPILE(
724 [ #include <sys/types.h> ],
725 [ u_int a; a = 1;],
726 [ ac_cv_have_u_int="yes" ],
727 [ ac_cv_have_u_int="no" ]
728 )
729])
730if test "x$ac_cv_have_u_int" = "xyes" ; then
731 AC_DEFINE(HAVE_U_INT)
732 have_u_int=1
733fi
734
Damien Miller61e50f12000-05-08 20:49:37 +1000735AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
736 AC_TRY_COMPILE(
737 [ #include <sys/types.h> ],
738 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
739 [ ac_cv_have_intxx_t="yes" ],
740 [ ac_cv_have_intxx_t="no" ]
741 )
742])
743if test "x$ac_cv_have_intxx_t" = "xyes" ; then
744 AC_DEFINE(HAVE_INTXX_T)
745 have_intxx_t=1
746fi
747
Damien Miller578783e2000-09-23 14:12:24 +1100748AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
749 AC_TRY_COMPILE(
750 [ #include <sys/types.h> ],
751 [ int64_t a; a = 1;],
752 [ ac_cv_have_int64_t="yes" ],
753 [ ac_cv_have_int64_t="no" ]
754 )
755])
756if test "x$ac_cv_have_int64_t" = "xyes" ; then
757 AC_DEFINE(HAVE_INT64_T)
758 have_int64_t=1
759fi
760
Damien Miller61e50f12000-05-08 20:49:37 +1000761AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
762 AC_TRY_COMPILE(
763 [ #include <sys/types.h> ],
764 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
765 [ ac_cv_have_u_intxx_t="yes" ],
766 [ ac_cv_have_u_intxx_t="no" ]
767 )
768])
769if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
770 AC_DEFINE(HAVE_U_INTXX_T)
771 have_u_intxx_t=1
772fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100773
Damien Miller578783e2000-09-23 14:12:24 +1100774AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
775 AC_TRY_COMPILE(
776 [ #include <sys/types.h> ],
777 [ u_int64_t a; a = 1;],
778 [ ac_cv_have_u_int64_t="yes" ],
779 [ ac_cv_have_u_int64_t="no" ]
780 )
781])
782if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
783 AC_DEFINE(HAVE_U_INT64_T)
784 have_u_int64_t=1
785fi
786
Damien Milleredb82922000-06-20 13:25:52 +1000787if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
788 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +1100789then
790 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
791 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +1000792 [
793#include <sys/bitypes.h>
794 ],
Damien Millerb29ea912000-01-15 14:12:03 +1100795 [
Damien Miller70494d12000-04-03 15:57:06 +1000796 int8_t a; int16_t b; int32_t c;
797 u_int8_t e; u_int16_t f; u_int32_t g;
798 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +1100799 ],
800 [
801 AC_DEFINE(HAVE_U_INTXX_T)
802 AC_DEFINE(HAVE_INTXX_T)
803 AC_MSG_RESULT(yes)
804 ],
805 [AC_MSG_RESULT(no)]
806 )
807fi
808
Damien Millerd6121d22000-03-17 23:26:46 +1100809if test -z "$have_u_intxx_t" ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000810 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
811 AC_TRY_COMPILE(
812 [
813#include <sys/types.h>
814 ],
815 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
816 [ ac_cv_have_uintxx_t="yes" ],
817 [ ac_cv_have_uintxx_t="no" ]
818 )
819 ])
820 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
821 AC_DEFINE(HAVE_UINTXX_T)
822 fi
Damien Millerd6121d22000-03-17 23:26:46 +1100823fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100824
Damien Miller61e50f12000-05-08 20:49:37 +1000825AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
826 AC_TRY_COMPILE(
827 [
Damien Miller81171112000-04-23 11:14:01 +1000828#include <sys/types.h>
829#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000830 ],
831 [socklen_t foo; foo = 1235;],
832 [ ac_cv_have_socklen_t="yes" ],
833 [ ac_cv_have_socklen_t="no" ]
834 )
835])
836if test "x$ac_cv_have_socklen_t" = "xyes" ; then
837 AC_DEFINE(HAVE_SOCKLEN_T)
838fi
Damien Miller74d0d4a1999-12-29 02:24:35 +1100839
Damien Miller61e50f12000-05-08 20:49:37 +1000840AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
841 AC_TRY_COMPILE(
842 [
843#include <sys/types.h>
844 ],
845 [ size_t foo; foo = 1235; ],
846 [ ac_cv_have_size_t="yes" ],
847 [ ac_cv_have_size_t="no" ]
848 )
849])
850if test "x$ac_cv_have_size_t" = "xyes" ; then
851 AC_DEFINE(HAVE_SIZE_T)
852fi
Damien Miller95058511999-12-29 10:36:45 +1100853
Damien Miller615f9392000-05-17 22:53:33 +1000854AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
855 AC_TRY_COMPILE(
856 [
857#include <sys/types.h>
858 ],
859 [ ssize_t foo; foo = 1235; ],
860 [ ac_cv_have_ssize_t="yes" ],
861 [ ac_cv_have_ssize_t="no" ]
862 )
863])
864if test "x$ac_cv_have_ssize_t" = "xyes" ; then
865 AC_DEFINE(HAVE_SSIZE_T)
866fi
867
Ben Lindstrom0d5af602001-01-09 00:50:29 +0000868AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
869 AC_TRY_COMPILE(
870 [
871#include <time.h>
872 ],
873 [ clock_t foo; foo = 1235; ],
874 [ ac_cv_have_clock_t="yes" ],
875 [ ac_cv_have_clock_t="no" ]
876 )
877])
878if test "x$ac_cv_have_clock_t" = "xyes" ; then
879 AC_DEFINE(HAVE_CLOCK_T)
880fi
881
Damien Millerb54b40e2000-06-23 08:23:34 +1000882AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
883 AC_TRY_COMPILE(
884 [
885#include <sys/types.h>
886#include <sys/socket.h>
887 ],
888 [ sa_family_t foo; foo = 1235; ],
889 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +1100890 [ AC_TRY_COMPILE(
891 [
892#include <sys/types.h>
893#include <sys/socket.h>
894#include <netinet/in.h>
895 ],
896 [ sa_family_t foo; foo = 1235; ],
897 [ ac_cv_have_sa_family_t="yes" ],
898
Damien Millerb54b40e2000-06-23 08:23:34 +1000899 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +1100900 )]
Damien Millerb54b40e2000-06-23 08:23:34 +1000901 )
902])
903if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
904 AC_DEFINE(HAVE_SA_FAMILY_T)
905fi
906
Damien Miller0f91b4e2000-06-18 15:43:25 +1000907AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
908 AC_TRY_COMPILE(
909 [
910#include <sys/types.h>
911 ],
912 [ pid_t foo; foo = 1235; ],
913 [ ac_cv_have_pid_t="yes" ],
914 [ ac_cv_have_pid_t="no" ]
915 )
916])
917if test "x$ac_cv_have_pid_t" = "xyes" ; then
918 AC_DEFINE(HAVE_PID_T)
919fi
920
921AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
922 AC_TRY_COMPILE(
923 [
924#include <sys/types.h>
925 ],
926 [ mode_t foo; foo = 1235; ],
927 [ ac_cv_have_mode_t="yes" ],
928 [ ac_cv_have_mode_t="no" ]
929 )
930])
931if test "x$ac_cv_have_mode_t" = "xyes" ; then
932 AC_DEFINE(HAVE_MODE_T)
933fi
934
Damien Miller61e50f12000-05-08 20:49:37 +1000935
936AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
937 AC_TRY_COMPILE(
938 [
Damien Miller81171112000-04-23 11:14:01 +1000939#include <sys/types.h>
940#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000941 ],
942 [ struct sockaddr_storage s; ],
943 [ ac_cv_have_struct_sockaddr_storage="yes" ],
944 [ ac_cv_have_struct_sockaddr_storage="no" ]
945 )
946])
947if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
948 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
949fi
Damien Miller34132e52000-01-14 15:45:46 +1100950
Damien Miller61e50f12000-05-08 20:49:37 +1000951AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
952 AC_TRY_COMPILE(
953 [
Damien Miller7b22d652000-06-18 14:07:04 +1000954#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000955#include <netinet/in.h>
956 ],
957 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
958 [ ac_cv_have_struct_sockaddr_in6="yes" ],
959 [ ac_cv_have_struct_sockaddr_in6="no" ]
960 )
961])
962if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
963 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
964fi
Damien Miller34132e52000-01-14 15:45:46 +1100965
Damien Miller61e50f12000-05-08 20:49:37 +1000966AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
967 AC_TRY_COMPILE(
968 [
Damien Miller7b22d652000-06-18 14:07:04 +1000969#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000970#include <netinet/in.h>
971 ],
972 [ struct in6_addr s; s.s6_addr[0] = 0; ],
973 [ ac_cv_have_struct_in6_addr="yes" ],
974 [ ac_cv_have_struct_in6_addr="no" ]
975 )
976])
977if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
978 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
979fi
Damien Miller34132e52000-01-14 15:45:46 +1100980
Damien Miller61e50f12000-05-08 20:49:37 +1000981AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
982 AC_TRY_COMPILE(
983 [
Damien Miller81171112000-04-23 11:14:01 +1000984#include <sys/types.h>
985#include <sys/socket.h>
986#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000987 ],
988 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
989 [ ac_cv_have_struct_addrinfo="yes" ],
990 [ ac_cv_have_struct_addrinfo="no" ]
991 )
992])
993if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
994 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
995fi
996
Ben Lindstrom42202bc2001-01-15 02:34:37 +0000997AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
998 AC_TRY_COMPILE(
999 [ #include <sys/time.h> ],
1000 [ struct timeval tv; tv.tv_sec = 1;],
1001 [ ac_cv_have_struct_timeval="yes" ],
1002 [ ac_cv_have_struct_timeval="no" ]
1003 )
1004])
1005if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1006 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1007 have_struct_timeval=1
1008fi
1009
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001010# If we don't have int64_t then we can't compile sftp-server. So don't
1011# even attempt to do it.
1012if test "x$ac_cv_have_int64_t" = "xno" -a \
1013 "x$ac_cv_sizeof_long_int" != "x8" -a \
1014 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1015 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001016else
1017dnl test snprintf (broken on SCO w/gcc)
1018 AC_TRY_RUN(
1019 [
1020#include <stdio.h>
1021#include <string.h>
1022#ifdef HAVE_SNPRINTF
1023main()
1024{
1025 char buf[50];
1026 char expected_out[50];
1027 int mazsize = 50 ;
1028#if (SIZEOF_LONG_INT == 8)
1029 long int num = 0x7fffffffffffffff;
1030#else
1031 long long num = 0x7fffffffffffffff;
1032#endif
1033 strcpy(expected_out, "9223372036854775807");
1034 snprintf(buf, mazsize, "%lld", num);
1035 if(strcmp(buf, expected_out) != 0)
1036 exit(1);
1037 exit(0);
1038}
1039#else
1040main() { exit(0); }
1041#endif
1042 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1043 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001044fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001045AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001046
Damien Miller78315eb2000-09-29 23:01:36 +11001047dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001048OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1049OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1050OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1051OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1052OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001053OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001054OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1055OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001056OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001057OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1058OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1059OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1060OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001061OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1062OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1063OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1064OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Damien Miller78315eb2000-09-29 23:01:36 +11001065AC_STRUCT_ST_BLKSIZE
andre2ff7b5d2000-06-03 14:57:40 +00001066
Damien Miller942da032000-08-18 13:59:06 +10001067AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
1068 ac_cv_have_sun_len_in_struct_sockaddr_un, [
1069 AC_TRY_COMPILE(
1070 [
1071#include <sys/types.h>
1072#include <sys/socket.h>
1073 ],
1074 [ struct sockaddr_un s; s.sun_len = 1; ],
1075 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
1076 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
1077 )
1078])
1079if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
1080 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
1081fi
1082
Damien Miller61e50f12000-05-08 20:49:37 +10001083AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1084 ac_cv_have_ss_family_in_struct_ss, [
1085 AC_TRY_COMPILE(
1086 [
Damien Miller81171112000-04-23 11:14:01 +10001087#include <sys/types.h>
1088#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001089 ],
1090 [ struct sockaddr_storage s; s.ss_family = 1; ],
1091 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1092 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1093 )
1094])
1095if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1096 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1097fi
1098
Damien Miller61e50f12000-05-08 20:49:37 +10001099AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1100 ac_cv_have___ss_family_in_struct_ss, [
1101 AC_TRY_COMPILE(
1102 [
Damien Miller81171112000-04-23 11:14:01 +10001103#include <sys/types.h>
1104#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001105 ],
1106 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1107 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1108 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1109 )
1110])
1111if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1112 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1113fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001114
Damien Millerad833b32000-08-23 10:46:23 +10001115AC_CACHE_CHECK([for pw_class field in struct passwd],
1116 ac_cv_have_pw_class_in_struct_passwd, [
1117 AC_TRY_COMPILE(
1118 [
Damien Millerad833b32000-08-23 10:46:23 +10001119#include <pwd.h>
1120 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001121 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001122 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1123 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1124 )
1125])
1126if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1127 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1128fi
1129
Damien Miller61e50f12000-05-08 20:49:37 +10001130
1131AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1132 AC_TRY_LINK([],
1133 [ extern char *__progname; printf("%s", __progname); ],
1134 [ ac_cv_libc_defines___progname="yes" ],
1135 [ ac_cv_libc_defines___progname="no" ]
1136 )
1137])
1138if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1139 AC_DEFINE(HAVE___PROGNAME)
1140fi
1141
Damien Millera22ba012000-03-02 23:09:20 +11001142
Damien Millerecbb26d2000-07-15 14:59:14 +10001143AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1144 AC_TRY_LINK([],
1145 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1146 [ ac_cv_libc_defines_sys_errlist="yes" ],
1147 [ ac_cv_libc_defines_sys_errlist="no" ]
1148 )
1149])
1150if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1151 AC_DEFINE(HAVE_SYS_ERRLIST)
1152fi
1153
1154
Damien Miller11fa2cc2000-08-16 10:35:58 +10001155AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1156 AC_TRY_LINK([],
1157 [ extern int sys_nerr; printf("%i", sys_nerr);],
1158 [ ac_cv_libc_defines_sys_nerr="yes" ],
1159 [ ac_cv_libc_defines_sys_nerr="no" ]
1160 )
1161])
1162if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1163 AC_DEFINE(HAVE_SYS_NERR)
1164fi
1165
1166
Damien Millerc79bc0d2001-03-28 13:03:42 +10001167# Check whether user wants Kerberos support
1168KRB4_MSG="no"
1169AC_ARG_WITH(kerberos4,
1170 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1171 [
1172 if test "x$withval" != "xno" ; then
1173
1174 if test "x$withval" != "xyes" ; then
1175 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1176 LDFLAGS="$LDFLAGS -L${withval}/lib"
1177 if test ! -z "$need_dash_r" ; then
1178 LDFLAGS="$LDFLAGS -R${withval}/lib"
1179 fi
1180 if test ! -z "$blibpath" ; then
1181 blibpath="$blibpath:${withval}/lib"
1182 fi
1183 else
1184 if test -d /usr/include/kerberosIV ; then
1185 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1186 fi
1187 fi
1188
1189 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001190 if test "$ac_cv_header_krb_h" != yes; then
1191 AC_MSG_WARN([Cannot find krb.h, build may fail])
1192 fi
Damien Miller98344742001-03-28 14:37:06 +10001193 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001194 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001195 AC_CHECK_LIB(krb4, main)
1196 if test "$ac_cv_lib_krb4_main" != yes; then
1197 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1198 else
1199 KLIBS="-lkrb4"
1200 fi
1201 else
1202 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001203 fi
Damien Miller98344742001-03-28 14:37:06 +10001204 AC_CHECK_LIB(des, des_cbc_encrypt)
1205 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1206 AC_CHECK_LIB(des425, des_cbc_encrypt)
1207 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1208 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1209 else
1210 KLIBS="-ldes425"
1211 fi
1212 else
1213 KLIBS="-ldes"
1214 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001215 AC_CHECK_LIB(resolv, dn_expand, , )
1216 KRB4=yes
1217 KRB4_MSG="yes"
1218 AC_DEFINE(KRB4)
1219 fi
1220 ]
1221)
1222
1223# Check whether user wants AFS support
1224AFS_MSG="no"
1225AC_ARG_WITH(afs,
1226 [ --with-afs=PATH Enable AFS support],
1227 [
1228 if test "x$withval" != "xno" ; then
1229
1230 if test "x$withval" != "xyes" ; then
1231 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1232 LDFLAGS="$LDFLAGS -L${withval}/lib"
1233 fi
1234
1235 if test -z "$KRB4" ; then
1236 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1237 fi
1238
1239 LIBS="-lkafs $LIBS"
1240 if test ! -z "$AFS_LIBS" ; then
1241 LIBS="$LIBS $AFS_LIBS"
1242 fi
1243 AC_DEFINE(AFS)
1244 AFS_MSG="yes"
1245 fi
1246 ]
1247)
1248LIBS="$LIBS $KLIBS"
1249
Damien Millera22ba012000-03-02 23:09:20 +11001250# Looking for programs, paths and files
1251AC_ARG_WITH(rsh,
1252 [ --with-rsh=PATH Specify path to remote shell program ],
1253 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001254 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001255 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001256 fi
1257 ],
1258 [
1259 AC_PATH_PROG(rsh_path, rsh)
1260 ]
1261)
1262
1263AC_ARG_WITH(xauth,
1264 [ --with-xauth=PATH Specify path to xauth program ],
1265 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001266 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001267 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001268 fi
1269 ],
1270 [
Damien Miller78315eb2000-09-29 23:01:36 +11001271 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 +10001272 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001273 xauth_path="/usr/openwin/bin/xauth"
1274 fi
1275 ]
1276)
1277
Damien Millera19cf472000-11-29 13:28:50 +11001278if test -z "$xauth_path" ; then
1279 XAUTH_PATH="undefined"
1280 AC_SUBST(XAUTH_PATH)
1281else
Damien Millera22ba012000-03-02 23:09:20 +11001282 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001283 XAUTH_PATH=$xauth_path
1284 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001285fi
1286if test ! -z "$rsh_path" ; then
1287 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1288fi
1289
1290# Check for mail directory (last resort if we cannot get it from headers)
1291if test ! -z "$MAIL" ; then
1292 maildir=`dirname $MAIL`
1293 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1294fi
1295
Damien Millera22ba012000-03-02 23:09:20 +11001296if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +11001297 AC_CHECK_FILE("/dev/ptmx",
1298 [
1299 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1300 have_dev_ptmx=1
1301 ]
1302 )
Damien Millera22ba012000-03-02 23:09:20 +11001303fi
Damien Miller204ad072000-03-02 23:56:12 +11001304AC_CHECK_FILE("/dev/ptc",
1305 [
1306 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1307 have_dev_ptc=1
1308 ]
1309)
1310
Damien Millera22ba012000-03-02 23:09:20 +11001311# Options from here on. Some of these are preset by platform above
1312
Damien Millera22ba012000-03-02 23:09:20 +11001313# Check for user-specified random device, otherwise check /dev/urandom
1314AC_ARG_WITH(random,
Damien Miller0736c4d2001-01-25 10:51:46 +11001315 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
Damien Millera22ba012000-03-02 23:09:20 +11001316 [
Damien Miller040f3832000-04-03 14:50:43 +10001317 if test "x$withval" != "xno" ; then
1318 RANDOM_POOL="$withval";
1319 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1320 fi
Damien Millera22ba012000-03-02 23:09:20 +11001321 ],
1322 [
1323 # Check for random device
1324 AC_CHECK_FILE("/dev/urandom",
1325 [
1326 RANDOM_POOL="/dev/urandom";
1327 AC_SUBST(RANDOM_POOL)
1328 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1329 ]
1330 )
1331 ]
1332)
1333
Damien Millerd0ccb982001-03-04 00:29:20 +11001334# Check for PRNGD/EGD pool file
1335AC_ARG_WITH(prngd-port,
1336 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1337 [
1338 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1339 PRNGD_PORT="$withval"
1340 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1341 fi
1342 ]
1343)
1344
1345# Check for PRNGD/EGD pool file
1346AC_ARG_WITH(prngd-socket,
1347 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
Damien Millera22ba012000-03-02 23:09:20 +11001348 [
Damien Miller040f3832000-04-03 14:50:43 +10001349 if test "x$withval" != "xno" ; then
Damien Millerd0ccb982001-03-04 00:29:20 +11001350 PRNGD_SOCKET="$withval"
1351 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller040f3832000-04-03 14:50:43 +10001352 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001353 ],
1354 [
1355 # Check for existing socket only if we don't have a random device already
1356 if test -z "$RANDOM_POOL" ; then
1357 AC_MSG_CHECKING(for PRNGD/EGD socket)
1358 # Insert other locations here
Tim Ricebee3f222001-03-11 17:32:12 -08001359 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
Damien Millerd0ccb982001-03-04 00:29:20 +11001360 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1361 PRNGD_SOCKET="$sock"
1362 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller0736c4d2001-01-25 10:51:46 +11001363 break;
1364 fi
1365 done
Damien Millerd0ccb982001-03-04 00:29:20 +11001366 if test ! -z "$PRNGD_SOCKET" ; then
1367 AC_MSG_RESULT($PRNGD_SOCKET)
Damien Miller4864e8f2001-02-08 10:07:08 +11001368 else
1369 AC_MSG_RESULT(not found)
1370 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001371 fi
Damien Millera22ba012000-03-02 23:09:20 +11001372 ]
1373)
1374
Damien Miller0736c4d2001-01-25 10:51:46 +11001375
Damien Miller0437b332000-05-02 09:56:41 +10001376# detect pathnames for entropy gathering commands, if we need them
1377INSTALL_SSH_PRNG_CMDS=""
1378rm -f prng_commands
Damien Millerd0ccb982001-03-04 00:29:20 +11001379if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
Damien Miller11e37f62000-04-08 18:23:30 +10001380 # Use these commands to collect entropy
Damien Miller61e50f12000-05-08 20:49:37 +10001381 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1382 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1383 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1384 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1385 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1386 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1387 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1388 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1389 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1390 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1391 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1392 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1393 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1394 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Damien Miller0437b332000-05-02 09:56:41 +10001395
1396 INSTALL_SSH_PRNG_CMDS="yes"
Damien Miller11e37f62000-04-08 18:23:30 +10001397fi
Damien Miller0437b332000-05-02 09:56:41 +10001398AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1399
Damien Miller11e37f62000-04-08 18:23:30 +10001400
Damien Miller670a4b82000-01-22 13:53:11 +11001401AC_ARG_WITH(catman,
Damien Miller897741e2001-04-16 10:41:46 +10001402 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001403 [
Damien Miller897741e2001-04-16 10:41:46 +10001404 case "$withval" in
1405 man|cat|doc)
1406 MANTYPE=$withval
1407 ;;
1408 *)
1409 AC_MSG_ERROR(invalid man type: $withval)
1410 ;;
1411 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001412 ]
1413)
Ben Lindstrombc709922001-04-18 18:04:21 +00001414if test -z "$MANTYPE"; then
Tim Riceb8fbb8e2001-04-21 14:31:52 -07001415 AC_PATH_PROGS(NROFF, nroff awf, /bin/false)
Ben Lindstrombc709922001-04-18 18:04:21 +00001416 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1417 MANTYPE=doc
1418 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1419 MANTYPE=man
1420 else
1421 MANTYPE=cat
1422 fi
1423fi
Damien Miller670a4b82000-01-22 13:53:11 +11001424AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001425if test "$MANTYPE" = "doc"; then
1426 mansubdir=man;
1427else
1428 mansubdir=$MANTYPE;
1429fi
1430AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001431
Damien Millera22ba012000-03-02 23:09:20 +11001432# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001433MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001434AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001435 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001436 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001437 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001438 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001439 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001440 fi
1441 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001442)
1443
Damien Millera22ba012000-03-02 23:09:20 +11001444# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001445AC_ARG_WITH(shadow,
1446 [ --without-shadow Disable shadow password support],
1447 [
1448 if test "x$withval" = "xno" ; then
1449 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001450 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001451 fi
1452 ]
1453)
1454
Damien Miller1f335fb2000-06-26 11:31:33 +10001455if test -z "$disable_shadow" ; then
1456 AC_MSG_CHECKING([if the systems has expire shadow information])
1457 AC_TRY_COMPILE(
1458 [
1459#include <sys/types.h>
1460#include <shadow.h>
1461 struct spwd sp;
1462 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1463 [ sp_expire_available=yes ], []
1464 )
1465
1466 if test "x$sp_expire_available" = "xyes" ; then
1467 AC_MSG_RESULT(yes)
1468 AC_DEFINE(HAS_SHADOW_EXPIRE)
1469 else
1470 AC_MSG_RESULT(no)
1471 fi
1472fi
1473
Damien Millera22ba012000-03-02 23:09:20 +11001474# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001475if test ! -z "$IPADDR_IN_DISPLAY" ; then
1476 DISPLAY_HACK_MSG="yes"
1477 AC_DEFINE(IPADDR_IN_DISPLAY)
1478else
1479 DISPLAY_HACK_MSG="no"
1480 AC_ARG_WITH(ipaddr-display,
1481 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1482 [
1483 if test "x$withval" != "xno" ; then
1484 AC_DEFINE(IPADDR_IN_DISPLAY)
1485 DISPLAY_HACK_MSG="yes"
1486 fi
1487 ]
1488 )
1489fi
Damien Miller76112de1999-12-21 11:18:08 +11001490
Damien Millera22ba012000-03-02 23:09:20 +11001491# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001492SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001493AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11001494 [ --with-default-path=PATH Specify default \$PATH environment for server],
1495 [
1496 if test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001497 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001498 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001499 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001500 ],
1501 [
1502 AC_TRY_RUN(
1503 [
1504/* find out what STDPATH is */
1505#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001506#ifdef HAVE_PATHS_H
1507# include <paths.h>
1508#endif
1509#ifndef _PATH_STDPATH
1510# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1511#endif
1512#include <sys/types.h>
1513#include <sys/stat.h>
1514#include <fcntl.h>
1515#define DATA "conftest.stdpath"
1516
1517main()
1518{
1519 FILE *fd;
1520 int rc;
1521
1522 fd = fopen(DATA,"w");
1523 if(fd == NULL)
1524 exit(1);
1525
1526 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1527 exit(1);
1528
1529 exit(0);
1530}
1531 ], [ user_path=`cat conftest.stdpath` ],
1532 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1533 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1534 )
1535# make sure $bindir is in USER_PATH so scp will work
1536 t_bindir=`eval echo ${bindir}`
1537 case $t_bindir in
1538 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1539 esac
1540 case $t_bindir in
1541 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1542 esac
1543 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1544 if test $? -ne 0 ; then
1545 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1546 if test $? -ne 0 ; then
1547 user_path=$user_path:$t_bindir
1548 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1549 fi
1550 fi
Damien Miller5a3e6831999-12-27 09:48:56 +11001551 ]
1552)
Tim Rice59ea0a02001-03-10 13:50:45 -08001553AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1554AC_SUBST(user_path)
Damien Miller5a3e6831999-12-27 09:48:56 +11001555
Damien Millera22ba012000-03-02 23:09:20 +11001556# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10001557IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11001558AC_ARG_WITH(ipv4-default,
1559 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1560 [
1561 if test "x$withval" != "xno" ; then
1562 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10001563 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11001564 fi
1565 ]
1566)
1567
Damien Miller61e50f12000-05-08 20:49:37 +10001568AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10001569IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11001570AC_ARG_WITH(4in6,
1571 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1572 [
1573 if test "x$withval" != "xno" ; then
1574 AC_MSG_RESULT(yes)
1575 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001576 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001577 else
1578 AC_MSG_RESULT(no)
1579 fi
1580 ],[
1581 if test "x$inet6_default_4in6" = "xyes"; then
1582 AC_MSG_RESULT([yes (default)])
1583 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001584 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001585 else
1586 AC_MSG_RESULT([no (default)])
1587 fi
1588 ]
1589)
1590
Damien Miller60396b02001-02-18 17:01:00 +11001591# Whether to enable BSD auth support
1592AC_ARG_WITH(bsd-auth,
1593 [ --with-bsd-auth Enable BSD auth support],
1594 [
1595 if test "x$withval" != "xno" ; then
1596 AC_DEFINE(BSD_AUTH)
1597 bsd_auth=yes
1598 fi
1599 ]
1600)
1601
Damien Miller78315eb2000-09-29 23:01:36 +11001602AC_MSG_CHECKING(whether to install ssh as suid root)
1603AC_ARG_ENABLE(suid-ssh,
1604[ --enable-suid-ssh Install ssh as suid root (default)
1605 --disable-suid-ssh Install ssh without suid bit],
1606[ case "$enableval" in
1607 no)
1608 AC_MSG_RESULT(no)
1609 SSHMODE=0711
1610 ;;
1611 *) AC_MSG_RESULT(yes)
1612 SSHMODE=04711
1613 ;;
1614 esac ],
1615 AC_MSG_RESULT(yes)
1616 SSHMODE=04711
1617)
1618AC_SUBST(SSHMODE)
1619
1620
Damien Millera22ba012000-03-02 23:09:20 +11001621# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11001622piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +11001623AC_ARG_WITH(pid-dir,
1624 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1625 [
1626 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +11001627 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +11001628 fi
1629 ]
1630)
Damien Miller4018c192000-04-30 09:30:44 +10001631
Damien Miller78315eb2000-09-29 23:01:36 +11001632# make sure the directory exists
1633if test ! -d $piddir ; then
1634 piddir=`eval echo ${sysconfdir}`
1635 case $piddir in
1636 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1637 esac
1638fi
1639
Ben Lindstrom226cfa02001-01-22 05:34:40 +00001640AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11001641AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11001642
andre2ff7b5d2000-06-03 14:57:40 +00001643dnl allow user to disable some login recording features
1644AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001645 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001646 [ AC_DEFINE(DISABLE_LASTLOG) ]
1647)
1648AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00001649 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001650 [ AC_DEFINE(DISABLE_UTMP) ]
1651)
1652AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00001653 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001654 [ AC_DEFINE(DISABLE_UTMPX) ]
1655)
1656AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00001657 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001658 [ AC_DEFINE(DISABLE_WTMP) ]
1659)
1660AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00001661 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001662 [ AC_DEFINE(DISABLE_WTMPX) ]
1663)
1664AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00001665 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001666 [ AC_DEFINE(DISABLE_LOGIN) ]
1667)
1668AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00001669 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001670 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1671)
1672AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00001673 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001674 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1675)
1676AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001677 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11001678 [
1679 if test "x$withval" = "xno" ; then
1680 AC_DEFINE(DISABLE_LASTLOG)
1681 else
1682 conf_lastlog_location=$withval
1683 fi
1684 ]
1685)
andre2ff7b5d2000-06-03 14:57:40 +00001686
1687dnl lastlog, [uw]tmpx? detection
1688dnl NOTE: set the paths in the platform section to avoid the
1689dnl need for command-line parameters
1690dnl lastlog and [uw]tmp are subject to a file search if all else fails
1691
1692dnl lastlog detection
1693dnl NOTE: the code itself will detect if lastlog is a directory
1694AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1695AC_TRY_COMPILE([
1696#include <sys/types.h>
1697#include <utmp.h>
1698#ifdef HAVE_LASTLOG_H
1699# include <lastlog.h>
1700#endif
Damien Miller2994e082000-06-04 15:51:47 +10001701#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001702# include <paths.h>
1703#endif
1704 ],
1705 [ char *lastlog = LASTLOG_FILE; ],
1706 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10001707 [
1708 AC_MSG_RESULT(no)
1709 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1710 AC_TRY_COMPILE([
1711#include <sys/types.h>
1712#include <utmp.h>
1713#ifdef HAVE_LASTLOG_H
1714# include <lastlog.h>
1715#endif
1716#ifdef HAVE_PATHS_H
1717# include <paths.h>
1718#endif
1719 ],
1720 [ char *lastlog = _PATH_LASTLOG; ],
1721 [ AC_MSG_RESULT(yes) ],
1722 [
andree441aa32000-06-12 22:34:38 +00001723 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10001724 system_lastlog_path=no
1725 ])
1726 ]
andre2ff7b5d2000-06-03 14:57:40 +00001727)
Damien Miller2994e082000-06-04 15:51:47 +10001728
andre2ff7b5d2000-06-03 14:57:40 +00001729if test -z "$conf_lastlog_location"; then
1730 if test x"$system_lastlog_path" = x"no" ; then
1731 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10001732 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00001733 conf_lastlog_location=$f
1734 fi
1735 done
1736 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00001737 AC_MSG_WARN([** Cannot find lastlog **])
1738 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00001739 fi
1740 fi
1741fi
1742
1743if test -n "$conf_lastlog_location"; then
1744 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1745fi
1746
1747dnl utmp detection
1748AC_MSG_CHECKING([if your system defines UTMP_FILE])
1749AC_TRY_COMPILE([
1750#include <sys/types.h>
1751#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001752#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001753# include <paths.h>
1754#endif
1755 ],
1756 [ char *utmp = UTMP_FILE; ],
1757 [ AC_MSG_RESULT(yes) ],
1758 [ AC_MSG_RESULT(no)
1759 system_utmp_path=no ]
1760)
1761if test -z "$conf_utmp_location"; then
1762 if test x"$system_utmp_path" = x"no" ; then
1763 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1764 if test -f $f ; then
1765 conf_utmp_location=$f
1766 fi
1767 done
1768 if test -z "$conf_utmp_location"; then
1769 AC_DEFINE(DISABLE_UTMP)
1770 fi
1771 fi
1772fi
1773if test -n "$conf_utmp_location"; then
1774 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1775fi
1776
1777dnl wtmp detection
1778AC_MSG_CHECKING([if your system defines WTMP_FILE])
1779AC_TRY_COMPILE([
1780#include <sys/types.h>
1781#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001782#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001783# include <paths.h>
1784#endif
1785 ],
1786 [ char *wtmp = WTMP_FILE; ],
1787 [ AC_MSG_RESULT(yes) ],
1788 [ AC_MSG_RESULT(no)
1789 system_wtmp_path=no ]
1790)
1791if test -z "$conf_wtmp_location"; then
1792 if test x"$system_wtmp_path" = x"no" ; then
1793 for f in /usr/adm/wtmp /var/log/wtmp; do
1794 if test -f $f ; then
1795 conf_wtmp_location=$f
1796 fi
1797 done
1798 if test -z "$conf_wtmp_location"; then
1799 AC_DEFINE(DISABLE_WTMP)
1800 fi
1801 fi
1802fi
1803if test -n "$conf_wtmp_location"; then
1804 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1805fi
1806
1807
1808dnl utmpx detection - I don't know any system so perverse as to require
1809dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1810dnl there, though.
1811AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1812AC_TRY_COMPILE([
1813#include <sys/types.h>
1814#include <utmp.h>
1815#ifdef HAVE_UTMPX_H
1816#include <utmpx.h>
1817#endif
Damien Miller2994e082000-06-04 15:51:47 +10001818#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001819# include <paths.h>
1820#endif
1821 ],
1822 [ char *utmpx = UTMPX_FILE; ],
1823 [ AC_MSG_RESULT(yes) ],
1824 [ AC_MSG_RESULT(no)
1825 system_utmpx_path=no ]
1826)
1827if test -z "$conf_utmpx_location"; then
1828 if test x"$system_utmpx_path" = x"no" ; then
1829 AC_DEFINE(DISABLE_UTMPX)
1830 fi
1831else
1832 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1833fi
1834
1835dnl wtmpx detection
1836AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1837AC_TRY_COMPILE([
1838#include <sys/types.h>
1839#include <utmp.h>
1840#ifdef HAVE_UTMPX_H
1841#include <utmpx.h>
1842#endif
Damien Miller2994e082000-06-04 15:51:47 +10001843#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001844# include <paths.h>
1845#endif
1846 ],
1847 [ char *wtmpx = WTMPX_FILE; ],
1848 [ AC_MSG_RESULT(yes) ],
1849 [ AC_MSG_RESULT(no)
1850 system_wtmpx_path=no ]
1851)
1852if test -z "$conf_wtmpx_location"; then
1853 if test x"$system_wtmpx_path" = x"no" ; then
1854 AC_DEFINE(DISABLE_WTMPX)
1855 fi
1856else
1857 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1858fi
1859
Damien Miller4018c192000-04-30 09:30:44 +10001860
1861# Change default command timeout for builtin PRNG
Damien Miller14c12cb2000-06-07 22:20:23 +10001862entropy_timeout=200
Damien Miller4018c192000-04-30 09:30:44 +10001863AC_ARG_WITH(entropy-timeout,
1864 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1865 [
1866 if test "x$withval" != "xno" ; then
1867 entropy_timeout=$withval
1868 fi
1869 ]
1870)
1871AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1872
1873
Damien Miller29ea30d2000-03-17 10:54:15 +11001874if test ! -z "$blibpath" ; then
1875 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1876 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1877fi
1878
Damien Millerbac2d8a2000-09-05 16:13:06 +11001879AC_EXEEXT
1880
Ben Lindstrom3c06f6a2001-01-31 21:52:01 +00001881AC_OUTPUT(Makefile openbsd-compat/Makefile ssh_prng_cmds)
Damien Miller0437b332000-05-02 09:56:41 +10001882
Damien Miller7b22d652000-06-18 14:07:04 +10001883# Print summary of options
1884
Damien Miller7b22d652000-06-18 14:07:04 +10001885if test ! -z "$RANDOM_POOL" ; then
1886 RAND_MSG="Device ($RANDOM_POOL)"
1887else
Damien Millerd0ccb982001-03-04 00:29:20 +11001888 if test ! -z "$PRNGD_PORT" ; then
1889 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
1890 elif test ! -z "$PRNGD_SOCKET" ; then
1891 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
Damien Miller7b22d652000-06-18 14:07:04 +10001892 else
1893 RAND_MSG="Builtin (timeout $entropy_timeout)"
Damien Miller6f9c3372000-10-25 10:06:04 +11001894 BUILTIN_RNG=1
Damien Miller7b22d652000-06-18 14:07:04 +10001895 fi
1896fi
1897
1898# Someone please show me a better way :)
1899A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1900B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1901C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1902D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00001903E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00001904F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10001905G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Tim Rice59ea0a02001-03-10 13:50:45 -08001906H=`eval echo ${user_path}` ; H=`eval echo ${H}`
Damien Miller7b22d652000-06-18 14:07:04 +10001907
1908echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00001909echo "OpenSSH has been configured with the following options:"
Damien Miller7b22d652000-06-18 14:07:04 +10001910echo " User binaries: $B"
1911echo " System binaries: $C"
1912echo " Configuration files: $D"
1913echo " Askpass program: $E"
1914echo " Manual pages: $F"
1915echo " PID file: $G"
Tim Rice59ea0a02001-03-10 13:50:45 -08001916echo " sshd default user PATH: $H"
Damien Miller7b22d652000-06-18 14:07:04 +10001917echo " Random number collection: $RAND_MSG"
Damien Miller897741e2001-04-16 10:41:46 +10001918echo " Manpage format: $MANTYPE"
Damien Miller7b22d652000-06-18 14:07:04 +10001919echo " PAM support: ${PAM_MSG}"
1920echo " KerberosIV support: $KRB4_MSG"
1921echo " AFS support: $AFS_MSG"
1922echo " S/KEY support: $SKEY_MSG"
1923echo " TCP Wrappers support: $TCPW_MSG"
1924echo " MD5 password support: $MD5_MSG"
1925echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1926echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1927echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1928
Damien Miller60396b02001-02-18 17:01:00 +11001929if test ! -z "$bsd_auth"; then
1930 echo " BSD Auth support: yes"
1931fi
1932
Damien Miller7b22d652000-06-18 14:07:04 +10001933echo ""
1934
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00001935echo " Host: ${host}"
1936echo " Compiler: ${CC}"
1937echo " Compiler flags: ${CFLAGS}"
1938echo "Preprocessor flags: ${CPPFLAGS}"
1939echo " Linker flags: ${LDFLAGS}"
1940echo " Libraries: ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10001941
1942echo ""
1943
Damien Miller82cf0ce2000-12-20 13:34:48 +11001944if test "x$PAM_MSG" = "xyes" ; then
1945 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
1946 echo "otherwise password authentication may fail. Example PAM control files"
1947 echo "can be found in the contrib/ subdirectory"
1948 echo ""
1949fi
1950
Damien Miller6f9c3372000-10-25 10:06:04 +11001951if test ! -z "$BUILTIN_RNG" ; then
1952 echo "WARNING: you are using the builtin random number collection service."
1953 echo "Please read WARNING.RNG and request that your OS vendor includes"
1954 echo "/dev/random in future versions of their OS."
1955 echo ""
1956fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001957
1958if test ! -z "$NO_SFTP"; then
1959 echo "sftp-server will be disabled. Your compiler does not support"
1960 echo "64bit integers."
1961 echo ""
1962fi
Damien Miller60396b02001-02-18 17:01:00 +11001963