blob: e35d757c5c3277a2e0947e8614f1dcd3626a13ee [file] [log] [blame]
Tim Rice07183b82001-04-25 21:40:28 -07001# $Id: configure.in,v 1.282 2001/04/26 04:40:28 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"
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)
Tim Rice07183b82001-04-25 21:40:28 -0700224 MANTYPE=man
Damien Miller78315eb2000-09-29 23:01:36 +1100225 ;;
226*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000227 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000228 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100229 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000230 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100231 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100232 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100233 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000234 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom42717bf2000-12-28 15:46:20 +0000235 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller217f5672001-02-16 12:12:41 +1100236 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700237 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000238 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000239*-dec-osf*)
Damien Millerb8c656e2000-06-28 15:22:41 +1000240 if test ! -z "USE_SIA" ; then
241 AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
242 if test -f /etc/sia/matrix.conf; then
243 AC_MSG_RESULT(yes)
244 AC_DEFINE(HAVE_OSF_SIA)
245 AC_DEFINE(DISABLE_LOGIN)
246 LIBS="$LIBS -lsecurity -ldb -lm -laud"
247 else
248 AC_MSG_RESULT(no)
249 fi
250 fi
251 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100252esac
253
Damien Millere37bfc12000-06-05 09:37:43 +1000254# Allow user to specify flags
255AC_ARG_WITH(cflags,
256 [ --with-cflags Specify additional flags to pass to compiler],
257 [
258 if test "x$withval" != "xno" ; then
259 CFLAGS="$CFLAGS $withval"
260 fi
261 ]
262)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000263AC_ARG_WITH(cppflags,
264 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
265 [
266 if test "x$withval" != "xno"; then
267 CPPFLAGS="$CPPFLAGS $withval"
268 fi
269 ]
270)
Damien Millere37bfc12000-06-05 09:37:43 +1000271AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000272 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000273 [
274 if test "x$withval" != "xno" ; then
275 LDFLAGS="$LDFLAGS $withval"
276 fi
277 ]
278)
279AC_ARG_WITH(libs,
280 [ --with-libs Specify additional libraries to link with],
281 [
282 if test "x$withval" != "xno" ; then
283 LIBS="$LIBS $withval"
284 fi
285 ]
286)
287
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000288AC_ARG_WITH(pcre,
289 [ --with-pcre Override built in regex library with pcre],
290 [
291
292 AC_CHECK_LIB(pcre, pcre_info,
293 [
294 AC_DEFINE(HAVE_LIBPCRE)
295 LIBS="$LIBS -lpcreposix -lpcre"
296 no_comp_check="yes"
297 ],
298 [ AC_MSG_ERROR([*** Can not locate pcre libraries.]) ]
299 )
300 ]
301)
Damien Millere37bfc12000-06-05 09:37:43 +1000302
Damien Millera22ba012000-03-02 23:09:20 +1100303# Checks for libraries.
Damien Miller22d5aa72001-02-18 12:49:57 +1100304if test -z "$no_libnsl" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000305 AC_CHECK_LIB(nsl, yp_match, , )
306fi
Damien Miller22d5aa72001-02-18 12:49:57 +1100307if test -z "$no_libsocket" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000308 AC_CHECK_LIB(socket, main, , )
309fi
310
Damien Millerdf288022001-02-18 13:07:07 +1100311dnl SCO OS3 needs this for libwrap
312AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
313
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000314AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
Damien Miller5dfe9762001-02-16 12:05:39 +1100315AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Millerab18c411999-11-11 10:40:23 +1100316AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Miller6f9c3372000-10-25 10:06:04 +1100317
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000318# We don't want to check if we did an pcre override.
319if test -z "$no_comp_check" ; then
320 AC_CHECK_FUNC(regcomp,
321 [ AC_DEFINE(HAVE_REGCOMP)],
322 [
323 AC_CHECK_LIB(pcre, pcre_info,
324 [
325 AC_DEFINE(HAVE_LIBPCRE)
326 LIBS="$LIBS -lpcreposix -lpcre"
327 ],
328 [
329 AC_MSG_ERROR([*** No regex library found.])
330 ])
331 ]
332 )
333fi
Damien Millerab18c411999-11-11 10:40:23 +1100334
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000335dnl UnixWare 2.x
336AC_CHECK_FUNC(strcasecmp,
337 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
338)
339AC_CHECK_FUNC(utimes,
340 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
341)
Damien Millerab18c411999-11-11 10:40:23 +1100342
Ben Lindstrom8697e082001-02-24 21:41:10 +0000343AC_FUNC_STRFTIME
344
Damien Millera22ba012000-03-02 23:09:20 +1100345# Checks for header files.
Damien Millerda2ed562001-04-25 22:50:18 +1000346AC_CHECK_HEADERS(bstring.h crypt.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)
Damien Miller3c027682001-03-14 11:39:45 +1100347
348# Check for ALTDIRFUNC glob() extension
349AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
350AC_EGREP_CPP(FOUNDIT,
351 [
352 #include <glob.h>
353 #ifdef GLOB_ALTDIRFUNC
354 FOUNDIT
355 #endif
356 ],
357 [
358 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
359 AC_MSG_RESULT(yes)
360 ],
361 [
362 AC_MSG_RESULT(no)
363 ]
364)
Damien Millerab18c411999-11-11 10:40:23 +1100365
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000366# Check for g.gl_matchc glob() extension
367AC_MSG_CHECKING(for gl_matchc field in glob_t)
368AC_EGREP_CPP(FOUNDIT,
369 [
370 #include <glob.h>
371 int main(void){glob_t g; g.gl_matchc = 1;}
372 ],
373 [
374 AC_DEFINE(GLOB_HAS_GL_MATCHC)
375 AC_MSG_RESULT(yes)
376 ],
377 [
378 AC_MSG_RESULT(no)
379 ]
380)
381
Damien Miller18bb4732001-03-28 14:35:30 +1000382AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
383AC_TRY_RUN(
384 [
385#include <sys/types.h>
386#include <dirent.h>
387int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
388 ],
389 [AC_MSG_RESULT(yes)],
390 [
391 AC_MSG_RESULT(no)
392 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
393 ]
394)
395
Damien Millerc547bf12001-02-16 10:18:12 +1100396# Check whether user wants S/Key support
397SKEY_MSG="no"
398AC_ARG_WITH(skey,
399 [ --with-skey=PATH Enable S/Key support],
400 [
401 if test "x$withval" != "xno" ; then
402
403 if test "x$withval" != "xyes" ; then
404 CPPFLAGS="$CPPFLAGS -I${withval}/include"
405 LDFLAGS="$LDFLAGS -L${withval}/lib"
406 fi
407
408 AC_DEFINE(SKEY)
409 LIBS="-lskey $LIBS"
410 SKEY_MSG="yes"
411
412 AC_CHECK_FUNC(skey_keyinfo,
413 [],
414 [
415 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
416 ])
417 fi
418 ]
419)
420
421# Check whether user wants TCP wrappers support
422TCPW_MSG="no"
423AC_ARG_WITH(tcp-wrappers,
424 [ --with-tcp-wrappers Enable tcpwrappers support],
425 [
426 if test "x$withval" != "xno" ; then
427 saved_LIBS="$LIBS"
428 LIBS="-lwrap $LIBS"
429 AC_MSG_CHECKING(for libwrap)
430 AC_TRY_LINK(
431 [
432#include <tcpd.h>
433 int deny_severity = 0, allow_severity = 0;
434 ],
435 [hosts_access(0);],
436 [
437 AC_MSG_RESULT(yes)
438 AC_DEFINE(LIBWRAP)
439 TCPW_MSG="yes"
440 ],
441 [
442 AC_MSG_ERROR([*** libwrap missing])
443 ]
444 )
445 fi
446 ]
447)
448
Damien Millerad833b32000-08-23 10:46:23 +1000449dnl Checks for library functions.
Ben Lindstrom09988722001-04-12 21:35:52 +0000450AC_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 +1000451dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000452AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000453dnl Checks for libutil functions
Ben Lindstrome2fb8d32000-12-28 00:07:07 +0000454AC_CHECK_HEADERS(libutil.h)
andre2ff7b5d2000-06-03 14:57:40 +0000455AC_CHECK_FUNCS(login logout updwtmp logwtmp)
Damien Millerad833b32000-08-23 10:46:23 +1000456dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000457AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000458AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000459dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000460AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000461AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100462
Damien Miller5fc85652000-07-09 23:53:07 +1000463AC_CHECK_FUNC(getuserattr,
464 [AC_DEFINE(HAVE_GETUSERATTR)],
465 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
466)
467
Damien Miller04f80141999-11-19 15:32:34 +1100468AC_CHECK_FUNC(login,
469 [AC_DEFINE(HAVE_LOGIN)],
470 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
471)
472
473AC_CHECK_FUNC(daemon,
474 [AC_DEFINE(HAVE_DAEMON)],
475 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
476)
477
Damien Miller9fb07e42000-03-05 16:22:59 +1100478AC_CHECK_FUNC(getpagesize,
479 [AC_DEFINE(HAVE_GETPAGESIZE)],
480 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
481)
482
Damien Millercb170cb2000-07-01 16:52:55 +1000483# Check for broken snprintf
484if test "x$ac_cv_func_snprintf" = "xyes" ; then
485 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
486 AC_TRY_RUN(
487 [
488#include <stdio.h>
489int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
490 ],
491 [AC_MSG_RESULT(yes)],
492 [
493 AC_MSG_RESULT(no)
494 AC_DEFINE(BROKEN_SNPRINTF)
495 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
496 ]
497 )
498fi
499
Damien Miller606f8802000-09-16 15:39:56 +1100500AC_FUNC_GETPGRP
501
Damien Millera64b57a2001-01-17 10:44:13 +1100502# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000503PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100504AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100505 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100506 [
Damien Millera64b57a2001-01-17 10:44:13 +1100507 if test "x$withval" != "xno" ; then
508 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
509 AC_MSG_ERROR([PAM headers not found])
510 fi
511
512 AC_CHECK_LIB(dl, dlopen, , )
513 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
514 AC_CHECK_FUNCS(pam_getenvlist)
515
516 disable_shadow=yes
517 PAM_MSG="yes"
518
519 AC_DEFINE(USE_PAM)
Damien Millera22ba012000-03-02 23:09:20 +1100520 fi
521 ]
522)
Damien Millera22ba012000-03-02 23:09:20 +1100523
Damien Millera64b57a2001-01-17 10:44:13 +1100524# Check for older PAM
525if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100526 # Check PAM strerror arguments (old PAM)
527 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
528 AC_TRY_COMPILE(
529 [
Damien Miller81171112000-04-23 11:14:01 +1000530#include <stdlib.h>
531#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100532 ],
533 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
534 [AC_MSG_RESULT(no)],
535 [
536 AC_DEFINE(HAVE_OLD_PAM)
537 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000538 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100539 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100540 )
Damien Millera22ba012000-03-02 23:09:20 +1100541fi
542
543# The big search for OpenSSL
544AC_ARG_WITH(ssl-dir,
545 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
546 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000547 if test "x$withval" != "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100548 tryssldir=$withval
549 fi
550 ]
551)
552
553saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100554saved_LDFLAGS="$LDFLAGS"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000555saved_CPPFLAGS="$CPPFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100556if test "x$prefix" != "xNONE" ; then
557 tryssldir="$tryssldir $prefix"
558fi
Damien Miller61e50f12000-05-08 20:49:37 +1000559AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera1b61e12000-09-16 17:02:16 +1100560 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 +1100561 CPPFLAGS="$saved_CPPFLAGS"
562 LDFLAGS="$saved_LDFLAGS"
Damien Miller3b512e12000-05-17 23:29:18 +1000563 LIBS="$saved_LIBS -lcrypto"
Damien Millerccdefb62001-02-19 12:56:39 +1100564
565 # Skip directories if they don't exist
566 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
567 continue;
568 fi
569 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
570 # Try to use $ssldir/lib if it exists, otherwise
571 # $ssldir
572 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000573 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100574 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000575 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100576 fi
577 else
Damien Millerb68af622001-03-28 21:05:26 +1000578 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100579 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000580 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100581 fi
582 fi
583 # Try to use $ssldir/include if it exists, otherwise
584 # $ssldir
585 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000586 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100587 else
Damien Millerb68af622001-03-28 21:05:26 +1000588 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100589 fi
590 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000591
Damien Miller3b512e12000-05-17 23:29:18 +1000592 # Basic test to check for compatible version and correct linking
593 # *does not* test for RSA - that comes later.
594 AC_TRY_RUN(
595 [
Damien Millere59ce622000-05-01 20:54:17 +1000596#include <string.h>
597#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000598int main(void)
599{
Damien Miller3b512e12000-05-17 23:29:18 +1000600 char a[2048];
601 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000602 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000603 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000604}
Damien Miller3b512e12000-05-17 23:29:18 +1000605 ],
606 [
607 found_crypto=1
608 break;
609 ], []
610 )
Damien Miller61e50f12000-05-08 20:49:37 +1000611
612 if test ! -z "$found_crypto" ; then
613 break;
614 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100615 done
616
Damien Miller61e50f12000-05-08 20:49:37 +1000617 if test -z "$found_crypto" ; then
Damien Miller5dfe9762001-02-16 12:05:39 +1100618 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
Damien Millerb85dcad2000-03-11 11:37:00 +1100619 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000620 if test -z "$ssldir" ; then
621 ssldir="(system)"
622 fi
Damien Millera22ba012000-03-02 23:09:20 +1100623
Damien Miller61e50f12000-05-08 20:49:37 +1000624 ac_cv_openssldir=$ssldir
625])
626
Damien Milleredb82922000-06-20 13:25:52 +1000627if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000628 AC_DEFINE(HAVE_OPENSSL)
629 dnl Need to recover ssldir - test above runs in subshell
630 ssldir=$ac_cv_openssldir
Damien Millera64b57a2001-01-17 10:44:13 +1100631 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
Damien Millerccdefb62001-02-19 12:56:39 +1100632 # Try to use $ssldir/lib if it exists, otherwise
633 # $ssldir
634 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000635 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100636 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000637 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100638 fi
639 else
Damien Millerb68af622001-03-28 21:05:26 +1000640 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100641 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000642 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100643 fi
Damien Millera64b57a2001-01-17 10:44:13 +1100644 fi
Damien Millerccdefb62001-02-19 12:56:39 +1100645 # Try to use $ssldir/include if it exists, otherwise
646 # $ssldir
647 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000648 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100649 else
Damien Millerb68af622001-03-28 21:05:26 +1000650 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millera64b57a2001-01-17 10:44:13 +1100651 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100652 fi
Damien Millera22ba012000-03-02 23:09:20 +1100653fi
Damien Miller3b512e12000-05-17 23:29:18 +1000654LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000655
Damien Miller3b512e12000-05-17 23:29:18 +1000656# Now test RSA support
657saved_LIBS="$LIBS"
658AC_MSG_CHECKING([for RSA support])
659for WANTS_RSAREF in "" 1 ; do
660 if test -z "$WANTS_RSAREF" ; then
661 LIBS="$saved_LIBS"
662 else
663 LIBS="$saved_LIBS -lRSAglue -lrsaref"
664 fi
665 AC_TRY_RUN([
666#include <string.h>
667#include <openssl/rand.h>
668#include <openssl/rsa.h>
669#include <openssl/bn.h>
670#include <openssl/sha.h>
671int main(void)
672{
673 int num; RSA *key; static unsigned char p_in[] = "blahblah";
674 unsigned char c[256], p[256];
675 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
676 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
677 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
678 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
679}
680 ],
681 [
682 rsa_works=1
683 break;
684 ], [])
685done
686
687if test ! -z "$no_rsa" ; then
688 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000689 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000690else
691 if test -z "$rsa_works" ; then
692 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000693 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000694 else
695 if test -z "$WANTS_RSAREF" ; then
696 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000697 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000698 else
Damien Miller7b22d652000-06-18 14:07:04 +1000699 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000700 AC_MSG_RESULT(using RSAref)
701 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
702 fi
703 fi
704fi
Damien Millera22ba012000-03-02 23:09:20 +1100705
Damien Millera64b57a2001-01-17 10:44:13 +1100706# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
707# version in OpenSSL. Skip this for PAM
708if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100709 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100710fi
711
Ben Lindstromb5628642000-10-18 00:02:25 +0000712# Cheap hack to ensure NEWS-OS libraries are arranged right.
713if test ! -z "$SONY" ; then
714 LIBS="$LIBS -liberty";
715fi
716
Damien Millera22ba012000-03-02 23:09:20 +1100717# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100718AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100719AC_CHECK_SIZEOF(short int, 2)
720AC_CHECK_SIZEOF(int, 4)
721AC_CHECK_SIZEOF(long int, 4)
722AC_CHECK_SIZEOF(long long int, 8)
723
Damien Millera22ba012000-03-02 23:09:20 +1100724# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +1100725AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
726 AC_TRY_COMPILE(
727 [ #include <sys/types.h> ],
728 [ u_int a; a = 1;],
729 [ ac_cv_have_u_int="yes" ],
730 [ ac_cv_have_u_int="no" ]
731 )
732])
733if test "x$ac_cv_have_u_int" = "xyes" ; then
734 AC_DEFINE(HAVE_U_INT)
735 have_u_int=1
736fi
737
Damien Miller61e50f12000-05-08 20:49:37 +1000738AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
739 AC_TRY_COMPILE(
740 [ #include <sys/types.h> ],
741 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
742 [ ac_cv_have_intxx_t="yes" ],
743 [ ac_cv_have_intxx_t="no" ]
744 )
745])
746if test "x$ac_cv_have_intxx_t" = "xyes" ; then
747 AC_DEFINE(HAVE_INTXX_T)
748 have_intxx_t=1
749fi
750
Damien Miller578783e2000-09-23 14:12:24 +1100751AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
752 AC_TRY_COMPILE(
753 [ #include <sys/types.h> ],
754 [ int64_t a; a = 1;],
755 [ ac_cv_have_int64_t="yes" ],
756 [ ac_cv_have_int64_t="no" ]
757 )
758])
759if test "x$ac_cv_have_int64_t" = "xyes" ; then
760 AC_DEFINE(HAVE_INT64_T)
761 have_int64_t=1
762fi
763
Damien Miller61e50f12000-05-08 20:49:37 +1000764AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
765 AC_TRY_COMPILE(
766 [ #include <sys/types.h> ],
767 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
768 [ ac_cv_have_u_intxx_t="yes" ],
769 [ ac_cv_have_u_intxx_t="no" ]
770 )
771])
772if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
773 AC_DEFINE(HAVE_U_INTXX_T)
774 have_u_intxx_t=1
775fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100776
Damien Miller578783e2000-09-23 14:12:24 +1100777AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
778 AC_TRY_COMPILE(
779 [ #include <sys/types.h> ],
780 [ u_int64_t a; a = 1;],
781 [ ac_cv_have_u_int64_t="yes" ],
782 [ ac_cv_have_u_int64_t="no" ]
783 )
784])
785if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
786 AC_DEFINE(HAVE_U_INT64_T)
787 have_u_int64_t=1
788fi
789
Damien Milleredb82922000-06-20 13:25:52 +1000790if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
791 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +1100792then
793 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
794 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +1000795 [
796#include <sys/bitypes.h>
797 ],
Damien Millerb29ea912000-01-15 14:12:03 +1100798 [
Damien Miller70494d12000-04-03 15:57:06 +1000799 int8_t a; int16_t b; int32_t c;
800 u_int8_t e; u_int16_t f; u_int32_t g;
801 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +1100802 ],
803 [
804 AC_DEFINE(HAVE_U_INTXX_T)
805 AC_DEFINE(HAVE_INTXX_T)
806 AC_MSG_RESULT(yes)
807 ],
808 [AC_MSG_RESULT(no)]
809 )
810fi
811
Damien Millerd6121d22000-03-17 23:26:46 +1100812if test -z "$have_u_intxx_t" ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000813 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
814 AC_TRY_COMPILE(
815 [
816#include <sys/types.h>
817 ],
818 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
819 [ ac_cv_have_uintxx_t="yes" ],
820 [ ac_cv_have_uintxx_t="no" ]
821 )
822 ])
823 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
824 AC_DEFINE(HAVE_UINTXX_T)
825 fi
Damien Millerd6121d22000-03-17 23:26:46 +1100826fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100827
Damien Miller61e50f12000-05-08 20:49:37 +1000828AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
829 AC_TRY_COMPILE(
830 [
Damien Miller81171112000-04-23 11:14:01 +1000831#include <sys/types.h>
832#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000833 ],
834 [socklen_t foo; foo = 1235;],
835 [ ac_cv_have_socklen_t="yes" ],
836 [ ac_cv_have_socklen_t="no" ]
837 )
838])
839if test "x$ac_cv_have_socklen_t" = "xyes" ; then
840 AC_DEFINE(HAVE_SOCKLEN_T)
841fi
Damien Miller74d0d4a1999-12-29 02:24:35 +1100842
Damien Miller61e50f12000-05-08 20:49:37 +1000843AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
844 AC_TRY_COMPILE(
845 [
846#include <sys/types.h>
847 ],
848 [ size_t foo; foo = 1235; ],
849 [ ac_cv_have_size_t="yes" ],
850 [ ac_cv_have_size_t="no" ]
851 )
852])
853if test "x$ac_cv_have_size_t" = "xyes" ; then
854 AC_DEFINE(HAVE_SIZE_T)
855fi
Damien Miller95058511999-12-29 10:36:45 +1100856
Damien Miller615f9392000-05-17 22:53:33 +1000857AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
858 AC_TRY_COMPILE(
859 [
860#include <sys/types.h>
861 ],
862 [ ssize_t foo; foo = 1235; ],
863 [ ac_cv_have_ssize_t="yes" ],
864 [ ac_cv_have_ssize_t="no" ]
865 )
866])
867if test "x$ac_cv_have_ssize_t" = "xyes" ; then
868 AC_DEFINE(HAVE_SSIZE_T)
869fi
870
Ben Lindstrom0d5af602001-01-09 00:50:29 +0000871AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
872 AC_TRY_COMPILE(
873 [
874#include <time.h>
875 ],
876 [ clock_t foo; foo = 1235; ],
877 [ ac_cv_have_clock_t="yes" ],
878 [ ac_cv_have_clock_t="no" ]
879 )
880])
881if test "x$ac_cv_have_clock_t" = "xyes" ; then
882 AC_DEFINE(HAVE_CLOCK_T)
883fi
884
Damien Millerb54b40e2000-06-23 08:23:34 +1000885AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
886 AC_TRY_COMPILE(
887 [
888#include <sys/types.h>
889#include <sys/socket.h>
890 ],
891 [ sa_family_t foo; foo = 1235; ],
892 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +1100893 [ AC_TRY_COMPILE(
894 [
895#include <sys/types.h>
896#include <sys/socket.h>
897#include <netinet/in.h>
898 ],
899 [ sa_family_t foo; foo = 1235; ],
900 [ ac_cv_have_sa_family_t="yes" ],
901
Damien Millerb54b40e2000-06-23 08:23:34 +1000902 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +1100903 )]
Damien Millerb54b40e2000-06-23 08:23:34 +1000904 )
905])
906if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
907 AC_DEFINE(HAVE_SA_FAMILY_T)
908fi
909
Damien Miller0f91b4e2000-06-18 15:43:25 +1000910AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
911 AC_TRY_COMPILE(
912 [
913#include <sys/types.h>
914 ],
915 [ pid_t foo; foo = 1235; ],
916 [ ac_cv_have_pid_t="yes" ],
917 [ ac_cv_have_pid_t="no" ]
918 )
919])
920if test "x$ac_cv_have_pid_t" = "xyes" ; then
921 AC_DEFINE(HAVE_PID_T)
922fi
923
924AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
925 AC_TRY_COMPILE(
926 [
927#include <sys/types.h>
928 ],
929 [ mode_t foo; foo = 1235; ],
930 [ ac_cv_have_mode_t="yes" ],
931 [ ac_cv_have_mode_t="no" ]
932 )
933])
934if test "x$ac_cv_have_mode_t" = "xyes" ; then
935 AC_DEFINE(HAVE_MODE_T)
936fi
937
Damien Miller61e50f12000-05-08 20:49:37 +1000938
939AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
940 AC_TRY_COMPILE(
941 [
Damien Miller81171112000-04-23 11:14:01 +1000942#include <sys/types.h>
943#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000944 ],
945 [ struct sockaddr_storage s; ],
946 [ ac_cv_have_struct_sockaddr_storage="yes" ],
947 [ ac_cv_have_struct_sockaddr_storage="no" ]
948 )
949])
950if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
951 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
952fi
Damien Miller34132e52000-01-14 15:45:46 +1100953
Damien Miller61e50f12000-05-08 20:49:37 +1000954AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
955 AC_TRY_COMPILE(
956 [
Damien Miller7b22d652000-06-18 14:07:04 +1000957#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000958#include <netinet/in.h>
959 ],
960 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
961 [ ac_cv_have_struct_sockaddr_in6="yes" ],
962 [ ac_cv_have_struct_sockaddr_in6="no" ]
963 )
964])
965if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
966 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
967fi
Damien Miller34132e52000-01-14 15:45:46 +1100968
Damien Miller61e50f12000-05-08 20:49:37 +1000969AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
970 AC_TRY_COMPILE(
971 [
Damien Miller7b22d652000-06-18 14:07:04 +1000972#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000973#include <netinet/in.h>
974 ],
975 [ struct in6_addr s; s.s6_addr[0] = 0; ],
976 [ ac_cv_have_struct_in6_addr="yes" ],
977 [ ac_cv_have_struct_in6_addr="no" ]
978 )
979])
980if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
981 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
982fi
Damien Miller34132e52000-01-14 15:45:46 +1100983
Damien Miller61e50f12000-05-08 20:49:37 +1000984AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
985 AC_TRY_COMPILE(
986 [
Damien Miller81171112000-04-23 11:14:01 +1000987#include <sys/types.h>
988#include <sys/socket.h>
989#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000990 ],
991 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
992 [ ac_cv_have_struct_addrinfo="yes" ],
993 [ ac_cv_have_struct_addrinfo="no" ]
994 )
995])
996if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
997 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
998fi
999
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001000AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1001 AC_TRY_COMPILE(
1002 [ #include <sys/time.h> ],
1003 [ struct timeval tv; tv.tv_sec = 1;],
1004 [ ac_cv_have_struct_timeval="yes" ],
1005 [ ac_cv_have_struct_timeval="no" ]
1006 )
1007])
1008if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1009 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1010 have_struct_timeval=1
1011fi
1012
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001013# If we don't have int64_t then we can't compile sftp-server. So don't
1014# even attempt to do it.
1015if test "x$ac_cv_have_int64_t" = "xno" -a \
1016 "x$ac_cv_sizeof_long_int" != "x8" -a \
1017 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1018 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001019else
1020dnl test snprintf (broken on SCO w/gcc)
1021 AC_TRY_RUN(
1022 [
1023#include <stdio.h>
1024#include <string.h>
1025#ifdef HAVE_SNPRINTF
1026main()
1027{
1028 char buf[50];
1029 char expected_out[50];
1030 int mazsize = 50 ;
1031#if (SIZEOF_LONG_INT == 8)
1032 long int num = 0x7fffffffffffffff;
1033#else
1034 long long num = 0x7fffffffffffffff;
1035#endif
1036 strcpy(expected_out, "9223372036854775807");
1037 snprintf(buf, mazsize, "%lld", num);
1038 if(strcmp(buf, expected_out) != 0)
1039 exit(1);
1040 exit(0);
1041}
1042#else
1043main() { exit(0); }
1044#endif
1045 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1046 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001047fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001048AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001049
Damien Miller78315eb2000-09-29 23:01:36 +11001050dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001051OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1052OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1053OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1054OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1055OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001056OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001057OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1058OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001059OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001060OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1061OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1062OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1063OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001064OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1065OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1066OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1067OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Damien Miller78315eb2000-09-29 23:01:36 +11001068AC_STRUCT_ST_BLKSIZE
andre2ff7b5d2000-06-03 14:57:40 +00001069
Damien Miller942da032000-08-18 13:59:06 +10001070AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
1071 ac_cv_have_sun_len_in_struct_sockaddr_un, [
1072 AC_TRY_COMPILE(
1073 [
1074#include <sys/types.h>
1075#include <sys/socket.h>
1076 ],
1077 [ struct sockaddr_un s; s.sun_len = 1; ],
1078 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
1079 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
1080 )
1081])
1082if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
1083 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
1084fi
1085
Damien Miller61e50f12000-05-08 20:49:37 +10001086AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1087 ac_cv_have_ss_family_in_struct_ss, [
1088 AC_TRY_COMPILE(
1089 [
Damien Miller81171112000-04-23 11:14:01 +10001090#include <sys/types.h>
1091#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001092 ],
1093 [ struct sockaddr_storage s; s.ss_family = 1; ],
1094 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1095 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1096 )
1097])
1098if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1099 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1100fi
1101
Damien Miller61e50f12000-05-08 20:49:37 +10001102AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1103 ac_cv_have___ss_family_in_struct_ss, [
1104 AC_TRY_COMPILE(
1105 [
Damien Miller81171112000-04-23 11:14:01 +10001106#include <sys/types.h>
1107#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001108 ],
1109 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1110 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1111 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1112 )
1113])
1114if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1115 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1116fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001117
Damien Millerad833b32000-08-23 10:46:23 +10001118AC_CACHE_CHECK([for pw_class field in struct passwd],
1119 ac_cv_have_pw_class_in_struct_passwd, [
1120 AC_TRY_COMPILE(
1121 [
Damien Millerad833b32000-08-23 10:46:23 +10001122#include <pwd.h>
1123 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001124 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001125 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1126 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1127 )
1128])
1129if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1130 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1131fi
1132
Damien Miller61e50f12000-05-08 20:49:37 +10001133
1134AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1135 AC_TRY_LINK([],
1136 [ extern char *__progname; printf("%s", __progname); ],
1137 [ ac_cv_libc_defines___progname="yes" ],
1138 [ ac_cv_libc_defines___progname="no" ]
1139 )
1140])
1141if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1142 AC_DEFINE(HAVE___PROGNAME)
1143fi
1144
Damien Millera22ba012000-03-02 23:09:20 +11001145
Damien Millerecbb26d2000-07-15 14:59:14 +10001146AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1147 AC_TRY_LINK([],
1148 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1149 [ ac_cv_libc_defines_sys_errlist="yes" ],
1150 [ ac_cv_libc_defines_sys_errlist="no" ]
1151 )
1152])
1153if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1154 AC_DEFINE(HAVE_SYS_ERRLIST)
1155fi
1156
1157
Damien Miller11fa2cc2000-08-16 10:35:58 +10001158AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1159 AC_TRY_LINK([],
1160 [ extern int sys_nerr; printf("%i", sys_nerr);],
1161 [ ac_cv_libc_defines_sys_nerr="yes" ],
1162 [ ac_cv_libc_defines_sys_nerr="no" ]
1163 )
1164])
1165if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1166 AC_DEFINE(HAVE_SYS_NERR)
1167fi
1168
1169
Damien Millerc79bc0d2001-03-28 13:03:42 +10001170# Check whether user wants Kerberos support
1171KRB4_MSG="no"
1172AC_ARG_WITH(kerberos4,
1173 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1174 [
1175 if test "x$withval" != "xno" ; then
1176
1177 if test "x$withval" != "xyes" ; then
1178 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1179 LDFLAGS="$LDFLAGS -L${withval}/lib"
1180 if test ! -z "$need_dash_r" ; then
1181 LDFLAGS="$LDFLAGS -R${withval}/lib"
1182 fi
1183 if test ! -z "$blibpath" ; then
1184 blibpath="$blibpath:${withval}/lib"
1185 fi
1186 else
1187 if test -d /usr/include/kerberosIV ; then
1188 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1189 fi
1190 fi
1191
1192 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001193 if test "$ac_cv_header_krb_h" != yes; then
1194 AC_MSG_WARN([Cannot find krb.h, build may fail])
1195 fi
Damien Miller98344742001-03-28 14:37:06 +10001196 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001197 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001198 AC_CHECK_LIB(krb4, main)
1199 if test "$ac_cv_lib_krb4_main" != yes; then
1200 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1201 else
1202 KLIBS="-lkrb4"
1203 fi
1204 else
1205 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001206 fi
Damien Miller98344742001-03-28 14:37:06 +10001207 AC_CHECK_LIB(des, des_cbc_encrypt)
1208 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1209 AC_CHECK_LIB(des425, des_cbc_encrypt)
1210 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1211 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1212 else
1213 KLIBS="-ldes425"
1214 fi
1215 else
1216 KLIBS="-ldes"
1217 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001218 AC_CHECK_LIB(resolv, dn_expand, , )
1219 KRB4=yes
1220 KRB4_MSG="yes"
1221 AC_DEFINE(KRB4)
1222 fi
1223 ]
1224)
1225
1226# Check whether user wants AFS support
1227AFS_MSG="no"
1228AC_ARG_WITH(afs,
1229 [ --with-afs=PATH Enable AFS support],
1230 [
1231 if test "x$withval" != "xno" ; then
1232
1233 if test "x$withval" != "xyes" ; then
1234 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1235 LDFLAGS="$LDFLAGS -L${withval}/lib"
1236 fi
1237
1238 if test -z "$KRB4" ; then
1239 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1240 fi
1241
1242 LIBS="-lkafs $LIBS"
1243 if test ! -z "$AFS_LIBS" ; then
1244 LIBS="$LIBS $AFS_LIBS"
1245 fi
1246 AC_DEFINE(AFS)
1247 AFS_MSG="yes"
1248 fi
1249 ]
1250)
1251LIBS="$LIBS $KLIBS"
1252
Damien Millera22ba012000-03-02 23:09:20 +11001253# Looking for programs, paths and files
1254AC_ARG_WITH(rsh,
1255 [ --with-rsh=PATH Specify path to remote shell program ],
1256 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001257 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001258 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001259 fi
1260 ],
1261 [
1262 AC_PATH_PROG(rsh_path, rsh)
1263 ]
1264)
1265
1266AC_ARG_WITH(xauth,
1267 [ --with-xauth=PATH Specify path to xauth program ],
1268 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001269 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001270 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001271 fi
1272 ],
1273 [
Damien Miller78315eb2000-09-29 23:01:36 +11001274 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 +10001275 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001276 xauth_path="/usr/openwin/bin/xauth"
1277 fi
1278 ]
1279)
1280
Damien Millera19cf472000-11-29 13:28:50 +11001281if test -z "$xauth_path" ; then
1282 XAUTH_PATH="undefined"
1283 AC_SUBST(XAUTH_PATH)
1284else
Damien Millera22ba012000-03-02 23:09:20 +11001285 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001286 XAUTH_PATH=$xauth_path
1287 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001288fi
1289if test ! -z "$rsh_path" ; then
1290 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1291fi
1292
1293# Check for mail directory (last resort if we cannot get it from headers)
1294if test ! -z "$MAIL" ; then
1295 maildir=`dirname $MAIL`
1296 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1297fi
1298
Damien Millera22ba012000-03-02 23:09:20 +11001299if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +11001300 AC_CHECK_FILE("/dev/ptmx",
1301 [
1302 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1303 have_dev_ptmx=1
1304 ]
1305 )
Damien Millera22ba012000-03-02 23:09:20 +11001306fi
Damien Miller204ad072000-03-02 23:56:12 +11001307AC_CHECK_FILE("/dev/ptc",
1308 [
1309 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1310 have_dev_ptc=1
1311 ]
1312)
1313
Damien Millera22ba012000-03-02 23:09:20 +11001314# Options from here on. Some of these are preset by platform above
1315
Damien Millera22ba012000-03-02 23:09:20 +11001316# Check for user-specified random device, otherwise check /dev/urandom
1317AC_ARG_WITH(random,
Damien Miller0736c4d2001-01-25 10:51:46 +11001318 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
Damien Millera22ba012000-03-02 23:09:20 +11001319 [
Damien Miller040f3832000-04-03 14:50:43 +10001320 if test "x$withval" != "xno" ; then
1321 RANDOM_POOL="$withval";
1322 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1323 fi
Damien Millera22ba012000-03-02 23:09:20 +11001324 ],
1325 [
1326 # Check for random device
1327 AC_CHECK_FILE("/dev/urandom",
1328 [
1329 RANDOM_POOL="/dev/urandom";
1330 AC_SUBST(RANDOM_POOL)
1331 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1332 ]
1333 )
1334 ]
1335)
1336
Damien Millerd0ccb982001-03-04 00:29:20 +11001337# Check for PRNGD/EGD pool file
1338AC_ARG_WITH(prngd-port,
1339 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1340 [
1341 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1342 PRNGD_PORT="$withval"
1343 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1344 fi
1345 ]
1346)
1347
1348# Check for PRNGD/EGD pool file
1349AC_ARG_WITH(prngd-socket,
1350 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
Damien Millera22ba012000-03-02 23:09:20 +11001351 [
Damien Miller040f3832000-04-03 14:50:43 +10001352 if test "x$withval" != "xno" ; then
Damien Millerd0ccb982001-03-04 00:29:20 +11001353 PRNGD_SOCKET="$withval"
1354 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller040f3832000-04-03 14:50:43 +10001355 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001356 ],
1357 [
1358 # Check for existing socket only if we don't have a random device already
1359 if test -z "$RANDOM_POOL" ; then
1360 AC_MSG_CHECKING(for PRNGD/EGD socket)
1361 # Insert other locations here
Tim Ricebee3f222001-03-11 17:32:12 -08001362 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
Damien Millerd0ccb982001-03-04 00:29:20 +11001363 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1364 PRNGD_SOCKET="$sock"
1365 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller0736c4d2001-01-25 10:51:46 +11001366 break;
1367 fi
1368 done
Damien Millerd0ccb982001-03-04 00:29:20 +11001369 if test ! -z "$PRNGD_SOCKET" ; then
1370 AC_MSG_RESULT($PRNGD_SOCKET)
Damien Miller4864e8f2001-02-08 10:07:08 +11001371 else
1372 AC_MSG_RESULT(not found)
1373 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001374 fi
Damien Millera22ba012000-03-02 23:09:20 +11001375 ]
1376)
1377
Damien Miller0736c4d2001-01-25 10:51:46 +11001378
Damien Miller0437b332000-05-02 09:56:41 +10001379# detect pathnames for entropy gathering commands, if we need them
1380INSTALL_SSH_PRNG_CMDS=""
1381rm -f prng_commands
Damien Millerd0ccb982001-03-04 00:29:20 +11001382if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
Damien Miller11e37f62000-04-08 18:23:30 +10001383 # Use these commands to collect entropy
Damien Miller61e50f12000-05-08 20:49:37 +10001384 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1385 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1386 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1387 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1388 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1389 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1390 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1391 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1392 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1393 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1394 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1395 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1396 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1397 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Damien Miller0437b332000-05-02 09:56:41 +10001398
1399 INSTALL_SSH_PRNG_CMDS="yes"
Damien Miller11e37f62000-04-08 18:23:30 +10001400fi
Damien Miller0437b332000-05-02 09:56:41 +10001401AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1402
Damien Miller11e37f62000-04-08 18:23:30 +10001403
Damien Miller670a4b82000-01-22 13:53:11 +11001404AC_ARG_WITH(catman,
Damien Miller897741e2001-04-16 10:41:46 +10001405 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001406 [
Damien Miller897741e2001-04-16 10:41:46 +10001407 case "$withval" in
1408 man|cat|doc)
1409 MANTYPE=$withval
1410 ;;
1411 *)
1412 AC_MSG_ERROR(invalid man type: $withval)
1413 ;;
1414 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001415 ]
1416)
Ben Lindstrombc709922001-04-18 18:04:21 +00001417if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001418 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001419 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1420 MANTYPE=doc
1421 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1422 MANTYPE=man
1423 else
1424 MANTYPE=cat
1425 fi
1426fi
Damien Miller670a4b82000-01-22 13:53:11 +11001427AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001428if test "$MANTYPE" = "doc"; then
1429 mansubdir=man;
1430else
1431 mansubdir=$MANTYPE;
1432fi
1433AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001434
Damien Millera22ba012000-03-02 23:09:20 +11001435# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001436MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001437AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001438 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001439 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001440 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001441 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001442 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001443 fi
1444 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001445)
1446
Damien Millera22ba012000-03-02 23:09:20 +11001447# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001448AC_ARG_WITH(shadow,
1449 [ --without-shadow Disable shadow password support],
1450 [
1451 if test "x$withval" = "xno" ; then
1452 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001453 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001454 fi
1455 ]
1456)
1457
Damien Miller1f335fb2000-06-26 11:31:33 +10001458if test -z "$disable_shadow" ; then
1459 AC_MSG_CHECKING([if the systems has expire shadow information])
1460 AC_TRY_COMPILE(
1461 [
1462#include <sys/types.h>
1463#include <shadow.h>
1464 struct spwd sp;
1465 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1466 [ sp_expire_available=yes ], []
1467 )
1468
1469 if test "x$sp_expire_available" = "xyes" ; then
1470 AC_MSG_RESULT(yes)
1471 AC_DEFINE(HAS_SHADOW_EXPIRE)
1472 else
1473 AC_MSG_RESULT(no)
1474 fi
1475fi
1476
Damien Millera22ba012000-03-02 23:09:20 +11001477# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001478if test ! -z "$IPADDR_IN_DISPLAY" ; then
1479 DISPLAY_HACK_MSG="yes"
1480 AC_DEFINE(IPADDR_IN_DISPLAY)
1481else
1482 DISPLAY_HACK_MSG="no"
1483 AC_ARG_WITH(ipaddr-display,
1484 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1485 [
1486 if test "x$withval" != "xno" ; then
1487 AC_DEFINE(IPADDR_IN_DISPLAY)
1488 DISPLAY_HACK_MSG="yes"
1489 fi
1490 ]
1491 )
1492fi
Damien Miller76112de1999-12-21 11:18:08 +11001493
Damien Millera22ba012000-03-02 23:09:20 +11001494# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001495SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001496AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11001497 [ --with-default-path=PATH Specify default \$PATH environment for server],
1498 [
1499 if test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001500 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001501 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001502 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001503 ],
1504 [
1505 AC_TRY_RUN(
1506 [
1507/* find out what STDPATH is */
1508#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001509#ifdef HAVE_PATHS_H
1510# include <paths.h>
1511#endif
1512#ifndef _PATH_STDPATH
1513# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1514#endif
1515#include <sys/types.h>
1516#include <sys/stat.h>
1517#include <fcntl.h>
1518#define DATA "conftest.stdpath"
1519
1520main()
1521{
1522 FILE *fd;
1523 int rc;
1524
1525 fd = fopen(DATA,"w");
1526 if(fd == NULL)
1527 exit(1);
1528
1529 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1530 exit(1);
1531
1532 exit(0);
1533}
1534 ], [ user_path=`cat conftest.stdpath` ],
1535 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1536 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1537 )
1538# make sure $bindir is in USER_PATH so scp will work
1539 t_bindir=`eval echo ${bindir}`
1540 case $t_bindir in
1541 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1542 esac
1543 case $t_bindir in
1544 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1545 esac
1546 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1547 if test $? -ne 0 ; then
1548 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1549 if test $? -ne 0 ; then
1550 user_path=$user_path:$t_bindir
1551 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1552 fi
1553 fi
Damien Miller5a3e6831999-12-27 09:48:56 +11001554 ]
1555)
Tim Rice59ea0a02001-03-10 13:50:45 -08001556AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1557AC_SUBST(user_path)
Damien Miller5a3e6831999-12-27 09:48:56 +11001558
Damien Millera22ba012000-03-02 23:09:20 +11001559# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10001560IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11001561AC_ARG_WITH(ipv4-default,
1562 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1563 [
1564 if test "x$withval" != "xno" ; then
1565 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10001566 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11001567 fi
1568 ]
1569)
1570
Damien Miller61e50f12000-05-08 20:49:37 +10001571AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10001572IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11001573AC_ARG_WITH(4in6,
1574 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1575 [
1576 if test "x$withval" != "xno" ; then
1577 AC_MSG_RESULT(yes)
1578 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001579 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001580 else
1581 AC_MSG_RESULT(no)
1582 fi
1583 ],[
1584 if test "x$inet6_default_4in6" = "xyes"; then
1585 AC_MSG_RESULT([yes (default)])
1586 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001587 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001588 else
1589 AC_MSG_RESULT([no (default)])
1590 fi
1591 ]
1592)
1593
Damien Miller60396b02001-02-18 17:01:00 +11001594# Whether to enable BSD auth support
1595AC_ARG_WITH(bsd-auth,
1596 [ --with-bsd-auth Enable BSD auth support],
1597 [
1598 if test "x$withval" != "xno" ; then
1599 AC_DEFINE(BSD_AUTH)
1600 bsd_auth=yes
1601 fi
1602 ]
1603)
1604
Damien Miller78315eb2000-09-29 23:01:36 +11001605AC_MSG_CHECKING(whether to install ssh as suid root)
1606AC_ARG_ENABLE(suid-ssh,
1607[ --enable-suid-ssh Install ssh as suid root (default)
1608 --disable-suid-ssh Install ssh without suid bit],
1609[ case "$enableval" in
1610 no)
1611 AC_MSG_RESULT(no)
1612 SSHMODE=0711
1613 ;;
1614 *) AC_MSG_RESULT(yes)
1615 SSHMODE=04711
1616 ;;
1617 esac ],
1618 AC_MSG_RESULT(yes)
1619 SSHMODE=04711
1620)
1621AC_SUBST(SSHMODE)
1622
1623
Damien Millera22ba012000-03-02 23:09:20 +11001624# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11001625piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +11001626AC_ARG_WITH(pid-dir,
1627 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1628 [
1629 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +11001630 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +11001631 fi
1632 ]
1633)
Damien Miller4018c192000-04-30 09:30:44 +10001634
Damien Miller78315eb2000-09-29 23:01:36 +11001635# make sure the directory exists
1636if test ! -d $piddir ; then
1637 piddir=`eval echo ${sysconfdir}`
1638 case $piddir in
1639 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1640 esac
1641fi
1642
Ben Lindstrom226cfa02001-01-22 05:34:40 +00001643AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11001644AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11001645
andre2ff7b5d2000-06-03 14:57:40 +00001646dnl allow user to disable some login recording features
1647AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001648 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001649 [ AC_DEFINE(DISABLE_LASTLOG) ]
1650)
1651AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00001652 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001653 [ AC_DEFINE(DISABLE_UTMP) ]
1654)
1655AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00001656 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001657 [ AC_DEFINE(DISABLE_UTMPX) ]
1658)
1659AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00001660 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001661 [ AC_DEFINE(DISABLE_WTMP) ]
1662)
1663AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00001664 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001665 [ AC_DEFINE(DISABLE_WTMPX) ]
1666)
1667AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00001668 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001669 [ AC_DEFINE(DISABLE_LOGIN) ]
1670)
1671AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00001672 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001673 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1674)
1675AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00001676 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001677 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1678)
1679AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001680 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11001681 [
1682 if test "x$withval" = "xno" ; then
1683 AC_DEFINE(DISABLE_LASTLOG)
1684 else
1685 conf_lastlog_location=$withval
1686 fi
1687 ]
1688)
andre2ff7b5d2000-06-03 14:57:40 +00001689
1690dnl lastlog, [uw]tmpx? detection
1691dnl NOTE: set the paths in the platform section to avoid the
1692dnl need for command-line parameters
1693dnl lastlog and [uw]tmp are subject to a file search if all else fails
1694
1695dnl lastlog detection
1696dnl NOTE: the code itself will detect if lastlog is a directory
1697AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1698AC_TRY_COMPILE([
1699#include <sys/types.h>
1700#include <utmp.h>
1701#ifdef HAVE_LASTLOG_H
1702# include <lastlog.h>
1703#endif
Damien Miller2994e082000-06-04 15:51:47 +10001704#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001705# include <paths.h>
1706#endif
1707 ],
1708 [ char *lastlog = LASTLOG_FILE; ],
1709 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10001710 [
1711 AC_MSG_RESULT(no)
1712 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1713 AC_TRY_COMPILE([
1714#include <sys/types.h>
1715#include <utmp.h>
1716#ifdef HAVE_LASTLOG_H
1717# include <lastlog.h>
1718#endif
1719#ifdef HAVE_PATHS_H
1720# include <paths.h>
1721#endif
1722 ],
1723 [ char *lastlog = _PATH_LASTLOG; ],
1724 [ AC_MSG_RESULT(yes) ],
1725 [
andree441aa32000-06-12 22:34:38 +00001726 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10001727 system_lastlog_path=no
1728 ])
1729 ]
andre2ff7b5d2000-06-03 14:57:40 +00001730)
Damien Miller2994e082000-06-04 15:51:47 +10001731
andre2ff7b5d2000-06-03 14:57:40 +00001732if test -z "$conf_lastlog_location"; then
1733 if test x"$system_lastlog_path" = x"no" ; then
1734 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10001735 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00001736 conf_lastlog_location=$f
1737 fi
1738 done
1739 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00001740 AC_MSG_WARN([** Cannot find lastlog **])
1741 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00001742 fi
1743 fi
1744fi
1745
1746if test -n "$conf_lastlog_location"; then
1747 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1748fi
1749
1750dnl utmp detection
1751AC_MSG_CHECKING([if your system defines UTMP_FILE])
1752AC_TRY_COMPILE([
1753#include <sys/types.h>
1754#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001755#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001756# include <paths.h>
1757#endif
1758 ],
1759 [ char *utmp = UTMP_FILE; ],
1760 [ AC_MSG_RESULT(yes) ],
1761 [ AC_MSG_RESULT(no)
1762 system_utmp_path=no ]
1763)
1764if test -z "$conf_utmp_location"; then
1765 if test x"$system_utmp_path" = x"no" ; then
1766 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1767 if test -f $f ; then
1768 conf_utmp_location=$f
1769 fi
1770 done
1771 if test -z "$conf_utmp_location"; then
1772 AC_DEFINE(DISABLE_UTMP)
1773 fi
1774 fi
1775fi
1776if test -n "$conf_utmp_location"; then
1777 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1778fi
1779
1780dnl wtmp detection
1781AC_MSG_CHECKING([if your system defines WTMP_FILE])
1782AC_TRY_COMPILE([
1783#include <sys/types.h>
1784#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001785#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001786# include <paths.h>
1787#endif
1788 ],
1789 [ char *wtmp = WTMP_FILE; ],
1790 [ AC_MSG_RESULT(yes) ],
1791 [ AC_MSG_RESULT(no)
1792 system_wtmp_path=no ]
1793)
1794if test -z "$conf_wtmp_location"; then
1795 if test x"$system_wtmp_path" = x"no" ; then
1796 for f in /usr/adm/wtmp /var/log/wtmp; do
1797 if test -f $f ; then
1798 conf_wtmp_location=$f
1799 fi
1800 done
1801 if test -z "$conf_wtmp_location"; then
1802 AC_DEFINE(DISABLE_WTMP)
1803 fi
1804 fi
1805fi
1806if test -n "$conf_wtmp_location"; then
1807 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1808fi
1809
1810
1811dnl utmpx detection - I don't know any system so perverse as to require
1812dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1813dnl there, though.
1814AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1815AC_TRY_COMPILE([
1816#include <sys/types.h>
1817#include <utmp.h>
1818#ifdef HAVE_UTMPX_H
1819#include <utmpx.h>
1820#endif
Damien Miller2994e082000-06-04 15:51:47 +10001821#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001822# include <paths.h>
1823#endif
1824 ],
1825 [ char *utmpx = UTMPX_FILE; ],
1826 [ AC_MSG_RESULT(yes) ],
1827 [ AC_MSG_RESULT(no)
1828 system_utmpx_path=no ]
1829)
1830if test -z "$conf_utmpx_location"; then
1831 if test x"$system_utmpx_path" = x"no" ; then
1832 AC_DEFINE(DISABLE_UTMPX)
1833 fi
1834else
1835 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1836fi
1837
1838dnl wtmpx detection
1839AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1840AC_TRY_COMPILE([
1841#include <sys/types.h>
1842#include <utmp.h>
1843#ifdef HAVE_UTMPX_H
1844#include <utmpx.h>
1845#endif
Damien Miller2994e082000-06-04 15:51:47 +10001846#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001847# include <paths.h>
1848#endif
1849 ],
1850 [ char *wtmpx = WTMPX_FILE; ],
1851 [ AC_MSG_RESULT(yes) ],
1852 [ AC_MSG_RESULT(no)
1853 system_wtmpx_path=no ]
1854)
1855if test -z "$conf_wtmpx_location"; then
1856 if test x"$system_wtmpx_path" = x"no" ; then
1857 AC_DEFINE(DISABLE_WTMPX)
1858 fi
1859else
1860 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1861fi
1862
Damien Miller4018c192000-04-30 09:30:44 +10001863
1864# Change default command timeout for builtin PRNG
Damien Miller14c12cb2000-06-07 22:20:23 +10001865entropy_timeout=200
Damien Miller4018c192000-04-30 09:30:44 +10001866AC_ARG_WITH(entropy-timeout,
1867 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1868 [
1869 if test "x$withval" != "xno" ; then
1870 entropy_timeout=$withval
1871 fi
1872 ]
1873)
1874AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1875
1876
Damien Miller29ea30d2000-03-17 10:54:15 +11001877if test ! -z "$blibpath" ; then
1878 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1879 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1880fi
1881
Damien Millerbac2d8a2000-09-05 16:13:06 +11001882AC_EXEEXT
1883
Ben Lindstrom3c06f6a2001-01-31 21:52:01 +00001884AC_OUTPUT(Makefile openbsd-compat/Makefile ssh_prng_cmds)
Damien Miller0437b332000-05-02 09:56:41 +10001885
Damien Miller7b22d652000-06-18 14:07:04 +10001886# Print summary of options
1887
Damien Miller7b22d652000-06-18 14:07:04 +10001888if test ! -z "$RANDOM_POOL" ; then
1889 RAND_MSG="Device ($RANDOM_POOL)"
1890else
Damien Millerd0ccb982001-03-04 00:29:20 +11001891 if test ! -z "$PRNGD_PORT" ; then
1892 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
1893 elif test ! -z "$PRNGD_SOCKET" ; then
1894 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
Damien Miller7b22d652000-06-18 14:07:04 +10001895 else
1896 RAND_MSG="Builtin (timeout $entropy_timeout)"
Damien Miller6f9c3372000-10-25 10:06:04 +11001897 BUILTIN_RNG=1
Damien Miller7b22d652000-06-18 14:07:04 +10001898 fi
1899fi
1900
1901# Someone please show me a better way :)
1902A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1903B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1904C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1905D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00001906E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00001907F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10001908G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Tim Rice59ea0a02001-03-10 13:50:45 -08001909H=`eval echo ${user_path}` ; H=`eval echo ${H}`
Damien Miller7b22d652000-06-18 14:07:04 +10001910
1911echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00001912echo "OpenSSH has been configured with the following options:"
Damien Miller7b22d652000-06-18 14:07:04 +10001913echo " User binaries: $B"
1914echo " System binaries: $C"
1915echo " Configuration files: $D"
1916echo " Askpass program: $E"
1917echo " Manual pages: $F"
1918echo " PID file: $G"
Tim Rice59ea0a02001-03-10 13:50:45 -08001919echo " sshd default user PATH: $H"
Damien Miller7b22d652000-06-18 14:07:04 +10001920echo " Random number collection: $RAND_MSG"
Damien Miller897741e2001-04-16 10:41:46 +10001921echo " Manpage format: $MANTYPE"
Damien Miller7b22d652000-06-18 14:07:04 +10001922echo " PAM support: ${PAM_MSG}"
1923echo " KerberosIV support: $KRB4_MSG"
1924echo " AFS support: $AFS_MSG"
1925echo " S/KEY support: $SKEY_MSG"
1926echo " TCP Wrappers support: $TCPW_MSG"
1927echo " MD5 password support: $MD5_MSG"
1928echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1929echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1930echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1931
Damien Miller60396b02001-02-18 17:01:00 +11001932if test ! -z "$bsd_auth"; then
1933 echo " BSD Auth support: yes"
1934fi
1935
Damien Miller7b22d652000-06-18 14:07:04 +10001936echo ""
1937
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00001938echo " Host: ${host}"
1939echo " Compiler: ${CC}"
1940echo " Compiler flags: ${CFLAGS}"
1941echo "Preprocessor flags: ${CPPFLAGS}"
1942echo " Linker flags: ${LDFLAGS}"
1943echo " Libraries: ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10001944
1945echo ""
1946
Damien Miller82cf0ce2000-12-20 13:34:48 +11001947if test "x$PAM_MSG" = "xyes" ; then
1948 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
1949 echo "otherwise password authentication may fail. Example PAM control files"
1950 echo "can be found in the contrib/ subdirectory"
1951 echo ""
1952fi
1953
Damien Miller6f9c3372000-10-25 10:06:04 +11001954if test ! -z "$BUILTIN_RNG" ; then
1955 echo "WARNING: you are using the builtin random number collection service."
1956 echo "Please read WARNING.RNG and request that your OS vendor includes"
1957 echo "/dev/random in future versions of their OS."
1958 echo ""
1959fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001960
1961if test ! -z "$NO_SFTP"; then
1962 echo "sftp-server will be disabled. Your compiler does not support"
1963 echo "64bit integers."
1964 echo ""
1965fi
Damien Miller60396b02001-02-18 17:01:00 +11001966