blob: 6bf5581f14e5a3fe6265362dac8a10f0d54aed3d [file] [log] [blame]
Damien Millerfa2bb692002-04-23 23:22:25 +10001# $Id: configure.ac,v 1.51 2002/04/23 13:22:25 djm Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Tim Rice13aae5e2001-10-21 17:53:58 -07003AC_INIT
4AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +10005
6AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11007AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11008AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11009AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100010
Damien Millera22ba012000-03-02 23:09:20 +110011# Checks for programs.
Damien Millerab18c411999-11-11 10:40:23 +110012AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100013AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110014AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000015AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070016AC_PATH_PROGS(PERL, perl5 perl)
Damien Millere79334a1999-12-29 10:03:37 +110017AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100018AC_PATH_PROG(ENT, ent)
19AC_SUBST(ENT)
Damien Miller78315eb2000-09-29 23:01:36 +110020AC_PATH_PROGS(FILEPRIV, filepriv, true, /sbin:/usr/sbin)
Damien Miller4864e8f2001-02-08 10:07:08 +110021AC_PATH_PROG(TEST_MINUS_S_SH, bash)
22AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
23AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110024
Damien Millere8bb4502001-09-25 16:39:35 +100025# System features
26AC_SYS_LARGEFILE
27
Damien Miller3f62aba2000-11-29 11:56:35 +110028if test -z "$AR" ; then
29 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
30fi
31
Damien Millerad833b32000-08-23 10:46:23 +100032# Use LOGIN_PROGRAM from environment if possible
33if test ! -z "$LOGIN_PROGRAM" ; then
34 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
35else
36 # Search for login
37 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
38 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
39 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
40 fi
41fi
42
Damien Miller166bd442000-03-16 10:48:25 +110043if test -z "$LD" ; then
44 LD=$CC
45fi
46AC_SUBST(LD)
47
Damien Miller166bd442000-03-16 10:48:25 +110048AC_C_INLINE
Damien Miller649d9992001-06-27 23:35:51 +100049if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
50 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110051fi
52
Damien Millera22ba012000-03-02 23:09:20 +110053# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110054case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110055*-*-aix*)
56 AFS_LIBS="-lld"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000057 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110058 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100059 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Millerfa2bb692002-04-23 23:22:25 +100060 AC_MSG_CHECKING([if linkage editor ($LD) accepts -blibpath])
61 saved_LDFLAGS="$LDFLAGS"
62 LDFLAGS="$LDFLAGS -blibpath:/usr/lib:/lib:/usr/local/lib"
63 AC_TRY_LINK([],
64 [],
65 [
66 AC_MSG_RESULT(yes)
67 blibpath="/usr/lib:/lib:/usr/local/lib"
68 ],
69 [ AC_MSG_RESULT(no) ]
70 )
71 LDFLAGS="$saved_LDFLAGS"
Damien Miller29ea30d2000-03-17 10:54:15 +110072 fi
Damien Millerd2c208a2000-05-17 22:00:02 +100073 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
Damien Millereca71f82000-01-20 22:38:27 +110074 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +100075 AC_DEFINE(BROKEN_REALPATH)
andre60f3c982000-06-03 16:18:19 +000076 dnl AIX handles lastlog as part of its login message
77 AC_DEFINE(DISABLE_LASTLOG)
Damien Miller75b1d102000-01-07 14:01:41 +110078 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110079*-*-cygwin*)
Tim Ricefe1d1002001-11-26 17:19:43 -080080 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110081 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +000082 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +110083 AC_DEFINE(DISABLE_SHADOW)
84 AC_DEFINE(IPV4_DEFAULT)
85 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +000086 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Damien Millerbac2d8a2000-09-05 16:13:06 +110087 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000088*-*-dgux*)
89 AC_DEFINE(IP_TOS_IS_BROKEN)
90 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +000091*-*-darwin*)
92 AC_DEFINE(BROKEN_GETADDRINFO)
93 ;;
Damien Miller76112de1999-12-21 11:18:08 +110094*-*-hpux10*)
95 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +100096 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +110097 fi
Kevin Steves315f8b72001-06-28 00:24:41 +000098 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +110099 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000100 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)
Kevin Steves315f8b72001-06-28 00:24:41 +0000104 LIBS="$LIBS -lxnet -lsec"
Damien Miller76112de1999-12-21 11:18:08 +1100105 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000106*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000107 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100108 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100109 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100110 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100111 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100112 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000113 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000114 LIBS="$LIBS -lxnet -lsec"
Damien Miller1bead332000-04-30 00:47:29 +1000115 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100116*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000117 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000118 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100119 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000120 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000121 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller1808f382000-01-06 12:03:12 +1100122 ;;
123*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000124 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000125 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100126 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000127 AC_DEFINE(WITH_IRIX_ARRAY)
128 AC_DEFINE(WITH_IRIX_PROJECT)
129 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000130 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000131 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000132 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100133 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100134*-*-linux*)
135 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100136 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100137 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000138 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100139 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100140 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000141mips-sony-bsd|mips-sony-newsos4)
142 AC_DEFINE(HAVE_NEWS4)
143 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000144 ;;
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)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000168 AC_DEFINE(LOGIN_NEEDS_UTMPX)
169 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000170 AC_DEFINE(PAM_TTY_KLUDGE)
andre2ff7b5d2000-06-03 14:57:40 +0000171 # hardwire lastlog location (can't detect it on some versions)
172 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000173 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
174 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
175 if test "$sol2ver" -ge 8; then
176 AC_MSG_RESULT(yes)
177 AC_DEFINE(DISABLE_UTMP)
178 AC_DEFINE(DISABLE_WTMP)
179 else
180 AC_MSG_RESULT(no)
181 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100182 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000183*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000184 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000185 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100186 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000187 conf_utmp_location=/etc/utmp
188 conf_wtmp_location=/var/adm/wtmp
189 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000190 AC_DEFINE(USE_PIPES)
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"
Tim Rice13aae5e2001-10-21 17:53:58 -0700195 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000196 AC_DEFINE(USE_PIPES)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000197 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000198*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000199 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700200 # /usr/ucblib MUST NOT be searched on ReliantUNIX
201 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100202 IPADDR_IN_DISPLAY=yes
203 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000204 AC_DEFINE(IP_TOS_IS_BROKEN)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700205 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
206 # Attention: always take care to bind libsocket and libnsl before libc,
207 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000208 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100209*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000210 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100211 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Ricea4f7ae12001-09-17 14:34:33 -0700212# enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100213 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100214 ;;
215*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000216 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100217 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Ricea4f7ae12001-09-17 14:34:33 -0700218# enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100219 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100220 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100221*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000222 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100223 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100224 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100225*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000226 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100227 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700228 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller78315eb2000-09-29 23:01:36 +1100229 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100230 RANLIB=true
231 no_dev_ptmx=1
232 AC_DEFINE(BROKEN_SYS_TERMIO_H)
233 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100234 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000235 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100236 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100237 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700238 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700239 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100240 ;;
241*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000242 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000243 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100244 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000245 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100246 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100247 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100248 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000249 AC_DEFINE(DISABLE_SHADOW)
Damien Miller217f5672001-02-16 12:12:41 +1100250 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700251 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000252 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000253*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700254 no_libsocket=1
255 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000256 AC_DEFINE(USE_PIPES)
Tim Ricee991e3c2001-08-07 15:29:07 -0700257 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
258 LIBS="$LIBS -lgen -lrsc"
259 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000260*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000261 AC_MSG_CHECKING(for Digital Unix SIA)
262 no_osfsia=""
263 AC_ARG_WITH(osfsia,
264 [ --with-osfsia Enable Digital Unix SIA],
265 [
266 if test "x$withval" = "xno" ; then
267 AC_MSG_RESULT(disabled)
268 no_osfsia=1
269 fi
270 ],
271 )
272 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000273 if test -f /etc/sia/matrix.conf; then
274 AC_MSG_RESULT(yes)
275 AC_DEFINE(HAVE_OSF_SIA)
276 AC_DEFINE(DISABLE_LOGIN)
277 LIBS="$LIBS -lsecurity -ldb -lm -laud"
278 else
279 AC_MSG_RESULT(no)
280 fi
281 fi
282 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000283
284*-*-nto-qnx)
285 AC_DEFINE(USE_PIPES)
286 AC_DEFINE(NO_X11_UNIX_SOCKETS)
287 AC_DEFINE(MISSING_NFDBITS)
288 AC_DEFINE(MISSING_HOWMANY)
289 AC_DEFINE(MISSING_FD_MASK)
290 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100291esac
292
Damien Millere37bfc12000-06-05 09:37:43 +1000293# Allow user to specify flags
294AC_ARG_WITH(cflags,
295 [ --with-cflags Specify additional flags to pass to compiler],
296 [
297 if test "x$withval" != "xno" ; then
298 CFLAGS="$CFLAGS $withval"
299 fi
300 ]
301)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000302AC_ARG_WITH(cppflags,
303 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
304 [
305 if test "x$withval" != "xno"; then
306 CPPFLAGS="$CPPFLAGS $withval"
307 fi
308 ]
309)
Damien Millere37bfc12000-06-05 09:37:43 +1000310AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000311 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000312 [
313 if test "x$withval" != "xno" ; then
314 LDFLAGS="$LDFLAGS $withval"
315 fi
316 ]
317)
318AC_ARG_WITH(libs,
319 [ --with-libs Specify additional libraries to link with],
320 [
321 if test "x$withval" != "xno" ; then
322 LIBS="$LIBS $withval"
323 fi
324 ]
325)
326
Tim Rice4cec93f2002-02-26 08:40:48 -0800327# Checks for header files.
328AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
329 getopt.h glob.h lastlog.h limits.h login.h \
330 login_cap.h maillock.h netdb.h netgroup.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000331 netinet/in_systm.h paths.h pty.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000332 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800333 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000334 sys/mman.h sys/select.h sys/stat.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800335 sys/stropts.h sys/sysmacros.h sys/time.h \
Kevin Steves117b06d2002-03-30 17:55:21 +0000336 sys/un.h time.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800337 util.h utime.h utmp.h utmpx.h)
338
Damien Millera22ba012000-03-02 23:09:20 +1100339# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700340AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
341AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000342
Damien Millerdf288022001-02-18 13:07:07 +1100343dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700344if test "x$with_tcp_wrappers" != "xno" ; then
345 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
346 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
347 fi
348fi
Damien Millerdf288022001-02-18 13:07:07 +1100349
Tim Rice13aae5e2001-10-21 17:53:58 -0700350AC_CHECK_FUNC(getspnam, ,
351 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700352
Damien Miller150c8b52002-02-13 23:06:56 +1100353AC_ARG_WITH(rpath,
354 [ --without-rpath Disable auto-added -R linker paths],
355 [
356 if test "x$withval" = "xno" ; then
357 need_dash_r=""
358 fi
359 if test "x$withval" = "xyes" ; then
360 need_dash_r=1
361 fi
362 ]
363)
364
Tim Rice13aae5e2001-10-21 17:53:58 -0700365dnl zlib is required
366AC_ARG_WITH(zlib,
367 [ --with-zlib=PATH Use zlib in PATH],
368 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000369 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100370 AC_MSG_ERROR([*** zlib is required ***])
371 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700372 if test -d "$withval/lib"; then
373 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700374 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700375 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700376 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700377 fi
378 else
379 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700380 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700381 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700382 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700383 fi
384 fi
385 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700386 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700387 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700388 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700389 fi
390 ]
391)
392
Tim Rice17b93e52001-10-23 22:36:54 -0700393AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100394
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000395dnl UnixWare 2.x
396AC_CHECK_FUNC(strcasecmp,
397 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
398)
399AC_CHECK_FUNC(utimes,
400 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
401)
Damien Millerab18c411999-11-11 10:40:23 +1100402
Tim Ricee589a292001-11-03 11:09:32 -0800403dnl Checks for libutil functions
404AC_CHECK_HEADERS(libutil.h)
405AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
406AC_CHECK_FUNCS(logout updwtmp logwtmp)
407
Ben Lindstrom8697e082001-02-24 21:41:10 +0000408AC_FUNC_STRFTIME
409
Damien Miller3c027682001-03-14 11:39:45 +1100410# Check for ALTDIRFUNC glob() extension
411AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
412AC_EGREP_CPP(FOUNDIT,
413 [
414 #include <glob.h>
415 #ifdef GLOB_ALTDIRFUNC
416 FOUNDIT
417 #endif
418 ],
419 [
420 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
421 AC_MSG_RESULT(yes)
422 ],
423 [
424 AC_MSG_RESULT(no)
425 ]
426)
Damien Millerab18c411999-11-11 10:40:23 +1100427
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000428# Check for g.gl_matchc glob() extension
429AC_MSG_CHECKING(for gl_matchc field in glob_t)
430AC_EGREP_CPP(FOUNDIT,
431 [
432 #include <glob.h>
433 int main(void){glob_t g; g.gl_matchc = 1;}
434 ],
435 [
436 AC_DEFINE(GLOB_HAS_GL_MATCHC)
437 AC_MSG_RESULT(yes)
438 ],
439 [
440 AC_MSG_RESULT(no)
441 ]
442)
443
Damien Miller18bb4732001-03-28 14:35:30 +1000444AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
445AC_TRY_RUN(
446 [
447#include <sys/types.h>
448#include <dirent.h>
449int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
450 ],
451 [AC_MSG_RESULT(yes)],
452 [
453 AC_MSG_RESULT(no)
454 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
455 ]
456)
457
Damien Millerc547bf12001-02-16 10:18:12 +1100458# Check whether user wants S/Key support
459SKEY_MSG="no"
460AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700461 [ --with-skey[[=PATH]] Enable S/Key support
462 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100463 [
464 if test "x$withval" != "xno" ; then
465
466 if test "x$withval" != "xyes" ; then
467 CPPFLAGS="$CPPFLAGS -I${withval}/include"
468 LDFLAGS="$LDFLAGS -L${withval}/lib"
469 fi
470
471 AC_DEFINE(SKEY)
472 LIBS="-lskey $LIBS"
473 SKEY_MSG="yes"
474
Tim Rice4cec93f2002-02-26 08:40:48 -0800475 AC_MSG_CHECKING([for s/key support])
476 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100477 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800478#include <stdio.h>
479#include <skey.h>
480int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
481 ],
482 [AC_MSG_RESULT(yes)],
483 [
484 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100485 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
486 ])
487 fi
488 ]
489)
490
491# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700492TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100493AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700494 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
495 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100496 [
497 if test "x$withval" != "xno" ; then
498 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700499 saved_LDFLAGS="$LDFLAGS"
500 saved_CPPFLAGS="$CPPFLAGS"
501 if test -n "${withval}" -a "${withval}" != "yes"; then
502 if test -d "${withval}/lib"; then
503 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700504 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700505 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700506 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700507 fi
508 else
509 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700510 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700511 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700512 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700513 fi
514 fi
515 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700516 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700517 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700518 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700519 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700520 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800521 LIBWRAP="-lwrap"
522 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100523 AC_MSG_CHECKING(for libwrap)
524 AC_TRY_LINK(
525 [
526#include <tcpd.h>
527 int deny_severity = 0, allow_severity = 0;
528 ],
529 [hosts_access(0);],
530 [
531 AC_MSG_RESULT(yes)
532 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800533 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700534 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100535 ],
536 [
537 AC_MSG_ERROR([*** libwrap missing])
538 ]
539 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800540 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100541 fi
542 ]
543)
544
Damien Millerad833b32000-08-23 10:46:23 +1000545dnl Checks for library functions.
Ben Lindstromfdee8ef2002-04-06 23:52:02 +0000546AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
Tim Rice13aae5e2001-10-21 17:53:58 -0700547 clock fchmod fchown freeaddrinfo futimes gai_strerror \
548 getaddrinfo getcwd getgrouplist getnameinfo getopt \
549 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
550 inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller594a71b2002-04-23 20:22:59 +1000551 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
552 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
553 setenv seteuid setlogin setproctitle setresgid setreuid setrlimit \
Kevin Stevese0f2ca42002-04-10 23:17:05 +0000554 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Tim Rice13aae5e2001-10-21 17:53:58 -0700555 strlcat strlcpy strmode strsep sysconf tcgetpgrp utimes \
556 vhangup vsnprintf waitpid __b64_ntop _getpty)
557
558dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700559AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700560 AC_CHECK_LIB(gen, dirname,[
561 AC_CACHE_CHECK([for broken dirname],
562 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700563 save_LIBS="$LIBS"
564 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700565 AC_TRY_RUN(
566 [
567#include <libgen.h>
568#include <string.h>
569
570int main(int argc, char **argv) {
571 char *s, buf[32];
572
573 strncpy(buf,"/etc", 32);
574 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700575 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700576 exit(1);
577 } else {
578 exit(0);
579 }
580}
581 ],
582 [ ac_cv_have_broken_dirname="no" ],
583 [ ac_cv_have_broken_dirname="yes" ]
584 )
Tim Rice17b93e52001-10-23 22:36:54 -0700585 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700586 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700587 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700588 LIBS="$LIBS -lgen"
589 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700590 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700591 fi
592 ])
593])
594
Damien Millerad833b32000-08-23 10:46:23 +1000595dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000596AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000597dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000598AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000599AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000600dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000601AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000602AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100603
Damien Miller5fc85652000-07-09 23:53:07 +1000604AC_CHECK_FUNC(getuserattr,
605 [AC_DEFINE(HAVE_GETUSERATTR)],
606 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
607)
608
Damien Miller04f80141999-11-19 15:32:34 +1100609AC_CHECK_FUNC(daemon,
610 [AC_DEFINE(HAVE_DAEMON)],
611 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
612)
613
Damien Miller9fb07e42000-03-05 16:22:59 +1100614AC_CHECK_FUNC(getpagesize,
615 [AC_DEFINE(HAVE_GETPAGESIZE)],
616 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
617)
618
Damien Millercb170cb2000-07-01 16:52:55 +1000619# Check for broken snprintf
620if test "x$ac_cv_func_snprintf" = "xyes" ; then
621 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
622 AC_TRY_RUN(
623 [
624#include <stdio.h>
625int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
626 ],
627 [AC_MSG_RESULT(yes)],
628 [
629 AC_MSG_RESULT(no)
630 AC_DEFINE(BROKEN_SNPRINTF)
631 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
632 ]
633 )
634fi
635
Damien Miller606f8802000-09-16 15:39:56 +1100636AC_FUNC_GETPGRP
637
Damien Millera64b57a2001-01-17 10:44:13 +1100638# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000639PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100640AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100641 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100642 [
Damien Millera64b57a2001-01-17 10:44:13 +1100643 if test "x$withval" != "xno" ; then
644 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
645 AC_MSG_ERROR([PAM headers not found])
646 fi
647
648 AC_CHECK_LIB(dl, dlopen, , )
649 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
650 AC_CHECK_FUNCS(pam_getenvlist)
651
652 disable_shadow=yes
653 PAM_MSG="yes"
654
655 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800656 if test $ac_cv_lib_dl_dlopen = yes; then
657 LIBPAM="-lpam -ldl"
658 else
659 LIBPAM="-lpam"
660 fi
661 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100662 fi
663 ]
664)
Damien Millera22ba012000-03-02 23:09:20 +1100665
Damien Millera64b57a2001-01-17 10:44:13 +1100666# Check for older PAM
667if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100668 # Check PAM strerror arguments (old PAM)
669 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
670 AC_TRY_COMPILE(
671 [
Damien Miller81171112000-04-23 11:14:01 +1000672#include <stdlib.h>
673#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100674 ],
675 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
676 [AC_MSG_RESULT(no)],
677 [
678 AC_DEFINE(HAVE_OLD_PAM)
679 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000680 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100681 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100682 )
Damien Millera22ba012000-03-02 23:09:20 +1100683fi
684
685# The big search for OpenSSL
686AC_ARG_WITH(ssl-dir,
687 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
688 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000689 if test "x$withval" != "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100690 tryssldir=$withval
691 fi
692 ]
693)
694
695saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100696saved_LDFLAGS="$LDFLAGS"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000697saved_CPPFLAGS="$CPPFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100698if test "x$prefix" != "xNONE" ; then
699 tryssldir="$tryssldir $prefix"
700fi
Damien Miller61e50f12000-05-08 20:49:37 +1000701AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera1b61e12000-09-16 17:02:16 +1100702 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 +1100703 CPPFLAGS="$saved_CPPFLAGS"
704 LDFLAGS="$saved_LDFLAGS"
Damien Miller3b512e12000-05-17 23:29:18 +1000705 LIBS="$saved_LIBS -lcrypto"
Damien Millerccdefb62001-02-19 12:56:39 +1100706
707 # Skip directories if they don't exist
708 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
709 continue;
710 fi
711 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
712 # Try to use $ssldir/lib if it exists, otherwise
713 # $ssldir
714 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000715 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100716 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000717 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100718 fi
719 else
Damien Millerb68af622001-03-28 21:05:26 +1000720 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100721 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000722 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100723 fi
724 fi
725 # Try to use $ssldir/include if it exists, otherwise
726 # $ssldir
727 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000728 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100729 else
Damien Millerb68af622001-03-28 21:05:26 +1000730 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100731 fi
732 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000733
Damien Miller3b512e12000-05-17 23:29:18 +1000734 # Basic test to check for compatible version and correct linking
735 # *does not* test for RSA - that comes later.
736 AC_TRY_RUN(
737 [
Damien Millere59ce622000-05-01 20:54:17 +1000738#include <string.h>
739#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000740int main(void)
741{
Damien Miller3b512e12000-05-17 23:29:18 +1000742 char a[2048];
743 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000744 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000745 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000746}
Damien Miller3b512e12000-05-17 23:29:18 +1000747 ],
748 [
749 found_crypto=1
750 break;
751 ], []
752 )
Damien Miller61e50f12000-05-08 20:49:37 +1000753
754 if test ! -z "$found_crypto" ; then
755 break;
756 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100757 done
758
Damien Miller61e50f12000-05-08 20:49:37 +1000759 if test -z "$found_crypto" ; then
Damien Miller5dfe9762001-02-16 12:05:39 +1100760 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
Damien Millerb85dcad2000-03-11 11:37:00 +1100761 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000762 if test -z "$ssldir" ; then
763 ssldir="(system)"
764 fi
Damien Millera22ba012000-03-02 23:09:20 +1100765
Damien Miller61e50f12000-05-08 20:49:37 +1000766 ac_cv_openssldir=$ssldir
767])
768
Damien Milleredb82922000-06-20 13:25:52 +1000769if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000770 AC_DEFINE(HAVE_OPENSSL)
771 dnl Need to recover ssldir - test above runs in subshell
772 ssldir=$ac_cv_openssldir
Damien Millera64b57a2001-01-17 10:44:13 +1100773 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
Damien Millerccdefb62001-02-19 12:56:39 +1100774 # Try to use $ssldir/lib if it exists, otherwise
775 # $ssldir
776 if test -d "$ssldir/lib" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000777 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100778 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000779 LDFLAGS="-R$ssldir/lib $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100780 fi
781 else
Damien Millerb68af622001-03-28 21:05:26 +1000782 LDFLAGS="-L$ssldir $saved_LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100783 if test ! -z "$need_dash_r" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000784 LDFLAGS="-R$ssldir $LDFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100785 fi
Damien Millera64b57a2001-01-17 10:44:13 +1100786 fi
Damien Millerccdefb62001-02-19 12:56:39 +1100787 # Try to use $ssldir/include if it exists, otherwise
788 # $ssldir
789 if test -d "$ssldir/include" ; then
Damien Millerb68af622001-03-28 21:05:26 +1000790 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
Damien Millerccdefb62001-02-19 12:56:39 +1100791 else
Damien Millerb68af622001-03-28 21:05:26 +1000792 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
Damien Millera64b57a2001-01-17 10:44:13 +1100793 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100794 fi
Damien Millera22ba012000-03-02 23:09:20 +1100795fi
Damien Miller3b512e12000-05-17 23:29:18 +1000796LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000797
Damien Miller3b512e12000-05-17 23:29:18 +1000798# Now test RSA support
799saved_LIBS="$LIBS"
800AC_MSG_CHECKING([for RSA support])
801for WANTS_RSAREF in "" 1 ; do
802 if test -z "$WANTS_RSAREF" ; then
803 LIBS="$saved_LIBS"
804 else
805 LIBS="$saved_LIBS -lRSAglue -lrsaref"
806 fi
807 AC_TRY_RUN([
808#include <string.h>
809#include <openssl/rand.h>
810#include <openssl/rsa.h>
811#include <openssl/bn.h>
812#include <openssl/sha.h>
813int main(void)
814{
815 int num; RSA *key; static unsigned char p_in[] = "blahblah";
816 unsigned char c[256], p[256];
817 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
818 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
819 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
820 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
821}
822 ],
823 [
824 rsa_works=1
825 break;
826 ], [])
827done
Ben Lindstrom23fec142001-06-09 02:16:28 +0000828LIBS="$saved_LIBS"
Damien Miller3b512e12000-05-17 23:29:18 +1000829
830if test ! -z "$no_rsa" ; then
831 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000832 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000833else
834 if test -z "$rsa_works" ; then
835 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000836 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000837 else
838 if test -z "$WANTS_RSAREF" ; then
839 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000840 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000841 else
Damien Miller7b22d652000-06-18 14:07:04 +1000842 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000843 AC_MSG_RESULT(using RSAref)
Ben Lindstrom23fec142001-06-09 02:16:28 +0000844 LIBS="$LIBS -lcrypto -lRSAglue -lrsaref"
Damien Miller3b512e12000-05-17 23:29:18 +1000845 fi
846 fi
847fi
Damien Millera22ba012000-03-02 23:09:20 +1100848
Damien Millerec932372002-01-22 22:16:03 +1100849# Sanity check OpenSSL headers
850AC_MSG_CHECKING([whether OpenSSL's headers match the library])
851AC_TRY_RUN(
852 [
853#include <string.h>
854#include <openssl/opensslv.h>
855int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
856 ],
857 [
858 AC_MSG_RESULT(yes)
859 ],
860 [
861 AC_MSG_RESULT(no)
862 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
863 ]
864)
865
Damien Millera64b57a2001-01-17 10:44:13 +1100866# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
867# version in OpenSSL. Skip this for PAM
868if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100869 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100870fi
871
Damien Miller6c21c512002-01-22 21:57:53 +1100872
873### Configure cryptographic random number support
874
875# Check wheter OpenSSL seeds itself
876AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
877AC_TRY_RUN(
878 [
879#include <string.h>
880#include <openssl/rand.h>
881int main(void) { return(RAND_status() == 1 ? 0 : 1); }
882 ],
883 [
884 OPENSSL_SEEDS_ITSELF=yes
885 AC_MSG_RESULT(yes)
886 ],
887 [
888 AC_MSG_RESULT(no)
889 # Default to use of the rand helper if OpenSSL doesn't
890 # seed itself
891 USE_RAND_HELPER=yes
892 ]
893)
894
895
896# Do we want to force the use of the rand helper?
897AC_ARG_WITH(rand-helper,
898 [ --with-rand-helper Use subprocess to gather strong randomness ],
899 [
900 if test "x$withval" = "xno" ; then
901 # Force use of OpenSSL's internal RNG, even if
902 # the previous test showed it to be unseeded.
903 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
904 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
905 OPENSSL_SEEDS_ITSELF=yes
906 USE_RAND_HELPER=""
907 fi
908 else
909 USE_RAND_HELPER=yes
910 fi
911 ],
912)
913
914# Which randomness source do we use?
915if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
916 # OpenSSL only
917 AC_DEFINE(OPENSSL_PRNG_ONLY)
918 RAND_MSG="OpenSSL internal ONLY"
919 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800920elif test ! -z "$USE_RAND_HELPER" ; then
921 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100922 RAND_MSG="ssh-rand-helper"
923 INSTALL_SSH_RAND_HELPER="yes"
924fi
925AC_SUBST(INSTALL_SSH_RAND_HELPER)
926
927### Configuration of ssh-rand-helper
928
929# PRNGD TCP socket
930AC_ARG_WITH(prngd-port,
931 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
932 [
Damien Millere996d722002-01-23 11:20:59 +1100933 case "$withval" in
934 no)
935 withval=""
936 ;;
937 [[0-9]]*)
938 ;;
939 *)
940 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
941 ;;
942 esac
943 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100944 PRNGD_PORT="$withval"
945 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
946 fi
947 ]
948)
949
950# PRNGD Unix domain socket
951AC_ARG_WITH(prngd-socket,
952 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
953 [
Damien Millere996d722002-01-23 11:20:59 +1100954 case "$withval" in
955 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100956 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100957 ;;
958 no)
959 withval=""
960 ;;
961 /*)
962 ;;
963 *)
964 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
965 ;;
966 esac
967
968 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100969 if test ! -z "$PRNGD_PORT" ; then
970 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
971 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100972 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100973 AC_MSG_WARN(Entropy socket is not readable)
974 fi
975 PRNGD_SOCKET="$withval"
976 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
977 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800978 ],
979 [
980 # Check for existing socket only if we don't have a random device already
981 if test "$USE_RAND_HELPER" = yes ; then
982 AC_MSG_CHECKING(for PRNGD/EGD socket)
983 # Insert other locations here
984 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
985 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
986 PRNGD_SOCKET="$sock"
987 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
988 break;
989 fi
990 done
991 if test ! -z "$PRNGD_SOCKET" ; then
992 AC_MSG_RESULT($PRNGD_SOCKET)
993 else
994 AC_MSG_RESULT(not found)
995 fi
996 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100997 ]
998)
999
1000# Change default command timeout for hashing entropy source
1001entropy_timeout=200
1002AC_ARG_WITH(entropy-timeout,
1003 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1004 [
1005 if test "x$withval" != "xno" ; then
1006 entropy_timeout=$withval
1007 fi
1008 ]
1009)
Damien Miller6c21c512002-01-22 21:57:53 +11001010AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1011
Kevin Steves7ff91122002-04-07 19:22:54 +00001012ssh_privsep_user=sshd
1013AC_ARG_WITH(privsep-user,
1014 [ --with-privsep-user Specify non-privileged user for privilege separation],
1015 [
1016 if test -n "$withval"; then
1017 ssh_privsep_user=$withval
1018 fi
1019 ]
1020)
Kevin Steves4e0bb522002-04-07 19:44:14 +00001021AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$ssh_privsep_user")
Kevin Steves7ff91122002-04-07 19:22:54 +00001022
Tim Rice88f2ab52002-03-17 12:17:34 -08001023# We do this little dance with the search path to insure
1024# that programs that we select for use by installed programs
1025# (which may be run by the super-user) come from trusted
1026# locations before they come from the user's private area.
1027# This should help avoid accidentally configuring some
1028# random version of a program in someone's personal bin.
1029
1030OPATH=$PATH
1031PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001032test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001033test -d /sbin && PATH=$PATH:/sbin
1034test -d /usr/sbin && PATH=$PATH:/usr/sbin
1035PATH=$PATH:/etc:$OPATH
1036
Damien Miller6c21c512002-01-22 21:57:53 +11001037# These programs are used by the command hashing source to gather entropy
1038OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1039OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1040OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1041OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1042OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1043OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1044OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1045OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1046OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1047OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1048OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1049OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1050OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1051OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1052OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1053OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001054# restore PATH
1055PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001056
1057# Where does ssh-rand-helper get its randomness from?
1058INSTALL_SSH_PRNG_CMDS=""
1059if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1060 if test ! -z "$PRNGD_PORT" ; then
1061 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1062 elif test ! -z "$PRNGD_SOCKET" ; then
1063 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1064 else
1065 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1066 RAND_HELPER_CMDHASH=yes
1067 INSTALL_SSH_PRNG_CMDS="yes"
1068 fi
1069fi
1070AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1071
1072
Ben Lindstromb5628642000-10-18 00:02:25 +00001073# Cheap hack to ensure NEWS-OS libraries are arranged right.
1074if test ! -z "$SONY" ; then
1075 LIBS="$LIBS -liberty";
1076fi
1077
Damien Millera22ba012000-03-02 23:09:20 +11001078# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001079AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001080AC_CHECK_SIZEOF(short int, 2)
1081AC_CHECK_SIZEOF(int, 4)
1082AC_CHECK_SIZEOF(long int, 4)
1083AC_CHECK_SIZEOF(long long int, 8)
1084
Damien Millerfa2bb692002-04-23 23:22:25 +10001085# Sanity check long long for some platforms (AIX)
1086if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1087 ac_cv_sizeof_long_long_int=0
1088fi
1089
Damien Millera22ba012000-03-02 23:09:20 +11001090# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001091AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1092 AC_TRY_COMPILE(
1093 [ #include <sys/types.h> ],
1094 [ u_int a; a = 1;],
1095 [ ac_cv_have_u_int="yes" ],
1096 [ ac_cv_have_u_int="no" ]
1097 )
1098])
1099if test "x$ac_cv_have_u_int" = "xyes" ; then
1100 AC_DEFINE(HAVE_U_INT)
1101 have_u_int=1
1102fi
1103
Damien Miller61e50f12000-05-08 20:49:37 +10001104AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1105 AC_TRY_COMPILE(
1106 [ #include <sys/types.h> ],
1107 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1108 [ ac_cv_have_intxx_t="yes" ],
1109 [ ac_cv_have_intxx_t="no" ]
1110 )
1111])
1112if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1113 AC_DEFINE(HAVE_INTXX_T)
1114 have_intxx_t=1
1115fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001116
1117if (test -z "$have_intxx_t" && \
1118 test "x$ac_cv_header_stdint_h" = "xyes")
1119then
1120 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1121 AC_TRY_COMPILE(
1122 [ #include <stdint.h> ],
1123 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1124 [
1125 AC_DEFINE(HAVE_INTXX_T)
1126 AC_MSG_RESULT(yes)
1127 ],
1128 [ AC_MSG_RESULT(no) ]
1129 )
1130fi
1131
Damien Miller578783e2000-09-23 14:12:24 +11001132AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1133 AC_TRY_COMPILE(
1134 [ #include <sys/types.h> ],
1135 [ int64_t a; a = 1;],
1136 [ ac_cv_have_int64_t="yes" ],
1137 [ ac_cv_have_int64_t="no" ]
1138 )
1139])
1140if test "x$ac_cv_have_int64_t" = "xyes" ; then
1141 AC_DEFINE(HAVE_INT64_T)
1142 have_int64_t=1
1143fi
1144
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001145if test -z "$have_int64_t" ; then
1146 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1147 AC_TRY_COMPILE(
1148 [ #include <sys/socket.h> ],
1149 [ int64_t a; a = 1],
1150 [
1151 AC_DEFINE(HAVE_INT64_T)
1152 AC_MSG_RESULT(yes)
1153 ],
1154 [ AC_MSG_RESULT(no) ]
1155 )
1156fi
1157
Tim Rice4cec93f2002-02-26 08:40:48 -08001158if test -z "$have_int64_t" ; then
1159 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1160 AC_TRY_COMPILE(
1161 [ #include <sys/bitypes.h> ],
1162 [ int64_t a; a = 1],
1163 [
1164 AC_DEFINE(HAVE_INT64_T)
1165 AC_MSG_RESULT(yes)
1166 ],
1167 [ AC_MSG_RESULT(no) ]
1168 )
1169fi
1170
Damien Miller61e50f12000-05-08 20:49:37 +10001171AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1172 AC_TRY_COMPILE(
1173 [ #include <sys/types.h> ],
1174 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1175 [ ac_cv_have_u_intxx_t="yes" ],
1176 [ ac_cv_have_u_intxx_t="no" ]
1177 )
1178])
1179if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1180 AC_DEFINE(HAVE_U_INTXX_T)
1181 have_u_intxx_t=1
1182fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001183
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001184if test -z "$have_u_intxx_t" ; then
1185 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1186 AC_TRY_COMPILE(
1187 [ #include <sys/socket.h> ],
1188 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1189 [
1190 AC_DEFINE(HAVE_U_INTXX_T)
1191 AC_MSG_RESULT(yes)
1192 ],
1193 [ AC_MSG_RESULT(no) ]
1194 )
1195fi
1196
Damien Miller578783e2000-09-23 14:12:24 +11001197AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1198 AC_TRY_COMPILE(
1199 [ #include <sys/types.h> ],
1200 [ u_int64_t a; a = 1;],
1201 [ ac_cv_have_u_int64_t="yes" ],
1202 [ ac_cv_have_u_int64_t="no" ]
1203 )
1204])
1205if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1206 AC_DEFINE(HAVE_U_INT64_T)
1207 have_u_int64_t=1
1208fi
1209
Tim Rice4cec93f2002-02-26 08:40:48 -08001210if test -z "$have_u_int64_t" ; then
1211 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1212 AC_TRY_COMPILE(
1213 [ #include <sys/bitypes.h> ],
1214 [ u_int64_t a; a = 1],
1215 [
1216 AC_DEFINE(HAVE_U_INT64_T)
1217 AC_MSG_RESULT(yes)
1218 ],
1219 [ AC_MSG_RESULT(no) ]
1220 )
1221fi
1222
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001223if test -z "$have_u_intxx_t" ; then
1224 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1225 AC_TRY_COMPILE(
1226 [
1227#include <sys/types.h>
1228 ],
1229 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1230 [ ac_cv_have_uintxx_t="yes" ],
1231 [ ac_cv_have_uintxx_t="no" ]
1232 )
1233 ])
1234 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1235 AC_DEFINE(HAVE_UINTXX_T)
1236 fi
1237fi
1238
1239if test -z "$have_uintxx_t" ; then
1240 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1241 AC_TRY_COMPILE(
1242 [ #include <stdint.h> ],
1243 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1244 [
1245 AC_DEFINE(HAVE_UINTXX_T)
1246 AC_MSG_RESULT(yes)
1247 ],
1248 [ AC_MSG_RESULT(no) ]
1249 )
1250fi
1251
Damien Milleredb82922000-06-20 13:25:52 +10001252if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1253 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001254then
1255 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1256 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001257 [
1258#include <sys/bitypes.h>
1259 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001260 [
Damien Miller70494d12000-04-03 15:57:06 +10001261 int8_t a; int16_t b; int32_t c;
1262 u_int8_t e; u_int16_t f; u_int32_t g;
1263 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001264 ],
1265 [
1266 AC_DEFINE(HAVE_U_INTXX_T)
1267 AC_DEFINE(HAVE_INTXX_T)
1268 AC_MSG_RESULT(yes)
1269 ],
1270 [AC_MSG_RESULT(no)]
1271 )
1272fi
1273
Damien Miller58be7382001-09-15 21:31:54 +10001274
1275AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1276 AC_TRY_COMPILE(
1277 [
1278#include <sys/types.h>
1279 ],
1280 [ u_char foo; foo = 125; ],
1281 [ ac_cv_have_u_char="yes" ],
1282 [ ac_cv_have_u_char="no" ]
1283 )
1284])
1285if test "x$ac_cv_have_u_char" = "xyes" ; then
1286 AC_DEFINE(HAVE_U_CHAR)
1287fi
1288
Tim Rice13aae5e2001-10-21 17:53:58 -07001289TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001290
Tim Rice200a5c02002-02-26 22:12:34 -08001291AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001292
Damien Miller61e50f12000-05-08 20:49:37 +10001293AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1294 AC_TRY_COMPILE(
1295 [
1296#include <sys/types.h>
1297 ],
1298 [ size_t foo; foo = 1235; ],
1299 [ ac_cv_have_size_t="yes" ],
1300 [ ac_cv_have_size_t="no" ]
1301 )
1302])
1303if test "x$ac_cv_have_size_t" = "xyes" ; then
1304 AC_DEFINE(HAVE_SIZE_T)
1305fi
Damien Miller95058511999-12-29 10:36:45 +11001306
Damien Miller615f9392000-05-17 22:53:33 +10001307AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1308 AC_TRY_COMPILE(
1309 [
1310#include <sys/types.h>
1311 ],
1312 [ ssize_t foo; foo = 1235; ],
1313 [ ac_cv_have_ssize_t="yes" ],
1314 [ ac_cv_have_ssize_t="no" ]
1315 )
1316])
1317if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1318 AC_DEFINE(HAVE_SSIZE_T)
1319fi
1320
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001321AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1322 AC_TRY_COMPILE(
1323 [
1324#include <time.h>
1325 ],
1326 [ clock_t foo; foo = 1235; ],
1327 [ ac_cv_have_clock_t="yes" ],
1328 [ ac_cv_have_clock_t="no" ]
1329 )
1330])
1331if test "x$ac_cv_have_clock_t" = "xyes" ; then
1332 AC_DEFINE(HAVE_CLOCK_T)
1333fi
1334
Damien Millerb54b40e2000-06-23 08:23:34 +10001335AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1336 AC_TRY_COMPILE(
1337 [
1338#include <sys/types.h>
1339#include <sys/socket.h>
1340 ],
1341 [ sa_family_t foo; foo = 1235; ],
1342 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001343 [ AC_TRY_COMPILE(
1344 [
1345#include <sys/types.h>
1346#include <sys/socket.h>
1347#include <netinet/in.h>
1348 ],
1349 [ sa_family_t foo; foo = 1235; ],
1350 [ ac_cv_have_sa_family_t="yes" ],
1351
Damien Millerb54b40e2000-06-23 08:23:34 +10001352 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001353 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001354 )
1355])
1356if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1357 AC_DEFINE(HAVE_SA_FAMILY_T)
1358fi
1359
Damien Miller0f91b4e2000-06-18 15:43:25 +10001360AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1361 AC_TRY_COMPILE(
1362 [
1363#include <sys/types.h>
1364 ],
1365 [ pid_t foo; foo = 1235; ],
1366 [ ac_cv_have_pid_t="yes" ],
1367 [ ac_cv_have_pid_t="no" ]
1368 )
1369])
1370if test "x$ac_cv_have_pid_t" = "xyes" ; then
1371 AC_DEFINE(HAVE_PID_T)
1372fi
1373
1374AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1375 AC_TRY_COMPILE(
1376 [
1377#include <sys/types.h>
1378 ],
1379 [ mode_t foo; foo = 1235; ],
1380 [ ac_cv_have_mode_t="yes" ],
1381 [ ac_cv_have_mode_t="no" ]
1382 )
1383])
1384if test "x$ac_cv_have_mode_t" = "xyes" ; then
1385 AC_DEFINE(HAVE_MODE_T)
1386fi
1387
Damien Miller61e50f12000-05-08 20:49:37 +10001388
1389AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1390 AC_TRY_COMPILE(
1391 [
Damien Miller81171112000-04-23 11:14:01 +10001392#include <sys/types.h>
1393#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001394 ],
1395 [ struct sockaddr_storage s; ],
1396 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1397 [ ac_cv_have_struct_sockaddr_storage="no" ]
1398 )
1399])
1400if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1401 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1402fi
Damien Miller34132e52000-01-14 15:45:46 +11001403
Damien Miller61e50f12000-05-08 20:49:37 +10001404AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1405 AC_TRY_COMPILE(
1406 [
Damien Miller7b22d652000-06-18 14:07:04 +10001407#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001408#include <netinet/in.h>
1409 ],
1410 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1411 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1412 [ ac_cv_have_struct_sockaddr_in6="no" ]
1413 )
1414])
1415if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1416 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1417fi
Damien Miller34132e52000-01-14 15:45:46 +11001418
Damien Miller61e50f12000-05-08 20:49:37 +10001419AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1420 AC_TRY_COMPILE(
1421 [
Damien Miller7b22d652000-06-18 14:07:04 +10001422#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001423#include <netinet/in.h>
1424 ],
1425 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1426 [ ac_cv_have_struct_in6_addr="yes" ],
1427 [ ac_cv_have_struct_in6_addr="no" ]
1428 )
1429])
1430if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1431 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1432fi
Damien Miller34132e52000-01-14 15:45:46 +11001433
Damien Miller61e50f12000-05-08 20:49:37 +10001434AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1435 AC_TRY_COMPILE(
1436 [
Damien Miller81171112000-04-23 11:14:01 +10001437#include <sys/types.h>
1438#include <sys/socket.h>
1439#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001440 ],
1441 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1442 [ ac_cv_have_struct_addrinfo="yes" ],
1443 [ ac_cv_have_struct_addrinfo="no" ]
1444 )
1445])
1446if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1447 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1448fi
1449
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001450AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1451 AC_TRY_COMPILE(
1452 [ #include <sys/time.h> ],
1453 [ struct timeval tv; tv.tv_sec = 1;],
1454 [ ac_cv_have_struct_timeval="yes" ],
1455 [ ac_cv_have_struct_timeval="no" ]
1456 )
1457])
1458if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1459 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1460 have_struct_timeval=1
1461fi
1462
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001463# If we don't have int64_t then we can't compile sftp-server. So don't
1464# even attempt to do it.
1465if test "x$ac_cv_have_int64_t" = "xno" -a \
1466 "x$ac_cv_sizeof_long_int" != "x8" -a \
1467 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1468 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001469else
1470dnl test snprintf (broken on SCO w/gcc)
1471 AC_TRY_RUN(
1472 [
1473#include <stdio.h>
1474#include <string.h>
1475#ifdef HAVE_SNPRINTF
1476main()
1477{
1478 char buf[50];
1479 char expected_out[50];
1480 int mazsize = 50 ;
1481#if (SIZEOF_LONG_INT == 8)
1482 long int num = 0x7fffffffffffffff;
1483#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001484 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001485#endif
1486 strcpy(expected_out, "9223372036854775807");
1487 snprintf(buf, mazsize, "%lld", num);
1488 if(strcmp(buf, expected_out) != 0)
1489 exit(1);
1490 exit(0);
1491}
1492#else
1493main() { exit(0); }
1494#endif
1495 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1496 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001497fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001498AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001499
Damien Miller78315eb2000-09-29 23:01:36 +11001500dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001501OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1502OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1503OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1504OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1505OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001506OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001507OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1508OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001509OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001510OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1511OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1512OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1513OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001514OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1515OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1516OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1517OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001518
1519AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001520
Damien Miller61e50f12000-05-08 20:49:37 +10001521AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1522 ac_cv_have_ss_family_in_struct_ss, [
1523 AC_TRY_COMPILE(
1524 [
Damien Miller81171112000-04-23 11:14:01 +10001525#include <sys/types.h>
1526#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001527 ],
1528 [ struct sockaddr_storage s; s.ss_family = 1; ],
1529 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1530 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1531 )
1532])
1533if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1534 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1535fi
1536
Damien Miller61e50f12000-05-08 20:49:37 +10001537AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1538 ac_cv_have___ss_family_in_struct_ss, [
1539 AC_TRY_COMPILE(
1540 [
Damien Miller81171112000-04-23 11:14:01 +10001541#include <sys/types.h>
1542#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001543 ],
1544 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1545 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1546 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1547 )
1548])
1549if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1550 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1551fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001552
Damien Millerad833b32000-08-23 10:46:23 +10001553AC_CACHE_CHECK([for pw_class field in struct passwd],
1554 ac_cv_have_pw_class_in_struct_passwd, [
1555 AC_TRY_COMPILE(
1556 [
Damien Millerad833b32000-08-23 10:46:23 +10001557#include <pwd.h>
1558 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001559 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001560 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1561 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1562 )
1563])
1564if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1565 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1566fi
1567
Kevin Steves82456952001-06-22 21:14:18 +00001568AC_CACHE_CHECK([for pw_expire field in struct passwd],
1569 ac_cv_have_pw_expire_in_struct_passwd, [
1570 AC_TRY_COMPILE(
1571 [
1572#include <pwd.h>
1573 ],
1574 [ struct passwd p; p.pw_expire = 0; ],
1575 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1576 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1577 )
1578])
1579if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1580 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1581fi
1582
1583AC_CACHE_CHECK([for pw_change field in struct passwd],
1584 ac_cv_have_pw_change_in_struct_passwd, [
1585 AC_TRY_COMPILE(
1586 [
1587#include <pwd.h>
1588 ],
1589 [ struct passwd p; p.pw_change = 0; ],
1590 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1591 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1592 )
1593])
1594if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1595 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1596fi
Damien Miller61e50f12000-05-08 20:49:37 +10001597
Kevin Steves939c9db2002-03-22 17:23:25 +00001598AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1599 ac_cv_have_accrights_in_msghdr, [
1600 AC_TRY_COMPILE(
1601 [
Tim Riceae49fe62002-04-12 10:26:21 -07001602#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001603#include <sys/socket.h>
1604#include <sys/uio.h>
1605 ],
1606 [ struct msghdr m; m.msg_accrights = 0; ],
1607 [ ac_cv_have_accrights_in_msghdr="yes" ],
1608 [ ac_cv_have_accrights_in_msghdr="no" ]
1609 )
1610])
1611if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1612 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1613fi
1614
Kevin Stevesa44e0352002-04-07 16:18:03 +00001615AC_CACHE_CHECK([for msg_control field in struct msghdr],
1616 ac_cv_have_control_in_msghdr, [
1617 AC_TRY_COMPILE(
1618 [
Tim Riceae49fe62002-04-12 10:26:21 -07001619#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001620#include <sys/socket.h>
1621#include <sys/uio.h>
1622 ],
1623 [ struct msghdr m; m.msg_control = 0; ],
1624 [ ac_cv_have_control_in_msghdr="yes" ],
1625 [ ac_cv_have_control_in_msghdr="no" ]
1626 )
1627])
1628if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1629 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1630fi
1631
Damien Miller61e50f12000-05-08 20:49:37 +10001632AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1633 AC_TRY_LINK([],
1634 [ extern char *__progname; printf("%s", __progname); ],
1635 [ ac_cv_libc_defines___progname="yes" ],
1636 [ ac_cv_libc_defines___progname="no" ]
1637 )
1638])
1639if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1640 AC_DEFINE(HAVE___PROGNAME)
1641fi
1642
Kevin Steves4846f4a2002-03-22 18:19:53 +00001643AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1644 AC_TRY_LINK([
1645#include <stdio.h>
1646],
1647 [ printf("%s", __FUNCTION__); ],
1648 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1649 [ ac_cv_cc_implements___FUNCTION__="no" ]
1650 )
1651])
1652if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1653 AC_DEFINE(HAVE___FUNCTION__)
1654fi
1655
1656AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1657 AC_TRY_LINK([
1658#include <stdio.h>
1659],
1660 [ printf("%s", __func__); ],
1661 [ ac_cv_cc_implements___func__="yes" ],
1662 [ ac_cv_cc_implements___func__="no" ]
1663 )
1664])
1665if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1666 AC_DEFINE(HAVE___func__)
1667fi
1668
Damien Miller4f8e6692001-07-14 13:22:53 +10001669AC_CACHE_CHECK([whether getopt has optreset support],
1670 ac_cv_have_getopt_optreset, [
1671 AC_TRY_LINK(
1672 [
1673#include <getopt.h>
1674 ],
1675 [ extern int optreset; optreset = 0; ],
1676 [ ac_cv_have_getopt_optreset="yes" ],
1677 [ ac_cv_have_getopt_optreset="no" ]
1678 )
1679])
1680if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1681 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1682fi
Damien Millera22ba012000-03-02 23:09:20 +11001683
Damien Millerecbb26d2000-07-15 14:59:14 +10001684AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1685 AC_TRY_LINK([],
1686 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1687 [ ac_cv_libc_defines_sys_errlist="yes" ],
1688 [ ac_cv_libc_defines_sys_errlist="no" ]
1689 )
1690])
1691if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1692 AC_DEFINE(HAVE_SYS_ERRLIST)
1693fi
1694
1695
Damien Miller11fa2cc2000-08-16 10:35:58 +10001696AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1697 AC_TRY_LINK([],
1698 [ extern int sys_nerr; printf("%i", sys_nerr);],
1699 [ ac_cv_libc_defines_sys_nerr="yes" ],
1700 [ ac_cv_libc_defines_sys_nerr="no" ]
1701 )
1702])
1703if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1704 AC_DEFINE(HAVE_SYS_NERR)
1705fi
1706
Damien Miller85de5802001-09-18 14:01:11 +10001707SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001708
1709# Check whether user wants sectok support
1710AC_ARG_WITH(sectok,
1711 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001712 [
1713 if test "x$withval" != "xno" ; then
1714 if test "x$withval" != "xyes" ; then
1715 CPPFLAGS="$CPPFLAGS -I${withval}"
1716 LDFLAGS="$LDFLAGS -L${withval}"
1717 if test ! -z "$need_dash_r" ; then
1718 LDFLAGS="$LDFLAGS -R${withval}"
1719 fi
1720 if test ! -z "$blibpath" ; then
1721 blibpath="$blibpath:${withval}"
1722 fi
1723 fi
1724 AC_CHECK_HEADERS(sectok.h)
1725 if test "$ac_cv_header_sectok_h" != yes; then
1726 AC_MSG_ERROR(Can't find sectok.h)
1727 fi
1728 AC_CHECK_LIB(sectok, sectok_open)
1729 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1730 AC_MSG_ERROR(Can't find libsectok)
1731 fi
1732 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001733 AC_DEFINE(USE_SECTOK)
1734 SCARD_MSG="yes, using sectok"
1735 fi
1736 ]
1737)
1738
1739# Check whether user wants OpenSC support
1740AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001741 AC_HELP_STRING([--with-opensc=PFX],
1742 [Enable smartcard support using OpenSC]),
1743 opensc_config_prefix="$withval", opensc_config_prefix="")
1744if test x$opensc_config_prefix != x ; then
1745 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1746 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1747 if test "$OPENSC_CONFIG" != "no"; then
1748 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1749 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1750 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1751 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1752 AC_DEFINE(SMARTCARD)
1753 AC_DEFINE(USE_OPENSC)
1754 SCARD_MSG="yes, using OpenSC"
1755 fi
1756fi
Damien Miller85de5802001-09-18 14:01:11 +10001757
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001758# Check whether user wants Kerberos 5 support
1759KRB5_MSG="no"
1760AC_ARG_WITH(kerberos5,
1761 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1762 [
1763 if test "x$withval" != "xno" ; then
1764 if test "x$withval" = "xyes" ; then
1765 KRB5ROOT="/usr/local"
1766 else
1767 KRB5ROOT=${withval}
1768 fi
1769 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1770 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1771 AC_DEFINE(KRB5)
1772 KRB5_MSG="yes"
1773 AC_MSG_CHECKING(whether we are using Heimdal)
1774 AC_TRY_COMPILE([ #include <krb5.h> ],
1775 [ char *tmp = heimdal_version; ],
1776 [ AC_MSG_RESULT(yes)
1777 AC_DEFINE(HEIMDAL)
1778 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1779 ],
1780 [ AC_MSG_RESULT(no)
1781 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1782 ]
1783 )
1784 if test ! -z "$need_dash_r" ; then
1785 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1786 fi
1787 if test ! -z "$blibpath" ; then
1788 blibpath="$blibpath:${KRB5ROOT}/lib"
1789 fi
1790 AC_CHECK_LIB(resolv, dn_expand, , )
1791
1792 KRB5=yes
1793 fi
1794 ]
1795)
1796# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001797KRB4_MSG="no"
1798AC_ARG_WITH(kerberos4,
1799 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1800 [
1801 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001802 if test "x$withval" != "xyes" ; then
1803 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1804 LDFLAGS="$LDFLAGS -L${withval}/lib"
1805 if test ! -z "$need_dash_r" ; then
1806 LDFLAGS="$LDFLAGS -R${withval}/lib"
1807 fi
1808 if test ! -z "$blibpath" ; then
1809 blibpath="$blibpath:${withval}/lib"
1810 fi
1811 else
1812 if test -d /usr/include/kerberosIV ; then
1813 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1814 fi
1815 fi
1816
1817 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001818 if test "$ac_cv_header_krb_h" != yes; then
1819 AC_MSG_WARN([Cannot find krb.h, build may fail])
1820 fi
Damien Miller98344742001-03-28 14:37:06 +10001821 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001822 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001823 AC_CHECK_LIB(krb4, main)
1824 if test "$ac_cv_lib_krb4_main" != yes; then
1825 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1826 else
1827 KLIBS="-lkrb4"
1828 fi
1829 else
1830 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001831 fi
Damien Miller98344742001-03-28 14:37:06 +10001832 AC_CHECK_LIB(des, des_cbc_encrypt)
1833 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1834 AC_CHECK_LIB(des425, des_cbc_encrypt)
1835 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1836 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1837 else
1838 KLIBS="-ldes425"
1839 fi
1840 else
1841 KLIBS="-ldes"
1842 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001843 AC_CHECK_LIB(resolv, dn_expand, , )
1844 KRB4=yes
1845 KRB4_MSG="yes"
1846 AC_DEFINE(KRB4)
1847 fi
1848 ]
1849)
1850
1851# Check whether user wants AFS support
1852AFS_MSG="no"
1853AC_ARG_WITH(afs,
1854 [ --with-afs=PATH Enable AFS support],
1855 [
1856 if test "x$withval" != "xno" ; then
1857
1858 if test "x$withval" != "xyes" ; then
1859 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1860 LDFLAGS="$LDFLAGS -L${withval}/lib"
1861 fi
1862
1863 if test -z "$KRB4" ; then
1864 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1865 fi
1866
1867 LIBS="-lkafs $LIBS"
1868 if test ! -z "$AFS_LIBS" ; then
1869 LIBS="$LIBS $AFS_LIBS"
1870 fi
1871 AC_DEFINE(AFS)
1872 AFS_MSG="yes"
1873 fi
1874 ]
1875)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001876LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001877
Damien Millera22ba012000-03-02 23:09:20 +11001878# Looking for programs, paths and files
1879AC_ARG_WITH(rsh,
1880 [ --with-rsh=PATH Specify path to remote shell program ],
1881 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001882 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001883 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001884 fi
1885 ],
1886 [
1887 AC_PATH_PROG(rsh_path, rsh)
1888 ]
1889)
1890
1891AC_ARG_WITH(xauth,
1892 [ --with-xauth=PATH Specify path to xauth program ],
1893 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001894 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001895 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001896 fi
1897 ],
1898 [
Damien Miller78315eb2000-09-29 23:01:36 +11001899 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 +10001900 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001901 xauth_path="/usr/openwin/bin/xauth"
1902 fi
1903 ]
1904)
1905
Damien Millera19cf472000-11-29 13:28:50 +11001906if test -z "$xauth_path" ; then
1907 XAUTH_PATH="undefined"
1908 AC_SUBST(XAUTH_PATH)
1909else
Damien Millera22ba012000-03-02 23:09:20 +11001910 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001911 XAUTH_PATH=$xauth_path
1912 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001913fi
1914if test ! -z "$rsh_path" ; then
1915 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1916fi
1917
1918# Check for mail directory (last resort if we cannot get it from headers)
1919if test ! -z "$MAIL" ; then
1920 maildir=`dirname $MAIL`
1921 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1922fi
1923
Damien Millera22ba012000-03-02 23:09:20 +11001924if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +11001925 AC_CHECK_FILE("/dev/ptmx",
1926 [
1927 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1928 have_dev_ptmx=1
1929 ]
1930 )
Damien Millera22ba012000-03-02 23:09:20 +11001931fi
Damien Miller204ad072000-03-02 23:56:12 +11001932AC_CHECK_FILE("/dev/ptc",
1933 [
1934 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1935 have_dev_ptc=1
1936 ]
1937)
1938
Damien Millera22ba012000-03-02 23:09:20 +11001939# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001940AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001941 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001942 [
Damien Miller897741e2001-04-16 10:41:46 +10001943 case "$withval" in
1944 man|cat|doc)
1945 MANTYPE=$withval
1946 ;;
1947 *)
1948 AC_MSG_ERROR(invalid man type: $withval)
1949 ;;
1950 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001951 ]
1952)
Ben Lindstrombc709922001-04-18 18:04:21 +00001953if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001954 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001955 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1956 MANTYPE=doc
1957 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1958 MANTYPE=man
1959 else
1960 MANTYPE=cat
1961 fi
1962fi
Damien Miller670a4b82000-01-22 13:53:11 +11001963AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001964if test "$MANTYPE" = "doc"; then
1965 mansubdir=man;
1966else
1967 mansubdir=$MANTYPE;
1968fi
1969AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001970
Damien Millera22ba012000-03-02 23:09:20 +11001971# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001972MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001973AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001974 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001975 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001976 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001977 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001978 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001979 fi
1980 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001981)
1982
Damien Millera22ba012000-03-02 23:09:20 +11001983# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001984AC_ARG_WITH(shadow,
1985 [ --without-shadow Disable shadow password support],
1986 [
1987 if test "x$withval" = "xno" ; then
1988 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001989 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001990 fi
1991 ]
1992)
1993
Damien Miller1f335fb2000-06-26 11:31:33 +10001994if test -z "$disable_shadow" ; then
1995 AC_MSG_CHECKING([if the systems has expire shadow information])
1996 AC_TRY_COMPILE(
1997 [
1998#include <sys/types.h>
1999#include <shadow.h>
2000 struct spwd sp;
2001 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2002 [ sp_expire_available=yes ], []
2003 )
2004
2005 if test "x$sp_expire_available" = "xyes" ; then
2006 AC_MSG_RESULT(yes)
2007 AC_DEFINE(HAS_SHADOW_EXPIRE)
2008 else
2009 AC_MSG_RESULT(no)
2010 fi
2011fi
2012
Damien Millera22ba012000-03-02 23:09:20 +11002013# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002014if test ! -z "$IPADDR_IN_DISPLAY" ; then
2015 DISPLAY_HACK_MSG="yes"
2016 AC_DEFINE(IPADDR_IN_DISPLAY)
2017else
2018 DISPLAY_HACK_MSG="no"
2019 AC_ARG_WITH(ipaddr-display,
2020 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2021 [
2022 if test "x$withval" != "xno" ; then
2023 AC_DEFINE(IPADDR_IN_DISPLAY)
2024 DISPLAY_HACK_MSG="yes"
2025 fi
2026 ]
2027 )
2028fi
Damien Miller76112de1999-12-21 11:18:08 +11002029
Tim Rice43a1c132002-04-17 21:19:14 -07002030dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2031if test $ac_cv_func_login_getcapbool = "yes" -a \
2032 $ac_cv_header_login_cap_h = "yes" ; then
2033 USES_LOGIN_CONF=yes
2034fi
Damien Millera22ba012000-03-02 23:09:20 +11002035# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002036SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002037AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11002038 [ --with-default-path=PATH Specify default \$PATH environment for server],
2039 [
Tim Rice43a1c132002-04-17 21:19:14 -07002040 if test "$USES_LOGIN_CONF" = "yes" ; then
2041 AC_MSG_WARN([
2042--with-default-path=PATH has no effect on this system.
2043Edit /etc/login.conf instead.])
2044 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08002045 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002046 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002047 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002048 ],
Tim Rice43a1c132002-04-17 21:19:14 -07002049 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2050 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2051 else
Tim Rice59ea0a02001-03-10 13:50:45 -08002052 AC_TRY_RUN(
2053 [
2054/* find out what STDPATH is */
2055#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002056#ifdef HAVE_PATHS_H
2057# include <paths.h>
2058#endif
2059#ifndef _PATH_STDPATH
2060# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2061#endif
2062#include <sys/types.h>
2063#include <sys/stat.h>
2064#include <fcntl.h>
2065#define DATA "conftest.stdpath"
2066
2067main()
2068{
2069 FILE *fd;
2070 int rc;
2071
2072 fd = fopen(DATA,"w");
2073 if(fd == NULL)
2074 exit(1);
2075
2076 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2077 exit(1);
2078
2079 exit(0);
2080}
2081 ], [ user_path=`cat conftest.stdpath` ],
2082 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2083 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2084 )
2085# make sure $bindir is in USER_PATH so scp will work
2086 t_bindir=`eval echo ${bindir}`
2087 case $t_bindir in
2088 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2089 esac
2090 case $t_bindir in
2091 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2092 esac
2093 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2094 if test $? -ne 0 ; then
2095 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2096 if test $? -ne 0 ; then
2097 user_path=$user_path:$t_bindir
2098 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2099 fi
2100 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002101 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002102)
Tim Rice43a1c132002-04-17 21:19:14 -07002103if test "$USES_LOGIN_CONF" != "yes" ; then
2104 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2105 AC_SUBST(user_path)
2106fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002107
Damien Millera22ba012000-03-02 23:09:20 +11002108# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002109IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002110AC_ARG_WITH(ipv4-default,
2111 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2112 [
2113 if test "x$withval" != "xno" ; then
2114 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002115 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002116 fi
2117 ]
2118)
2119
Damien Miller61e50f12000-05-08 20:49:37 +10002120AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002121IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002122AC_ARG_WITH(4in6,
2123 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2124 [
2125 if test "x$withval" != "xno" ; then
2126 AC_MSG_RESULT(yes)
2127 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002128 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002129 else
2130 AC_MSG_RESULT(no)
2131 fi
2132 ],[
2133 if test "x$inet6_default_4in6" = "xyes"; then
2134 AC_MSG_RESULT([yes (default)])
2135 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002136 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002137 else
2138 AC_MSG_RESULT([no (default)])
2139 fi
2140 ]
2141)
2142
Damien Miller60396b02001-02-18 17:01:00 +11002143# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002144BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002145AC_ARG_WITH(bsd-auth,
2146 [ --with-bsd-auth Enable BSD auth support],
2147 [
2148 if test "x$withval" != "xno" ; then
2149 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002150 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002151 fi
2152 ]
2153)
2154
Damien Miller78315eb2000-09-29 23:01:36 +11002155AC_MSG_CHECKING(whether to install ssh as suid root)
2156AC_ARG_ENABLE(suid-ssh,
2157[ --enable-suid-ssh Install ssh as suid root (default)
2158 --disable-suid-ssh Install ssh without suid bit],
2159[ case "$enableval" in
2160 no)
2161 AC_MSG_RESULT(no)
2162 SSHMODE=0711
2163 ;;
2164 *) AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00002165 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11002166 ;;
2167 esac ],
2168 AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00002169 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11002170)
2171AC_SUBST(SSHMODE)
2172
2173
Damien Millera22ba012000-03-02 23:09:20 +11002174# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002175piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002176# make sure the directory exists
2177if test ! -d $piddir ; then
2178 piddir=`eval echo ${sysconfdir}`
2179 case $piddir in
2180 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2181 esac
2182fi
2183
Tim Rice88f2ab52002-03-17 12:17:34 -08002184AC_ARG_WITH(pid-dir,
2185 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2186 [
2187 if test "x$withval" != "xno" ; then
2188 piddir=$withval
2189 if test ! -d $piddir ; then
2190 AC_MSG_WARN([** no $piddir directory on this system **])
2191 fi
2192 fi
2193 ]
2194)
2195
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002196AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002197AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002198
andre2ff7b5d2000-06-03 14:57:40 +00002199dnl allow user to disable some login recording features
2200AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002201 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002202 [ AC_DEFINE(DISABLE_LASTLOG) ]
2203)
2204AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002205 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002206 [ AC_DEFINE(DISABLE_UTMP) ]
2207)
2208AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002209 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002210 [ AC_DEFINE(DISABLE_UTMPX) ]
2211)
2212AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002213 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002214 [ AC_DEFINE(DISABLE_WTMP) ]
2215)
2216AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002217 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002218 [ AC_DEFINE(DISABLE_WTMPX) ]
2219)
2220AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002221 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002222 [ AC_DEFINE(DISABLE_LOGIN) ]
2223)
2224AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002225 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002226 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2227)
2228AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002229 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002230 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2231)
2232AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002233 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002234 [
2235 if test "x$withval" = "xno" ; then
2236 AC_DEFINE(DISABLE_LASTLOG)
2237 else
2238 conf_lastlog_location=$withval
2239 fi
2240 ]
2241)
andre2ff7b5d2000-06-03 14:57:40 +00002242
2243dnl lastlog, [uw]tmpx? detection
2244dnl NOTE: set the paths in the platform section to avoid the
2245dnl need for command-line parameters
2246dnl lastlog and [uw]tmp are subject to a file search if all else fails
2247
2248dnl lastlog detection
2249dnl NOTE: the code itself will detect if lastlog is a directory
2250AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2251AC_TRY_COMPILE([
2252#include <sys/types.h>
2253#include <utmp.h>
2254#ifdef HAVE_LASTLOG_H
2255# include <lastlog.h>
2256#endif
Damien Miller2994e082000-06-04 15:51:47 +10002257#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002258# include <paths.h>
2259#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002260#ifdef HAVE_LOGIN_H
2261# include <login.h>
2262#endif
andre2ff7b5d2000-06-03 14:57:40 +00002263 ],
2264 [ char *lastlog = LASTLOG_FILE; ],
2265 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002266 [
2267 AC_MSG_RESULT(no)
2268 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2269 AC_TRY_COMPILE([
2270#include <sys/types.h>
2271#include <utmp.h>
2272#ifdef HAVE_LASTLOG_H
2273# include <lastlog.h>
2274#endif
2275#ifdef HAVE_PATHS_H
2276# include <paths.h>
2277#endif
2278 ],
2279 [ char *lastlog = _PATH_LASTLOG; ],
2280 [ AC_MSG_RESULT(yes) ],
2281 [
andree441aa32000-06-12 22:34:38 +00002282 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002283 system_lastlog_path=no
2284 ])
2285 ]
andre2ff7b5d2000-06-03 14:57:40 +00002286)
Damien Miller2994e082000-06-04 15:51:47 +10002287
andre2ff7b5d2000-06-03 14:57:40 +00002288if test -z "$conf_lastlog_location"; then
2289 if test x"$system_lastlog_path" = x"no" ; then
2290 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002291 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002292 conf_lastlog_location=$f
2293 fi
2294 done
2295 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002296 AC_MSG_WARN([** Cannot find lastlog **])
2297 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002298 fi
2299 fi
2300fi
2301
2302if test -n "$conf_lastlog_location"; then
2303 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2304fi
2305
2306dnl utmp detection
2307AC_MSG_CHECKING([if your system defines UTMP_FILE])
2308AC_TRY_COMPILE([
2309#include <sys/types.h>
2310#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002311#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002312# include <paths.h>
2313#endif
2314 ],
2315 [ char *utmp = UTMP_FILE; ],
2316 [ AC_MSG_RESULT(yes) ],
2317 [ AC_MSG_RESULT(no)
2318 system_utmp_path=no ]
2319)
2320if test -z "$conf_utmp_location"; then
2321 if test x"$system_utmp_path" = x"no" ; then
2322 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2323 if test -f $f ; then
2324 conf_utmp_location=$f
2325 fi
2326 done
2327 if test -z "$conf_utmp_location"; then
2328 AC_DEFINE(DISABLE_UTMP)
2329 fi
2330 fi
2331fi
2332if test -n "$conf_utmp_location"; then
2333 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2334fi
2335
2336dnl wtmp detection
2337AC_MSG_CHECKING([if your system defines WTMP_FILE])
2338AC_TRY_COMPILE([
2339#include <sys/types.h>
2340#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002341#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002342# include <paths.h>
2343#endif
2344 ],
2345 [ char *wtmp = WTMP_FILE; ],
2346 [ AC_MSG_RESULT(yes) ],
2347 [ AC_MSG_RESULT(no)
2348 system_wtmp_path=no ]
2349)
2350if test -z "$conf_wtmp_location"; then
2351 if test x"$system_wtmp_path" = x"no" ; then
2352 for f in /usr/adm/wtmp /var/log/wtmp; do
2353 if test -f $f ; then
2354 conf_wtmp_location=$f
2355 fi
2356 done
2357 if test -z "$conf_wtmp_location"; then
2358 AC_DEFINE(DISABLE_WTMP)
2359 fi
2360 fi
2361fi
2362if test -n "$conf_wtmp_location"; then
2363 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2364fi
2365
2366
2367dnl utmpx detection - I don't know any system so perverse as to require
2368dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2369dnl there, though.
2370AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2371AC_TRY_COMPILE([
2372#include <sys/types.h>
2373#include <utmp.h>
2374#ifdef HAVE_UTMPX_H
2375#include <utmpx.h>
2376#endif
Damien Miller2994e082000-06-04 15:51:47 +10002377#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002378# include <paths.h>
2379#endif
2380 ],
2381 [ char *utmpx = UTMPX_FILE; ],
2382 [ AC_MSG_RESULT(yes) ],
2383 [ AC_MSG_RESULT(no)
2384 system_utmpx_path=no ]
2385)
2386if test -z "$conf_utmpx_location"; then
2387 if test x"$system_utmpx_path" = x"no" ; then
2388 AC_DEFINE(DISABLE_UTMPX)
2389 fi
2390else
2391 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2392fi
2393
2394dnl wtmpx detection
2395AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2396AC_TRY_COMPILE([
2397#include <sys/types.h>
2398#include <utmp.h>
2399#ifdef HAVE_UTMPX_H
2400#include <utmpx.h>
2401#endif
Damien Miller2994e082000-06-04 15:51:47 +10002402#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002403# include <paths.h>
2404#endif
2405 ],
2406 [ char *wtmpx = WTMPX_FILE; ],
2407 [ AC_MSG_RESULT(yes) ],
2408 [ AC_MSG_RESULT(no)
2409 system_wtmpx_path=no ]
2410)
2411if test -z "$conf_wtmpx_location"; then
2412 if test x"$system_wtmpx_path" = x"no" ; then
2413 AC_DEFINE(DISABLE_WTMPX)
2414 fi
2415else
2416 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2417fi
2418
Damien Miller4018c192000-04-30 09:30:44 +10002419
Damien Miller29ea30d2000-03-17 10:54:15 +11002420if test ! -z "$blibpath" ; then
2421 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2422 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2423fi
2424
Tim Rice4cec93f2002-02-26 08:40:48 -08002425dnl remove pam and dl because they are in $LIBPAM
2426if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002427 LIBS=`echo $LIBS | sed 's/-lpam //'`
2428fi
2429if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2430 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002431fi
2432
Damien Millerbac2d8a2000-09-05 16:13:06 +11002433AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002434AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2435AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002436
Damien Miller7b22d652000-06-18 14:07:04 +10002437# Print summary of options
2438
Damien Miller7b22d652000-06-18 14:07:04 +10002439# Someone please show me a better way :)
2440A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2441B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2442C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2443D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002444E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002445F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002446G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Tim Rice59ea0a02001-03-10 13:50:45 -08002447H=`eval echo ${user_path}` ; H=`eval echo ${H}`
Damien Miller7b22d652000-06-18 14:07:04 +10002448
2449echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002450echo "OpenSSH has been configured with the following options:"
Damien Miller7b22d652000-06-18 14:07:04 +10002451echo " User binaries: $B"
2452echo " System binaries: $C"
2453echo " Configuration files: $D"
2454echo " Askpass program: $E"
2455echo " Manual pages: $F"
2456echo " PID file: $G"
Tim Rice43a1c132002-04-17 21:19:14 -07002457if test "$USES_LOGIN_CONF" = "yes" ; then
2458echo " At runtime, sshd will use the path defined in /etc/login.conf"
2459else
Tim Rice59ea0a02001-03-10 13:50:45 -08002460echo " sshd default user PATH: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002461fi
Damien Miller897741e2001-04-16 10:41:46 +10002462echo " Manpage format: $MANTYPE"
Damien Miller7b22d652000-06-18 14:07:04 +10002463echo " PAM support: ${PAM_MSG}"
2464echo " KerberosIV support: $KRB4_MSG"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002465echo " KerberosV support: $KRB5_MSG"
Damien Miller85de5802001-09-18 14:01:11 +10002466echo " Smartcard support: $SCARD_MSG"
Damien Miller7b22d652000-06-18 14:07:04 +10002467echo " AFS support: $AFS_MSG"
2468echo " S/KEY support: $SKEY_MSG"
2469echo " TCP Wrappers support: $TCPW_MSG"
2470echo " MD5 password support: $MD5_MSG"
2471echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2472echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2473echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002474echo " BSD Auth support: $BSD_AUTH_MSG"
2475echo " Random number source: $RAND_MSG"
2476if test ! -z "$USE_RAND_HELPER" ; then
2477 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002478fi
2479
Damien Miller7b22d652000-06-18 14:07:04 +10002480echo ""
2481
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002482echo " Host: ${host}"
2483echo " Compiler: ${CC}"
2484echo " Compiler flags: ${CFLAGS}"
2485echo "Preprocessor flags: ${CPPFLAGS}"
2486echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002487echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002488
2489echo ""
2490
Damien Miller82cf0ce2000-12-20 13:34:48 +11002491if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002492 echo "PAM is enabled. You may need to install a PAM control file "
2493 echo "for sshd, otherwise password authentication may fail. "
2494 echo "Example PAM control files can be found in the contrib/ "
2495 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002496 echo ""
2497fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002498
2499if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002500 echo "sftp-server will be disabled. Your compiler does not "
2501 echo "support 64bit integers."
2502 echo ""
2503fi
2504
2505if test ! -z "$RAND_HELPER_CMDHASH" ; then
2506 echo "WARNING: you are using the builtin random number collection "
2507 echo "service. Please read WARNING.RNG and request that your OS "
2508 echo "vendor includes kernel-based random number collection in "
2509 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002510 echo ""
2511fi
Damien Miller60396b02001-02-18 17:01:00 +11002512