blob: 4b1362a9030b943f03c406da033f4998215d7a1d [file] [log] [blame]
Ben Lindstrom97c677d2001-05-08 20:33:05 +00001# $Id: configure.in,v 1.284 2001/05/08 20:33:06 mouring Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Damien Millerab18c411999-11-11 10:40:23 +11003AC_INIT(ssh.c)
Damien Miller7f6ea021999-10-28 13:25:17 +10004
5AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11006AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11007AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11008AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +10009
Damien Millera22ba012000-03-02 23:09:20 +110010# Checks for programs.
Damien Millerab18c411999-11-11 10:40:23 +110011AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100012AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110013AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000014AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070015AC_PATH_PROGS(PERL, perl5 perl)
Damien Millere79334a1999-12-29 10:03:37 +110016AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100017AC_PATH_PROG(ENT, ent)
18AC_SUBST(ENT)
Damien Miller78315eb2000-09-29 23:01:36 +110019AC_PATH_PROGS(FILEPRIV, filepriv, true, /sbin:/usr/sbin)
Damien Miller4864e8f2001-02-08 10:07:08 +110020AC_PATH_PROG(TEST_MINUS_S_SH, bash)
21AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
22AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110023
Damien Miller3f62aba2000-11-29 11:56:35 +110024if test -z "$AR" ; then
25 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
26fi
27
Damien Millerad833b32000-08-23 10:46:23 +100028# Use LOGIN_PROGRAM from environment if possible
29if test ! -z "$LOGIN_PROGRAM" ; then
30 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
31else
32 # Search for login
33 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
34 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
35 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
36 fi
37fi
38
Damien Miller166bd442000-03-16 10:48:25 +110039if test -z "$LD" ; then
40 LD=$CC
41fi
42AC_SUBST(LD)
43
44# C Compiler features
45AC_C_INLINE
46if test "$GCC" = "yes"; then
47 CFLAGS="$CFLAGS -Wall"
48fi
49
Damien Millera22ba012000-03-02 23:09:20 +110050# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110051case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110052*-*-aix*)
53 AFS_LIBS="-lld"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000054 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110055 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100056 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Miller29ea30d2000-03-17 10:54:15 +110057 blibpath="/usr/lib:/lib:/usr/local/lib"
58 fi
Damien Millerd2c208a2000-05-17 22:00:02 +100059 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
Damien Millereca71f82000-01-20 22:38:27 +110060 AC_DEFINE(BROKEN_GETADDRINFO)
andre60f3c982000-06-03 16:18:19 +000061 dnl AIX handles lastlog as part of its login message
62 AC_DEFINE(DISABLE_LASTLOG)
Damien Miller75b1d102000-01-07 14:01:41 +110063 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110064*-*-cygwin*)
Damien Milleref767ac2000-10-17 23:14:08 +110065 LIBS="$LIBS -lregex /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110066 AC_DEFINE(HAVE_CYGWIN)
Damien Millerbac2d8a2000-09-05 16:13:06 +110067 AC_DEFINE(DISABLE_SHADOW)
68 AC_DEFINE(IPV4_DEFAULT)
69 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +000070 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Damien Millerbac2d8a2000-09-05 16:13:06 +110071 no_libsocket=1
72 no_libnsl=1
73 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000074*-*-dgux*)
75 AC_DEFINE(IP_TOS_IS_BROKEN)
76 ;;
Damien Miller76112de1999-12-21 11:18:08 +110077*-*-hpux10*)
78 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +100079 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +110080 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000081 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110082 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +100083 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110084 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110085 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000086 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Damien Miller8a1e6a62000-09-16 15:55:52 +110087 LIBS="$LIBS -lsec"
Damien Miller76112de1999-12-21 11:18:08 +110088 ;;
Damien Miller1bead332000-04-30 00:47:29 +100089*-*-hpux11*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000090 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110091 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +110092 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +110093 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110094 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110095 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000096 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Damien Miller8a1e6a62000-09-16 15:55:52 +110097 LIBS="$LIBS -lsec"
Damien Miller1bead332000-04-30 00:47:29 +100098 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +110099*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000100 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000101 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100102 PATH="$PATH:/usr/etc"
Damien Miller1808f382000-01-06 12:03:12 +1100103 no_libsocket=1
104 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000105 AC_DEFINE(BROKEN_INET_NTOA)
Damien Miller1808f382000-01-06 12:03:12 +1100106 ;;
107*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000108 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000109 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100110 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000111 AC_DEFINE(WITH_IRIX_ARRAY)
112 AC_DEFINE(WITH_IRIX_PROJECT)
113 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom4a1d9162000-11-21 10:45:31 +0000114 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100115 no_libsocket=1
116 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000117 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100118 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100119*-*-linux*)
120 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100121 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100122 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000123 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100124 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100125 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000126mips-sony-bsd|mips-sony-newsos4)
127 AC_DEFINE(HAVE_NEWS4)
128 SONY=1
129 AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT),
Damien Miller5dfe9762001-02-16 12:05:39 +1100130 AC_MSG_ERROR([*** libiberty missing - please install first or check config.log ***])
Ben Lindstromb5628642000-10-18 00:02:25 +0000131 )
132 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100133*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100134 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100135 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100136*-*-freebsd*)
137 check_for_libcrypt_later=1
138 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000139*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000140 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100141 conf_utmp_location=/etc/utmp
142 conf_wtmp_location=/usr/adm/wtmp
143 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000144 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000145 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000146 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100147 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000148 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000149 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000150 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100151*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000152 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000153 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100154 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100155 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000156 AC_DEFINE(LOGIN_NEEDS_UTMPX)
157 AC_DEFINE(LOGIN_NEEDS_TERM)
andre2ff7b5d2000-06-03 14:57:40 +0000158 # hardwire lastlog location (can't detect it on some versions)
159 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000160 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
161 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
162 if test "$sol2ver" -ge 8; then
163 AC_MSG_RESULT(yes)
164 AC_DEFINE(DISABLE_UTMP)
165 AC_DEFINE(DISABLE_WTMP)
166 else
167 AC_MSG_RESULT(no)
168 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100169 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000170*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000171 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000172 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100173 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller877d8ea2001-02-18 15:29:28 +1100174 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000175 conf_utmp_location=/etc/utmp
176 conf_wtmp_location=/var/adm/wtmp
177 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000178 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000179 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000180*-ncr-sysv*)
181 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
182 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000183 LIBS="$LIBS -lc89 -lnsl -lgen -lsocket"
Ben Lindstrom34328342001-04-23 22:39:42 +0000184 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000185 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000186*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000187 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller2ae714f2000-07-11 09:29:50 +1000188 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100189 IPADDR_IN_DISPLAY=yes
190 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000191 AC_DEFINE(IP_TOS_IS_BROKEN)
Kevin Steves52dd4682001-03-08 18:26:57 +0000192 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Millerb2dc28e2000-07-12 09:18:33 +1000193 LIBS="$LIBS -lgen -lnsl -lucb"
Damien Miller2ae714f2000-07-11 09:29:50 +1000194 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100195*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000196 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100197 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller78315eb2000-09-29 23:01:36 +1100198 enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100199 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100200 ;;
201*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000202 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100203 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller78315eb2000-09-29 23:01:36 +1100204 enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100205 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100206 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100207*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000208 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100209 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100210 LIBS="$LIBS -lgen -lsocket"
211 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100212*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000213 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100214 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Ben Lindstrom980754c2000-11-12 00:04:24 +0000215 LIBS="$LIBS -lgen -lsocket -los -lprot -lx -ltinfo -lm"
Damien Miller78315eb2000-09-29 23:01:36 +1100216 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100217 RANLIB=true
218 no_dev_ptmx=1
219 AC_DEFINE(BROKEN_SYS_TERMIO_H)
220 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100221 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000222 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000223 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Millerfbd884a2001-02-27 08:39:07 +1100224 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100225 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700226 MANTYPE=man
Damien Miller78315eb2000-09-29 23:01:36 +1100227 ;;
228*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000229 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000230 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100231 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000232 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100233 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100234 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100235 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000236 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom42717bf2000-12-28 15:46:20 +0000237 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller217f5672001-02-16 12:12:41 +1100238 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700239 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000240 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000241*-dec-osf*)
Ben Lindstrom253effb2001-05-07 12:54:26 +0000242 if test ! -z "$USE_SIA" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000243 AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
244 if test -f /etc/sia/matrix.conf; then
245 AC_MSG_RESULT(yes)
246 AC_DEFINE(HAVE_OSF_SIA)
247 AC_DEFINE(DISABLE_LOGIN)
248 LIBS="$LIBS -lsecurity -ldb -lm -laud"
249 else
250 AC_MSG_RESULT(no)
251 fi
252 fi
253 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100254esac
255
Damien Millere37bfc12000-06-05 09:37:43 +1000256# Allow user to specify flags
257AC_ARG_WITH(cflags,
258 [ --with-cflags Specify additional flags to pass to compiler],
259 [
260 if test "x$withval" != "xno" ; then
261 CFLAGS="$CFLAGS $withval"
262 fi
263 ]
264)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000265AC_ARG_WITH(cppflags,
266 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
267 [
268 if test "x$withval" != "xno"; then
269 CPPFLAGS="$CPPFLAGS $withval"
270 fi
271 ]
272)
Damien Millere37bfc12000-06-05 09:37:43 +1000273AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000274 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000275 [
276 if test "x$withval" != "xno" ; then
277 LDFLAGS="$LDFLAGS $withval"
278 fi
279 ]
280)
281AC_ARG_WITH(libs,
282 [ --with-libs Specify additional libraries to link with],
283 [
284 if test "x$withval" != "xno" ; then
285 LIBS="$LIBS $withval"
286 fi
287 ]
288)
289
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000290AC_ARG_WITH(pcre,
291 [ --with-pcre Override built in regex library with pcre],
292 [
293
294 AC_CHECK_LIB(pcre, pcre_info,
295 [
296 AC_DEFINE(HAVE_LIBPCRE)
297 LIBS="$LIBS -lpcreposix -lpcre"
298 no_comp_check="yes"
299 ],
300 [ AC_MSG_ERROR([*** Can not locate pcre libraries.]) ]
301 )
302 ]
303)
Damien Millere37bfc12000-06-05 09:37:43 +1000304
Damien Millera22ba012000-03-02 23:09:20 +1100305# Checks for libraries.
Damien Miller22d5aa72001-02-18 12:49:57 +1100306if test -z "$no_libnsl" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000307 AC_CHECK_LIB(nsl, yp_match, , )
308fi
Damien Miller22d5aa72001-02-18 12:49:57 +1100309if test -z "$no_libsocket" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000310 AC_CHECK_LIB(socket, main, , )
311fi
312
Damien Millerdf288022001-02-18 13:07:07 +1100313dnl SCO OS3 needs this for libwrap
314AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
315
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000316AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
Damien Miller5dfe9762001-02-16 12:05:39 +1100317AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Millerab18c411999-11-11 10:40:23 +1100318AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Miller6f9c3372000-10-25 10:06:04 +1100319
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000320# We don't want to check if we did an pcre override.
321if test -z "$no_comp_check" ; then
322 AC_CHECK_FUNC(regcomp,
323 [ AC_DEFINE(HAVE_REGCOMP)],
324 [
325 AC_CHECK_LIB(pcre, pcre_info,
326 [
327 AC_DEFINE(HAVE_LIBPCRE)
328 LIBS="$LIBS -lpcreposix -lpcre"
329 ],
330 [
331 AC_MSG_ERROR([*** No regex library found.])
332 ])
333 ]
334 )
335fi
Damien Millerab18c411999-11-11 10:40:23 +1100336
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000337dnl UnixWare 2.x
338AC_CHECK_FUNC(strcasecmp,
339 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
340)
341AC_CHECK_FUNC(utimes,
342 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
343)
Damien Millerab18c411999-11-11 10:40:23 +1100344
Ben Lindstrom8697e082001-02-24 21:41:10 +0000345AC_FUNC_STRFTIME
346
Damien Millera22ba012000-03-02 23:09:20 +1100347# Checks for header files.
Damien Millerda2ed562001-04-25 22:50:18 +1000348AC_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 +1100349
350# Check for ALTDIRFUNC glob() extension
351AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
352AC_EGREP_CPP(FOUNDIT,
353 [
354 #include <glob.h>
355 #ifdef GLOB_ALTDIRFUNC
356 FOUNDIT
357 #endif
358 ],
359 [
360 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
361 AC_MSG_RESULT(yes)
362 ],
363 [
364 AC_MSG_RESULT(no)
365 ]
366)
Damien Millerab18c411999-11-11 10:40:23 +1100367
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000368# Check for g.gl_matchc glob() extension
369AC_MSG_CHECKING(for gl_matchc field in glob_t)
370AC_EGREP_CPP(FOUNDIT,
371 [
372 #include <glob.h>
373 int main(void){glob_t g; g.gl_matchc = 1;}
374 ],
375 [
376 AC_DEFINE(GLOB_HAS_GL_MATCHC)
377 AC_MSG_RESULT(yes)
378 ],
379 [
380 AC_MSG_RESULT(no)
381 ]
382)
383
Damien Miller18bb4732001-03-28 14:35:30 +1000384AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
385AC_TRY_RUN(
386 [
387#include <sys/types.h>
388#include <dirent.h>
389int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
390 ],
391 [AC_MSG_RESULT(yes)],
392 [
393 AC_MSG_RESULT(no)
394 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
395 ]
396)
397
Damien Millerc547bf12001-02-16 10:18:12 +1100398# Check whether user wants S/Key support
399SKEY_MSG="no"
400AC_ARG_WITH(skey,
401 [ --with-skey=PATH Enable S/Key support],
402 [
403 if test "x$withval" != "xno" ; then
404
405 if test "x$withval" != "xyes" ; then
406 CPPFLAGS="$CPPFLAGS -I${withval}/include"
407 LDFLAGS="$LDFLAGS -L${withval}/lib"
408 fi
409
410 AC_DEFINE(SKEY)
411 LIBS="-lskey $LIBS"
412 SKEY_MSG="yes"
413
414 AC_CHECK_FUNC(skey_keyinfo,
415 [],
416 [
417 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
418 ])
419 fi
420 ]
421)
422
423# Check whether user wants TCP wrappers support
424TCPW_MSG="no"
425AC_ARG_WITH(tcp-wrappers,
426 [ --with-tcp-wrappers Enable tcpwrappers support],
427 [
428 if test "x$withval" != "xno" ; then
429 saved_LIBS="$LIBS"
430 LIBS="-lwrap $LIBS"
431 AC_MSG_CHECKING(for libwrap)
432 AC_TRY_LINK(
433 [
434#include <tcpd.h>
435 int deny_severity = 0, allow_severity = 0;
436 ],
437 [hosts_access(0);],
438 [
439 AC_MSG_RESULT(yes)
440 AC_DEFINE(LIBWRAP)
441 TCPW_MSG="yes"
442 ],
443 [
444 AC_MSG_ERROR([*** libwrap missing])
445 ]
446 )
447 fi
448 ]
449)
450
Damien Millerad833b32000-08-23 10:46:23 +1000451dnl Checks for library functions.
Ben Lindstrom09988722001-04-12 21:35:52 +0000452AC_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 +1000453dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000454AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000455dnl Checks for libutil functions
Ben Lindstrome2fb8d32000-12-28 00:07:07 +0000456AC_CHECK_HEADERS(libutil.h)
andre2ff7b5d2000-06-03 14:57:40 +0000457AC_CHECK_FUNCS(login logout updwtmp logwtmp)
Damien Millerad833b32000-08-23 10:46:23 +1000458dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000459AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000460AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000461dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000462AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000463AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100464
Damien Miller5fc85652000-07-09 23:53:07 +1000465AC_CHECK_FUNC(getuserattr,
466 [AC_DEFINE(HAVE_GETUSERATTR)],
467 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
468)
469
Damien Miller04f80141999-11-19 15:32:34 +1100470AC_CHECK_FUNC(login,
471 [AC_DEFINE(HAVE_LOGIN)],
472 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
473)
474
475AC_CHECK_FUNC(daemon,
476 [AC_DEFINE(HAVE_DAEMON)],
477 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
478)
479
Damien Miller9fb07e42000-03-05 16:22:59 +1100480AC_CHECK_FUNC(getpagesize,
481 [AC_DEFINE(HAVE_GETPAGESIZE)],
482 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
483)
484
Damien Millercb170cb2000-07-01 16:52:55 +1000485# Check for broken snprintf
486if test "x$ac_cv_func_snprintf" = "xyes" ; then
487 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
488 AC_TRY_RUN(
489 [
490#include <stdio.h>
491int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
492 ],
493 [AC_MSG_RESULT(yes)],
494 [
495 AC_MSG_RESULT(no)
496 AC_DEFINE(BROKEN_SNPRINTF)
497 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
498 ]
499 )
500fi
501
Damien Miller606f8802000-09-16 15:39:56 +1100502AC_FUNC_GETPGRP
503
Damien Millera64b57a2001-01-17 10:44:13 +1100504# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000505PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100506AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100507 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100508 [
Damien Millera64b57a2001-01-17 10:44:13 +1100509 if test "x$withval" != "xno" ; then
510 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
511 AC_MSG_ERROR([PAM headers not found])
512 fi
513
514 AC_CHECK_LIB(dl, dlopen, , )
515 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
516 AC_CHECK_FUNCS(pam_getenvlist)
517
518 disable_shadow=yes
519 PAM_MSG="yes"
520
521 AC_DEFINE(USE_PAM)
Damien Millera22ba012000-03-02 23:09:20 +1100522 fi
523 ]
524)
Damien Millera22ba012000-03-02 23:09:20 +1100525
Damien Millera64b57a2001-01-17 10:44:13 +1100526# Check for older PAM
527if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100528 # Check PAM strerror arguments (old PAM)
529 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
530 AC_TRY_COMPILE(
531 [
Damien Miller81171112000-04-23 11:14:01 +1000532#include <stdlib.h>
533#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100534 ],
535 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
536 [AC_MSG_RESULT(no)],
537 [
538 AC_DEFINE(HAVE_OLD_PAM)
539 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000540 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100541 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100542 )
Damien Millera22ba012000-03-02 23:09:20 +1100543fi
544
545# The big search for OpenSSL
546AC_ARG_WITH(ssl-dir,
547 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
548 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000549 if test "x$withval" != "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100550 tryssldir=$withval
551 fi
552 ]
553)
554
555saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100556saved_LDFLAGS="$LDFLAGS"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000557saved_CPPFLAGS="$CPPFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100558if test "x$prefix" != "xNONE" ; then
559 tryssldir="$tryssldir $prefix"
560fi
Damien Miller61e50f12000-05-08 20:49:37 +1000561AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera1b61e12000-09-16 17:02:16 +1100562 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 +1100563 CPPFLAGS="$saved_CPPFLAGS"
564 LDFLAGS="$saved_LDFLAGS"
Damien Miller3b512e12000-05-17 23:29:18 +1000565 LIBS="$saved_LIBS -lcrypto"
Damien Millerccdefb62001-02-19 12:56:39 +1100566
567 # Skip directories if they don't exist
568 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
569 continue;
570 fi
571 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
572 # Try to use $ssldir/lib if it exists, otherwise
573 # $ssldir
574 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000575 LDFLAGS="-L$ssldir/lib $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/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100578 fi
579 else
Damien Millerb68af622001-03-28 21:05:26 +1000580 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100581 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000582 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100583 fi
584 fi
585 # Try to use $ssldir/include if it exists, otherwise
586 # $ssldir
587 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000588 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100589 else
Damien Millerb68af622001-03-28 21:05:26 +1000590 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100591 fi
592 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000593
Damien Miller3b512e12000-05-17 23:29:18 +1000594 # Basic test to check for compatible version and correct linking
595 # *does not* test for RSA - that comes later.
596 AC_TRY_RUN(
597 [
Damien Millere59ce622000-05-01 20:54:17 +1000598#include <string.h>
599#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000600int main(void)
601{
Damien Miller3b512e12000-05-17 23:29:18 +1000602 char a[2048];
603 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000604 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000605 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000606}
Damien Miller3b512e12000-05-17 23:29:18 +1000607 ],
608 [
609 found_crypto=1
610 break;
611 ], []
612 )
Damien Miller61e50f12000-05-08 20:49:37 +1000613
614 if test ! -z "$found_crypto" ; then
615 break;
616 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100617 done
618
Damien Miller61e50f12000-05-08 20:49:37 +1000619 if test -z "$found_crypto" ; then
Damien Miller5dfe9762001-02-16 12:05:39 +1100620 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
Damien Millerb85dcad2000-03-11 11:37:00 +1100621 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000622 if test -z "$ssldir" ; then
623 ssldir="(system)"
624 fi
Damien Millera22ba012000-03-02 23:09:20 +1100625
Damien Miller61e50f12000-05-08 20:49:37 +1000626 ac_cv_openssldir=$ssldir
627])
628
Damien Milleredb82922000-06-20 13:25:52 +1000629if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000630 AC_DEFINE(HAVE_OPENSSL)
631 dnl Need to recover ssldir - test above runs in subshell
632 ssldir=$ac_cv_openssldir
Damien Millera64b57a2001-01-17 10:44:13 +1100633 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
Damien Millerccdefb62001-02-19 12:56:39 +1100634 # Try to use $ssldir/lib if it exists, otherwise
635 # $ssldir
636 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000637 LDFLAGS="-L$ssldir/lib $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/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100640 fi
641 else
Damien Millerb68af622001-03-28 21:05:26 +1000642 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100643 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000644 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100645 fi
Damien Millera64b57a2001-01-17 10:44:13 +1100646 fi
Damien Millerccdefb62001-02-19 12:56:39 +1100647 # Try to use $ssldir/include if it exists, otherwise
648 # $ssldir
649 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000650 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100651 else
Damien Millerb68af622001-03-28 21:05:26 +1000652 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millera64b57a2001-01-17 10:44:13 +1100653 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100654 fi
Damien Millera22ba012000-03-02 23:09:20 +1100655fi
Damien Miller3b512e12000-05-17 23:29:18 +1000656LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000657
Damien Miller3b512e12000-05-17 23:29:18 +1000658# Now test RSA support
659saved_LIBS="$LIBS"
660AC_MSG_CHECKING([for RSA support])
661for WANTS_RSAREF in "" 1 ; do
662 if test -z "$WANTS_RSAREF" ; then
663 LIBS="$saved_LIBS"
664 else
665 LIBS="$saved_LIBS -lRSAglue -lrsaref"
666 fi
667 AC_TRY_RUN([
668#include <string.h>
669#include <openssl/rand.h>
670#include <openssl/rsa.h>
671#include <openssl/bn.h>
672#include <openssl/sha.h>
673int main(void)
674{
675 int num; RSA *key; static unsigned char p_in[] = "blahblah";
676 unsigned char c[256], p[256];
677 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
678 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
679 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
680 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
681}
682 ],
683 [
684 rsa_works=1
685 break;
686 ], [])
687done
688
689if test ! -z "$no_rsa" ; then
690 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000691 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000692else
693 if test -z "$rsa_works" ; then
694 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000695 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000696 else
697 if test -z "$WANTS_RSAREF" ; then
698 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000699 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000700 else
Damien Miller7b22d652000-06-18 14:07:04 +1000701 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000702 AC_MSG_RESULT(using RSAref)
703 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
704 fi
705 fi
706fi
Damien Millera22ba012000-03-02 23:09:20 +1100707
Damien Millera64b57a2001-01-17 10:44:13 +1100708# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
709# version in OpenSSL. Skip this for PAM
710if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100711 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100712fi
713
Ben Lindstromb5628642000-10-18 00:02:25 +0000714# Cheap hack to ensure NEWS-OS libraries are arranged right.
715if test ! -z "$SONY" ; then
716 LIBS="$LIBS -liberty";
717fi
718
Damien Millera22ba012000-03-02 23:09:20 +1100719# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100720AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100721AC_CHECK_SIZEOF(short int, 2)
722AC_CHECK_SIZEOF(int, 4)
723AC_CHECK_SIZEOF(long int, 4)
724AC_CHECK_SIZEOF(long long int, 8)
725
Damien Millera22ba012000-03-02 23:09:20 +1100726# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +1100727AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
728 AC_TRY_COMPILE(
729 [ #include <sys/types.h> ],
730 [ u_int a; a = 1;],
731 [ ac_cv_have_u_int="yes" ],
732 [ ac_cv_have_u_int="no" ]
733 )
734])
735if test "x$ac_cv_have_u_int" = "xyes" ; then
736 AC_DEFINE(HAVE_U_INT)
737 have_u_int=1
738fi
739
Damien Miller61e50f12000-05-08 20:49:37 +1000740AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
741 AC_TRY_COMPILE(
742 [ #include <sys/types.h> ],
743 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
744 [ ac_cv_have_intxx_t="yes" ],
745 [ ac_cv_have_intxx_t="no" ]
746 )
747])
748if test "x$ac_cv_have_intxx_t" = "xyes" ; then
749 AC_DEFINE(HAVE_INTXX_T)
750 have_intxx_t=1
751fi
752
Damien Miller578783e2000-09-23 14:12:24 +1100753AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
754 AC_TRY_COMPILE(
755 [ #include <sys/types.h> ],
756 [ int64_t a; a = 1;],
757 [ ac_cv_have_int64_t="yes" ],
758 [ ac_cv_have_int64_t="no" ]
759 )
760])
761if test "x$ac_cv_have_int64_t" = "xyes" ; then
762 AC_DEFINE(HAVE_INT64_T)
763 have_int64_t=1
764fi
765
Damien Miller61e50f12000-05-08 20:49:37 +1000766AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
767 AC_TRY_COMPILE(
768 [ #include <sys/types.h> ],
769 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
770 [ ac_cv_have_u_intxx_t="yes" ],
771 [ ac_cv_have_u_intxx_t="no" ]
772 )
773])
774if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
775 AC_DEFINE(HAVE_U_INTXX_T)
776 have_u_intxx_t=1
777fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100778
Damien Miller578783e2000-09-23 14:12:24 +1100779AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
780 AC_TRY_COMPILE(
781 [ #include <sys/types.h> ],
782 [ u_int64_t a; a = 1;],
783 [ ac_cv_have_u_int64_t="yes" ],
784 [ ac_cv_have_u_int64_t="no" ]
785 )
786])
787if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
788 AC_DEFINE(HAVE_U_INT64_T)
789 have_u_int64_t=1
790fi
791
Damien Milleredb82922000-06-20 13:25:52 +1000792if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
793 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +1100794then
795 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
796 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +1000797 [
798#include <sys/bitypes.h>
799 ],
Damien Millerb29ea912000-01-15 14:12:03 +1100800 [
Damien Miller70494d12000-04-03 15:57:06 +1000801 int8_t a; int16_t b; int32_t c;
802 u_int8_t e; u_int16_t f; u_int32_t g;
803 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +1100804 ],
805 [
806 AC_DEFINE(HAVE_U_INTXX_T)
807 AC_DEFINE(HAVE_INTXX_T)
808 AC_MSG_RESULT(yes)
809 ],
810 [AC_MSG_RESULT(no)]
811 )
812fi
813
Damien Millerd6121d22000-03-17 23:26:46 +1100814if test -z "$have_u_intxx_t" ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000815 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
816 AC_TRY_COMPILE(
817 [
818#include <sys/types.h>
819 ],
820 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
821 [ ac_cv_have_uintxx_t="yes" ],
822 [ ac_cv_have_uintxx_t="no" ]
823 )
824 ])
825 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
826 AC_DEFINE(HAVE_UINTXX_T)
827 fi
Damien Millerd6121d22000-03-17 23:26:46 +1100828fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100829
Damien Miller61e50f12000-05-08 20:49:37 +1000830AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
831 AC_TRY_COMPILE(
832 [
Damien Miller81171112000-04-23 11:14:01 +1000833#include <sys/types.h>
834#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000835 ],
836 [socklen_t foo; foo = 1235;],
837 [ ac_cv_have_socklen_t="yes" ],
838 [ ac_cv_have_socklen_t="no" ]
839 )
840])
841if test "x$ac_cv_have_socklen_t" = "xyes" ; then
842 AC_DEFINE(HAVE_SOCKLEN_T)
843fi
Damien Miller74d0d4a1999-12-29 02:24:35 +1100844
Damien Miller61e50f12000-05-08 20:49:37 +1000845AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
846 AC_TRY_COMPILE(
847 [
848#include <sys/types.h>
849 ],
850 [ size_t foo; foo = 1235; ],
851 [ ac_cv_have_size_t="yes" ],
852 [ ac_cv_have_size_t="no" ]
853 )
854])
855if test "x$ac_cv_have_size_t" = "xyes" ; then
856 AC_DEFINE(HAVE_SIZE_T)
857fi
Damien Miller95058511999-12-29 10:36:45 +1100858
Damien Miller615f9392000-05-17 22:53:33 +1000859AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
860 AC_TRY_COMPILE(
861 [
862#include <sys/types.h>
863 ],
864 [ ssize_t foo; foo = 1235; ],
865 [ ac_cv_have_ssize_t="yes" ],
866 [ ac_cv_have_ssize_t="no" ]
867 )
868])
869if test "x$ac_cv_have_ssize_t" = "xyes" ; then
870 AC_DEFINE(HAVE_SSIZE_T)
871fi
872
Ben Lindstrom0d5af602001-01-09 00:50:29 +0000873AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
874 AC_TRY_COMPILE(
875 [
876#include <time.h>
877 ],
878 [ clock_t foo; foo = 1235; ],
879 [ ac_cv_have_clock_t="yes" ],
880 [ ac_cv_have_clock_t="no" ]
881 )
882])
883if test "x$ac_cv_have_clock_t" = "xyes" ; then
884 AC_DEFINE(HAVE_CLOCK_T)
885fi
886
Damien Millerb54b40e2000-06-23 08:23:34 +1000887AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
888 AC_TRY_COMPILE(
889 [
890#include <sys/types.h>
891#include <sys/socket.h>
892 ],
893 [ sa_family_t foo; foo = 1235; ],
894 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +1100895 [ AC_TRY_COMPILE(
896 [
897#include <sys/types.h>
898#include <sys/socket.h>
899#include <netinet/in.h>
900 ],
901 [ sa_family_t foo; foo = 1235; ],
902 [ ac_cv_have_sa_family_t="yes" ],
903
Damien Millerb54b40e2000-06-23 08:23:34 +1000904 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +1100905 )]
Damien Millerb54b40e2000-06-23 08:23:34 +1000906 )
907])
908if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
909 AC_DEFINE(HAVE_SA_FAMILY_T)
910fi
911
Damien Miller0f91b4e2000-06-18 15:43:25 +1000912AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
913 AC_TRY_COMPILE(
914 [
915#include <sys/types.h>
916 ],
917 [ pid_t foo; foo = 1235; ],
918 [ ac_cv_have_pid_t="yes" ],
919 [ ac_cv_have_pid_t="no" ]
920 )
921])
922if test "x$ac_cv_have_pid_t" = "xyes" ; then
923 AC_DEFINE(HAVE_PID_T)
924fi
925
926AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
927 AC_TRY_COMPILE(
928 [
929#include <sys/types.h>
930 ],
931 [ mode_t foo; foo = 1235; ],
932 [ ac_cv_have_mode_t="yes" ],
933 [ ac_cv_have_mode_t="no" ]
934 )
935])
936if test "x$ac_cv_have_mode_t" = "xyes" ; then
937 AC_DEFINE(HAVE_MODE_T)
938fi
939
Damien Miller61e50f12000-05-08 20:49:37 +1000940
941AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
942 AC_TRY_COMPILE(
943 [
Damien Miller81171112000-04-23 11:14:01 +1000944#include <sys/types.h>
945#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000946 ],
947 [ struct sockaddr_storage s; ],
948 [ ac_cv_have_struct_sockaddr_storage="yes" ],
949 [ ac_cv_have_struct_sockaddr_storage="no" ]
950 )
951])
952if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
953 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
954fi
Damien Miller34132e52000-01-14 15:45:46 +1100955
Damien Miller61e50f12000-05-08 20:49:37 +1000956AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
957 AC_TRY_COMPILE(
958 [
Damien Miller7b22d652000-06-18 14:07:04 +1000959#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000960#include <netinet/in.h>
961 ],
962 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
963 [ ac_cv_have_struct_sockaddr_in6="yes" ],
964 [ ac_cv_have_struct_sockaddr_in6="no" ]
965 )
966])
967if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
968 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
969fi
Damien Miller34132e52000-01-14 15:45:46 +1100970
Damien Miller61e50f12000-05-08 20:49:37 +1000971AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
972 AC_TRY_COMPILE(
973 [
Damien Miller7b22d652000-06-18 14:07:04 +1000974#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000975#include <netinet/in.h>
976 ],
977 [ struct in6_addr s; s.s6_addr[0] = 0; ],
978 [ ac_cv_have_struct_in6_addr="yes" ],
979 [ ac_cv_have_struct_in6_addr="no" ]
980 )
981])
982if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
983 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
984fi
Damien Miller34132e52000-01-14 15:45:46 +1100985
Damien Miller61e50f12000-05-08 20:49:37 +1000986AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
987 AC_TRY_COMPILE(
988 [
Damien Miller81171112000-04-23 11:14:01 +1000989#include <sys/types.h>
990#include <sys/socket.h>
991#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000992 ],
993 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
994 [ ac_cv_have_struct_addrinfo="yes" ],
995 [ ac_cv_have_struct_addrinfo="no" ]
996 )
997])
998if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
999 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1000fi
1001
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001002AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1003 AC_TRY_COMPILE(
1004 [ #include <sys/time.h> ],
1005 [ struct timeval tv; tv.tv_sec = 1;],
1006 [ ac_cv_have_struct_timeval="yes" ],
1007 [ ac_cv_have_struct_timeval="no" ]
1008 )
1009])
1010if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1011 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1012 have_struct_timeval=1
1013fi
1014
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001015# If we don't have int64_t then we can't compile sftp-server. So don't
1016# even attempt to do it.
1017if test "x$ac_cv_have_int64_t" = "xno" -a \
1018 "x$ac_cv_sizeof_long_int" != "x8" -a \
1019 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1020 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001021else
1022dnl test snprintf (broken on SCO w/gcc)
1023 AC_TRY_RUN(
1024 [
1025#include <stdio.h>
1026#include <string.h>
1027#ifdef HAVE_SNPRINTF
1028main()
1029{
1030 char buf[50];
1031 char expected_out[50];
1032 int mazsize = 50 ;
1033#if (SIZEOF_LONG_INT == 8)
1034 long int num = 0x7fffffffffffffff;
1035#else
1036 long long num = 0x7fffffffffffffff;
1037#endif
1038 strcpy(expected_out, "9223372036854775807");
1039 snprintf(buf, mazsize, "%lld", num);
1040 if(strcmp(buf, expected_out) != 0)
1041 exit(1);
1042 exit(0);
1043}
1044#else
1045main() { exit(0); }
1046#endif
1047 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1048 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001049fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001050AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001051
Damien Miller78315eb2000-09-29 23:01:36 +11001052dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001053OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1054OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1055OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1056OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1057OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001058OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001059OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1060OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001061OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001062OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1063OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1064OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1065OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001066OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1067OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1068OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1069OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Damien Miller78315eb2000-09-29 23:01:36 +11001070AC_STRUCT_ST_BLKSIZE
andre2ff7b5d2000-06-03 14:57:40 +00001071
Damien Miller942da032000-08-18 13:59:06 +10001072AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
1073 ac_cv_have_sun_len_in_struct_sockaddr_un, [
1074 AC_TRY_COMPILE(
1075 [
1076#include <sys/types.h>
1077#include <sys/socket.h>
1078 ],
1079 [ struct sockaddr_un s; s.sun_len = 1; ],
1080 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
1081 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
1082 )
1083])
1084if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
1085 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
1086fi
1087
Damien Miller61e50f12000-05-08 20:49:37 +10001088AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1089 ac_cv_have_ss_family_in_struct_ss, [
1090 AC_TRY_COMPILE(
1091 [
Damien Miller81171112000-04-23 11:14:01 +10001092#include <sys/types.h>
1093#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001094 ],
1095 [ struct sockaddr_storage s; s.ss_family = 1; ],
1096 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1097 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1098 )
1099])
1100if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1101 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1102fi
1103
Damien Miller61e50f12000-05-08 20:49:37 +10001104AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1105 ac_cv_have___ss_family_in_struct_ss, [
1106 AC_TRY_COMPILE(
1107 [
Damien Miller81171112000-04-23 11:14:01 +10001108#include <sys/types.h>
1109#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001110 ],
1111 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1112 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1113 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1114 )
1115])
1116if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1117 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1118fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001119
Damien Millerad833b32000-08-23 10:46:23 +10001120AC_CACHE_CHECK([for pw_class field in struct passwd],
1121 ac_cv_have_pw_class_in_struct_passwd, [
1122 AC_TRY_COMPILE(
1123 [
Damien Millerad833b32000-08-23 10:46:23 +10001124#include <pwd.h>
1125 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001126 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001127 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1128 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1129 )
1130])
1131if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1132 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1133fi
1134
Damien Miller61e50f12000-05-08 20:49:37 +10001135
1136AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1137 AC_TRY_LINK([],
1138 [ extern char *__progname; printf("%s", __progname); ],
1139 [ ac_cv_libc_defines___progname="yes" ],
1140 [ ac_cv_libc_defines___progname="no" ]
1141 )
1142])
1143if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1144 AC_DEFINE(HAVE___PROGNAME)
1145fi
1146
Damien Millera22ba012000-03-02 23:09:20 +11001147
Damien Millerecbb26d2000-07-15 14:59:14 +10001148AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1149 AC_TRY_LINK([],
1150 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1151 [ ac_cv_libc_defines_sys_errlist="yes" ],
1152 [ ac_cv_libc_defines_sys_errlist="no" ]
1153 )
1154])
1155if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1156 AC_DEFINE(HAVE_SYS_ERRLIST)
1157fi
1158
1159
Damien Miller11fa2cc2000-08-16 10:35:58 +10001160AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1161 AC_TRY_LINK([],
1162 [ extern int sys_nerr; printf("%i", sys_nerr);],
1163 [ ac_cv_libc_defines_sys_nerr="yes" ],
1164 [ ac_cv_libc_defines_sys_nerr="no" ]
1165 )
1166])
1167if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1168 AC_DEFINE(HAVE_SYS_NERR)
1169fi
1170
1171
Damien Millerc79bc0d2001-03-28 13:03:42 +10001172# Check whether user wants Kerberos support
1173KRB4_MSG="no"
1174AC_ARG_WITH(kerberos4,
1175 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1176 [
1177 if test "x$withval" != "xno" ; then
1178
1179 if test "x$withval" != "xyes" ; then
1180 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1181 LDFLAGS="$LDFLAGS -L${withval}/lib"
1182 if test ! -z "$need_dash_r" ; then
1183 LDFLAGS="$LDFLAGS -R${withval}/lib"
1184 fi
1185 if test ! -z "$blibpath" ; then
1186 blibpath="$blibpath:${withval}/lib"
1187 fi
1188 else
1189 if test -d /usr/include/kerberosIV ; then
1190 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1191 fi
1192 fi
1193
1194 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001195 if test "$ac_cv_header_krb_h" != yes; then
1196 AC_MSG_WARN([Cannot find krb.h, build may fail])
1197 fi
Damien Miller98344742001-03-28 14:37:06 +10001198 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001199 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001200 AC_CHECK_LIB(krb4, main)
1201 if test "$ac_cv_lib_krb4_main" != yes; then
1202 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1203 else
1204 KLIBS="-lkrb4"
1205 fi
1206 else
1207 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001208 fi
Damien Miller98344742001-03-28 14:37:06 +10001209 AC_CHECK_LIB(des, des_cbc_encrypt)
1210 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1211 AC_CHECK_LIB(des425, des_cbc_encrypt)
1212 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1213 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1214 else
1215 KLIBS="-ldes425"
1216 fi
1217 else
1218 KLIBS="-ldes"
1219 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001220 AC_CHECK_LIB(resolv, dn_expand, , )
1221 KRB4=yes
1222 KRB4_MSG="yes"
1223 AC_DEFINE(KRB4)
1224 fi
1225 ]
1226)
1227
1228# Check whether user wants AFS support
1229AFS_MSG="no"
1230AC_ARG_WITH(afs,
1231 [ --with-afs=PATH Enable AFS support],
1232 [
1233 if test "x$withval" != "xno" ; then
1234
1235 if test "x$withval" != "xyes" ; then
1236 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1237 LDFLAGS="$LDFLAGS -L${withval}/lib"
1238 fi
1239
1240 if test -z "$KRB4" ; then
1241 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1242 fi
1243
1244 LIBS="-lkafs $LIBS"
1245 if test ! -z "$AFS_LIBS" ; then
1246 LIBS="$LIBS $AFS_LIBS"
1247 fi
1248 AC_DEFINE(AFS)
1249 AFS_MSG="yes"
1250 fi
1251 ]
1252)
1253LIBS="$LIBS $KLIBS"
1254
Damien Millera22ba012000-03-02 23:09:20 +11001255# Looking for programs, paths and files
1256AC_ARG_WITH(rsh,
1257 [ --with-rsh=PATH Specify path to remote shell program ],
1258 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001259 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001260 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001261 fi
1262 ],
1263 [
1264 AC_PATH_PROG(rsh_path, rsh)
1265 ]
1266)
1267
1268AC_ARG_WITH(xauth,
1269 [ --with-xauth=PATH Specify path to xauth program ],
1270 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001271 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001272 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001273 fi
1274 ],
1275 [
Damien Miller78315eb2000-09-29 23:01:36 +11001276 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 +10001277 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001278 xauth_path="/usr/openwin/bin/xauth"
1279 fi
1280 ]
1281)
1282
Damien Millera19cf472000-11-29 13:28:50 +11001283if test -z "$xauth_path" ; then
1284 XAUTH_PATH="undefined"
1285 AC_SUBST(XAUTH_PATH)
1286else
Damien Millera22ba012000-03-02 23:09:20 +11001287 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001288 XAUTH_PATH=$xauth_path
1289 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001290fi
1291if test ! -z "$rsh_path" ; then
1292 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1293fi
1294
1295# Check for mail directory (last resort if we cannot get it from headers)
1296if test ! -z "$MAIL" ; then
1297 maildir=`dirname $MAIL`
1298 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1299fi
1300
Damien Millera22ba012000-03-02 23:09:20 +11001301if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +11001302 AC_CHECK_FILE("/dev/ptmx",
1303 [
1304 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1305 have_dev_ptmx=1
1306 ]
1307 )
Damien Millera22ba012000-03-02 23:09:20 +11001308fi
Damien Miller204ad072000-03-02 23:56:12 +11001309AC_CHECK_FILE("/dev/ptc",
1310 [
1311 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1312 have_dev_ptc=1
1313 ]
1314)
1315
Damien Millera22ba012000-03-02 23:09:20 +11001316# Options from here on. Some of these are preset by platform above
1317
Damien Millera22ba012000-03-02 23:09:20 +11001318# Check for user-specified random device, otherwise check /dev/urandom
1319AC_ARG_WITH(random,
Damien Miller0736c4d2001-01-25 10:51:46 +11001320 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
Damien Millera22ba012000-03-02 23:09:20 +11001321 [
Damien Miller040f3832000-04-03 14:50:43 +10001322 if test "x$withval" != "xno" ; then
1323 RANDOM_POOL="$withval";
1324 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1325 fi
Damien Millera22ba012000-03-02 23:09:20 +11001326 ],
1327 [
1328 # Check for random device
1329 AC_CHECK_FILE("/dev/urandom",
1330 [
1331 RANDOM_POOL="/dev/urandom";
1332 AC_SUBST(RANDOM_POOL)
1333 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1334 ]
1335 )
1336 ]
1337)
1338
Damien Millerd0ccb982001-03-04 00:29:20 +11001339# Check for PRNGD/EGD pool file
1340AC_ARG_WITH(prngd-port,
1341 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1342 [
1343 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1344 PRNGD_PORT="$withval"
1345 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1346 fi
1347 ]
1348)
1349
1350# Check for PRNGD/EGD pool file
1351AC_ARG_WITH(prngd-socket,
1352 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
Damien Millera22ba012000-03-02 23:09:20 +11001353 [
Damien Miller040f3832000-04-03 14:50:43 +10001354 if test "x$withval" != "xno" ; then
Damien Millerd0ccb982001-03-04 00:29:20 +11001355 PRNGD_SOCKET="$withval"
1356 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller040f3832000-04-03 14:50:43 +10001357 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001358 ],
1359 [
1360 # Check for existing socket only if we don't have a random device already
1361 if test -z "$RANDOM_POOL" ; then
1362 AC_MSG_CHECKING(for PRNGD/EGD socket)
1363 # Insert other locations here
Tim Ricebee3f222001-03-11 17:32:12 -08001364 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
Damien Millerd0ccb982001-03-04 00:29:20 +11001365 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1366 PRNGD_SOCKET="$sock"
1367 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller0736c4d2001-01-25 10:51:46 +11001368 break;
1369 fi
1370 done
Damien Millerd0ccb982001-03-04 00:29:20 +11001371 if test ! -z "$PRNGD_SOCKET" ; then
1372 AC_MSG_RESULT($PRNGD_SOCKET)
Damien Miller4864e8f2001-02-08 10:07:08 +11001373 else
1374 AC_MSG_RESULT(not found)
1375 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001376 fi
Damien Millera22ba012000-03-02 23:09:20 +11001377 ]
1378)
1379
Damien Miller0736c4d2001-01-25 10:51:46 +11001380
Damien Miller0437b332000-05-02 09:56:41 +10001381# detect pathnames for entropy gathering commands, if we need them
1382INSTALL_SSH_PRNG_CMDS=""
1383rm -f prng_commands
Damien Millerd0ccb982001-03-04 00:29:20 +11001384if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
Damien Miller11e37f62000-04-08 18:23:30 +10001385 # Use these commands to collect entropy
Damien Miller61e50f12000-05-08 20:49:37 +10001386 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1387 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1388 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1389 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1390 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1391 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1392 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1393 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1394 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1395 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1396 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1397 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1398 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1399 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Damien Miller0437b332000-05-02 09:56:41 +10001400
1401 INSTALL_SSH_PRNG_CMDS="yes"
Damien Miller11e37f62000-04-08 18:23:30 +10001402fi
Damien Miller0437b332000-05-02 09:56:41 +10001403AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1404
Damien Miller11e37f62000-04-08 18:23:30 +10001405
Damien Miller670a4b82000-01-22 13:53:11 +11001406AC_ARG_WITH(catman,
Damien Miller897741e2001-04-16 10:41:46 +10001407 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001408 [
Damien Miller897741e2001-04-16 10:41:46 +10001409 case "$withval" in
1410 man|cat|doc)
1411 MANTYPE=$withval
1412 ;;
1413 *)
1414 AC_MSG_ERROR(invalid man type: $withval)
1415 ;;
1416 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001417 ]
1418)
Ben Lindstrombc709922001-04-18 18:04:21 +00001419if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001420 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001421 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1422 MANTYPE=doc
1423 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1424 MANTYPE=man
1425 else
1426 MANTYPE=cat
1427 fi
1428fi
Damien Miller670a4b82000-01-22 13:53:11 +11001429AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001430if test "$MANTYPE" = "doc"; then
1431 mansubdir=man;
1432else
1433 mansubdir=$MANTYPE;
1434fi
1435AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001436
Damien Millera22ba012000-03-02 23:09:20 +11001437# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001438MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001439AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001440 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001441 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001442 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001443 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001444 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001445 fi
1446 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001447)
1448
Damien Millera22ba012000-03-02 23:09:20 +11001449# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001450AC_ARG_WITH(shadow,
1451 [ --without-shadow Disable shadow password support],
1452 [
1453 if test "x$withval" = "xno" ; then
1454 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001455 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001456 fi
1457 ]
1458)
1459
Damien Miller1f335fb2000-06-26 11:31:33 +10001460if test -z "$disable_shadow" ; then
1461 AC_MSG_CHECKING([if the systems has expire shadow information])
1462 AC_TRY_COMPILE(
1463 [
1464#include <sys/types.h>
1465#include <shadow.h>
1466 struct spwd sp;
1467 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1468 [ sp_expire_available=yes ], []
1469 )
1470
1471 if test "x$sp_expire_available" = "xyes" ; then
1472 AC_MSG_RESULT(yes)
1473 AC_DEFINE(HAS_SHADOW_EXPIRE)
1474 else
1475 AC_MSG_RESULT(no)
1476 fi
1477fi
1478
Damien Millera22ba012000-03-02 23:09:20 +11001479# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001480if test ! -z "$IPADDR_IN_DISPLAY" ; then
1481 DISPLAY_HACK_MSG="yes"
1482 AC_DEFINE(IPADDR_IN_DISPLAY)
1483else
1484 DISPLAY_HACK_MSG="no"
1485 AC_ARG_WITH(ipaddr-display,
1486 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1487 [
1488 if test "x$withval" != "xno" ; then
1489 AC_DEFINE(IPADDR_IN_DISPLAY)
1490 DISPLAY_HACK_MSG="yes"
1491 fi
1492 ]
1493 )
1494fi
Damien Miller76112de1999-12-21 11:18:08 +11001495
Damien Millera22ba012000-03-02 23:09:20 +11001496# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001497SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001498AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11001499 [ --with-default-path=PATH Specify default \$PATH environment for server],
1500 [
1501 if test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001502 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001503 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001504 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001505 ],
1506 [
1507 AC_TRY_RUN(
1508 [
1509/* find out what STDPATH is */
1510#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001511#ifdef HAVE_PATHS_H
1512# include <paths.h>
1513#endif
1514#ifndef _PATH_STDPATH
1515# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1516#endif
1517#include <sys/types.h>
1518#include <sys/stat.h>
1519#include <fcntl.h>
1520#define DATA "conftest.stdpath"
1521
1522main()
1523{
1524 FILE *fd;
1525 int rc;
1526
1527 fd = fopen(DATA,"w");
1528 if(fd == NULL)
1529 exit(1);
1530
1531 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1532 exit(1);
1533
1534 exit(0);
1535}
1536 ], [ user_path=`cat conftest.stdpath` ],
1537 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1538 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1539 )
1540# make sure $bindir is in USER_PATH so scp will work
1541 t_bindir=`eval echo ${bindir}`
1542 case $t_bindir in
1543 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1544 esac
1545 case $t_bindir in
1546 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1547 esac
1548 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1549 if test $? -ne 0 ; then
1550 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1551 if test $? -ne 0 ; then
1552 user_path=$user_path:$t_bindir
1553 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1554 fi
1555 fi
Damien Miller5a3e6831999-12-27 09:48:56 +11001556 ]
1557)
Tim Rice59ea0a02001-03-10 13:50:45 -08001558AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1559AC_SUBST(user_path)
Damien Miller5a3e6831999-12-27 09:48:56 +11001560
Damien Millera22ba012000-03-02 23:09:20 +11001561# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10001562IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11001563AC_ARG_WITH(ipv4-default,
1564 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1565 [
1566 if test "x$withval" != "xno" ; then
1567 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10001568 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11001569 fi
1570 ]
1571)
1572
Damien Miller61e50f12000-05-08 20:49:37 +10001573AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10001574IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11001575AC_ARG_WITH(4in6,
1576 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1577 [
1578 if test "x$withval" != "xno" ; then
1579 AC_MSG_RESULT(yes)
1580 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001581 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001582 else
1583 AC_MSG_RESULT(no)
1584 fi
1585 ],[
1586 if test "x$inet6_default_4in6" = "xyes"; then
1587 AC_MSG_RESULT([yes (default)])
1588 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001589 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001590 else
1591 AC_MSG_RESULT([no (default)])
1592 fi
1593 ]
1594)
1595
Damien Miller60396b02001-02-18 17:01:00 +11001596# Whether to enable BSD auth support
1597AC_ARG_WITH(bsd-auth,
1598 [ --with-bsd-auth Enable BSD auth support],
1599 [
1600 if test "x$withval" != "xno" ; then
1601 AC_DEFINE(BSD_AUTH)
1602 bsd_auth=yes
1603 fi
1604 ]
1605)
1606
Damien Miller78315eb2000-09-29 23:01:36 +11001607AC_MSG_CHECKING(whether to install ssh as suid root)
1608AC_ARG_ENABLE(suid-ssh,
1609[ --enable-suid-ssh Install ssh as suid root (default)
1610 --disable-suid-ssh Install ssh without suid bit],
1611[ case "$enableval" in
1612 no)
1613 AC_MSG_RESULT(no)
1614 SSHMODE=0711
1615 ;;
1616 *) AC_MSG_RESULT(yes)
1617 SSHMODE=04711
1618 ;;
1619 esac ],
1620 AC_MSG_RESULT(yes)
1621 SSHMODE=04711
1622)
1623AC_SUBST(SSHMODE)
1624
1625
Damien Millera22ba012000-03-02 23:09:20 +11001626# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11001627piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +11001628AC_ARG_WITH(pid-dir,
1629 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1630 [
1631 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +11001632 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +11001633 fi
1634 ]
1635)
Damien Miller4018c192000-04-30 09:30:44 +10001636
Damien Miller78315eb2000-09-29 23:01:36 +11001637# make sure the directory exists
1638if test ! -d $piddir ; then
1639 piddir=`eval echo ${sysconfdir}`
1640 case $piddir in
1641 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1642 esac
1643fi
1644
Ben Lindstrom226cfa02001-01-22 05:34:40 +00001645AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11001646AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11001647
andre2ff7b5d2000-06-03 14:57:40 +00001648dnl allow user to disable some login recording features
1649AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001650 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001651 [ AC_DEFINE(DISABLE_LASTLOG) ]
1652)
1653AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00001654 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001655 [ AC_DEFINE(DISABLE_UTMP) ]
1656)
1657AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00001658 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001659 [ AC_DEFINE(DISABLE_UTMPX) ]
1660)
1661AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00001662 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001663 [ AC_DEFINE(DISABLE_WTMP) ]
1664)
1665AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00001666 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001667 [ AC_DEFINE(DISABLE_WTMPX) ]
1668)
1669AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00001670 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001671 [ AC_DEFINE(DISABLE_LOGIN) ]
1672)
1673AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00001674 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001675 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1676)
1677AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00001678 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001679 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1680)
1681AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001682 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11001683 [
1684 if test "x$withval" = "xno" ; then
1685 AC_DEFINE(DISABLE_LASTLOG)
1686 else
1687 conf_lastlog_location=$withval
1688 fi
1689 ]
1690)
andre2ff7b5d2000-06-03 14:57:40 +00001691
1692dnl lastlog, [uw]tmpx? detection
1693dnl NOTE: set the paths in the platform section to avoid the
1694dnl need for command-line parameters
1695dnl lastlog and [uw]tmp are subject to a file search if all else fails
1696
1697dnl lastlog detection
1698dnl NOTE: the code itself will detect if lastlog is a directory
1699AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1700AC_TRY_COMPILE([
1701#include <sys/types.h>
1702#include <utmp.h>
1703#ifdef HAVE_LASTLOG_H
1704# include <lastlog.h>
1705#endif
Damien Miller2994e082000-06-04 15:51:47 +10001706#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001707# include <paths.h>
1708#endif
1709 ],
1710 [ char *lastlog = LASTLOG_FILE; ],
1711 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10001712 [
1713 AC_MSG_RESULT(no)
1714 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1715 AC_TRY_COMPILE([
1716#include <sys/types.h>
1717#include <utmp.h>
1718#ifdef HAVE_LASTLOG_H
1719# include <lastlog.h>
1720#endif
1721#ifdef HAVE_PATHS_H
1722# include <paths.h>
1723#endif
1724 ],
1725 [ char *lastlog = _PATH_LASTLOG; ],
1726 [ AC_MSG_RESULT(yes) ],
1727 [
andree441aa32000-06-12 22:34:38 +00001728 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10001729 system_lastlog_path=no
1730 ])
1731 ]
andre2ff7b5d2000-06-03 14:57:40 +00001732)
Damien Miller2994e082000-06-04 15:51:47 +10001733
andre2ff7b5d2000-06-03 14:57:40 +00001734if test -z "$conf_lastlog_location"; then
1735 if test x"$system_lastlog_path" = x"no" ; then
1736 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10001737 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00001738 conf_lastlog_location=$f
1739 fi
1740 done
1741 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00001742 AC_MSG_WARN([** Cannot find lastlog **])
1743 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00001744 fi
1745 fi
1746fi
1747
1748if test -n "$conf_lastlog_location"; then
1749 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1750fi
1751
1752dnl utmp detection
1753AC_MSG_CHECKING([if your system defines UTMP_FILE])
1754AC_TRY_COMPILE([
1755#include <sys/types.h>
1756#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001757#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001758# include <paths.h>
1759#endif
1760 ],
1761 [ char *utmp = UTMP_FILE; ],
1762 [ AC_MSG_RESULT(yes) ],
1763 [ AC_MSG_RESULT(no)
1764 system_utmp_path=no ]
1765)
1766if test -z "$conf_utmp_location"; then
1767 if test x"$system_utmp_path" = x"no" ; then
1768 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1769 if test -f $f ; then
1770 conf_utmp_location=$f
1771 fi
1772 done
1773 if test -z "$conf_utmp_location"; then
1774 AC_DEFINE(DISABLE_UTMP)
1775 fi
1776 fi
1777fi
1778if test -n "$conf_utmp_location"; then
1779 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1780fi
1781
1782dnl wtmp detection
1783AC_MSG_CHECKING([if your system defines WTMP_FILE])
1784AC_TRY_COMPILE([
1785#include <sys/types.h>
1786#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001787#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001788# include <paths.h>
1789#endif
1790 ],
1791 [ char *wtmp = WTMP_FILE; ],
1792 [ AC_MSG_RESULT(yes) ],
1793 [ AC_MSG_RESULT(no)
1794 system_wtmp_path=no ]
1795)
1796if test -z "$conf_wtmp_location"; then
1797 if test x"$system_wtmp_path" = x"no" ; then
1798 for f in /usr/adm/wtmp /var/log/wtmp; do
1799 if test -f $f ; then
1800 conf_wtmp_location=$f
1801 fi
1802 done
1803 if test -z "$conf_wtmp_location"; then
1804 AC_DEFINE(DISABLE_WTMP)
1805 fi
1806 fi
1807fi
1808if test -n "$conf_wtmp_location"; then
1809 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1810fi
1811
1812
1813dnl utmpx detection - I don't know any system so perverse as to require
1814dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1815dnl there, though.
1816AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1817AC_TRY_COMPILE([
1818#include <sys/types.h>
1819#include <utmp.h>
1820#ifdef HAVE_UTMPX_H
1821#include <utmpx.h>
1822#endif
Damien Miller2994e082000-06-04 15:51:47 +10001823#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001824# include <paths.h>
1825#endif
1826 ],
1827 [ char *utmpx = UTMPX_FILE; ],
1828 [ AC_MSG_RESULT(yes) ],
1829 [ AC_MSG_RESULT(no)
1830 system_utmpx_path=no ]
1831)
1832if test -z "$conf_utmpx_location"; then
1833 if test x"$system_utmpx_path" = x"no" ; then
1834 AC_DEFINE(DISABLE_UTMPX)
1835 fi
1836else
1837 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1838fi
1839
1840dnl wtmpx detection
1841AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1842AC_TRY_COMPILE([
1843#include <sys/types.h>
1844#include <utmp.h>
1845#ifdef HAVE_UTMPX_H
1846#include <utmpx.h>
1847#endif
Damien Miller2994e082000-06-04 15:51:47 +10001848#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001849# include <paths.h>
1850#endif
1851 ],
1852 [ char *wtmpx = WTMPX_FILE; ],
1853 [ AC_MSG_RESULT(yes) ],
1854 [ AC_MSG_RESULT(no)
1855 system_wtmpx_path=no ]
1856)
1857if test -z "$conf_wtmpx_location"; then
1858 if test x"$system_wtmpx_path" = x"no" ; then
1859 AC_DEFINE(DISABLE_WTMPX)
1860 fi
1861else
1862 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1863fi
1864
Damien Miller4018c192000-04-30 09:30:44 +10001865
1866# Change default command timeout for builtin PRNG
Damien Miller14c12cb2000-06-07 22:20:23 +10001867entropy_timeout=200
Damien Miller4018c192000-04-30 09:30:44 +10001868AC_ARG_WITH(entropy-timeout,
1869 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1870 [
1871 if test "x$withval" != "xno" ; then
1872 entropy_timeout=$withval
1873 fi
1874 ]
1875)
1876AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1877
1878
Damien Miller29ea30d2000-03-17 10:54:15 +11001879if test ! -z "$blibpath" ; then
1880 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1881 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1882fi
1883
Damien Millerbac2d8a2000-09-05 16:13:06 +11001884AC_EXEEXT
1885
Ben Lindstrom3c06f6a2001-01-31 21:52:01 +00001886AC_OUTPUT(Makefile openbsd-compat/Makefile ssh_prng_cmds)
Damien Miller0437b332000-05-02 09:56:41 +10001887
Damien Miller7b22d652000-06-18 14:07:04 +10001888# Print summary of options
1889
Damien Miller7b22d652000-06-18 14:07:04 +10001890if test ! -z "$RANDOM_POOL" ; then
1891 RAND_MSG="Device ($RANDOM_POOL)"
1892else
Damien Millerd0ccb982001-03-04 00:29:20 +11001893 if test ! -z "$PRNGD_PORT" ; then
1894 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
1895 elif test ! -z "$PRNGD_SOCKET" ; then
1896 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
Damien Miller7b22d652000-06-18 14:07:04 +10001897 else
1898 RAND_MSG="Builtin (timeout $entropy_timeout)"
Damien Miller6f9c3372000-10-25 10:06:04 +11001899 BUILTIN_RNG=1
Damien Miller7b22d652000-06-18 14:07:04 +10001900 fi
1901fi
1902
1903# Someone please show me a better way :)
1904A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1905B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1906C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1907D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00001908E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00001909F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10001910G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Tim Rice59ea0a02001-03-10 13:50:45 -08001911H=`eval echo ${user_path}` ; H=`eval echo ${H}`
Damien Miller7b22d652000-06-18 14:07:04 +10001912
1913echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00001914echo "OpenSSH has been configured with the following options:"
Damien Miller7b22d652000-06-18 14:07:04 +10001915echo " User binaries: $B"
1916echo " System binaries: $C"
1917echo " Configuration files: $D"
1918echo " Askpass program: $E"
1919echo " Manual pages: $F"
1920echo " PID file: $G"
Tim Rice59ea0a02001-03-10 13:50:45 -08001921echo " sshd default user PATH: $H"
Damien Miller7b22d652000-06-18 14:07:04 +10001922echo " Random number collection: $RAND_MSG"
Damien Miller897741e2001-04-16 10:41:46 +10001923echo " Manpage format: $MANTYPE"
Damien Miller7b22d652000-06-18 14:07:04 +10001924echo " PAM support: ${PAM_MSG}"
1925echo " KerberosIV support: $KRB4_MSG"
1926echo " AFS support: $AFS_MSG"
1927echo " S/KEY support: $SKEY_MSG"
1928echo " TCP Wrappers support: $TCPW_MSG"
1929echo " MD5 password support: $MD5_MSG"
1930echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1931echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1932echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1933
Damien Miller60396b02001-02-18 17:01:00 +11001934if test ! -z "$bsd_auth"; then
1935 echo " BSD Auth support: yes"
1936fi
1937
Damien Miller7b22d652000-06-18 14:07:04 +10001938echo ""
1939
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00001940echo " Host: ${host}"
1941echo " Compiler: ${CC}"
1942echo " Compiler flags: ${CFLAGS}"
1943echo "Preprocessor flags: ${CPPFLAGS}"
1944echo " Linker flags: ${LDFLAGS}"
1945echo " Libraries: ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10001946
1947echo ""
1948
Damien Miller82cf0ce2000-12-20 13:34:48 +11001949if test "x$PAM_MSG" = "xyes" ; then
1950 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
1951 echo "otherwise password authentication may fail. Example PAM control files"
1952 echo "can be found in the contrib/ subdirectory"
1953 echo ""
1954fi
1955
Damien Miller6f9c3372000-10-25 10:06:04 +11001956if test ! -z "$BUILTIN_RNG" ; then
1957 echo "WARNING: you are using the builtin random number collection service."
1958 echo "Please read WARNING.RNG and request that your OS vendor includes"
1959 echo "/dev/random in future versions of their OS."
1960 echo ""
1961fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001962
1963if test ! -z "$NO_SFTP"; then
1964 echo "sftp-server will be disabled. Your compiler does not support"
1965 echo "64bit integers."
1966 echo ""
1967fi
Damien Miller60396b02001-02-18 17:01:00 +11001968