blob: 638877edd635add1220b25ef06f2d83d41011b98 [file] [log] [blame]
Damien Millerc79bc0d2001-03-28 13:03:42 +10001# $Id: configure.in,v 1.268 2001/03/28 03:03:42 djm Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Damien Millerab18c411999-11-11 10:40:23 +11003AC_INIT(ssh.c)
Damien Miller7f6ea021999-10-28 13:25:17 +10004
5AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11006AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11007AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11008AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +10009
Damien Millera22ba012000-03-02 23:09:20 +110010# Checks for programs.
Damien Millerab18c411999-11-11 10:40:23 +110011AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100012AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110013AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000014AC_PATH_PROG(AR, ar)
Damien Millere79334a1999-12-29 10:03:37 +110015AC_PATH_PROG(PERL, perl)
16AC_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)
andree441aa32000-06-12 22:34:38 +000061 MANTYPE='$(CATMAN)'
62 mansubdir=cat
andre60f3c982000-06-03 16:18:19 +000063 dnl AIX handles lastlog as part of its login message
64 AC_DEFINE(DISABLE_LASTLOG)
Damien Miller5fc85652000-07-09 23:53:07 +100065 MANTYPE='$(CATMAN)'
66 mansubdir=cat
Damien Miller75b1d102000-01-07 14:01:41 +110067 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110068*-*-cygwin*)
Damien Milleref767ac2000-10-17 23:14:08 +110069 LIBS="$LIBS -lregex /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110070 AC_DEFINE(HAVE_CYGWIN)
Damien Millerbac2d8a2000-09-05 16:13:06 +110071 AC_DEFINE(DISABLE_SHADOW)
72 AC_DEFINE(IPV4_DEFAULT)
73 AC_DEFINE(IP_TOS_IS_BROKEN)
74 AC_DEFINE(BROKEN_VHANGUP)
Ben Lindstrom38e60932001-02-24 00:55:04 +000075 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Damien Millerbac2d8a2000-09-05 16:13:06 +110076 no_libsocket=1
77 no_libnsl=1
78 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000079*-*-dgux*)
80 AC_DEFINE(IP_TOS_IS_BROKEN)
81 ;;
Damien Miller76112de1999-12-21 11:18:08 +110082*-*-hpux10*)
83 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +100084 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +110085 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000086 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110087 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +100088 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110089 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110090 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000091 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Damien Miller8a1e6a62000-09-16 15:55:52 +110092 LIBS="$LIBS -lsec"
Damien Miller670a4b82000-01-22 13:53:11 +110093 MANTYPE='$(CATMAN)'
94 mansubdir=cat
Damien Miller76112de1999-12-21 11:18:08 +110095 ;;
Damien Miller1bead332000-04-30 00:47:29 +100096*-*-hpux11*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000097 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110098 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +110099 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100100 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100101 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100102 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000103 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100104 LIBS="$LIBS -lsec"
Damien Miller1bead332000-04-30 00:47:29 +1000105 MANTYPE='$(CATMAN)'
106 mansubdir=cat
107 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100108*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000109 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000110 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100111 PATH="$PATH:/usr/etc"
Damien Miller07278932000-01-22 14:05:37 +1100112 MANTYPE='$(CATMAN)'
Damien Miller1808f382000-01-06 12:03:12 +1100113 no_libsocket=1
114 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000115 AC_DEFINE(BROKEN_INET_NTOA)
Damien Miller1808f382000-01-06 12:03:12 +1100116 ;;
117*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000118 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000119 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100120 PATH="$PATH:/usr/etc"
Damien Miller07278932000-01-22 14:05:37 +1100121 MANTYPE='$(CATMAN)'
Damien Miller91606b12000-06-28 08:22:29 +1000122 AC_DEFINE(WITH_IRIX_ARRAY)
123 AC_DEFINE(WITH_IRIX_PROJECT)
124 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom4a1d9162000-11-21 10:45:31 +0000125 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100126 no_libsocket=1
127 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000128 AC_DEFINE(BROKEN_INET_NTOA)
Ben Lindstrom75214f92000-12-01 21:19:51 +0000129 mansubdir=man
Damien Millerbeb4ba51999-12-28 15:09:35 +1100130 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100131*-*-linux*)
132 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100133 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100134 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000135 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100136 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100137 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000138mips-sony-bsd|mips-sony-newsos4)
139 AC_DEFINE(HAVE_NEWS4)
140 SONY=1
141 AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT),
Damien Miller5dfe9762001-02-16 12:05:39 +1100142 AC_MSG_ERROR([*** libiberty missing - please install first or check config.log ***])
Ben Lindstromb5628642000-10-18 00:02:25 +0000143 )
144 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100145*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100146 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100147 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100148*-*-freebsd*)
149 check_for_libcrypt_later=1
150 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000151*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000152 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100153 conf_utmp_location=/etc/utmp
154 conf_wtmp_location=/usr/adm/wtmp
155 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000156 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000157 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000158 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100159 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000160 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000161 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000162 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100163*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000164 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000165 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100166 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100167 AC_DEFINE(PAM_SUN_CODEBASE)
andre2ff7b5d2000-06-03 14:57:40 +0000168 # hardwire lastlog location (can't detect it on some versions)
169 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000170 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
171 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
172 if test "$sol2ver" -ge 8; then
173 AC_MSG_RESULT(yes)
174 AC_DEFINE(DISABLE_UTMP)
175 AC_DEFINE(DISABLE_WTMP)
176 else
177 AC_MSG_RESULT(no)
178 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100179 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000180*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000181 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000182 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100183 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller877d8ea2001-02-18 15:29:28 +1100184 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000185 conf_utmp_location=/etc/utmp
186 conf_wtmp_location=/var/adm/wtmp
187 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000188 AC_DEFINE(USE_PIPES)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000189 MANTYPE='$(CATMAN)'
190 mansubdir=cat
Damien Millerdfc83f42000-05-20 15:02:59 +1000191 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000192*-ncr-sysv*)
193 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
194 LDFLAGS="$LDFLAGS -L/usr/local/lib"
195 MANTYPE='$(CATMAN)'
196 mansubdir=cat
197 LIBS="$LIBS -lc89 -lnsl -lgen -lsocket"
198 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000199*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000200 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller2ae714f2000-07-11 09:29:50 +1000201 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
202 MANTYPE='$(CATMAN)'
Damien Millerfd9885e2001-01-10 08:16:53 +1100203 IPADDR_IN_DISPLAY=yes
204 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000205 AC_DEFINE(IP_TOS_IS_BROKEN)
Kevin Steves52dd4682001-03-08 18:26:57 +0000206 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller2ae714f2000-07-11 09:29:50 +1000207 mansubdir=cat
Damien Millerb2dc28e2000-07-12 09:18:33 +1000208 LIBS="$LIBS -lgen -lnsl -lucb"
Damien Miller2ae714f2000-07-11 09:29:50 +1000209 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100210*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000211 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100212 LDFLAGS="$LDFLAGS -L/usr/local/lib"
213 MANTYPE='$(CATMAN)'
214 mansubdir=cat
Damien Miller78315eb2000-09-29 23:01:36 +1100215 enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100216 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100217 ;;
218*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000219 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100220 LDFLAGS="$LDFLAGS -L/usr/local/lib"
221 MANTYPE='$(CATMAN)'
222 mansubdir=cat
Damien Miller78315eb2000-09-29 23:01:36 +1100223 enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100224 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100225 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100226*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000227 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100228 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller0e1cf7c2000-01-26 12:15:30 +1100229 MANTYPE='$(CATMAN)'
230 mansubdir=cat
Damien Miller75b1d102000-01-07 14:01:41 +1100231 LIBS="$LIBS -lgen -lsocket"
232 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100233*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000234 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100235 LDFLAGS="$LDFLAGS -L/usr/local/lib"
236 MANTYPE='$(CATMAN)'
Ben Lindstrom980754c2000-11-12 00:04:24 +0000237 LIBS="$LIBS -lgen -lsocket -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100238 mansubdir=cat
Damien Miller78315eb2000-09-29 23:01:36 +1100239 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100240 RANLIB=true
241 no_dev_ptmx=1
242 AC_DEFINE(BROKEN_SYS_TERMIO_H)
243 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100244 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000245 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000246 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Millerfbd884a2001-02-27 08:39:07 +1100247 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100248 AC_CHECK_FUNCS(getluid setluid)
Damien Miller78315eb2000-09-29 23:01:36 +1100249 ;;
250*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000251 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000252 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100253 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000254 MANTYPE='$(CATMAN)'
255 mansubdir=cat
Damien Millera66626b2000-06-13 18:57:53 +1000256 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100257 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100258 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100259 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000260 AC_DEFINE(DISABLE_SHADOW)
Ben Lindstrom42717bf2000-12-28 15:46:20 +0000261 AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
Damien Miller217f5672001-02-16 12:12:41 +1100262 AC_CHECK_FUNCS(getluid setluid)
Damien Millera66626b2000-06-13 18:57:53 +1000263 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000264*-dec-osf*)
Damien Millerb8c656e2000-06-28 15:22:41 +1000265 if test ! -z "USE_SIA" ; then
266 AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
267 if test -f /etc/sia/matrix.conf; then
268 AC_MSG_RESULT(yes)
269 AC_DEFINE(HAVE_OSF_SIA)
270 AC_DEFINE(DISABLE_LOGIN)
271 LIBS="$LIBS -lsecurity -ldb -lm -laud"
272 else
273 AC_MSG_RESULT(no)
274 fi
275 fi
276 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100277esac
278
Damien Millere37bfc12000-06-05 09:37:43 +1000279# Allow user to specify flags
280AC_ARG_WITH(cflags,
281 [ --with-cflags Specify additional flags to pass to compiler],
282 [
283 if test "x$withval" != "xno" ; then
284 CFLAGS="$CFLAGS $withval"
285 fi
286 ]
287)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000288AC_ARG_WITH(cppflags,
289 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
290 [
291 if test "x$withval" != "xno"; then
292 CPPFLAGS="$CPPFLAGS $withval"
293 fi
294 ]
295)
Damien Millere37bfc12000-06-05 09:37:43 +1000296AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000297 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000298 [
299 if test "x$withval" != "xno" ; then
300 LDFLAGS="$LDFLAGS $withval"
301 fi
302 ]
303)
304AC_ARG_WITH(libs,
305 [ --with-libs Specify additional libraries to link with],
306 [
307 if test "x$withval" != "xno" ; then
308 LIBS="$LIBS $withval"
309 fi
310 ]
311)
312
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000313AC_ARG_WITH(pcre,
314 [ --with-pcre Override built in regex library with pcre],
315 [
316
317 AC_CHECK_LIB(pcre, pcre_info,
318 [
319 AC_DEFINE(HAVE_LIBPCRE)
320 LIBS="$LIBS -lpcreposix -lpcre"
321 no_comp_check="yes"
322 ],
323 [ AC_MSG_ERROR([*** Can not locate pcre libraries.]) ]
324 )
325 ]
326)
Damien Millere37bfc12000-06-05 09:37:43 +1000327
Damien Millera22ba012000-03-02 23:09:20 +1100328# Checks for libraries.
Damien Miller22d5aa72001-02-18 12:49:57 +1100329if test -z "$no_libnsl" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000330 AC_CHECK_LIB(nsl, yp_match, , )
331fi
Damien Miller22d5aa72001-02-18 12:49:57 +1100332if test -z "$no_libsocket" ; then
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000333 AC_CHECK_LIB(socket, main, , )
334fi
335
Damien Millerdf288022001-02-18 13:07:07 +1100336dnl SCO OS3 needs this for libwrap
337AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
338
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000339AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
Damien Miller5dfe9762001-02-16 12:05:39 +1100340AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Millerab18c411999-11-11 10:40:23 +1100341AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Miller6f9c3372000-10-25 10:06:04 +1100342
Ben Lindstrom4e5a0aa2001-02-15 18:16:22 +0000343# We don't want to check if we did an pcre override.
344if test -z "$no_comp_check" ; then
345 AC_CHECK_FUNC(regcomp,
346 [ AC_DEFINE(HAVE_REGCOMP)],
347 [
348 AC_CHECK_LIB(pcre, pcre_info,
349 [
350 AC_DEFINE(HAVE_LIBPCRE)
351 LIBS="$LIBS -lpcreposix -lpcre"
352 ],
353 [
354 AC_MSG_ERROR([*** No regex library found.])
355 ])
356 ]
357 )
358fi
Damien Millerab18c411999-11-11 10:40:23 +1100359
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000360dnl UnixWare 2.x
361AC_CHECK_FUNC(strcasecmp,
362 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
363)
364AC_CHECK_FUNC(utimes,
365 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
366)
Damien Millerab18c411999-11-11 10:40:23 +1100367
Ben Lindstrom8697e082001-02-24 21:41:10 +0000368AC_FUNC_STRFTIME
369
Damien Millera22ba012000-03-02 23:09:20 +1100370# Checks for header files.
Damien Miller3c027682001-03-14 11:39:45 +1100371AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.h glob.h lastlog.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h regex.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/queue.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h sys/un.h stddef.h time.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
372
373# Check for ALTDIRFUNC glob() extension
374AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
375AC_EGREP_CPP(FOUNDIT,
376 [
377 #include <glob.h>
378 #ifdef GLOB_ALTDIRFUNC
379 FOUNDIT
380 #endif
381 ],
382 [
383 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
384 AC_MSG_RESULT(yes)
385 ],
386 [
387 AC_MSG_RESULT(no)
388 ]
389)
Damien Millerab18c411999-11-11 10:40:23 +1100390
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000391# Check for g.gl_matchc glob() extension
392AC_MSG_CHECKING(for gl_matchc field in glob_t)
393AC_EGREP_CPP(FOUNDIT,
394 [
395 #include <glob.h>
396 int main(void){glob_t g; g.gl_matchc = 1;}
397 ],
398 [
399 AC_DEFINE(GLOB_HAS_GL_MATCHC)
400 AC_MSG_RESULT(yes)
401 ],
402 [
403 AC_MSG_RESULT(no)
404 ]
405)
406
Damien Millerc547bf12001-02-16 10:18:12 +1100407# Check whether user wants S/Key support
408SKEY_MSG="no"
409AC_ARG_WITH(skey,
410 [ --with-skey=PATH Enable S/Key support],
411 [
412 if test "x$withval" != "xno" ; then
413
414 if test "x$withval" != "xyes" ; then
415 CPPFLAGS="$CPPFLAGS -I${withval}/include"
416 LDFLAGS="$LDFLAGS -L${withval}/lib"
417 fi
418
419 AC_DEFINE(SKEY)
420 LIBS="-lskey $LIBS"
421 SKEY_MSG="yes"
422
423 AC_CHECK_FUNC(skey_keyinfo,
424 [],
425 [
426 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
427 ])
428 fi
429 ]
430)
431
432# Check whether user wants TCP wrappers support
433TCPW_MSG="no"
434AC_ARG_WITH(tcp-wrappers,
435 [ --with-tcp-wrappers Enable tcpwrappers support],
436 [
437 if test "x$withval" != "xno" ; then
438 saved_LIBS="$LIBS"
439 LIBS="-lwrap $LIBS"
440 AC_MSG_CHECKING(for libwrap)
441 AC_TRY_LINK(
442 [
443#include <tcpd.h>
444 int deny_severity = 0, allow_severity = 0;
445 ],
446 [hosts_access(0);],
447 [
448 AC_MSG_RESULT(yes)
449 AC_DEFINE(LIBWRAP)
450 TCPW_MSG="yes"
451 ],
452 [
453 AC_MSG_ERROR([*** libwrap missing])
454 ]
455 )
456 fi
457 ]
458)
459
Damien Millerad833b32000-08-23 10:46:23 +1000460dnl Checks for library functions.
Damien Miller9de61e82001-03-19 10:09:27 +1100461AC_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 innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setdtablesize setenv seteuid setlogin setproctitle 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 +1000462dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000463AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000464dnl Checks for libutil functions
Ben Lindstrome2fb8d32000-12-28 00:07:07 +0000465AC_CHECK_HEADERS(libutil.h)
andre2ff7b5d2000-06-03 14:57:40 +0000466AC_CHECK_FUNCS(login logout updwtmp logwtmp)
Damien Millerad833b32000-08-23 10:46:23 +1000467dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000468AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000469AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000470dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000471AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000472AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100473
Damien Miller5fc85652000-07-09 23:53:07 +1000474AC_CHECK_FUNC(getuserattr,
475 [AC_DEFINE(HAVE_GETUSERATTR)],
476 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
477)
478
Damien Miller04f80141999-11-19 15:32:34 +1100479AC_CHECK_FUNC(login,
480 [AC_DEFINE(HAVE_LOGIN)],
481 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
482)
483
484AC_CHECK_FUNC(daemon,
485 [AC_DEFINE(HAVE_DAEMON)],
486 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
487)
488
Damien Miller9fb07e42000-03-05 16:22:59 +1100489AC_CHECK_FUNC(getpagesize,
490 [AC_DEFINE(HAVE_GETPAGESIZE)],
491 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
492)
493
Damien Millercb170cb2000-07-01 16:52:55 +1000494# Check for broken snprintf
495if test "x$ac_cv_func_snprintf" = "xyes" ; then
496 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
497 AC_TRY_RUN(
498 [
499#include <stdio.h>
500int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
501 ],
502 [AC_MSG_RESULT(yes)],
503 [
504 AC_MSG_RESULT(no)
505 AC_DEFINE(BROKEN_SNPRINTF)
506 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
507 ]
508 )
509fi
510
Damien Miller606f8802000-09-16 15:39:56 +1100511AC_FUNC_GETPGRP
512
Damien Millera64b57a2001-01-17 10:44:13 +1100513# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000514PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100515AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100516 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100517 [
Damien Millera64b57a2001-01-17 10:44:13 +1100518 if test "x$withval" != "xno" ; then
519 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
520 AC_MSG_ERROR([PAM headers not found])
521 fi
522
523 AC_CHECK_LIB(dl, dlopen, , )
524 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
525 AC_CHECK_FUNCS(pam_getenvlist)
526
527 disable_shadow=yes
528 PAM_MSG="yes"
529
530 AC_DEFINE(USE_PAM)
Damien Millera22ba012000-03-02 23:09:20 +1100531 fi
532 ]
533)
Damien Millera22ba012000-03-02 23:09:20 +1100534
Damien Millera64b57a2001-01-17 10:44:13 +1100535# Check for older PAM
536if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100537 # Check PAM strerror arguments (old PAM)
538 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
539 AC_TRY_COMPILE(
540 [
Damien Miller81171112000-04-23 11:14:01 +1000541#include <stdlib.h>
542#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100543 ],
544 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
545 [AC_MSG_RESULT(no)],
546 [
547 AC_DEFINE(HAVE_OLD_PAM)
548 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000549 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100550 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100551 )
Damien Millera22ba012000-03-02 23:09:20 +1100552fi
553
554# The big search for OpenSSL
555AC_ARG_WITH(ssl-dir,
556 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
557 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000558 if test "x$withval" != "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100559 tryssldir=$withval
560 fi
561 ]
562)
563
564saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100565saved_LDFLAGS="$LDFLAGS"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000566saved_CPPFLAGS="$CPPFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100567if test "x$prefix" != "xNONE" ; then
568 tryssldir="$tryssldir $prefix"
569fi
Damien Miller61e50f12000-05-08 20:49:37 +1000570AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera1b61e12000-09-16 17:02:16 +1100571 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 +1100572 CPPFLAGS="$saved_CPPFLAGS"
573 LDFLAGS="$saved_LDFLAGS"
Damien Miller3b512e12000-05-17 23:29:18 +1000574 LIBS="$saved_LIBS -lcrypto"
Damien Millerccdefb62001-02-19 12:56:39 +1100575
576 # Skip directories if they don't exist
577 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
578 continue;
579 fi
580 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
581 # Try to use $ssldir/lib if it exists, otherwise
582 # $ssldir
583 if test -d "$ssldir/lib" ; then
Ben Lindstrom5eff0312001-02-21 02:35:37 +0000584 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib"
Damien Millerccdefb62001-02-19 12:56:39 +1100585 if test ! -z "$need_dash_r" ; then
586 LDFLAGS="$LDFLAGS -R$ssldir/lib"
587 fi
588 else
Ben Lindstrom5eff0312001-02-21 02:35:37 +0000589 LDFLAGS="$saved_LDFLAGS -L$ssldir"
Damien Millerccdefb62001-02-19 12:56:39 +1100590 if test ! -z "$need_dash_r" ; then
591 LDFLAGS="$LDFLAGS -R$ssldir"
592 fi
593 fi
594 # Try to use $ssldir/include if it exists, otherwise
595 # $ssldir
596 if test -d "$ssldir/include" ; then
Ben Lindstrom4ef92b52001-02-23 05:05:53 +0000597 CPPFLAGS="$saved_CPPFLAGS -I$ssldir/include"
Damien Millerccdefb62001-02-19 12:56:39 +1100598 else
Ben Lindstrom4ef92b52001-02-23 05:05:53 +0000599 CPPFLAGS="$saved_CPPFLAGS -I$ssldir"
Damien Millerccdefb62001-02-19 12:56:39 +1100600 fi
601 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000602
Damien Miller3b512e12000-05-17 23:29:18 +1000603 # Basic test to check for compatible version and correct linking
604 # *does not* test for RSA - that comes later.
605 AC_TRY_RUN(
606 [
Damien Millere59ce622000-05-01 20:54:17 +1000607#include <string.h>
608#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000609int main(void)
610{
Damien Miller3b512e12000-05-17 23:29:18 +1000611 char a[2048];
612 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000613 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000614 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000615}
Damien Miller3b512e12000-05-17 23:29:18 +1000616 ],
617 [
618 found_crypto=1
619 break;
620 ], []
621 )
Damien Miller61e50f12000-05-08 20:49:37 +1000622
623 if test ! -z "$found_crypto" ; then
624 break;
625 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100626 done
627
Damien Miller61e50f12000-05-08 20:49:37 +1000628 if test -z "$found_crypto" ; then
Damien Miller5dfe9762001-02-16 12:05:39 +1100629 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
Damien Millerb85dcad2000-03-11 11:37:00 +1100630 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000631 if test -z "$ssldir" ; then
632 ssldir="(system)"
633 fi
Damien Millera22ba012000-03-02 23:09:20 +1100634
Damien Miller61e50f12000-05-08 20:49:37 +1000635 ac_cv_openssldir=$ssldir
636])
637
Damien Milleredb82922000-06-20 13:25:52 +1000638if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000639 AC_DEFINE(HAVE_OPENSSL)
640 dnl Need to recover ssldir - test above runs in subshell
641 ssldir=$ac_cv_openssldir
Damien Millera64b57a2001-01-17 10:44:13 +1100642 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
Damien Millerccdefb62001-02-19 12:56:39 +1100643 # Try to use $ssldir/lib if it exists, otherwise
644 # $ssldir
645 if test -d "$ssldir/lib" ; then
Ben Lindstrom5eff0312001-02-21 02:35:37 +0000646 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib"
Damien Millerccdefb62001-02-19 12:56:39 +1100647 if test ! -z "$need_dash_r" ; then
648 LDFLAGS="$LDFLAGS -R$ssldir/lib"
649 fi
650 else
Ben Lindstrom5eff0312001-02-21 02:35:37 +0000651 LDFLAGS="$saved_LDFLAGS -L$ssldir"
Damien Millerccdefb62001-02-19 12:56:39 +1100652 if test ! -z "$need_dash_r" ; then
653 LDFLAGS="$LDFLAGS -R$ssldir"
654 fi
Damien Millera64b57a2001-01-17 10:44:13 +1100655 fi
Damien Millerccdefb62001-02-19 12:56:39 +1100656 # Try to use $ssldir/include if it exists, otherwise
657 # $ssldir
658 if test -d "$ssldir/include" ; then
Ben Lindstrom4ef92b52001-02-23 05:05:53 +0000659 CPPFLAGS="$saved_CPPFLAGS -I$ssldir/include"
Damien Millerccdefb62001-02-19 12:56:39 +1100660 else
Ben Lindstrom4ef92b52001-02-23 05:05:53 +0000661 CPPFLAGS="$saved_CPPFLAGS -I$ssldir"
Damien Millera64b57a2001-01-17 10:44:13 +1100662 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100663 fi
Damien Millera22ba012000-03-02 23:09:20 +1100664fi
Damien Miller3b512e12000-05-17 23:29:18 +1000665LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000666
Damien Miller3b512e12000-05-17 23:29:18 +1000667# Now test RSA support
668saved_LIBS="$LIBS"
669AC_MSG_CHECKING([for RSA support])
670for WANTS_RSAREF in "" 1 ; do
671 if test -z "$WANTS_RSAREF" ; then
672 LIBS="$saved_LIBS"
673 else
674 LIBS="$saved_LIBS -lRSAglue -lrsaref"
675 fi
676 AC_TRY_RUN([
677#include <string.h>
678#include <openssl/rand.h>
679#include <openssl/rsa.h>
680#include <openssl/bn.h>
681#include <openssl/sha.h>
682int main(void)
683{
684 int num; RSA *key; static unsigned char p_in[] = "blahblah";
685 unsigned char c[256], p[256];
686 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
687 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
688 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
689 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
690}
691 ],
692 [
693 rsa_works=1
694 break;
695 ], [])
696done
697
698if test ! -z "$no_rsa" ; then
699 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000700 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000701else
702 if test -z "$rsa_works" ; then
703 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000704 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000705 else
706 if test -z "$WANTS_RSAREF" ; then
707 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000708 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000709 else
Damien Miller7b22d652000-06-18 14:07:04 +1000710 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000711 AC_MSG_RESULT(using RSAref)
712 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
713 fi
714 fi
715fi
Damien Millera22ba012000-03-02 23:09:20 +1100716
Damien Millera64b57a2001-01-17 10:44:13 +1100717# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
718# version in OpenSSL. Skip this for PAM
719if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100720 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100721fi
722
Ben Lindstromb5628642000-10-18 00:02:25 +0000723# Cheap hack to ensure NEWS-OS libraries are arranged right.
724if test ! -z "$SONY" ; then
725 LIBS="$LIBS -liberty";
726fi
727
Damien Millera22ba012000-03-02 23:09:20 +1100728# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100729AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100730AC_CHECK_SIZEOF(short int, 2)
731AC_CHECK_SIZEOF(int, 4)
732AC_CHECK_SIZEOF(long int, 4)
733AC_CHECK_SIZEOF(long long int, 8)
734
Damien Millera22ba012000-03-02 23:09:20 +1100735# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +1100736AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
737 AC_TRY_COMPILE(
738 [ #include <sys/types.h> ],
739 [ u_int a; a = 1;],
740 [ ac_cv_have_u_int="yes" ],
741 [ ac_cv_have_u_int="no" ]
742 )
743])
744if test "x$ac_cv_have_u_int" = "xyes" ; then
745 AC_DEFINE(HAVE_U_INT)
746 have_u_int=1
747fi
748
Damien Miller61e50f12000-05-08 20:49:37 +1000749AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
750 AC_TRY_COMPILE(
751 [ #include <sys/types.h> ],
752 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
753 [ ac_cv_have_intxx_t="yes" ],
754 [ ac_cv_have_intxx_t="no" ]
755 )
756])
757if test "x$ac_cv_have_intxx_t" = "xyes" ; then
758 AC_DEFINE(HAVE_INTXX_T)
759 have_intxx_t=1
760fi
761
Damien Miller578783e2000-09-23 14:12:24 +1100762AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
763 AC_TRY_COMPILE(
764 [ #include <sys/types.h> ],
765 [ int64_t a; a = 1;],
766 [ ac_cv_have_int64_t="yes" ],
767 [ ac_cv_have_int64_t="no" ]
768 )
769])
770if test "x$ac_cv_have_int64_t" = "xyes" ; then
771 AC_DEFINE(HAVE_INT64_T)
772 have_int64_t=1
773fi
774
Damien Miller61e50f12000-05-08 20:49:37 +1000775AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
776 AC_TRY_COMPILE(
777 [ #include <sys/types.h> ],
778 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
779 [ ac_cv_have_u_intxx_t="yes" ],
780 [ ac_cv_have_u_intxx_t="no" ]
781 )
782])
783if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
784 AC_DEFINE(HAVE_U_INTXX_T)
785 have_u_intxx_t=1
786fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100787
Damien Miller578783e2000-09-23 14:12:24 +1100788AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
789 AC_TRY_COMPILE(
790 [ #include <sys/types.h> ],
791 [ u_int64_t a; a = 1;],
792 [ ac_cv_have_u_int64_t="yes" ],
793 [ ac_cv_have_u_int64_t="no" ]
794 )
795])
796if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
797 AC_DEFINE(HAVE_U_INT64_T)
798 have_u_int64_t=1
799fi
800
Damien Milleredb82922000-06-20 13:25:52 +1000801if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
802 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +1100803then
804 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
805 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +1000806 [
807#include <sys/bitypes.h>
808 ],
Damien Millerb29ea912000-01-15 14:12:03 +1100809 [
Damien Miller70494d12000-04-03 15:57:06 +1000810 int8_t a; int16_t b; int32_t c;
811 u_int8_t e; u_int16_t f; u_int32_t g;
812 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +1100813 ],
814 [
815 AC_DEFINE(HAVE_U_INTXX_T)
816 AC_DEFINE(HAVE_INTXX_T)
817 AC_MSG_RESULT(yes)
818 ],
819 [AC_MSG_RESULT(no)]
820 )
821fi
822
Damien Millerd6121d22000-03-17 23:26:46 +1100823if test -z "$have_u_intxx_t" ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000824 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
825 AC_TRY_COMPILE(
826 [
827#include <sys/types.h>
828 ],
829 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
830 [ ac_cv_have_uintxx_t="yes" ],
831 [ ac_cv_have_uintxx_t="no" ]
832 )
833 ])
834 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
835 AC_DEFINE(HAVE_UINTXX_T)
836 fi
Damien Millerd6121d22000-03-17 23:26:46 +1100837fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100838
Damien Miller61e50f12000-05-08 20:49:37 +1000839AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
840 AC_TRY_COMPILE(
841 [
Damien Miller81171112000-04-23 11:14:01 +1000842#include <sys/types.h>
843#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000844 ],
845 [socklen_t foo; foo = 1235;],
846 [ ac_cv_have_socklen_t="yes" ],
847 [ ac_cv_have_socklen_t="no" ]
848 )
849])
850if test "x$ac_cv_have_socklen_t" = "xyes" ; then
851 AC_DEFINE(HAVE_SOCKLEN_T)
852fi
Damien Miller74d0d4a1999-12-29 02:24:35 +1100853
Damien Miller61e50f12000-05-08 20:49:37 +1000854AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
855 AC_TRY_COMPILE(
856 [
857#include <sys/types.h>
858 ],
859 [ size_t foo; foo = 1235; ],
860 [ ac_cv_have_size_t="yes" ],
861 [ ac_cv_have_size_t="no" ]
862 )
863])
864if test "x$ac_cv_have_size_t" = "xyes" ; then
865 AC_DEFINE(HAVE_SIZE_T)
866fi
Damien Miller95058511999-12-29 10:36:45 +1100867
Damien Miller615f9392000-05-17 22:53:33 +1000868AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
869 AC_TRY_COMPILE(
870 [
871#include <sys/types.h>
872 ],
873 [ ssize_t foo; foo = 1235; ],
874 [ ac_cv_have_ssize_t="yes" ],
875 [ ac_cv_have_ssize_t="no" ]
876 )
877])
878if test "x$ac_cv_have_ssize_t" = "xyes" ; then
879 AC_DEFINE(HAVE_SSIZE_T)
880fi
881
Ben Lindstrom0d5af602001-01-09 00:50:29 +0000882AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
883 AC_TRY_COMPILE(
884 [
885#include <time.h>
886 ],
887 [ clock_t foo; foo = 1235; ],
888 [ ac_cv_have_clock_t="yes" ],
889 [ ac_cv_have_clock_t="no" ]
890 )
891])
892if test "x$ac_cv_have_clock_t" = "xyes" ; then
893 AC_DEFINE(HAVE_CLOCK_T)
894fi
895
Damien Millerb54b40e2000-06-23 08:23:34 +1000896AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
897 AC_TRY_COMPILE(
898 [
899#include <sys/types.h>
900#include <sys/socket.h>
901 ],
902 [ sa_family_t foo; foo = 1235; ],
903 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +1100904 [ AC_TRY_COMPILE(
905 [
906#include <sys/types.h>
907#include <sys/socket.h>
908#include <netinet/in.h>
909 ],
910 [ sa_family_t foo; foo = 1235; ],
911 [ ac_cv_have_sa_family_t="yes" ],
912
Damien Millerb54b40e2000-06-23 08:23:34 +1000913 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +1100914 )]
Damien Millerb54b40e2000-06-23 08:23:34 +1000915 )
916])
917if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
918 AC_DEFINE(HAVE_SA_FAMILY_T)
919fi
920
Damien Miller0f91b4e2000-06-18 15:43:25 +1000921AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
922 AC_TRY_COMPILE(
923 [
924#include <sys/types.h>
925 ],
926 [ pid_t foo; foo = 1235; ],
927 [ ac_cv_have_pid_t="yes" ],
928 [ ac_cv_have_pid_t="no" ]
929 )
930])
931if test "x$ac_cv_have_pid_t" = "xyes" ; then
932 AC_DEFINE(HAVE_PID_T)
933fi
934
935AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
936 AC_TRY_COMPILE(
937 [
938#include <sys/types.h>
939 ],
940 [ mode_t foo; foo = 1235; ],
941 [ ac_cv_have_mode_t="yes" ],
942 [ ac_cv_have_mode_t="no" ]
943 )
944])
945if test "x$ac_cv_have_mode_t" = "xyes" ; then
946 AC_DEFINE(HAVE_MODE_T)
947fi
948
Damien Miller61e50f12000-05-08 20:49:37 +1000949
950AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
951 AC_TRY_COMPILE(
952 [
Damien Miller81171112000-04-23 11:14:01 +1000953#include <sys/types.h>
954#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000955 ],
956 [ struct sockaddr_storage s; ],
957 [ ac_cv_have_struct_sockaddr_storage="yes" ],
958 [ ac_cv_have_struct_sockaddr_storage="no" ]
959 )
960])
961if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
962 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
963fi
Damien Miller34132e52000-01-14 15:45:46 +1100964
Damien Miller61e50f12000-05-08 20:49:37 +1000965AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
966 AC_TRY_COMPILE(
967 [
Damien Miller7b22d652000-06-18 14:07:04 +1000968#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000969#include <netinet/in.h>
970 ],
971 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
972 [ ac_cv_have_struct_sockaddr_in6="yes" ],
973 [ ac_cv_have_struct_sockaddr_in6="no" ]
974 )
975])
976if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
977 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
978fi
Damien Miller34132e52000-01-14 15:45:46 +1100979
Damien Miller61e50f12000-05-08 20:49:37 +1000980AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
981 AC_TRY_COMPILE(
982 [
Damien Miller7b22d652000-06-18 14:07:04 +1000983#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000984#include <netinet/in.h>
985 ],
986 [ struct in6_addr s; s.s6_addr[0] = 0; ],
987 [ ac_cv_have_struct_in6_addr="yes" ],
988 [ ac_cv_have_struct_in6_addr="no" ]
989 )
990])
991if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
992 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
993fi
Damien Miller34132e52000-01-14 15:45:46 +1100994
Damien Miller61e50f12000-05-08 20:49:37 +1000995AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
996 AC_TRY_COMPILE(
997 [
Damien Miller81171112000-04-23 11:14:01 +1000998#include <sys/types.h>
999#include <sys/socket.h>
1000#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001001 ],
1002 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1003 [ ac_cv_have_struct_addrinfo="yes" ],
1004 [ ac_cv_have_struct_addrinfo="no" ]
1005 )
1006])
1007if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1008 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1009fi
1010
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001011AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1012 AC_TRY_COMPILE(
1013 [ #include <sys/time.h> ],
1014 [ struct timeval tv; tv.tv_sec = 1;],
1015 [ ac_cv_have_struct_timeval="yes" ],
1016 [ ac_cv_have_struct_timeval="no" ]
1017 )
1018])
1019if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1020 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1021 have_struct_timeval=1
1022fi
1023
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001024# If we don't have int64_t then we can't compile sftp-server. So don't
1025# even attempt to do it.
1026if test "x$ac_cv_have_int64_t" = "xno" -a \
1027 "x$ac_cv_sizeof_long_int" != "x8" -a \
1028 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1029 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001030else
1031dnl test snprintf (broken on SCO w/gcc)
1032 AC_TRY_RUN(
1033 [
1034#include <stdio.h>
1035#include <string.h>
1036#ifdef HAVE_SNPRINTF
1037main()
1038{
1039 char buf[50];
1040 char expected_out[50];
1041 int mazsize = 50 ;
1042#if (SIZEOF_LONG_INT == 8)
1043 long int num = 0x7fffffffffffffff;
1044#else
1045 long long num = 0x7fffffffffffffff;
1046#endif
1047 strcpy(expected_out, "9223372036854775807");
1048 snprintf(buf, mazsize, "%lld", num);
1049 if(strcmp(buf, expected_out) != 0)
1050 exit(1);
1051 exit(0);
1052}
1053#else
1054main() { exit(0); }
1055#endif
1056 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1057 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001058fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001059AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001060
Damien Miller78315eb2000-09-29 23:01:36 +11001061dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001062OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1063OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1064OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1065OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1066OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001067OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001068OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1069OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001070OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001071OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1072OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1073OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1074OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001075OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1076OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1077OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1078OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Damien Miller78315eb2000-09-29 23:01:36 +11001079AC_STRUCT_ST_BLKSIZE
andre2ff7b5d2000-06-03 14:57:40 +00001080
Damien Miller942da032000-08-18 13:59:06 +10001081AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
1082 ac_cv_have_sun_len_in_struct_sockaddr_un, [
1083 AC_TRY_COMPILE(
1084 [
1085#include <sys/types.h>
1086#include <sys/socket.h>
1087 ],
1088 [ struct sockaddr_un s; s.sun_len = 1; ],
1089 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
1090 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
1091 )
1092])
1093if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
1094 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
1095fi
1096
Damien Miller61e50f12000-05-08 20:49:37 +10001097AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1098 ac_cv_have_ss_family_in_struct_ss, [
1099 AC_TRY_COMPILE(
1100 [
Damien Miller81171112000-04-23 11:14:01 +10001101#include <sys/types.h>
1102#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001103 ],
1104 [ struct sockaddr_storage s; s.ss_family = 1; ],
1105 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1106 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1107 )
1108])
1109if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1110 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1111fi
1112
Damien Miller61e50f12000-05-08 20:49:37 +10001113AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1114 ac_cv_have___ss_family_in_struct_ss, [
1115 AC_TRY_COMPILE(
1116 [
Damien Miller81171112000-04-23 11:14:01 +10001117#include <sys/types.h>
1118#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001119 ],
1120 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1121 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1122 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1123 )
1124])
1125if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1126 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1127fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001128
Damien Millerad833b32000-08-23 10:46:23 +10001129AC_CACHE_CHECK([for pw_class field in struct passwd],
1130 ac_cv_have_pw_class_in_struct_passwd, [
1131 AC_TRY_COMPILE(
1132 [
Damien Millerad833b32000-08-23 10:46:23 +10001133#include <pwd.h>
1134 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001135 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001136 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1137 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1138 )
1139])
1140if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1141 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1142fi
1143
Damien Miller61e50f12000-05-08 20:49:37 +10001144
1145AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1146 AC_TRY_LINK([],
1147 [ extern char *__progname; printf("%s", __progname); ],
1148 [ ac_cv_libc_defines___progname="yes" ],
1149 [ ac_cv_libc_defines___progname="no" ]
1150 )
1151])
1152if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1153 AC_DEFINE(HAVE___PROGNAME)
1154fi
1155
Damien Millera22ba012000-03-02 23:09:20 +11001156
Damien Millerecbb26d2000-07-15 14:59:14 +10001157AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1158 AC_TRY_LINK([],
1159 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1160 [ ac_cv_libc_defines_sys_errlist="yes" ],
1161 [ ac_cv_libc_defines_sys_errlist="no" ]
1162 )
1163])
1164if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1165 AC_DEFINE(HAVE_SYS_ERRLIST)
1166fi
1167
1168
Damien Miller11fa2cc2000-08-16 10:35:58 +10001169AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1170 AC_TRY_LINK([],
1171 [ extern int sys_nerr; printf("%i", sys_nerr);],
1172 [ ac_cv_libc_defines_sys_nerr="yes" ],
1173 [ ac_cv_libc_defines_sys_nerr="no" ]
1174 )
1175])
1176if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1177 AC_DEFINE(HAVE_SYS_NERR)
1178fi
1179
1180
Damien Millerc79bc0d2001-03-28 13:03:42 +10001181# Check whether user wants Kerberos support
1182KRB4_MSG="no"
1183AC_ARG_WITH(kerberos4,
1184 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1185 [
1186 if test "x$withval" != "xno" ; then
1187
1188 if test "x$withval" != "xyes" ; then
1189 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1190 LDFLAGS="$LDFLAGS -L${withval}/lib"
1191 if test ! -z "$need_dash_r" ; then
1192 LDFLAGS="$LDFLAGS -R${withval}/lib"
1193 fi
1194 if test ! -z "$blibpath" ; then
1195 blibpath="$blibpath:${withval}/lib"
1196 fi
1197 else
1198 if test -d /usr/include/kerberosIV ; then
1199 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1200 fi
1201 fi
1202
1203 AC_CHECK_HEADERS(krb.h)
1204 AC_CHECK_LIB(krb, main)
1205 if test "$ac_cv_header_krb_h" != yes; then
1206 AC_MSG_WARN([Cannot find krb.h, build may fail])
1207 fi
1208 if test "$ac_cv_lib_krb_main" != yes; then
1209 AC_MSG_WARN([Cannot find libkrb, build may fail])
1210 fi
1211
1212 KLIBS="-lkrb -ldes"
1213 AC_CHECK_LIB(resolv, dn_expand, , )
1214 KRB4=yes
1215 KRB4_MSG="yes"
1216 AC_DEFINE(KRB4)
1217 fi
1218 ]
1219)
1220
1221# Check whether user wants AFS support
1222AFS_MSG="no"
1223AC_ARG_WITH(afs,
1224 [ --with-afs=PATH Enable AFS support],
1225 [
1226 if test "x$withval" != "xno" ; then
1227
1228 if test "x$withval" != "xyes" ; then
1229 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1230 LDFLAGS="$LDFLAGS -L${withval}/lib"
1231 fi
1232
1233 if test -z "$KRB4" ; then
1234 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1235 fi
1236
1237 LIBS="-lkafs $LIBS"
1238 if test ! -z "$AFS_LIBS" ; then
1239 LIBS="$LIBS $AFS_LIBS"
1240 fi
1241 AC_DEFINE(AFS)
1242 AFS_MSG="yes"
1243 fi
1244 ]
1245)
1246LIBS="$LIBS $KLIBS"
1247
Damien Millera22ba012000-03-02 23:09:20 +11001248# Looking for programs, paths and files
1249AC_ARG_WITH(rsh,
1250 [ --with-rsh=PATH Specify path to remote shell program ],
1251 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001252 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001253 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001254 fi
1255 ],
1256 [
1257 AC_PATH_PROG(rsh_path, rsh)
1258 ]
1259)
1260
1261AC_ARG_WITH(xauth,
1262 [ --with-xauth=PATH Specify path to xauth program ],
1263 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001264 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001265 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001266 fi
1267 ],
1268 [
Damien Miller78315eb2000-09-29 23:01:36 +11001269 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 +10001270 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001271 xauth_path="/usr/openwin/bin/xauth"
1272 fi
1273 ]
1274)
1275
Damien Millera19cf472000-11-29 13:28:50 +11001276if test -z "$xauth_path" ; then
1277 XAUTH_PATH="undefined"
1278 AC_SUBST(XAUTH_PATH)
1279else
Damien Millera22ba012000-03-02 23:09:20 +11001280 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001281 XAUTH_PATH=$xauth_path
1282 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001283fi
1284if test ! -z "$rsh_path" ; then
1285 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1286fi
1287
1288# Check for mail directory (last resort if we cannot get it from headers)
1289if test ! -z "$MAIL" ; then
1290 maildir=`dirname $MAIL`
1291 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1292fi
1293
Damien Millera22ba012000-03-02 23:09:20 +11001294if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +11001295 AC_CHECK_FILE("/dev/ptmx",
1296 [
1297 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1298 have_dev_ptmx=1
1299 ]
1300 )
Damien Millera22ba012000-03-02 23:09:20 +11001301fi
Damien Miller204ad072000-03-02 23:56:12 +11001302AC_CHECK_FILE("/dev/ptc",
1303 [
1304 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1305 have_dev_ptc=1
1306 ]
1307)
1308
Damien Millera22ba012000-03-02 23:09:20 +11001309# Options from here on. Some of these are preset by platform above
1310
Damien Millera22ba012000-03-02 23:09:20 +11001311# Check for user-specified random device, otherwise check /dev/urandom
1312AC_ARG_WITH(random,
Damien Miller0736c4d2001-01-25 10:51:46 +11001313 [ --with-random=FILE read entropy from FILE (default=/dev/urandom)],
Damien Millera22ba012000-03-02 23:09:20 +11001314 [
Damien Miller040f3832000-04-03 14:50:43 +10001315 if test "x$withval" != "xno" ; then
1316 RANDOM_POOL="$withval";
1317 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1318 fi
Damien Millera22ba012000-03-02 23:09:20 +11001319 ],
1320 [
1321 # Check for random device
1322 AC_CHECK_FILE("/dev/urandom",
1323 [
1324 RANDOM_POOL="/dev/urandom";
1325 AC_SUBST(RANDOM_POOL)
1326 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
1327 ]
1328 )
1329 ]
1330)
1331
Damien Millerd0ccb982001-03-04 00:29:20 +11001332# Check for PRNGD/EGD pool file
1333AC_ARG_WITH(prngd-port,
1334 [ --with-prngd-port=PORT read entropy from PRNGD/EGD localhost:PORT],
1335 [
1336 if test ! -z "$withval" -a "x$withval" != "xno" ; then
1337 PRNGD_PORT="$withval"
1338 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1339 fi
1340 ]
1341)
1342
1343# Check for PRNGD/EGD pool file
1344AC_ARG_WITH(prngd-socket,
1345 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
Damien Millera22ba012000-03-02 23:09:20 +11001346 [
Damien Miller040f3832000-04-03 14:50:43 +10001347 if test "x$withval" != "xno" ; then
Damien Millerd0ccb982001-03-04 00:29:20 +11001348 PRNGD_SOCKET="$withval"
1349 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller040f3832000-04-03 14:50:43 +10001350 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001351 ],
1352 [
1353 # Check for existing socket only if we don't have a random device already
1354 if test -z "$RANDOM_POOL" ; then
1355 AC_MSG_CHECKING(for PRNGD/EGD socket)
1356 # Insert other locations here
Tim Ricebee3f222001-03-11 17:32:12 -08001357 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
Damien Millerd0ccb982001-03-04 00:29:20 +11001358 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1359 PRNGD_SOCKET="$sock"
1360 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
Damien Miller0736c4d2001-01-25 10:51:46 +11001361 break;
1362 fi
1363 done
Damien Millerd0ccb982001-03-04 00:29:20 +11001364 if test ! -z "$PRNGD_SOCKET" ; then
1365 AC_MSG_RESULT($PRNGD_SOCKET)
Damien Miller4864e8f2001-02-08 10:07:08 +11001366 else
1367 AC_MSG_RESULT(not found)
1368 fi
Damien Miller0736c4d2001-01-25 10:51:46 +11001369 fi
Damien Millera22ba012000-03-02 23:09:20 +11001370 ]
1371)
1372
Damien Miller0736c4d2001-01-25 10:51:46 +11001373
Damien Miller0437b332000-05-02 09:56:41 +10001374# detect pathnames for entropy gathering commands, if we need them
1375INSTALL_SSH_PRNG_CMDS=""
1376rm -f prng_commands
Damien Millerd0ccb982001-03-04 00:29:20 +11001377if (test -z "$RANDOM_POOL" && test -z "$PRNGD") ; then
Damien Miller11e37f62000-04-08 18:23:30 +10001378 # Use these commands to collect entropy
Damien Miller61e50f12000-05-08 20:49:37 +10001379 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1380 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1381 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1382 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1383 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1384 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1385 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1386 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1387 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1388 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1389 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1390 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1391 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1392 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Damien Miller0437b332000-05-02 09:56:41 +10001393
1394 INSTALL_SSH_PRNG_CMDS="yes"
Damien Miller11e37f62000-04-08 18:23:30 +10001395fi
Damien Miller0437b332000-05-02 09:56:41 +10001396AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1397
Damien Miller11e37f62000-04-08 18:23:30 +10001398
Damien Miller670a4b82000-01-22 13:53:11 +11001399AC_ARG_WITH(catman,
1400 [ --with-catman=man|cat Install preformatted manpages[no]],
1401 [
1402 MANTYPE='$(CATMAN)'
1403 if test x"$withval" != x"yes" ; then
1404 mansubdir=$withval
1405 else
1406 mansubdir=cat
1407 fi
1408 ], [
1409 if test -z "$MANTYPE" ; then
1410 MANTYPE='$(TROFFMAN)'
1411 mansubdir=man
1412 fi
1413 ]
1414)
1415AC_SUBST(MANTYPE)
1416AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001417
Damien Millera22ba012000-03-02 23:09:20 +11001418# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001419MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001420AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001421 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001422 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001423 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001424 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001425 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001426 fi
1427 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001428)
1429
Damien Millera22ba012000-03-02 23:09:20 +11001430# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001431AC_ARG_WITH(shadow,
1432 [ --without-shadow Disable shadow password support],
1433 [
1434 if test "x$withval" = "xno" ; then
1435 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001436 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001437 fi
1438 ]
1439)
1440
Damien Miller1f335fb2000-06-26 11:31:33 +10001441if test -z "$disable_shadow" ; then
1442 AC_MSG_CHECKING([if the systems has expire shadow information])
1443 AC_TRY_COMPILE(
1444 [
1445#include <sys/types.h>
1446#include <shadow.h>
1447 struct spwd sp;
1448 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1449 [ sp_expire_available=yes ], []
1450 )
1451
1452 if test "x$sp_expire_available" = "xyes" ; then
1453 AC_MSG_RESULT(yes)
1454 AC_DEFINE(HAS_SHADOW_EXPIRE)
1455 else
1456 AC_MSG_RESULT(no)
1457 fi
1458fi
1459
Damien Millera22ba012000-03-02 23:09:20 +11001460# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001461if test ! -z "$IPADDR_IN_DISPLAY" ; then
1462 DISPLAY_HACK_MSG="yes"
1463 AC_DEFINE(IPADDR_IN_DISPLAY)
1464else
1465 DISPLAY_HACK_MSG="no"
1466 AC_ARG_WITH(ipaddr-display,
1467 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1468 [
1469 if test "x$withval" != "xno" ; then
1470 AC_DEFINE(IPADDR_IN_DISPLAY)
1471 DISPLAY_HACK_MSG="yes"
1472 fi
1473 ]
1474 )
1475fi
Damien Miller76112de1999-12-21 11:18:08 +11001476
Damien Millera22ba012000-03-02 23:09:20 +11001477# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001478SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001479AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11001480 [ --with-default-path=PATH Specify default \$PATH environment for server],
1481 [
1482 if test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001483 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001484 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001485 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001486 ],
1487 [
1488 AC_TRY_RUN(
1489 [
1490/* find out what STDPATH is */
1491#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001492#ifdef HAVE_PATHS_H
1493# include <paths.h>
1494#endif
1495#ifndef _PATH_STDPATH
1496# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1497#endif
1498#include <sys/types.h>
1499#include <sys/stat.h>
1500#include <fcntl.h>
1501#define DATA "conftest.stdpath"
1502
1503main()
1504{
1505 FILE *fd;
1506 int rc;
1507
1508 fd = fopen(DATA,"w");
1509 if(fd == NULL)
1510 exit(1);
1511
1512 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1513 exit(1);
1514
1515 exit(0);
1516}
1517 ], [ user_path=`cat conftest.stdpath` ],
1518 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1519 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1520 )
1521# make sure $bindir is in USER_PATH so scp will work
1522 t_bindir=`eval echo ${bindir}`
1523 case $t_bindir in
1524 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
1525 esac
1526 case $t_bindir in
1527 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
1528 esac
1529 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
1530 if test $? -ne 0 ; then
1531 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
1532 if test $? -ne 0 ; then
1533 user_path=$user_path:$t_bindir
1534 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
1535 fi
1536 fi
Damien Miller5a3e6831999-12-27 09:48:56 +11001537 ]
1538)
Tim Rice59ea0a02001-03-10 13:50:45 -08001539AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
1540AC_SUBST(user_path)
Damien Miller5a3e6831999-12-27 09:48:56 +11001541
Damien Millera22ba012000-03-02 23:09:20 +11001542# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10001543IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11001544AC_ARG_WITH(ipv4-default,
1545 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1546 [
1547 if test "x$withval" != "xno" ; then
1548 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10001549 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11001550 fi
1551 ]
1552)
1553
Damien Miller61e50f12000-05-08 20:49:37 +10001554AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10001555IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11001556AC_ARG_WITH(4in6,
1557 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1558 [
1559 if test "x$withval" != "xno" ; then
1560 AC_MSG_RESULT(yes)
1561 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001562 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001563 else
1564 AC_MSG_RESULT(no)
1565 fi
1566 ],[
1567 if test "x$inet6_default_4in6" = "xyes"; then
1568 AC_MSG_RESULT([yes (default)])
1569 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001570 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001571 else
1572 AC_MSG_RESULT([no (default)])
1573 fi
1574 ]
1575)
1576
Damien Miller60396b02001-02-18 17:01:00 +11001577# Whether to enable BSD auth support
1578AC_ARG_WITH(bsd-auth,
1579 [ --with-bsd-auth Enable BSD auth support],
1580 [
1581 if test "x$withval" != "xno" ; then
1582 AC_DEFINE(BSD_AUTH)
1583 bsd_auth=yes
1584 fi
1585 ]
1586)
1587
Damien Miller78315eb2000-09-29 23:01:36 +11001588AC_MSG_CHECKING(whether to install ssh as suid root)
1589AC_ARG_ENABLE(suid-ssh,
1590[ --enable-suid-ssh Install ssh as suid root (default)
1591 --disable-suid-ssh Install ssh without suid bit],
1592[ case "$enableval" in
1593 no)
1594 AC_MSG_RESULT(no)
1595 SSHMODE=0711
1596 ;;
1597 *) AC_MSG_RESULT(yes)
1598 SSHMODE=04711
1599 ;;
1600 esac ],
1601 AC_MSG_RESULT(yes)
1602 SSHMODE=04711
1603)
1604AC_SUBST(SSHMODE)
1605
1606
Damien Millera22ba012000-03-02 23:09:20 +11001607# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11001608piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +11001609AC_ARG_WITH(pid-dir,
1610 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1611 [
1612 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +11001613 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +11001614 fi
1615 ]
1616)
Damien Miller4018c192000-04-30 09:30:44 +10001617
Damien Miller78315eb2000-09-29 23:01:36 +11001618# make sure the directory exists
1619if test ! -d $piddir ; then
1620 piddir=`eval echo ${sysconfdir}`
1621 case $piddir in
1622 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1623 esac
1624fi
1625
Ben Lindstrom226cfa02001-01-22 05:34:40 +00001626AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11001627AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11001628
andre2ff7b5d2000-06-03 14:57:40 +00001629dnl allow user to disable some login recording features
1630AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001631 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001632 [ AC_DEFINE(DISABLE_LASTLOG) ]
1633)
1634AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00001635 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001636 [ AC_DEFINE(DISABLE_UTMP) ]
1637)
1638AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00001639 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001640 [ AC_DEFINE(DISABLE_UTMPX) ]
1641)
1642AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00001643 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001644 [ AC_DEFINE(DISABLE_WTMP) ]
1645)
1646AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00001647 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001648 [ AC_DEFINE(DISABLE_WTMPX) ]
1649)
1650AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00001651 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001652 [ AC_DEFINE(DISABLE_LOGIN) ]
1653)
1654AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00001655 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001656 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1657)
1658AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00001659 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001660 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1661)
1662AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001663 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11001664 [
1665 if test "x$withval" = "xno" ; then
1666 AC_DEFINE(DISABLE_LASTLOG)
1667 else
1668 conf_lastlog_location=$withval
1669 fi
1670 ]
1671)
andre2ff7b5d2000-06-03 14:57:40 +00001672
1673dnl lastlog, [uw]tmpx? detection
1674dnl NOTE: set the paths in the platform section to avoid the
1675dnl need for command-line parameters
1676dnl lastlog and [uw]tmp are subject to a file search if all else fails
1677
1678dnl lastlog detection
1679dnl NOTE: the code itself will detect if lastlog is a directory
1680AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1681AC_TRY_COMPILE([
1682#include <sys/types.h>
1683#include <utmp.h>
1684#ifdef HAVE_LASTLOG_H
1685# include <lastlog.h>
1686#endif
Damien Miller2994e082000-06-04 15:51:47 +10001687#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001688# include <paths.h>
1689#endif
1690 ],
1691 [ char *lastlog = LASTLOG_FILE; ],
1692 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10001693 [
1694 AC_MSG_RESULT(no)
1695 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1696 AC_TRY_COMPILE([
1697#include <sys/types.h>
1698#include <utmp.h>
1699#ifdef HAVE_LASTLOG_H
1700# include <lastlog.h>
1701#endif
1702#ifdef HAVE_PATHS_H
1703# include <paths.h>
1704#endif
1705 ],
1706 [ char *lastlog = _PATH_LASTLOG; ],
1707 [ AC_MSG_RESULT(yes) ],
1708 [
andree441aa32000-06-12 22:34:38 +00001709 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10001710 system_lastlog_path=no
1711 ])
1712 ]
andre2ff7b5d2000-06-03 14:57:40 +00001713)
Damien Miller2994e082000-06-04 15:51:47 +10001714
andre2ff7b5d2000-06-03 14:57:40 +00001715if test -z "$conf_lastlog_location"; then
1716 if test x"$system_lastlog_path" = x"no" ; then
1717 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10001718 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00001719 conf_lastlog_location=$f
1720 fi
1721 done
1722 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00001723 AC_MSG_WARN([** Cannot find lastlog **])
1724 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00001725 fi
1726 fi
1727fi
1728
1729if test -n "$conf_lastlog_location"; then
1730 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1731fi
1732
1733dnl utmp detection
1734AC_MSG_CHECKING([if your system defines UTMP_FILE])
1735AC_TRY_COMPILE([
1736#include <sys/types.h>
1737#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001738#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001739# include <paths.h>
1740#endif
1741 ],
1742 [ char *utmp = UTMP_FILE; ],
1743 [ AC_MSG_RESULT(yes) ],
1744 [ AC_MSG_RESULT(no)
1745 system_utmp_path=no ]
1746)
1747if test -z "$conf_utmp_location"; then
1748 if test x"$system_utmp_path" = x"no" ; then
1749 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1750 if test -f $f ; then
1751 conf_utmp_location=$f
1752 fi
1753 done
1754 if test -z "$conf_utmp_location"; then
1755 AC_DEFINE(DISABLE_UTMP)
1756 fi
1757 fi
1758fi
1759if test -n "$conf_utmp_location"; then
1760 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1761fi
1762
1763dnl wtmp detection
1764AC_MSG_CHECKING([if your system defines WTMP_FILE])
1765AC_TRY_COMPILE([
1766#include <sys/types.h>
1767#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001768#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001769# include <paths.h>
1770#endif
1771 ],
1772 [ char *wtmp = WTMP_FILE; ],
1773 [ AC_MSG_RESULT(yes) ],
1774 [ AC_MSG_RESULT(no)
1775 system_wtmp_path=no ]
1776)
1777if test -z "$conf_wtmp_location"; then
1778 if test x"$system_wtmp_path" = x"no" ; then
1779 for f in /usr/adm/wtmp /var/log/wtmp; do
1780 if test -f $f ; then
1781 conf_wtmp_location=$f
1782 fi
1783 done
1784 if test -z "$conf_wtmp_location"; then
1785 AC_DEFINE(DISABLE_WTMP)
1786 fi
1787 fi
1788fi
1789if test -n "$conf_wtmp_location"; then
1790 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1791fi
1792
1793
1794dnl utmpx detection - I don't know any system so perverse as to require
1795dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1796dnl there, though.
1797AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1798AC_TRY_COMPILE([
1799#include <sys/types.h>
1800#include <utmp.h>
1801#ifdef HAVE_UTMPX_H
1802#include <utmpx.h>
1803#endif
Damien Miller2994e082000-06-04 15:51:47 +10001804#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001805# include <paths.h>
1806#endif
1807 ],
1808 [ char *utmpx = UTMPX_FILE; ],
1809 [ AC_MSG_RESULT(yes) ],
1810 [ AC_MSG_RESULT(no)
1811 system_utmpx_path=no ]
1812)
1813if test -z "$conf_utmpx_location"; then
1814 if test x"$system_utmpx_path" = x"no" ; then
1815 AC_DEFINE(DISABLE_UTMPX)
1816 fi
1817else
1818 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1819fi
1820
1821dnl wtmpx detection
1822AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1823AC_TRY_COMPILE([
1824#include <sys/types.h>
1825#include <utmp.h>
1826#ifdef HAVE_UTMPX_H
1827#include <utmpx.h>
1828#endif
Damien Miller2994e082000-06-04 15:51:47 +10001829#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001830# include <paths.h>
1831#endif
1832 ],
1833 [ char *wtmpx = WTMPX_FILE; ],
1834 [ AC_MSG_RESULT(yes) ],
1835 [ AC_MSG_RESULT(no)
1836 system_wtmpx_path=no ]
1837)
1838if test -z "$conf_wtmpx_location"; then
1839 if test x"$system_wtmpx_path" = x"no" ; then
1840 AC_DEFINE(DISABLE_WTMPX)
1841 fi
1842else
1843 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1844fi
1845
Damien Miller4018c192000-04-30 09:30:44 +10001846
1847# Change default command timeout for builtin PRNG
Damien Miller14c12cb2000-06-07 22:20:23 +10001848entropy_timeout=200
Damien Miller4018c192000-04-30 09:30:44 +10001849AC_ARG_WITH(entropy-timeout,
1850 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1851 [
1852 if test "x$withval" != "xno" ; then
1853 entropy_timeout=$withval
1854 fi
1855 ]
1856)
1857AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1858
1859
Damien Miller29ea30d2000-03-17 10:54:15 +11001860if test ! -z "$blibpath" ; then
1861 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1862 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1863fi
1864
Damien Millerbac2d8a2000-09-05 16:13:06 +11001865AC_EXEEXT
1866
Ben Lindstrom3c06f6a2001-01-31 21:52:01 +00001867AC_OUTPUT(Makefile openbsd-compat/Makefile ssh_prng_cmds)
Damien Miller0437b332000-05-02 09:56:41 +10001868
Damien Miller7b22d652000-06-18 14:07:04 +10001869# Print summary of options
1870
1871if test x$MANTYPE = x'$(CATMAN)' ; then
1872 MAN_MSG=cat
1873else
1874 MAN_MSG=man
1875fi
1876if test ! -z "$RANDOM_POOL" ; then
1877 RAND_MSG="Device ($RANDOM_POOL)"
1878else
Damien Millerd0ccb982001-03-04 00:29:20 +11001879 if test ! -z "$PRNGD_PORT" ; then
1880 RAND_MSG="PRNGD/EGD (port localhost:$PRNGD_PORT)"
1881 elif test ! -z "$PRNGD_SOCKET" ; then
1882 RAND_MSG="PRNGD/EGD (socket $PRNGD_SOCKET)"
Damien Miller7b22d652000-06-18 14:07:04 +10001883 else
1884 RAND_MSG="Builtin (timeout $entropy_timeout)"
Damien Miller6f9c3372000-10-25 10:06:04 +11001885 BUILTIN_RNG=1
Damien Miller7b22d652000-06-18 14:07:04 +10001886 fi
1887fi
1888
1889# Someone please show me a better way :)
1890A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1891B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1892C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1893D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00001894E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Damien Miller7b22d652000-06-18 14:07:04 +10001895F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
1896G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Tim Rice59ea0a02001-03-10 13:50:45 -08001897H=`eval echo ${user_path}` ; H=`eval echo ${H}`
Damien Miller7b22d652000-06-18 14:07:04 +10001898
1899echo ""
1900echo "OpenSSH configured has been configured with the following options."
1901echo " User binaries: $B"
1902echo " System binaries: $C"
1903echo " Configuration files: $D"
1904echo " Askpass program: $E"
1905echo " Manual pages: $F"
1906echo " PID file: $G"
Tim Rice59ea0a02001-03-10 13:50:45 -08001907echo " sshd default user PATH: $H"
Damien Miller7b22d652000-06-18 14:07:04 +10001908echo " Random number collection: $RAND_MSG"
1909echo " Manpage format: $MAN_MSG"
1910echo " PAM support: ${PAM_MSG}"
1911echo " KerberosIV support: $KRB4_MSG"
1912echo " AFS support: $AFS_MSG"
1913echo " S/KEY support: $SKEY_MSG"
1914echo " TCP Wrappers support: $TCPW_MSG"
1915echo " MD5 password support: $MD5_MSG"
1916echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1917echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1918echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1919
Damien Miller60396b02001-02-18 17:01:00 +11001920if test ! -z "$bsd_auth"; then
1921 echo " BSD Auth support: yes"
1922fi
1923
Damien Miller7b22d652000-06-18 14:07:04 +10001924echo ""
1925
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00001926echo " Host: ${host}"
1927echo " Compiler: ${CC}"
1928echo " Compiler flags: ${CFLAGS}"
1929echo "Preprocessor flags: ${CPPFLAGS}"
1930echo " Linker flags: ${LDFLAGS}"
1931echo " Libraries: ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10001932
1933echo ""
1934
Damien Miller82cf0ce2000-12-20 13:34:48 +11001935if test "x$PAM_MSG" = "xyes" ; then
1936 echo "PAM is enabled. You may need to install a PAM control file for sshd,"
1937 echo "otherwise password authentication may fail. Example PAM control files"
1938 echo "can be found in the contrib/ subdirectory"
1939 echo ""
1940fi
1941
Damien Miller6f9c3372000-10-25 10:06:04 +11001942if test ! -z "$BUILTIN_RNG" ; then
1943 echo "WARNING: you are using the builtin random number collection service."
1944 echo "Please read WARNING.RNG and request that your OS vendor includes"
1945 echo "/dev/random in future versions of their OS."
1946 echo ""
1947fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001948
1949if test ! -z "$NO_SFTP"; then
1950 echo "sftp-server will be disabled. Your compiler does not support"
1951 echo "64bit integers."
1952 echo ""
1953fi
Damien Miller60396b02001-02-18 17:01:00 +11001954