blob: 120709876e32fe0e4c86eff28bdf0fec003c6020 [file] [log] [blame]
Ben Lindstrom99a4e142002-07-09 14:06:40 +00001# $Id: configure.ac,v 1.77 2002/07/09 14:06:40 mouring 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)
Tim Rice0502a472002-05-08 16:04:14 -070024AC_PATH_PROG(SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110025
Damien Millere8bb4502001-09-25 16:39:35 +100026# System features
27AC_SYS_LARGEFILE
28
Damien Miller3f62aba2000-11-29 11:56:35 +110029if test -z "$AR" ; then
30 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
31fi
32
Damien Millerad833b32000-08-23 10:46:23 +100033# Use LOGIN_PROGRAM from environment if possible
34if test ! -z "$LOGIN_PROGRAM" ; then
35 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
36else
37 # Search for login
38 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
39 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
40 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
41 fi
42fi
43
Damien Miller166bd442000-03-16 10:48:25 +110044if test -z "$LD" ; then
45 LD=$CC
46fi
47AC_SUBST(LD)
48
Damien Miller166bd442000-03-16 10:48:25 +110049AC_C_INLINE
Damien Miller649d9992001-06-27 23:35:51 +100050if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
51 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110052fi
53
Damien Millera22ba012000-03-02 23:09:20 +110054# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110055case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110056*-*-aix*)
57 AFS_LIBS="-lld"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000058 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110059 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100060 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Millerfa2bb692002-04-23 23:22:25 +100061 AC_MSG_CHECKING([if linkage editor ($LD) accepts -blibpath])
62 saved_LDFLAGS="$LDFLAGS"
63 LDFLAGS="$LDFLAGS -blibpath:/usr/lib:/lib:/usr/local/lib"
64 AC_TRY_LINK([],
65 [],
66 [
67 AC_MSG_RESULT(yes)
68 blibpath="/usr/lib:/lib:/usr/local/lib"
69 ],
70 [ AC_MSG_RESULT(no) ]
71 )
72 LDFLAGS="$saved_LDFLAGS"
Damien Miller29ea30d2000-03-17 10:54:15 +110073 fi
Tim Ricee958ed32002-07-05 07:12:33 -070074 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
75 [AC_CHECK_LIB(s,authenticate,
76 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
77 LIBS="$LIBS -ls"
78 ])
79 ])
Damien Millereca71f82000-01-20 22:38:27 +110080 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +100081 AC_DEFINE(BROKEN_REALPATH)
andre60f3c982000-06-03 16:18:19 +000082 dnl AIX handles lastlog as part of its login message
83 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +000084 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller75b1d102000-01-07 14:01:41 +110085 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110086*-*-cygwin*)
Tim Ricefe1d1002001-11-26 17:19:43 -080087 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110088 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +000089 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +110090 AC_DEFINE(DISABLE_SHADOW)
91 AC_DEFINE(IPV4_DEFAULT)
92 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +000093 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +000094 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -070095 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +000096 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +110097 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000098*-*-dgux*)
99 AC_DEFINE(IP_TOS_IS_BROKEN)
100 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000101*-*-darwin*)
102 AC_DEFINE(BROKEN_GETADDRINFO)
103 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000104*-*-hpux10.26)
105 if test -z "$GCC"; then
106 CFLAGS="$CFLAGS -Ae"
107 fi
108 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
109 IPADDR_IN_DISPLAY=yes
110 AC_DEFINE(HAVE_SECUREWARE)
111 AC_DEFINE(USE_PIPES)
112 AC_DEFINE(LOGIN_NO_ENDOPT)
113 AC_DEFINE(LOGIN_NEEDS_UTMPX)
114 AC_DEFINE(DISABLE_SHADOW)
115 AC_DEFINE(DISABLE_UTMP)
116 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
117 LIBS="$LIBS -lxnet -lsec -lsecpw"
118 disable_ptmx_check=yes
119 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100120*-*-hpux10*)
121 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000122 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100123 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000124 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100125 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000126 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000127 AC_DEFINE(LOGIN_NO_ENDOPT)
128 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100129 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100130 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000131 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves315f8b72001-06-28 00:24:41 +0000132 LIBS="$LIBS -lxnet -lsec"
Damien Miller76112de1999-12-21 11:18:08 +1100133 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000134*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000135 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100136 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100137 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100138 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000139 AC_DEFINE(LOGIN_NO_ENDOPT)
140 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100141 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100142 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000143 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000144 LIBS="$LIBS -lxnet -lsec"
Damien Miller1bead332000-04-30 00:47:29 +1000145 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100146*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000147 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000148 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100149 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000150 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000151 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller1808f382000-01-06 12:03:12 +1100152 ;;
153*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000154 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000155 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100156 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000157 AC_DEFINE(WITH_IRIX_ARRAY)
158 AC_DEFINE(WITH_IRIX_PROJECT)
159 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000160 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000161 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000162 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100163 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100164*-*-linux*)
165 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100166 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100167 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000168 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100169 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100170 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000171mips-sony-bsd|mips-sony-newsos4)
172 AC_DEFINE(HAVE_NEWS4)
173 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000174 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100175*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100176 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100177 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100178*-*-freebsd*)
179 check_for_libcrypt_later=1
180 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000181*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000182 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100183 conf_utmp_location=/etc/utmp
184 conf_wtmp_location=/usr/adm/wtmp
185 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000186 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000187 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000188 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100189 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000190 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000191 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000192 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100193*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000194 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000195 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100196 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100197 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000198 AC_DEFINE(LOGIN_NEEDS_UTMPX)
199 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000200 AC_DEFINE(PAM_TTY_KLUDGE)
andre2ff7b5d2000-06-03 14:57:40 +0000201 # hardwire lastlog location (can't detect it on some versions)
202 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000203 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
204 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
205 if test "$sol2ver" -ge 8; then
206 AC_MSG_RESULT(yes)
207 AC_DEFINE(DISABLE_UTMP)
208 AC_DEFINE(DISABLE_WTMP)
209 else
210 AC_MSG_RESULT(no)
211 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100212 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000213*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000214 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000215 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100216 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000217 conf_utmp_location=/etc/utmp
218 conf_wtmp_location=/var/adm/wtmp
219 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000220 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000221 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000222*-ncr-sysv*)
223 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
224 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700225 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000226 AC_DEFINE(USE_PIPES)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000227 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000228*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000229 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700230 # /usr/ucblib MUST NOT be searched on ReliantUNIX
231 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100232 IPADDR_IN_DISPLAY=yes
233 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000234 AC_DEFINE(IP_TOS_IS_BROKEN)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700235 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
236 # Attention: always take care to bind libsocket and libnsl before libc,
237 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000238 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100239*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000240 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100241 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100242 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100243 ;;
244*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000245 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100246 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100247 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100248 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100249*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000250 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100251 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100252 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100253*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000254 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100255 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700256 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100257 RANLIB=true
258 no_dev_ptmx=1
259 AC_DEFINE(BROKEN_SYS_TERMIO_H)
260 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000261 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000262 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100263 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100264 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700265 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700266 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100267 ;;
268*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000269 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000270 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100271 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000272 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100273 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000274 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000275 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700276 AC_DEFINE(DISABLE_FD_PASSING)
Damien Miller217f5672001-02-16 12:12:41 +1100277 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700278 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000279 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000280*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700281 no_libsocket=1
282 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000283 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700284 AC_DEFINE(DISABLE_FD_PASSING)
Tim Ricee991e3c2001-08-07 15:29:07 -0700285 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
286 LIBS="$LIBS -lgen -lrsc"
287 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000288*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000289 AC_MSG_CHECKING(for Digital Unix SIA)
290 no_osfsia=""
291 AC_ARG_WITH(osfsia,
292 [ --with-osfsia Enable Digital Unix SIA],
293 [
294 if test "x$withval" = "xno" ; then
295 AC_MSG_RESULT(disabled)
296 no_osfsia=1
297 fi
298 ],
299 )
300 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000301 if test -f /etc/sia/matrix.conf; then
302 AC_MSG_RESULT(yes)
303 AC_DEFINE(HAVE_OSF_SIA)
304 AC_DEFINE(DISABLE_LOGIN)
305 LIBS="$LIBS -lsecurity -ldb -lm -laud"
306 else
307 AC_MSG_RESULT(no)
308 fi
309 fi
310 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000311
312*-*-nto-qnx)
313 AC_DEFINE(USE_PIPES)
314 AC_DEFINE(NO_X11_UNIX_SOCKETS)
315 AC_DEFINE(MISSING_NFDBITS)
316 AC_DEFINE(MISSING_HOWMANY)
317 AC_DEFINE(MISSING_FD_MASK)
318 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100319esac
320
Damien Millere37bfc12000-06-05 09:37:43 +1000321# Allow user to specify flags
322AC_ARG_WITH(cflags,
323 [ --with-cflags Specify additional flags to pass to compiler],
324 [
325 if test "x$withval" != "xno" ; then
326 CFLAGS="$CFLAGS $withval"
327 fi
328 ]
329)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000330AC_ARG_WITH(cppflags,
331 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
332 [
333 if test "x$withval" != "xno"; then
334 CPPFLAGS="$CPPFLAGS $withval"
335 fi
336 ]
337)
Damien Millere37bfc12000-06-05 09:37:43 +1000338AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000339 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000340 [
341 if test "x$withval" != "xno" ; then
342 LDFLAGS="$LDFLAGS $withval"
343 fi
344 ]
345)
346AC_ARG_WITH(libs,
347 [ --with-libs Specify additional libraries to link with],
348 [
349 if test "x$withval" != "xno" ; then
350 LIBS="$LIBS $withval"
351 fi
352 ]
353)
354
Tim Rice4cec93f2002-02-26 08:40:48 -0800355# Checks for header files.
356AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
357 getopt.h glob.h lastlog.h limits.h login.h \
358 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000359 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000360 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800361 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000362 sys/mman.h sys/select.h sys/stat.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800363 sys/stropts.h sys/sysmacros.h sys/time.h \
Kevin Steves117b06d2002-03-30 17:55:21 +0000364 sys/un.h time.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800365 util.h utime.h utmp.h utmpx.h)
366
Damien Millera22ba012000-03-02 23:09:20 +1100367# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700368AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
369AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000370
Damien Millerdf288022001-02-18 13:07:07 +1100371dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700372if test "x$with_tcp_wrappers" != "xno" ; then
373 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
374 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
375 fi
376fi
Damien Millerdf288022001-02-18 13:07:07 +1100377
Tim Rice13aae5e2001-10-21 17:53:58 -0700378AC_CHECK_FUNC(getspnam, ,
379 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700380
Damien Miller150c8b52002-02-13 23:06:56 +1100381AC_ARG_WITH(rpath,
382 [ --without-rpath Disable auto-added -R linker paths],
383 [
384 if test "x$withval" = "xno" ; then
385 need_dash_r=""
386 fi
387 if test "x$withval" = "xyes" ; then
388 need_dash_r=1
389 fi
390 ]
391)
392
Tim Rice13aae5e2001-10-21 17:53:58 -0700393dnl zlib is required
394AC_ARG_WITH(zlib,
395 [ --with-zlib=PATH Use zlib in PATH],
396 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000397 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100398 AC_MSG_ERROR([*** zlib is required ***])
399 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700400 if test -d "$withval/lib"; then
401 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700402 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700403 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700404 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700405 fi
406 else
407 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700408 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700409 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700410 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700411 fi
412 fi
413 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700414 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700415 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700416 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700417 fi
418 ]
419)
420
Tim Rice17b93e52001-10-23 22:36:54 -0700421AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100422
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000423dnl UnixWare 2.x
424AC_CHECK_FUNC(strcasecmp,
425 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
426)
427AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700428 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
429 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000430)
Damien Millerab18c411999-11-11 10:40:23 +1100431
Tim Ricee589a292001-11-03 11:09:32 -0800432dnl Checks for libutil functions
433AC_CHECK_HEADERS(libutil.h)
434AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
435AC_CHECK_FUNCS(logout updwtmp logwtmp)
436
Ben Lindstrom8697e082001-02-24 21:41:10 +0000437AC_FUNC_STRFTIME
438
Damien Miller3c027682001-03-14 11:39:45 +1100439# Check for ALTDIRFUNC glob() extension
440AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
441AC_EGREP_CPP(FOUNDIT,
442 [
443 #include <glob.h>
444 #ifdef GLOB_ALTDIRFUNC
445 FOUNDIT
446 #endif
447 ],
448 [
449 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
450 AC_MSG_RESULT(yes)
451 ],
452 [
453 AC_MSG_RESULT(no)
454 ]
455)
Damien Millerab18c411999-11-11 10:40:23 +1100456
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000457# Check for g.gl_matchc glob() extension
458AC_MSG_CHECKING(for gl_matchc field in glob_t)
459AC_EGREP_CPP(FOUNDIT,
460 [
461 #include <glob.h>
462 int main(void){glob_t g; g.gl_matchc = 1;}
463 ],
464 [
465 AC_DEFINE(GLOB_HAS_GL_MATCHC)
466 AC_MSG_RESULT(yes)
467 ],
468 [
469 AC_MSG_RESULT(no)
470 ]
471)
472
Damien Miller18bb4732001-03-28 14:35:30 +1000473AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
474AC_TRY_RUN(
475 [
476#include <sys/types.h>
477#include <dirent.h>
478int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
479 ],
480 [AC_MSG_RESULT(yes)],
481 [
482 AC_MSG_RESULT(no)
483 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
484 ]
485)
486
Damien Millerc547bf12001-02-16 10:18:12 +1100487# Check whether user wants S/Key support
488SKEY_MSG="no"
489AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700490 [ --with-skey[[=PATH]] Enable S/Key support
491 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100492 [
493 if test "x$withval" != "xno" ; then
494
495 if test "x$withval" != "xyes" ; then
496 CPPFLAGS="$CPPFLAGS -I${withval}/include"
497 LDFLAGS="$LDFLAGS -L${withval}/lib"
498 fi
499
500 AC_DEFINE(SKEY)
501 LIBS="-lskey $LIBS"
502 SKEY_MSG="yes"
503
Tim Rice4cec93f2002-02-26 08:40:48 -0800504 AC_MSG_CHECKING([for s/key support])
505 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100506 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800507#include <stdio.h>
508#include <skey.h>
509int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
510 ],
511 [AC_MSG_RESULT(yes)],
512 [
513 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100514 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
515 ])
516 fi
517 ]
518)
519
520# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700521TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100522AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700523 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
524 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100525 [
526 if test "x$withval" != "xno" ; then
527 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700528 saved_LDFLAGS="$LDFLAGS"
529 saved_CPPFLAGS="$CPPFLAGS"
530 if test -n "${withval}" -a "${withval}" != "yes"; then
531 if test -d "${withval}/lib"; then
532 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700533 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700534 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700535 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700536 fi
537 else
538 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700539 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700540 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700541 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700542 fi
543 fi
544 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700545 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700546 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700547 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700548 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700549 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800550 LIBWRAP="-lwrap"
551 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100552 AC_MSG_CHECKING(for libwrap)
553 AC_TRY_LINK(
554 [
555#include <tcpd.h>
556 int deny_severity = 0, allow_severity = 0;
557 ],
558 [hosts_access(0);],
559 [
560 AC_MSG_RESULT(yes)
561 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800562 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700563 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100564 ],
565 [
566 AC_MSG_ERROR([*** libwrap missing])
567 ]
568 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800569 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100570 fi
571 ]
572)
573
Damien Millerad833b32000-08-23 10:46:23 +1000574dnl Checks for library functions.
Ben Lindstromfdee8ef2002-04-06 23:52:02 +0000575AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
Tim Rice13aae5e2001-10-21 17:53:58 -0700576 clock fchmod fchown freeaddrinfo futimes gai_strerror \
577 getaddrinfo getcwd getgrouplist getnameinfo getopt \
578 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
579 inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller594a71b2002-04-23 20:22:59 +1000580 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
581 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
Ben Lindstrom837461b2002-06-12 16:57:14 +0000582 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
Ben Lindstromf0bfa832002-06-21 00:01:18 +0000583 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
584 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
585 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
Tim Rice13aae5e2001-10-21 17:53:58 -0700586
Ben Lindstrom6b0c96a2002-06-25 03:22:03 +0000587if test $ac_cv_func_mmap = yes ; then
588AC_MSG_CHECKING([for mmap anon shared])
589AC_TRY_RUN(
590 [
591#include <stdio.h>
Ben Lindstrom68e83112002-06-28 00:37:33 +0000592#include <sys/types.h>
Ben Lindstrom6b0c96a2002-06-25 03:22:03 +0000593#include <sys/mman.h>
594#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
595#define MAP_ANON MAP_ANONYMOUS
596#endif
597main() { char *p;
598p = (char *) mmap(NULL, 10, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED, -1, 0);
599if (p == (char *)-1)
600 exit(1);
601exit(0);
602}
603 ],
604 [
605 AC_MSG_RESULT(yes)
606 AC_DEFINE(HAVE_MMAP_ANON_SHARED)
607 ],
608 [ AC_MSG_RESULT(no) ]
609)
610fi
611
Tim Rice13aae5e2001-10-21 17:53:58 -0700612dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700613AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700614 AC_CHECK_LIB(gen, dirname,[
615 AC_CACHE_CHECK([for broken dirname],
616 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700617 save_LIBS="$LIBS"
618 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700619 AC_TRY_RUN(
620 [
621#include <libgen.h>
622#include <string.h>
623
624int main(int argc, char **argv) {
625 char *s, buf[32];
626
627 strncpy(buf,"/etc", 32);
628 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700629 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700630 exit(1);
631 } else {
632 exit(0);
633 }
634}
635 ],
636 [ ac_cv_have_broken_dirname="no" ],
637 [ ac_cv_have_broken_dirname="yes" ]
638 )
Tim Rice17b93e52001-10-23 22:36:54 -0700639 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700640 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700641 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700642 LIBS="$LIBS -lgen"
643 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700644 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700645 fi
646 ])
647])
648
Damien Millerad833b32000-08-23 10:46:23 +1000649dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000650AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000651dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000652AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000653AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000654dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000655AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000656AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100657
Damien Miller04f80141999-11-19 15:32:34 +1100658AC_CHECK_FUNC(daemon,
659 [AC_DEFINE(HAVE_DAEMON)],
660 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
661)
662
Damien Miller9fb07e42000-03-05 16:22:59 +1100663AC_CHECK_FUNC(getpagesize,
664 [AC_DEFINE(HAVE_GETPAGESIZE)],
665 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
666)
667
Damien Millercb170cb2000-07-01 16:52:55 +1000668# Check for broken snprintf
669if test "x$ac_cv_func_snprintf" = "xyes" ; then
670 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
671 AC_TRY_RUN(
672 [
673#include <stdio.h>
674int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
675 ],
676 [AC_MSG_RESULT(yes)],
677 [
678 AC_MSG_RESULT(no)
679 AC_DEFINE(BROKEN_SNPRINTF)
680 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
681 ]
682 )
683fi
684
Damien Miller606f8802000-09-16 15:39:56 +1100685AC_FUNC_GETPGRP
686
Damien Millera64b57a2001-01-17 10:44:13 +1100687# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000688PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100689AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100690 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100691 [
Damien Millera64b57a2001-01-17 10:44:13 +1100692 if test "x$withval" != "xno" ; then
693 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
694 AC_MSG_ERROR([PAM headers not found])
695 fi
696
697 AC_CHECK_LIB(dl, dlopen, , )
698 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
699 AC_CHECK_FUNCS(pam_getenvlist)
700
701 disable_shadow=yes
702 PAM_MSG="yes"
703
704 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800705 if test $ac_cv_lib_dl_dlopen = yes; then
706 LIBPAM="-lpam -ldl"
707 else
708 LIBPAM="-lpam"
709 fi
710 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100711 fi
712 ]
713)
Damien Millera22ba012000-03-02 23:09:20 +1100714
Damien Millera64b57a2001-01-17 10:44:13 +1100715# Check for older PAM
716if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100717 # Check PAM strerror arguments (old PAM)
718 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
719 AC_TRY_COMPILE(
720 [
Damien Miller81171112000-04-23 11:14:01 +1000721#include <stdlib.h>
722#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100723 ],
724 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
725 [AC_MSG_RESULT(no)],
726 [
727 AC_DEFINE(HAVE_OLD_PAM)
728 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000729 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100730 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100731 )
Damien Millera22ba012000-03-02 23:09:20 +1100732fi
733
Tim Riceaef73712002-05-11 13:17:42 -0700734# Search for OpenSSL
735saved_CPPFLAGS="$CPPFLAGS"
736saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100737AC_ARG_WITH(ssl-dir,
738 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
739 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000740 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700741 if test -d "$withval/lib"; then
742 if test -n "${need_dash_r}"; then
743 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
744 else
745 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
746 fi
747 else
748 if test -n "${need_dash_r}"; then
749 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
750 else
751 LDFLAGS="-L${withval} ${LDFLAGS}"
752 fi
753 fi
754 if test -d "$withval/include"; then
755 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
756 else
757 CPPFLAGS="-I${withval} ${CPPFLAGS}"
758 fi
Damien Millera22ba012000-03-02 23:09:20 +1100759 fi
760 ]
761)
Tim Riceaef73712002-05-11 13:17:42 -0700762LIBS="$LIBS -lcrypto"
763AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000764 [
Tim Riceaef73712002-05-11 13:17:42 -0700765 dnl Check default openssl install dir
766 if test -n "${need_dash_r}"; then
767 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000768 else
Tim Riceaef73712002-05-11 13:17:42 -0700769 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000770 fi
Tim Riceaef73712002-05-11 13:17:42 -0700771 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
772 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
773 [
774 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
775 ]
776 )
777 ]
778)
779
Damien Millera22ba012000-03-02 23:09:20 +1100780
Damien Millerec932372002-01-22 22:16:03 +1100781# Sanity check OpenSSL headers
782AC_MSG_CHECKING([whether OpenSSL's headers match the library])
783AC_TRY_RUN(
784 [
785#include <string.h>
786#include <openssl/opensslv.h>
787int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
788 ],
789 [
790 AC_MSG_RESULT(yes)
791 ],
792 [
793 AC_MSG_RESULT(no)
794 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
795 ]
796)
797
Damien Millera64b57a2001-01-17 10:44:13 +1100798# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
799# version in OpenSSL. Skip this for PAM
800if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100801 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100802fi
803
Damien Miller6c21c512002-01-22 21:57:53 +1100804
805### Configure cryptographic random number support
806
807# Check wheter OpenSSL seeds itself
808AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
809AC_TRY_RUN(
810 [
811#include <string.h>
812#include <openssl/rand.h>
813int main(void) { return(RAND_status() == 1 ? 0 : 1); }
814 ],
815 [
816 OPENSSL_SEEDS_ITSELF=yes
817 AC_MSG_RESULT(yes)
818 ],
819 [
820 AC_MSG_RESULT(no)
821 # Default to use of the rand helper if OpenSSL doesn't
822 # seed itself
823 USE_RAND_HELPER=yes
824 ]
825)
826
827
828# Do we want to force the use of the rand helper?
829AC_ARG_WITH(rand-helper,
830 [ --with-rand-helper Use subprocess to gather strong randomness ],
831 [
832 if test "x$withval" = "xno" ; then
833 # Force use of OpenSSL's internal RNG, even if
834 # the previous test showed it to be unseeded.
835 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
836 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
837 OPENSSL_SEEDS_ITSELF=yes
838 USE_RAND_HELPER=""
839 fi
840 else
841 USE_RAND_HELPER=yes
842 fi
843 ],
844)
845
846# Which randomness source do we use?
847if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
848 # OpenSSL only
849 AC_DEFINE(OPENSSL_PRNG_ONLY)
850 RAND_MSG="OpenSSL internal ONLY"
851 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800852elif test ! -z "$USE_RAND_HELPER" ; then
853 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100854 RAND_MSG="ssh-rand-helper"
855 INSTALL_SSH_RAND_HELPER="yes"
856fi
857AC_SUBST(INSTALL_SSH_RAND_HELPER)
858
859### Configuration of ssh-rand-helper
860
861# PRNGD TCP socket
862AC_ARG_WITH(prngd-port,
863 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
864 [
Damien Millere996d722002-01-23 11:20:59 +1100865 case "$withval" in
866 no)
867 withval=""
868 ;;
869 [[0-9]]*)
870 ;;
871 *)
872 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
873 ;;
874 esac
875 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100876 PRNGD_PORT="$withval"
877 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
878 fi
879 ]
880)
881
882# PRNGD Unix domain socket
883AC_ARG_WITH(prngd-socket,
884 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
885 [
Damien Millere996d722002-01-23 11:20:59 +1100886 case "$withval" in
887 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100888 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100889 ;;
890 no)
891 withval=""
892 ;;
893 /*)
894 ;;
895 *)
896 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
897 ;;
898 esac
899
900 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100901 if test ! -z "$PRNGD_PORT" ; then
902 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
903 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100904 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100905 AC_MSG_WARN(Entropy socket is not readable)
906 fi
907 PRNGD_SOCKET="$withval"
908 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
909 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800910 ],
911 [
912 # Check for existing socket only if we don't have a random device already
913 if test "$USE_RAND_HELPER" = yes ; then
914 AC_MSG_CHECKING(for PRNGD/EGD socket)
915 # Insert other locations here
916 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
917 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
918 PRNGD_SOCKET="$sock"
919 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
920 break;
921 fi
922 done
923 if test ! -z "$PRNGD_SOCKET" ; then
924 AC_MSG_RESULT($PRNGD_SOCKET)
925 else
926 AC_MSG_RESULT(not found)
927 fi
928 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100929 ]
930)
931
932# Change default command timeout for hashing entropy source
933entropy_timeout=200
934AC_ARG_WITH(entropy-timeout,
935 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
936 [
937 if test "x$withval" != "xno" ; then
938 entropy_timeout=$withval
939 fi
940 ]
941)
Damien Miller6c21c512002-01-22 21:57:53 +1100942AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
943
Damien Millerd3f6ad22002-06-25 10:24:47 +1000944SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +0000945AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +0000946 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +0000947 [
948 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +1000949 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +0000950 fi
951 ]
952)
Damien Millerd3f6ad22002-06-25 10:24:47 +1000953AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
954AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +0000955
Tim Rice88f2ab52002-03-17 12:17:34 -0800956# We do this little dance with the search path to insure
957# that programs that we select for use by installed programs
958# (which may be run by the super-user) come from trusted
959# locations before they come from the user's private area.
960# This should help avoid accidentally configuring some
961# random version of a program in someone's personal bin.
962
963OPATH=$PATH
964PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -0700965test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -0800966test -d /sbin && PATH=$PATH:/sbin
967test -d /usr/sbin && PATH=$PATH:/usr/sbin
968PATH=$PATH:/etc:$OPATH
969
Damien Miller6c21c512002-01-22 21:57:53 +1100970# These programs are used by the command hashing source to gather entropy
971OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
972OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
973OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
974OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
975OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
976OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
977OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
978OSSH_PATH_ENTROPY_PROG(PROG_W, w)
979OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
980OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
981OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
982OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
983OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
984OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
985OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
986OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -0800987# restore PATH
988PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +1100989
990# Where does ssh-rand-helper get its randomness from?
991INSTALL_SSH_PRNG_CMDS=""
992if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
993 if test ! -z "$PRNGD_PORT" ; then
994 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
995 elif test ! -z "$PRNGD_SOCKET" ; then
996 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
997 else
998 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
999 RAND_HELPER_CMDHASH=yes
1000 INSTALL_SSH_PRNG_CMDS="yes"
1001 fi
1002fi
1003AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1004
1005
Ben Lindstromb5628642000-10-18 00:02:25 +00001006# Cheap hack to ensure NEWS-OS libraries are arranged right.
1007if test ! -z "$SONY" ; then
1008 LIBS="$LIBS -liberty";
1009fi
1010
Damien Millera22ba012000-03-02 23:09:20 +11001011# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001012AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001013AC_CHECK_SIZEOF(short int, 2)
1014AC_CHECK_SIZEOF(int, 4)
1015AC_CHECK_SIZEOF(long int, 4)
1016AC_CHECK_SIZEOF(long long int, 8)
1017
Damien Millerfa2bb692002-04-23 23:22:25 +10001018# Sanity check long long for some platforms (AIX)
1019if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1020 ac_cv_sizeof_long_long_int=0
1021fi
1022
Damien Millera22ba012000-03-02 23:09:20 +11001023# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001024AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1025 AC_TRY_COMPILE(
1026 [ #include <sys/types.h> ],
1027 [ u_int a; a = 1;],
1028 [ ac_cv_have_u_int="yes" ],
1029 [ ac_cv_have_u_int="no" ]
1030 )
1031])
1032if test "x$ac_cv_have_u_int" = "xyes" ; then
1033 AC_DEFINE(HAVE_U_INT)
1034 have_u_int=1
1035fi
1036
Damien Miller61e50f12000-05-08 20:49:37 +10001037AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1038 AC_TRY_COMPILE(
1039 [ #include <sys/types.h> ],
1040 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1041 [ ac_cv_have_intxx_t="yes" ],
1042 [ ac_cv_have_intxx_t="no" ]
1043 )
1044])
1045if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1046 AC_DEFINE(HAVE_INTXX_T)
1047 have_intxx_t=1
1048fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001049
1050if (test -z "$have_intxx_t" && \
1051 test "x$ac_cv_header_stdint_h" = "xyes")
1052then
1053 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1054 AC_TRY_COMPILE(
1055 [ #include <stdint.h> ],
1056 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1057 [
1058 AC_DEFINE(HAVE_INTXX_T)
1059 AC_MSG_RESULT(yes)
1060 ],
1061 [ AC_MSG_RESULT(no) ]
1062 )
1063fi
1064
Damien Miller578783e2000-09-23 14:12:24 +11001065AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1066 AC_TRY_COMPILE(
1067 [ #include <sys/types.h> ],
1068 [ int64_t a; a = 1;],
1069 [ ac_cv_have_int64_t="yes" ],
1070 [ ac_cv_have_int64_t="no" ]
1071 )
1072])
1073if test "x$ac_cv_have_int64_t" = "xyes" ; then
1074 AC_DEFINE(HAVE_INT64_T)
1075 have_int64_t=1
1076fi
1077
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001078if test -z "$have_int64_t" ; then
1079 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1080 AC_TRY_COMPILE(
1081 [ #include <sys/socket.h> ],
1082 [ int64_t a; a = 1],
1083 [
1084 AC_DEFINE(HAVE_INT64_T)
1085 AC_MSG_RESULT(yes)
1086 ],
1087 [ AC_MSG_RESULT(no) ]
1088 )
1089fi
1090
Tim Rice4cec93f2002-02-26 08:40:48 -08001091if test -z "$have_int64_t" ; then
1092 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1093 AC_TRY_COMPILE(
1094 [ #include <sys/bitypes.h> ],
1095 [ int64_t a; a = 1],
1096 [
1097 AC_DEFINE(HAVE_INT64_T)
1098 AC_MSG_RESULT(yes)
1099 ],
1100 [ AC_MSG_RESULT(no) ]
1101 )
1102fi
1103
Damien Miller61e50f12000-05-08 20:49:37 +10001104AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1105 AC_TRY_COMPILE(
1106 [ #include <sys/types.h> ],
1107 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1108 [ ac_cv_have_u_intxx_t="yes" ],
1109 [ ac_cv_have_u_intxx_t="no" ]
1110 )
1111])
1112if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1113 AC_DEFINE(HAVE_U_INTXX_T)
1114 have_u_intxx_t=1
1115fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001116
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001117if test -z "$have_u_intxx_t" ; then
1118 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1119 AC_TRY_COMPILE(
1120 [ #include <sys/socket.h> ],
1121 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1122 [
1123 AC_DEFINE(HAVE_U_INTXX_T)
1124 AC_MSG_RESULT(yes)
1125 ],
1126 [ AC_MSG_RESULT(no) ]
1127 )
1128fi
1129
Damien Miller578783e2000-09-23 14:12:24 +11001130AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1131 AC_TRY_COMPILE(
1132 [ #include <sys/types.h> ],
1133 [ u_int64_t a; a = 1;],
1134 [ ac_cv_have_u_int64_t="yes" ],
1135 [ ac_cv_have_u_int64_t="no" ]
1136 )
1137])
1138if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1139 AC_DEFINE(HAVE_U_INT64_T)
1140 have_u_int64_t=1
1141fi
1142
Tim Rice4cec93f2002-02-26 08:40:48 -08001143if test -z "$have_u_int64_t" ; then
1144 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1145 AC_TRY_COMPILE(
1146 [ #include <sys/bitypes.h> ],
1147 [ u_int64_t a; a = 1],
1148 [
1149 AC_DEFINE(HAVE_U_INT64_T)
1150 AC_MSG_RESULT(yes)
1151 ],
1152 [ AC_MSG_RESULT(no) ]
1153 )
1154fi
1155
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001156if test -z "$have_u_intxx_t" ; then
1157 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1158 AC_TRY_COMPILE(
1159 [
1160#include <sys/types.h>
1161 ],
1162 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1163 [ ac_cv_have_uintxx_t="yes" ],
1164 [ ac_cv_have_uintxx_t="no" ]
1165 )
1166 ])
1167 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1168 AC_DEFINE(HAVE_UINTXX_T)
1169 fi
1170fi
1171
1172if test -z "$have_uintxx_t" ; then
1173 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1174 AC_TRY_COMPILE(
1175 [ #include <stdint.h> ],
1176 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1177 [
1178 AC_DEFINE(HAVE_UINTXX_T)
1179 AC_MSG_RESULT(yes)
1180 ],
1181 [ AC_MSG_RESULT(no) ]
1182 )
1183fi
1184
Damien Milleredb82922000-06-20 13:25:52 +10001185if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1186 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001187then
1188 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1189 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001190 [
1191#include <sys/bitypes.h>
1192 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001193 [
Damien Miller70494d12000-04-03 15:57:06 +10001194 int8_t a; int16_t b; int32_t c;
1195 u_int8_t e; u_int16_t f; u_int32_t g;
1196 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001197 ],
1198 [
1199 AC_DEFINE(HAVE_U_INTXX_T)
1200 AC_DEFINE(HAVE_INTXX_T)
1201 AC_MSG_RESULT(yes)
1202 ],
1203 [AC_MSG_RESULT(no)]
1204 )
1205fi
1206
Damien Miller58be7382001-09-15 21:31:54 +10001207
1208AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1209 AC_TRY_COMPILE(
1210 [
1211#include <sys/types.h>
1212 ],
1213 [ u_char foo; foo = 125; ],
1214 [ ac_cv_have_u_char="yes" ],
1215 [ ac_cv_have_u_char="no" ]
1216 )
1217])
1218if test "x$ac_cv_have_u_char" = "xyes" ; then
1219 AC_DEFINE(HAVE_U_CHAR)
1220fi
1221
Tim Rice13aae5e2001-10-21 17:53:58 -07001222TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001223
Tim Rice200a5c02002-02-26 22:12:34 -08001224AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001225
Damien Miller61e50f12000-05-08 20:49:37 +10001226AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1227 AC_TRY_COMPILE(
1228 [
1229#include <sys/types.h>
1230 ],
1231 [ size_t foo; foo = 1235; ],
1232 [ ac_cv_have_size_t="yes" ],
1233 [ ac_cv_have_size_t="no" ]
1234 )
1235])
1236if test "x$ac_cv_have_size_t" = "xyes" ; then
1237 AC_DEFINE(HAVE_SIZE_T)
1238fi
Damien Miller95058511999-12-29 10:36:45 +11001239
Damien Miller615f9392000-05-17 22:53:33 +10001240AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1241 AC_TRY_COMPILE(
1242 [
1243#include <sys/types.h>
1244 ],
1245 [ ssize_t foo; foo = 1235; ],
1246 [ ac_cv_have_ssize_t="yes" ],
1247 [ ac_cv_have_ssize_t="no" ]
1248 )
1249])
1250if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1251 AC_DEFINE(HAVE_SSIZE_T)
1252fi
1253
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001254AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1255 AC_TRY_COMPILE(
1256 [
1257#include <time.h>
1258 ],
1259 [ clock_t foo; foo = 1235; ],
1260 [ ac_cv_have_clock_t="yes" ],
1261 [ ac_cv_have_clock_t="no" ]
1262 )
1263])
1264if test "x$ac_cv_have_clock_t" = "xyes" ; then
1265 AC_DEFINE(HAVE_CLOCK_T)
1266fi
1267
Damien Millerb54b40e2000-06-23 08:23:34 +10001268AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1269 AC_TRY_COMPILE(
1270 [
1271#include <sys/types.h>
1272#include <sys/socket.h>
1273 ],
1274 [ sa_family_t foo; foo = 1235; ],
1275 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001276 [ AC_TRY_COMPILE(
1277 [
1278#include <sys/types.h>
1279#include <sys/socket.h>
1280#include <netinet/in.h>
1281 ],
1282 [ sa_family_t foo; foo = 1235; ],
1283 [ ac_cv_have_sa_family_t="yes" ],
1284
Damien Millerb54b40e2000-06-23 08:23:34 +10001285 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001286 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001287 )
1288])
1289if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1290 AC_DEFINE(HAVE_SA_FAMILY_T)
1291fi
1292
Damien Miller0f91b4e2000-06-18 15:43:25 +10001293AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1294 AC_TRY_COMPILE(
1295 [
1296#include <sys/types.h>
1297 ],
1298 [ pid_t foo; foo = 1235; ],
1299 [ ac_cv_have_pid_t="yes" ],
1300 [ ac_cv_have_pid_t="no" ]
1301 )
1302])
1303if test "x$ac_cv_have_pid_t" = "xyes" ; then
1304 AC_DEFINE(HAVE_PID_T)
1305fi
1306
1307AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1308 AC_TRY_COMPILE(
1309 [
1310#include <sys/types.h>
1311 ],
1312 [ mode_t foo; foo = 1235; ],
1313 [ ac_cv_have_mode_t="yes" ],
1314 [ ac_cv_have_mode_t="no" ]
1315 )
1316])
1317if test "x$ac_cv_have_mode_t" = "xyes" ; then
1318 AC_DEFINE(HAVE_MODE_T)
1319fi
1320
Damien Miller61e50f12000-05-08 20:49:37 +10001321
1322AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1323 AC_TRY_COMPILE(
1324 [
Damien Miller81171112000-04-23 11:14:01 +10001325#include <sys/types.h>
1326#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001327 ],
1328 [ struct sockaddr_storage s; ],
1329 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1330 [ ac_cv_have_struct_sockaddr_storage="no" ]
1331 )
1332])
1333if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1334 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1335fi
Damien Miller34132e52000-01-14 15:45:46 +11001336
Damien Miller61e50f12000-05-08 20:49:37 +10001337AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1338 AC_TRY_COMPILE(
1339 [
Damien Miller7b22d652000-06-18 14:07:04 +10001340#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001341#include <netinet/in.h>
1342 ],
1343 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1344 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1345 [ ac_cv_have_struct_sockaddr_in6="no" ]
1346 )
1347])
1348if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1349 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1350fi
Damien Miller34132e52000-01-14 15:45:46 +11001351
Damien Miller61e50f12000-05-08 20:49:37 +10001352AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1353 AC_TRY_COMPILE(
1354 [
Damien Miller7b22d652000-06-18 14:07:04 +10001355#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001356#include <netinet/in.h>
1357 ],
1358 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1359 [ ac_cv_have_struct_in6_addr="yes" ],
1360 [ ac_cv_have_struct_in6_addr="no" ]
1361 )
1362])
1363if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1364 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1365fi
Damien Miller34132e52000-01-14 15:45:46 +11001366
Damien Miller61e50f12000-05-08 20:49:37 +10001367AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1368 AC_TRY_COMPILE(
1369 [
Damien Miller81171112000-04-23 11:14:01 +10001370#include <sys/types.h>
1371#include <sys/socket.h>
1372#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001373 ],
1374 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1375 [ ac_cv_have_struct_addrinfo="yes" ],
1376 [ ac_cv_have_struct_addrinfo="no" ]
1377 )
1378])
1379if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1380 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1381fi
1382
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001383AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1384 AC_TRY_COMPILE(
1385 [ #include <sys/time.h> ],
1386 [ struct timeval tv; tv.tv_sec = 1;],
1387 [ ac_cv_have_struct_timeval="yes" ],
1388 [ ac_cv_have_struct_timeval="no" ]
1389 )
1390])
1391if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1392 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1393 have_struct_timeval=1
1394fi
1395
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001396# If we don't have int64_t then we can't compile sftp-server. So don't
1397# even attempt to do it.
1398if test "x$ac_cv_have_int64_t" = "xno" -a \
1399 "x$ac_cv_sizeof_long_int" != "x8" -a \
1400 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1401 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001402else
1403dnl test snprintf (broken on SCO w/gcc)
1404 AC_TRY_RUN(
1405 [
1406#include <stdio.h>
1407#include <string.h>
1408#ifdef HAVE_SNPRINTF
1409main()
1410{
1411 char buf[50];
1412 char expected_out[50];
1413 int mazsize = 50 ;
1414#if (SIZEOF_LONG_INT == 8)
1415 long int num = 0x7fffffffffffffff;
1416#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001417 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001418#endif
1419 strcpy(expected_out, "9223372036854775807");
1420 snprintf(buf, mazsize, "%lld", num);
1421 if(strcmp(buf, expected_out) != 0)
1422 exit(1);
1423 exit(0);
1424}
1425#else
1426main() { exit(0); }
1427#endif
1428 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1429 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001430fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001431AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001432
Damien Miller78315eb2000-09-29 23:01:36 +11001433dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001434OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1435OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1436OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1437OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1438OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001439OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001440OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1441OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001442OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001443OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1444OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1445OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1446OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001447OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1448OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1449OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1450OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001451
1452AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001453
Damien Miller61e50f12000-05-08 20:49:37 +10001454AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1455 ac_cv_have_ss_family_in_struct_ss, [
1456 AC_TRY_COMPILE(
1457 [
Damien Miller81171112000-04-23 11:14:01 +10001458#include <sys/types.h>
1459#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001460 ],
1461 [ struct sockaddr_storage s; s.ss_family = 1; ],
1462 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1463 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1464 )
1465])
1466if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1467 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1468fi
1469
Damien Miller61e50f12000-05-08 20:49:37 +10001470AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1471 ac_cv_have___ss_family_in_struct_ss, [
1472 AC_TRY_COMPILE(
1473 [
Damien Miller81171112000-04-23 11:14:01 +10001474#include <sys/types.h>
1475#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001476 ],
1477 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1478 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1479 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1480 )
1481])
1482if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1483 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1484fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001485
Damien Millerad833b32000-08-23 10:46:23 +10001486AC_CACHE_CHECK([for pw_class field in struct passwd],
1487 ac_cv_have_pw_class_in_struct_passwd, [
1488 AC_TRY_COMPILE(
1489 [
Damien Millerad833b32000-08-23 10:46:23 +10001490#include <pwd.h>
1491 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001492 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001493 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1494 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1495 )
1496])
1497if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1498 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1499fi
1500
Kevin Steves82456952001-06-22 21:14:18 +00001501AC_CACHE_CHECK([for pw_expire field in struct passwd],
1502 ac_cv_have_pw_expire_in_struct_passwd, [
1503 AC_TRY_COMPILE(
1504 [
1505#include <pwd.h>
1506 ],
1507 [ struct passwd p; p.pw_expire = 0; ],
1508 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1509 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1510 )
1511])
1512if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1513 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1514fi
1515
1516AC_CACHE_CHECK([for pw_change field in struct passwd],
1517 ac_cv_have_pw_change_in_struct_passwd, [
1518 AC_TRY_COMPILE(
1519 [
1520#include <pwd.h>
1521 ],
1522 [ struct passwd p; p.pw_change = 0; ],
1523 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1524 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1525 )
1526])
1527if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1528 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1529fi
Damien Miller61e50f12000-05-08 20:49:37 +10001530
Tim Rice28bbb0c2002-05-27 17:37:32 -07001531dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001532AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1533 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001534 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001535 [
Tim Riceae49fe62002-04-12 10:26:21 -07001536#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001537#include <sys/socket.h>
1538#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001539int main() {
1540#ifdef msg_accrights
1541exit(1);
1542#endif
1543struct msghdr m;
1544m.msg_accrights = 0;
1545exit(0);
1546}
Kevin Steves939c9db2002-03-22 17:23:25 +00001547 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001548 [ ac_cv_have_accrights_in_msghdr="yes" ],
1549 [ ac_cv_have_accrights_in_msghdr="no" ]
1550 )
1551])
1552if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1553 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1554fi
1555
Kevin Stevesa44e0352002-04-07 16:18:03 +00001556AC_CACHE_CHECK([for msg_control field in struct msghdr],
1557 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001558 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001559 [
Tim Riceae49fe62002-04-12 10:26:21 -07001560#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001561#include <sys/socket.h>
1562#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001563int main() {
1564#ifdef msg_control
1565exit(1);
1566#endif
1567struct msghdr m;
1568m.msg_control = 0;
1569exit(0);
1570}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001571 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001572 [ ac_cv_have_control_in_msghdr="yes" ],
1573 [ ac_cv_have_control_in_msghdr="no" ]
1574 )
1575])
1576if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1577 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1578fi
1579
Damien Miller61e50f12000-05-08 20:49:37 +10001580AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1581 AC_TRY_LINK([],
1582 [ extern char *__progname; printf("%s", __progname); ],
1583 [ ac_cv_libc_defines___progname="yes" ],
1584 [ ac_cv_libc_defines___progname="no" ]
1585 )
1586])
1587if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1588 AC_DEFINE(HAVE___PROGNAME)
1589fi
1590
Kevin Steves4846f4a2002-03-22 18:19:53 +00001591AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1592 AC_TRY_LINK([
1593#include <stdio.h>
1594],
1595 [ printf("%s", __FUNCTION__); ],
1596 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1597 [ ac_cv_cc_implements___FUNCTION__="no" ]
1598 )
1599])
1600if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1601 AC_DEFINE(HAVE___FUNCTION__)
1602fi
1603
1604AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1605 AC_TRY_LINK([
1606#include <stdio.h>
1607],
1608 [ printf("%s", __func__); ],
1609 [ ac_cv_cc_implements___func__="yes" ],
1610 [ ac_cv_cc_implements___func__="no" ]
1611 )
1612])
1613if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1614 AC_DEFINE(HAVE___func__)
1615fi
1616
Damien Miller4f8e6692001-07-14 13:22:53 +10001617AC_CACHE_CHECK([whether getopt has optreset support],
1618 ac_cv_have_getopt_optreset, [
1619 AC_TRY_LINK(
1620 [
1621#include <getopt.h>
1622 ],
1623 [ extern int optreset; optreset = 0; ],
1624 [ ac_cv_have_getopt_optreset="yes" ],
1625 [ ac_cv_have_getopt_optreset="no" ]
1626 )
1627])
1628if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1629 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1630fi
Damien Millera22ba012000-03-02 23:09:20 +11001631
Damien Millerecbb26d2000-07-15 14:59:14 +10001632AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1633 AC_TRY_LINK([],
1634 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1635 [ ac_cv_libc_defines_sys_errlist="yes" ],
1636 [ ac_cv_libc_defines_sys_errlist="no" ]
1637 )
1638])
1639if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1640 AC_DEFINE(HAVE_SYS_ERRLIST)
1641fi
1642
1643
Damien Miller11fa2cc2000-08-16 10:35:58 +10001644AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1645 AC_TRY_LINK([],
1646 [ extern int sys_nerr; printf("%i", sys_nerr);],
1647 [ ac_cv_libc_defines_sys_nerr="yes" ],
1648 [ ac_cv_libc_defines_sys_nerr="no" ]
1649 )
1650])
1651if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1652 AC_DEFINE(HAVE_SYS_NERR)
1653fi
1654
Damien Miller85de5802001-09-18 14:01:11 +10001655SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001656
1657# Check whether user wants sectok support
1658AC_ARG_WITH(sectok,
1659 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001660 [
1661 if test "x$withval" != "xno" ; then
1662 if test "x$withval" != "xyes" ; then
1663 CPPFLAGS="$CPPFLAGS -I${withval}"
1664 LDFLAGS="$LDFLAGS -L${withval}"
1665 if test ! -z "$need_dash_r" ; then
1666 LDFLAGS="$LDFLAGS -R${withval}"
1667 fi
1668 if test ! -z "$blibpath" ; then
1669 blibpath="$blibpath:${withval}"
1670 fi
1671 fi
1672 AC_CHECK_HEADERS(sectok.h)
1673 if test "$ac_cv_header_sectok_h" != yes; then
1674 AC_MSG_ERROR(Can't find sectok.h)
1675 fi
1676 AC_CHECK_LIB(sectok, sectok_open)
1677 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1678 AC_MSG_ERROR(Can't find libsectok)
1679 fi
1680 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001681 AC_DEFINE(USE_SECTOK)
1682 SCARD_MSG="yes, using sectok"
1683 fi
1684 ]
1685)
1686
1687# Check whether user wants OpenSC support
1688AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001689 AC_HELP_STRING([--with-opensc=PFX],
1690 [Enable smartcard support using OpenSC]),
1691 opensc_config_prefix="$withval", opensc_config_prefix="")
1692if test x$opensc_config_prefix != x ; then
1693 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1694 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1695 if test "$OPENSC_CONFIG" != "no"; then
1696 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1697 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1698 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1699 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1700 AC_DEFINE(SMARTCARD)
1701 AC_DEFINE(USE_OPENSC)
1702 SCARD_MSG="yes, using OpenSC"
1703 fi
1704fi
Damien Miller85de5802001-09-18 14:01:11 +10001705
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001706# Check whether user wants Kerberos 5 support
1707KRB5_MSG="no"
1708AC_ARG_WITH(kerberos5,
1709 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1710 [
1711 if test "x$withval" != "xno" ; then
1712 if test "x$withval" = "xyes" ; then
1713 KRB5ROOT="/usr/local"
1714 else
1715 KRB5ROOT=${withval}
1716 fi
1717 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1718 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1719 AC_DEFINE(KRB5)
1720 KRB5_MSG="yes"
1721 AC_MSG_CHECKING(whether we are using Heimdal)
1722 AC_TRY_COMPILE([ #include <krb5.h> ],
1723 [ char *tmp = heimdal_version; ],
1724 [ AC_MSG_RESULT(yes)
1725 AC_DEFINE(HEIMDAL)
1726 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1727 ],
1728 [ AC_MSG_RESULT(no)
1729 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1730 ]
1731 )
1732 if test ! -z "$need_dash_r" ; then
1733 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1734 fi
1735 if test ! -z "$blibpath" ; then
1736 blibpath="$blibpath:${KRB5ROOT}/lib"
1737 fi
1738 AC_CHECK_LIB(resolv, dn_expand, , )
1739
1740 KRB5=yes
1741 fi
1742 ]
1743)
1744# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001745KRB4_MSG="no"
1746AC_ARG_WITH(kerberos4,
1747 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1748 [
1749 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001750 if test "x$withval" != "xyes" ; then
1751 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1752 LDFLAGS="$LDFLAGS -L${withval}/lib"
1753 if test ! -z "$need_dash_r" ; then
1754 LDFLAGS="$LDFLAGS -R${withval}/lib"
1755 fi
1756 if test ! -z "$blibpath" ; then
1757 blibpath="$blibpath:${withval}/lib"
1758 fi
1759 else
1760 if test -d /usr/include/kerberosIV ; then
1761 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1762 fi
1763 fi
1764
1765 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001766 if test "$ac_cv_header_krb_h" != yes; then
1767 AC_MSG_WARN([Cannot find krb.h, build may fail])
1768 fi
Damien Miller98344742001-03-28 14:37:06 +10001769 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001770 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001771 AC_CHECK_LIB(krb4, main)
1772 if test "$ac_cv_lib_krb4_main" != yes; then
1773 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1774 else
1775 KLIBS="-lkrb4"
1776 fi
1777 else
1778 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001779 fi
Damien Miller98344742001-03-28 14:37:06 +10001780 AC_CHECK_LIB(des, des_cbc_encrypt)
1781 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1782 AC_CHECK_LIB(des425, des_cbc_encrypt)
1783 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1784 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1785 else
1786 KLIBS="-ldes425"
1787 fi
1788 else
1789 KLIBS="-ldes"
1790 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001791 AC_CHECK_LIB(resolv, dn_expand, , )
1792 KRB4=yes
1793 KRB4_MSG="yes"
1794 AC_DEFINE(KRB4)
1795 fi
1796 ]
1797)
1798
1799# Check whether user wants AFS support
1800AFS_MSG="no"
1801AC_ARG_WITH(afs,
1802 [ --with-afs=PATH Enable AFS support],
1803 [
1804 if test "x$withval" != "xno" ; then
1805
1806 if test "x$withval" != "xyes" ; then
1807 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1808 LDFLAGS="$LDFLAGS -L${withval}/lib"
1809 fi
1810
1811 if test -z "$KRB4" ; then
1812 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1813 fi
1814
1815 LIBS="-lkafs $LIBS"
1816 if test ! -z "$AFS_LIBS" ; then
1817 LIBS="$LIBS $AFS_LIBS"
1818 fi
1819 AC_DEFINE(AFS)
1820 AFS_MSG="yes"
1821 fi
1822 ]
1823)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001824LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001825
Damien Millera22ba012000-03-02 23:09:20 +11001826# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11001827
Damien Millerf58c6722002-05-13 13:15:42 +10001828PRIVSEP_PATH=/var/empty
1829AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07001830 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10001831 [
1832 if test "x$withval" != "$no" ; then
1833 PRIVSEP_PATH=$withval
1834 fi
1835 ]
1836)
1837AC_SUBST(PRIVSEP_PATH)
1838
Damien Millera22ba012000-03-02 23:09:20 +11001839AC_ARG_WITH(xauth,
1840 [ --with-xauth=PATH Specify path to xauth program ],
1841 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001842 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001843 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001844 fi
1845 ],
1846 [
Damien Miller78315eb2000-09-29 23:01:36 +11001847 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 +10001848 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001849 xauth_path="/usr/openwin/bin/xauth"
1850 fi
1851 ]
1852)
1853
Damien Millera19cf472000-11-29 13:28:50 +11001854if test -z "$xauth_path" ; then
1855 XAUTH_PATH="undefined"
1856 AC_SUBST(XAUTH_PATH)
1857else
Damien Millera22ba012000-03-02 23:09:20 +11001858 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001859 XAUTH_PATH=$xauth_path
1860 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001861fi
Damien Millera22ba012000-03-02 23:09:20 +11001862
1863# Check for mail directory (last resort if we cannot get it from headers)
1864if test ! -z "$MAIL" ; then
1865 maildir=`dirname $MAIL`
1866 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1867fi
1868
Damien Millera22ba012000-03-02 23:09:20 +11001869if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00001870 if test "x$disable_ptmx_check" != "xyes" ; then
1871 AC_CHECK_FILE("/dev/ptmx",
1872 [
1873 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1874 have_dev_ptmx=1
1875 ]
1876 )
1877 fi
Damien Millera22ba012000-03-02 23:09:20 +11001878fi
Damien Miller204ad072000-03-02 23:56:12 +11001879AC_CHECK_FILE("/dev/ptc",
1880 [
1881 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1882 have_dev_ptc=1
1883 ]
1884)
1885
Damien Millera22ba012000-03-02 23:09:20 +11001886# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001887AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001888 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001889 [
Damien Miller897741e2001-04-16 10:41:46 +10001890 case "$withval" in
1891 man|cat|doc)
1892 MANTYPE=$withval
1893 ;;
1894 *)
1895 AC_MSG_ERROR(invalid man type: $withval)
1896 ;;
1897 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001898 ]
1899)
Ben Lindstrombc709922001-04-18 18:04:21 +00001900if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001901 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001902 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1903 MANTYPE=doc
1904 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1905 MANTYPE=man
1906 else
1907 MANTYPE=cat
1908 fi
1909fi
Damien Miller670a4b82000-01-22 13:53:11 +11001910AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001911if test "$MANTYPE" = "doc"; then
1912 mansubdir=man;
1913else
1914 mansubdir=$MANTYPE;
1915fi
1916AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001917
Damien Millera22ba012000-03-02 23:09:20 +11001918# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001919MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001920AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001921 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001922 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001923 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001924 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001925 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001926 fi
1927 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001928)
1929
Damien Millera22ba012000-03-02 23:09:20 +11001930# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001931AC_ARG_WITH(shadow,
1932 [ --without-shadow Disable shadow password support],
1933 [
1934 if test "x$withval" = "xno" ; then
1935 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001936 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001937 fi
1938 ]
1939)
1940
Damien Miller1f335fb2000-06-26 11:31:33 +10001941if test -z "$disable_shadow" ; then
1942 AC_MSG_CHECKING([if the systems has expire shadow information])
1943 AC_TRY_COMPILE(
1944 [
1945#include <sys/types.h>
1946#include <shadow.h>
1947 struct spwd sp;
1948 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1949 [ sp_expire_available=yes ], []
1950 )
1951
1952 if test "x$sp_expire_available" = "xyes" ; then
1953 AC_MSG_RESULT(yes)
1954 AC_DEFINE(HAS_SHADOW_EXPIRE)
1955 else
1956 AC_MSG_RESULT(no)
1957 fi
1958fi
1959
Damien Millera22ba012000-03-02 23:09:20 +11001960# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001961if test ! -z "$IPADDR_IN_DISPLAY" ; then
1962 DISPLAY_HACK_MSG="yes"
1963 AC_DEFINE(IPADDR_IN_DISPLAY)
1964else
1965 DISPLAY_HACK_MSG="no"
1966 AC_ARG_WITH(ipaddr-display,
1967 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1968 [
1969 if test "x$withval" != "xno" ; then
1970 AC_DEFINE(IPADDR_IN_DISPLAY)
1971 DISPLAY_HACK_MSG="yes"
1972 fi
1973 ]
1974 )
1975fi
Damien Miller76112de1999-12-21 11:18:08 +11001976
Tim Rice43a1c132002-04-17 21:19:14 -07001977dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
1978if test $ac_cv_func_login_getcapbool = "yes" -a \
1979 $ac_cv_header_login_cap_h = "yes" ; then
1980 USES_LOGIN_CONF=yes
1981fi
Damien Millera22ba012000-03-02 23:09:20 +11001982# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001983SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001984AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10001985 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11001986 [
Tim Rice43a1c132002-04-17 21:19:14 -07001987 if test "$USES_LOGIN_CONF" = "yes" ; then
1988 AC_MSG_WARN([
1989--with-default-path=PATH has no effect on this system.
1990Edit /etc/login.conf instead.])
1991 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001992 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001993 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001994 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001995 ],
Tim Rice43a1c132002-04-17 21:19:14 -07001996 [ if test "$USES_LOGIN_CONF" = "yes" ; then
1997 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
1998 else
Tim Rice59ea0a02001-03-10 13:50:45 -08001999 AC_TRY_RUN(
2000 [
2001/* find out what STDPATH is */
2002#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002003#ifdef HAVE_PATHS_H
2004# include <paths.h>
2005#endif
2006#ifndef _PATH_STDPATH
2007# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2008#endif
2009#include <sys/types.h>
2010#include <sys/stat.h>
2011#include <fcntl.h>
2012#define DATA "conftest.stdpath"
2013
2014main()
2015{
2016 FILE *fd;
2017 int rc;
2018
2019 fd = fopen(DATA,"w");
2020 if(fd == NULL)
2021 exit(1);
2022
2023 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2024 exit(1);
2025
2026 exit(0);
2027}
2028 ], [ user_path=`cat conftest.stdpath` ],
2029 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2030 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2031 )
2032# make sure $bindir is in USER_PATH so scp will work
2033 t_bindir=`eval echo ${bindir}`
2034 case $t_bindir in
2035 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2036 esac
2037 case $t_bindir in
2038 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2039 esac
2040 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2041 if test $? -ne 0 ; then
2042 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2043 if test $? -ne 0 ; then
2044 user_path=$user_path:$t_bindir
2045 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2046 fi
2047 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002048 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002049)
Tim Rice43a1c132002-04-17 21:19:14 -07002050if test "$USES_LOGIN_CONF" != "yes" ; then
2051 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2052 AC_SUBST(user_path)
2053fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002054
Damien Millera18bbd32002-05-13 10:48:57 +10002055# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002056AC_ARG_WITH(superuser-path,
2057 [ --with-superuser-path= Specify different path for super-user],
2058 [
2059 if test "x$withval" != "xno" ; then
2060 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2061 superuser_path=$withval
2062 fi
2063 ]
2064)
2065
2066
Damien Millera22ba012000-03-02 23:09:20 +11002067# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002068IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002069AC_ARG_WITH(ipv4-default,
2070 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2071 [
2072 if test "x$withval" != "xno" ; then
2073 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002074 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002075 fi
2076 ]
2077)
2078
Damien Miller61e50f12000-05-08 20:49:37 +10002079AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002080IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002081AC_ARG_WITH(4in6,
2082 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2083 [
2084 if test "x$withval" != "xno" ; then
2085 AC_MSG_RESULT(yes)
2086 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002087 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002088 else
2089 AC_MSG_RESULT(no)
2090 fi
2091 ],[
2092 if test "x$inet6_default_4in6" = "xyes"; then
2093 AC_MSG_RESULT([yes (default)])
2094 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002095 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002096 else
2097 AC_MSG_RESULT([no (default)])
2098 fi
2099 ]
2100)
2101
Damien Miller60396b02001-02-18 17:01:00 +11002102# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002103BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002104AC_ARG_WITH(bsd-auth,
2105 [ --with-bsd-auth Enable BSD auth support],
2106 [
2107 if test "x$withval" != "xno" ; then
2108 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002109 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002110 fi
2111 ]
2112)
2113
Damien Millera22ba012000-03-02 23:09:20 +11002114# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002115piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002116# make sure the directory exists
2117if test ! -d $piddir ; then
2118 piddir=`eval echo ${sysconfdir}`
2119 case $piddir in
2120 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2121 esac
2122fi
2123
Tim Rice88f2ab52002-03-17 12:17:34 -08002124AC_ARG_WITH(pid-dir,
2125 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2126 [
2127 if test "x$withval" != "xno" ; then
2128 piddir=$withval
2129 if test ! -d $piddir ; then
2130 AC_MSG_WARN([** no $piddir directory on this system **])
2131 fi
2132 fi
2133 ]
2134)
2135
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002136AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002137AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002138
andre2ff7b5d2000-06-03 14:57:40 +00002139dnl allow user to disable some login recording features
2140AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002141 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002142 [ AC_DEFINE(DISABLE_LASTLOG) ]
2143)
2144AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002145 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002146 [ AC_DEFINE(DISABLE_UTMP) ]
2147)
2148AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002149 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002150 [ AC_DEFINE(DISABLE_UTMPX) ]
2151)
2152AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002153 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002154 [ AC_DEFINE(DISABLE_WTMP) ]
2155)
2156AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002157 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002158 [ AC_DEFINE(DISABLE_WTMPX) ]
2159)
2160AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002161 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002162 [ AC_DEFINE(DISABLE_LOGIN) ]
2163)
2164AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002165 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002166 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2167)
2168AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002169 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002170 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2171)
2172AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002173 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002174 [
2175 if test "x$withval" = "xno" ; then
2176 AC_DEFINE(DISABLE_LASTLOG)
2177 else
2178 conf_lastlog_location=$withval
2179 fi
2180 ]
2181)
andre2ff7b5d2000-06-03 14:57:40 +00002182
2183dnl lastlog, [uw]tmpx? detection
2184dnl NOTE: set the paths in the platform section to avoid the
2185dnl need for command-line parameters
2186dnl lastlog and [uw]tmp are subject to a file search if all else fails
2187
2188dnl lastlog detection
2189dnl NOTE: the code itself will detect if lastlog is a directory
2190AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2191AC_TRY_COMPILE([
2192#include <sys/types.h>
2193#include <utmp.h>
2194#ifdef HAVE_LASTLOG_H
2195# include <lastlog.h>
2196#endif
Damien Miller2994e082000-06-04 15:51:47 +10002197#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002198# include <paths.h>
2199#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002200#ifdef HAVE_LOGIN_H
2201# include <login.h>
2202#endif
andre2ff7b5d2000-06-03 14:57:40 +00002203 ],
2204 [ char *lastlog = LASTLOG_FILE; ],
2205 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002206 [
2207 AC_MSG_RESULT(no)
2208 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2209 AC_TRY_COMPILE([
2210#include <sys/types.h>
2211#include <utmp.h>
2212#ifdef HAVE_LASTLOG_H
2213# include <lastlog.h>
2214#endif
2215#ifdef HAVE_PATHS_H
2216# include <paths.h>
2217#endif
2218 ],
2219 [ char *lastlog = _PATH_LASTLOG; ],
2220 [ AC_MSG_RESULT(yes) ],
2221 [
andree441aa32000-06-12 22:34:38 +00002222 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002223 system_lastlog_path=no
2224 ])
2225 ]
andre2ff7b5d2000-06-03 14:57:40 +00002226)
Damien Miller2994e082000-06-04 15:51:47 +10002227
andre2ff7b5d2000-06-03 14:57:40 +00002228if test -z "$conf_lastlog_location"; then
2229 if test x"$system_lastlog_path" = x"no" ; then
2230 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002231 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002232 conf_lastlog_location=$f
2233 fi
2234 done
2235 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002236 AC_MSG_WARN([** Cannot find lastlog **])
2237 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002238 fi
2239 fi
2240fi
2241
2242if test -n "$conf_lastlog_location"; then
2243 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2244fi
2245
2246dnl utmp detection
2247AC_MSG_CHECKING([if your system defines UTMP_FILE])
2248AC_TRY_COMPILE([
2249#include <sys/types.h>
2250#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002251#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002252# include <paths.h>
2253#endif
2254 ],
2255 [ char *utmp = UTMP_FILE; ],
2256 [ AC_MSG_RESULT(yes) ],
2257 [ AC_MSG_RESULT(no)
2258 system_utmp_path=no ]
2259)
2260if test -z "$conf_utmp_location"; then
2261 if test x"$system_utmp_path" = x"no" ; then
2262 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2263 if test -f $f ; then
2264 conf_utmp_location=$f
2265 fi
2266 done
2267 if test -z "$conf_utmp_location"; then
2268 AC_DEFINE(DISABLE_UTMP)
2269 fi
2270 fi
2271fi
2272if test -n "$conf_utmp_location"; then
2273 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2274fi
2275
2276dnl wtmp detection
2277AC_MSG_CHECKING([if your system defines WTMP_FILE])
2278AC_TRY_COMPILE([
2279#include <sys/types.h>
2280#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002281#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002282# include <paths.h>
2283#endif
2284 ],
2285 [ char *wtmp = WTMP_FILE; ],
2286 [ AC_MSG_RESULT(yes) ],
2287 [ AC_MSG_RESULT(no)
2288 system_wtmp_path=no ]
2289)
2290if test -z "$conf_wtmp_location"; then
2291 if test x"$system_wtmp_path" = x"no" ; then
2292 for f in /usr/adm/wtmp /var/log/wtmp; do
2293 if test -f $f ; then
2294 conf_wtmp_location=$f
2295 fi
2296 done
2297 if test -z "$conf_wtmp_location"; then
2298 AC_DEFINE(DISABLE_WTMP)
2299 fi
2300 fi
2301fi
2302if test -n "$conf_wtmp_location"; then
2303 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2304fi
2305
2306
2307dnl utmpx detection - I don't know any system so perverse as to require
2308dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2309dnl there, though.
2310AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2311AC_TRY_COMPILE([
2312#include <sys/types.h>
2313#include <utmp.h>
2314#ifdef HAVE_UTMPX_H
2315#include <utmpx.h>
2316#endif
Damien Miller2994e082000-06-04 15:51:47 +10002317#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002318# include <paths.h>
2319#endif
2320 ],
2321 [ char *utmpx = UTMPX_FILE; ],
2322 [ AC_MSG_RESULT(yes) ],
2323 [ AC_MSG_RESULT(no)
2324 system_utmpx_path=no ]
2325)
2326if test -z "$conf_utmpx_location"; then
2327 if test x"$system_utmpx_path" = x"no" ; then
2328 AC_DEFINE(DISABLE_UTMPX)
2329 fi
2330else
2331 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2332fi
2333
2334dnl wtmpx detection
2335AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2336AC_TRY_COMPILE([
2337#include <sys/types.h>
2338#include <utmp.h>
2339#ifdef HAVE_UTMPX_H
2340#include <utmpx.h>
2341#endif
Damien Miller2994e082000-06-04 15:51:47 +10002342#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002343# include <paths.h>
2344#endif
2345 ],
2346 [ char *wtmpx = WTMPX_FILE; ],
2347 [ AC_MSG_RESULT(yes) ],
2348 [ AC_MSG_RESULT(no)
2349 system_wtmpx_path=no ]
2350)
2351if test -z "$conf_wtmpx_location"; then
2352 if test x"$system_wtmpx_path" = x"no" ; then
2353 AC_DEFINE(DISABLE_WTMPX)
2354 fi
2355else
2356 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2357fi
2358
Damien Miller4018c192000-04-30 09:30:44 +10002359
Damien Miller29ea30d2000-03-17 10:54:15 +11002360if test ! -z "$blibpath" ; then
2361 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2362 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2363fi
2364
Tim Rice4cec93f2002-02-26 08:40:48 -08002365dnl remove pam and dl because they are in $LIBPAM
2366if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002367 LIBS=`echo $LIBS | sed 's/-lpam //'`
2368fi
2369if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2370 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002371fi
2372
Damien Millerbac2d8a2000-09-05 16:13:06 +11002373AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002374AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2375AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002376
Damien Miller7b22d652000-06-18 14:07:04 +10002377# Print summary of options
2378
Damien Miller7b22d652000-06-18 14:07:04 +10002379# Someone please show me a better way :)
2380A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2381B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2382C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2383D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002384E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002385F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002386G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002387H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2388I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2389J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002390
2391echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002392echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002393echo " User binaries: $B"
2394echo " System binaries: $C"
2395echo " Configuration files: $D"
2396echo " Askpass program: $E"
2397echo " Manual pages: $F"
2398echo " PID file: $G"
2399echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002400if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002401echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002402else
Damien Millerf58c6722002-05-13 13:15:42 +10002403echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002404fi
Damien Millera18bbd32002-05-13 10:48:57 +10002405if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002406echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002407fi
Damien Millerf58c6722002-05-13 13:15:42 +10002408echo " Manpage format: $MANTYPE"
2409echo " PAM support: ${PAM_MSG}"
2410echo " KerberosIV support: $KRB4_MSG"
2411echo " KerberosV support: $KRB5_MSG"
2412echo " Smartcard support: $SCARD_MSG"
2413echo " AFS support: $AFS_MSG"
2414echo " S/KEY support: $SKEY_MSG"
2415echo " TCP Wrappers support: $TCPW_MSG"
2416echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002417echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002418echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2419echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2420echo " BSD Auth support: $BSD_AUTH_MSG"
2421echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002422if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002423echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002424fi
2425
Damien Miller7b22d652000-06-18 14:07:04 +10002426echo ""
2427
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002428echo " Host: ${host}"
2429echo " Compiler: ${CC}"
2430echo " Compiler flags: ${CFLAGS}"
2431echo "Preprocessor flags: ${CPPFLAGS}"
2432echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002433echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002434
2435echo ""
2436
Damien Miller82cf0ce2000-12-20 13:34:48 +11002437if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002438 echo "PAM is enabled. You may need to install a PAM control file "
2439 echo "for sshd, otherwise password authentication may fail. "
2440 echo "Example PAM control files can be found in the contrib/ "
2441 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002442 echo ""
2443fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002444
2445if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002446 echo "sftp-server will be disabled. Your compiler does not "
2447 echo "support 64bit integers."
2448 echo ""
2449fi
2450
2451if test ! -z "$RAND_HELPER_CMDHASH" ; then
2452 echo "WARNING: you are using the builtin random number collection "
2453 echo "service. Please read WARNING.RNG and request that your OS "
2454 echo "vendor includes kernel-based random number collection in "
2455 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002456 echo ""
2457fi
Damien Miller60396b02001-02-18 17:01:00 +11002458