blob: 4b48be389c0329f821e9d97b07b9fe7026978c2f [file] [log] [blame]
Tim Ricee958ed32002-07-05 07:12:33 -07001# $Id: configure.ac,v 1.74 2002/07/05 14:12:34 tim 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)
Tim Rice8eff3192002-06-25 15:35:15 -070094 AC_DEFINE(BROKEN_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +000095 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +110096 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000097*-*-dgux*)
98 AC_DEFINE(IP_TOS_IS_BROKEN)
99 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000100*-*-darwin*)
101 AC_DEFINE(BROKEN_GETADDRINFO)
102 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000103*-*-hpux10.26)
104 if test -z "$GCC"; then
105 CFLAGS="$CFLAGS -Ae"
106 fi
107 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
108 IPADDR_IN_DISPLAY=yes
109 AC_DEFINE(HAVE_SECUREWARE)
110 AC_DEFINE(USE_PIPES)
111 AC_DEFINE(LOGIN_NO_ENDOPT)
112 AC_DEFINE(LOGIN_NEEDS_UTMPX)
113 AC_DEFINE(DISABLE_SHADOW)
114 AC_DEFINE(DISABLE_UTMP)
115 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
116 LIBS="$LIBS -lxnet -lsec -lsecpw"
117 disable_ptmx_check=yes
118 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100119*-*-hpux10*)
120 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000121 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100122 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000123 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100124 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000125 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000126 AC_DEFINE(LOGIN_NO_ENDOPT)
127 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100128 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100129 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000130 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves315f8b72001-06-28 00:24:41 +0000131 LIBS="$LIBS -lxnet -lsec"
Damien Miller76112de1999-12-21 11:18:08 +1100132 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000133*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000134 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100135 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100136 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100137 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000138 AC_DEFINE(LOGIN_NO_ENDOPT)
139 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100140 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100141 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000142 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000143 LIBS="$LIBS -lxnet -lsec"
Damien Miller1bead332000-04-30 00:47:29 +1000144 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100145*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000146 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000147 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100148 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000149 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000150 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller1808f382000-01-06 12:03:12 +1100151 ;;
152*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000153 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000154 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100155 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000156 AC_DEFINE(WITH_IRIX_ARRAY)
157 AC_DEFINE(WITH_IRIX_PROJECT)
158 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000159 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000160 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000161 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100162 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100163*-*-linux*)
164 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100165 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100166 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000167 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100168 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100169 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000170mips-sony-bsd|mips-sony-newsos4)
171 AC_DEFINE(HAVE_NEWS4)
172 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000173 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100174*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100175 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100176 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100177*-*-freebsd*)
178 check_for_libcrypt_later=1
179 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000180*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000181 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100182 conf_utmp_location=/etc/utmp
183 conf_wtmp_location=/usr/adm/wtmp
184 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000185 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000186 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000187 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100188 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000189 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000190 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000191 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100192*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000193 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000194 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100195 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100196 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000197 AC_DEFINE(LOGIN_NEEDS_UTMPX)
198 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000199 AC_DEFINE(PAM_TTY_KLUDGE)
andre2ff7b5d2000-06-03 14:57:40 +0000200 # hardwire lastlog location (can't detect it on some versions)
201 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000202 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
203 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
204 if test "$sol2ver" -ge 8; then
205 AC_MSG_RESULT(yes)
206 AC_DEFINE(DISABLE_UTMP)
207 AC_DEFINE(DISABLE_WTMP)
208 else
209 AC_MSG_RESULT(no)
210 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100211 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000212*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000213 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000214 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100215 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000216 conf_utmp_location=/etc/utmp
217 conf_wtmp_location=/var/adm/wtmp
218 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000219 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000220 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000221*-ncr-sysv*)
222 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
223 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700224 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000225 AC_DEFINE(USE_PIPES)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000226 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000227*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000228 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700229 # /usr/ucblib MUST NOT be searched on ReliantUNIX
230 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100231 IPADDR_IN_DISPLAY=yes
232 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000233 AC_DEFINE(IP_TOS_IS_BROKEN)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700234 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
235 # Attention: always take care to bind libsocket and libnsl before libc,
236 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000237 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100238*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000239 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100240 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100241 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100242 ;;
243*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000244 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100245 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100246 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100247 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100248*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000249 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100250 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100251 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100252*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000253 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100254 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700255 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100256 RANLIB=true
257 no_dev_ptmx=1
258 AC_DEFINE(BROKEN_SYS_TERMIO_H)
259 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000260 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000261 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100262 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100263 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700264 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700265 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100266 ;;
267*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000268 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000269 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100270 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000271 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100272 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000273 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000274 AC_DEFINE(DISABLE_SHADOW)
Tim Rice8eff3192002-06-25 15:35:15 -0700275 AC_DEFINE(BROKEN_FD_PASSING)
Damien Miller217f5672001-02-16 12:12:41 +1100276 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700277 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000278 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000279*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700280 no_libsocket=1
281 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000282 AC_DEFINE(USE_PIPES)
Tim Rice8eff3192002-06-25 15:35:15 -0700283 AC_DEFINE(BROKEN_FD_PASSING)
Tim Ricee991e3c2001-08-07 15:29:07 -0700284 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
285 LIBS="$LIBS -lgen -lrsc"
286 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000287*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000288 AC_MSG_CHECKING(for Digital Unix SIA)
289 no_osfsia=""
290 AC_ARG_WITH(osfsia,
291 [ --with-osfsia Enable Digital Unix SIA],
292 [
293 if test "x$withval" = "xno" ; then
294 AC_MSG_RESULT(disabled)
295 no_osfsia=1
296 fi
297 ],
298 )
299 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000300 if test -f /etc/sia/matrix.conf; then
301 AC_MSG_RESULT(yes)
302 AC_DEFINE(HAVE_OSF_SIA)
303 AC_DEFINE(DISABLE_LOGIN)
304 LIBS="$LIBS -lsecurity -ldb -lm -laud"
305 else
306 AC_MSG_RESULT(no)
307 fi
308 fi
309 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000310
311*-*-nto-qnx)
312 AC_DEFINE(USE_PIPES)
313 AC_DEFINE(NO_X11_UNIX_SOCKETS)
314 AC_DEFINE(MISSING_NFDBITS)
315 AC_DEFINE(MISSING_HOWMANY)
316 AC_DEFINE(MISSING_FD_MASK)
317 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100318esac
319
Damien Millere37bfc12000-06-05 09:37:43 +1000320# Allow user to specify flags
321AC_ARG_WITH(cflags,
322 [ --with-cflags Specify additional flags to pass to compiler],
323 [
324 if test "x$withval" != "xno" ; then
325 CFLAGS="$CFLAGS $withval"
326 fi
327 ]
328)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000329AC_ARG_WITH(cppflags,
330 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
331 [
332 if test "x$withval" != "xno"; then
333 CPPFLAGS="$CPPFLAGS $withval"
334 fi
335 ]
336)
Damien Millere37bfc12000-06-05 09:37:43 +1000337AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000338 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000339 [
340 if test "x$withval" != "xno" ; then
341 LDFLAGS="$LDFLAGS $withval"
342 fi
343 ]
344)
345AC_ARG_WITH(libs,
346 [ --with-libs Specify additional libraries to link with],
347 [
348 if test "x$withval" != "xno" ; then
349 LIBS="$LIBS $withval"
350 fi
351 ]
352)
353
Tim Rice4cec93f2002-02-26 08:40:48 -0800354# Checks for header files.
355AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
356 getopt.h glob.h lastlog.h limits.h login.h \
357 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000358 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000359 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800360 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000361 sys/mman.h sys/select.h sys/stat.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800362 sys/stropts.h sys/sysmacros.h sys/time.h \
Kevin Steves117b06d2002-03-30 17:55:21 +0000363 sys/un.h time.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800364 util.h utime.h utmp.h utmpx.h)
365
Damien Millera22ba012000-03-02 23:09:20 +1100366# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700367AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
368AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000369
Damien Millerdf288022001-02-18 13:07:07 +1100370dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700371if test "x$with_tcp_wrappers" != "xno" ; then
372 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
373 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
374 fi
375fi
Damien Millerdf288022001-02-18 13:07:07 +1100376
Tim Rice13aae5e2001-10-21 17:53:58 -0700377AC_CHECK_FUNC(getspnam, ,
378 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700379
Damien Miller150c8b52002-02-13 23:06:56 +1100380AC_ARG_WITH(rpath,
381 [ --without-rpath Disable auto-added -R linker paths],
382 [
383 if test "x$withval" = "xno" ; then
384 need_dash_r=""
385 fi
386 if test "x$withval" = "xyes" ; then
387 need_dash_r=1
388 fi
389 ]
390)
391
Tim Rice13aae5e2001-10-21 17:53:58 -0700392dnl zlib is required
393AC_ARG_WITH(zlib,
394 [ --with-zlib=PATH Use zlib in PATH],
395 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000396 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100397 AC_MSG_ERROR([*** zlib is required ***])
398 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700399 if test -d "$withval/lib"; then
400 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700401 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700402 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700403 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700404 fi
405 else
406 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700407 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700408 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700409 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700410 fi
411 fi
412 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700413 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700414 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700415 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700416 fi
417 ]
418)
419
Tim Rice17b93e52001-10-23 22:36:54 -0700420AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100421
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000422dnl UnixWare 2.x
423AC_CHECK_FUNC(strcasecmp,
424 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
425)
426AC_CHECK_FUNC(utimes,
427 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
428)
Damien Millerab18c411999-11-11 10:40:23 +1100429
Tim Ricee589a292001-11-03 11:09:32 -0800430dnl Checks for libutil functions
431AC_CHECK_HEADERS(libutil.h)
432AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
433AC_CHECK_FUNCS(logout updwtmp logwtmp)
434
Ben Lindstrom8697e082001-02-24 21:41:10 +0000435AC_FUNC_STRFTIME
436
Damien Miller3c027682001-03-14 11:39:45 +1100437# Check for ALTDIRFUNC glob() extension
438AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
439AC_EGREP_CPP(FOUNDIT,
440 [
441 #include <glob.h>
442 #ifdef GLOB_ALTDIRFUNC
443 FOUNDIT
444 #endif
445 ],
446 [
447 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
448 AC_MSG_RESULT(yes)
449 ],
450 [
451 AC_MSG_RESULT(no)
452 ]
453)
Damien Millerab18c411999-11-11 10:40:23 +1100454
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000455# Check for g.gl_matchc glob() extension
456AC_MSG_CHECKING(for gl_matchc field in glob_t)
457AC_EGREP_CPP(FOUNDIT,
458 [
459 #include <glob.h>
460 int main(void){glob_t g; g.gl_matchc = 1;}
461 ],
462 [
463 AC_DEFINE(GLOB_HAS_GL_MATCHC)
464 AC_MSG_RESULT(yes)
465 ],
466 [
467 AC_MSG_RESULT(no)
468 ]
469)
470
Damien Miller18bb4732001-03-28 14:35:30 +1000471AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
472AC_TRY_RUN(
473 [
474#include <sys/types.h>
475#include <dirent.h>
476int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
477 ],
478 [AC_MSG_RESULT(yes)],
479 [
480 AC_MSG_RESULT(no)
481 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
482 ]
483)
484
Damien Millerc547bf12001-02-16 10:18:12 +1100485# Check whether user wants S/Key support
486SKEY_MSG="no"
487AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700488 [ --with-skey[[=PATH]] Enable S/Key support
489 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100490 [
491 if test "x$withval" != "xno" ; then
492
493 if test "x$withval" != "xyes" ; then
494 CPPFLAGS="$CPPFLAGS -I${withval}/include"
495 LDFLAGS="$LDFLAGS -L${withval}/lib"
496 fi
497
498 AC_DEFINE(SKEY)
499 LIBS="-lskey $LIBS"
500 SKEY_MSG="yes"
501
Tim Rice4cec93f2002-02-26 08:40:48 -0800502 AC_MSG_CHECKING([for s/key support])
503 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100504 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800505#include <stdio.h>
506#include <skey.h>
507int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
508 ],
509 [AC_MSG_RESULT(yes)],
510 [
511 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100512 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
513 ])
514 fi
515 ]
516)
517
518# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700519TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100520AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700521 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
522 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100523 [
524 if test "x$withval" != "xno" ; then
525 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700526 saved_LDFLAGS="$LDFLAGS"
527 saved_CPPFLAGS="$CPPFLAGS"
528 if test -n "${withval}" -a "${withval}" != "yes"; then
529 if test -d "${withval}/lib"; then
530 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700531 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700532 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700533 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700534 fi
535 else
536 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700537 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700538 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700539 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700540 fi
541 fi
542 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700543 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700544 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700545 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700546 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700547 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800548 LIBWRAP="-lwrap"
549 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100550 AC_MSG_CHECKING(for libwrap)
551 AC_TRY_LINK(
552 [
553#include <tcpd.h>
554 int deny_severity = 0, allow_severity = 0;
555 ],
556 [hosts_access(0);],
557 [
558 AC_MSG_RESULT(yes)
559 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800560 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700561 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100562 ],
563 [
564 AC_MSG_ERROR([*** libwrap missing])
565 ]
566 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800567 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100568 fi
569 ]
570)
571
Damien Millerad833b32000-08-23 10:46:23 +1000572dnl Checks for library functions.
Ben Lindstromfdee8ef2002-04-06 23:52:02 +0000573AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
Tim Rice13aae5e2001-10-21 17:53:58 -0700574 clock fchmod fchown freeaddrinfo futimes gai_strerror \
575 getaddrinfo getcwd getgrouplist getnameinfo getopt \
576 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
577 inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller594a71b2002-04-23 20:22:59 +1000578 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
579 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
Ben Lindstrom837461b2002-06-12 16:57:14 +0000580 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
Ben Lindstromf0bfa832002-06-21 00:01:18 +0000581 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
582 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
583 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
Tim Rice13aae5e2001-10-21 17:53:58 -0700584
Ben Lindstrom6b0c96a2002-06-25 03:22:03 +0000585if test $ac_cv_func_mmap = yes ; then
586AC_MSG_CHECKING([for mmap anon shared])
587AC_TRY_RUN(
588 [
589#include <stdio.h>
Ben Lindstrom68e83112002-06-28 00:37:33 +0000590#include <sys/types.h>
Ben Lindstrom6b0c96a2002-06-25 03:22:03 +0000591#include <sys/mman.h>
592#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
593#define MAP_ANON MAP_ANONYMOUS
594#endif
595main() { char *p;
596p = (char *) mmap(NULL, 10, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED, -1, 0);
597if (p == (char *)-1)
598 exit(1);
599exit(0);
600}
601 ],
602 [
603 AC_MSG_RESULT(yes)
604 AC_DEFINE(HAVE_MMAP_ANON_SHARED)
605 ],
606 [ AC_MSG_RESULT(no) ]
607)
608fi
609
Tim Rice13aae5e2001-10-21 17:53:58 -0700610dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700611AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700612 AC_CHECK_LIB(gen, dirname,[
613 AC_CACHE_CHECK([for broken dirname],
614 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700615 save_LIBS="$LIBS"
616 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700617 AC_TRY_RUN(
618 [
619#include <libgen.h>
620#include <string.h>
621
622int main(int argc, char **argv) {
623 char *s, buf[32];
624
625 strncpy(buf,"/etc", 32);
626 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700627 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700628 exit(1);
629 } else {
630 exit(0);
631 }
632}
633 ],
634 [ ac_cv_have_broken_dirname="no" ],
635 [ ac_cv_have_broken_dirname="yes" ]
636 )
Tim Rice17b93e52001-10-23 22:36:54 -0700637 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700638 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700639 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700640 LIBS="$LIBS -lgen"
641 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700642 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700643 fi
644 ])
645])
646
Damien Millerad833b32000-08-23 10:46:23 +1000647dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000648AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000649dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000650AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000651AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000652dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000653AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000654AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100655
Damien Miller04f80141999-11-19 15:32:34 +1100656AC_CHECK_FUNC(daemon,
657 [AC_DEFINE(HAVE_DAEMON)],
658 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
659)
660
Damien Miller9fb07e42000-03-05 16:22:59 +1100661AC_CHECK_FUNC(getpagesize,
662 [AC_DEFINE(HAVE_GETPAGESIZE)],
663 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
664)
665
Damien Millercb170cb2000-07-01 16:52:55 +1000666# Check for broken snprintf
667if test "x$ac_cv_func_snprintf" = "xyes" ; then
668 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
669 AC_TRY_RUN(
670 [
671#include <stdio.h>
672int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
673 ],
674 [AC_MSG_RESULT(yes)],
675 [
676 AC_MSG_RESULT(no)
677 AC_DEFINE(BROKEN_SNPRINTF)
678 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
679 ]
680 )
681fi
682
Damien Miller606f8802000-09-16 15:39:56 +1100683AC_FUNC_GETPGRP
684
Damien Millera64b57a2001-01-17 10:44:13 +1100685# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000686PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100687AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100688 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100689 [
Damien Millera64b57a2001-01-17 10:44:13 +1100690 if test "x$withval" != "xno" ; then
691 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
692 AC_MSG_ERROR([PAM headers not found])
693 fi
694
695 AC_CHECK_LIB(dl, dlopen, , )
696 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
697 AC_CHECK_FUNCS(pam_getenvlist)
698
699 disable_shadow=yes
700 PAM_MSG="yes"
701
702 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800703 if test $ac_cv_lib_dl_dlopen = yes; then
704 LIBPAM="-lpam -ldl"
705 else
706 LIBPAM="-lpam"
707 fi
708 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100709 fi
710 ]
711)
Damien Millera22ba012000-03-02 23:09:20 +1100712
Damien Millera64b57a2001-01-17 10:44:13 +1100713# Check for older PAM
714if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100715 # Check PAM strerror arguments (old PAM)
716 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
717 AC_TRY_COMPILE(
718 [
Damien Miller81171112000-04-23 11:14:01 +1000719#include <stdlib.h>
720#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100721 ],
722 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
723 [AC_MSG_RESULT(no)],
724 [
725 AC_DEFINE(HAVE_OLD_PAM)
726 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000727 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100728 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100729 )
Damien Millera22ba012000-03-02 23:09:20 +1100730fi
731
Tim Riceaef73712002-05-11 13:17:42 -0700732# Search for OpenSSL
733saved_CPPFLAGS="$CPPFLAGS"
734saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100735AC_ARG_WITH(ssl-dir,
736 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
737 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000738 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700739 if test -d "$withval/lib"; then
740 if test -n "${need_dash_r}"; then
741 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
742 else
743 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
744 fi
745 else
746 if test -n "${need_dash_r}"; then
747 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
748 else
749 LDFLAGS="-L${withval} ${LDFLAGS}"
750 fi
751 fi
752 if test -d "$withval/include"; then
753 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
754 else
755 CPPFLAGS="-I${withval} ${CPPFLAGS}"
756 fi
Damien Millera22ba012000-03-02 23:09:20 +1100757 fi
758 ]
759)
Tim Riceaef73712002-05-11 13:17:42 -0700760LIBS="$LIBS -lcrypto"
761AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000762 [
Tim Riceaef73712002-05-11 13:17:42 -0700763 dnl Check default openssl install dir
764 if test -n "${need_dash_r}"; then
765 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000766 else
Tim Riceaef73712002-05-11 13:17:42 -0700767 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000768 fi
Tim Riceaef73712002-05-11 13:17:42 -0700769 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
770 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
771 [
772 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
773 ]
774 )
775 ]
776)
777
Damien Millera22ba012000-03-02 23:09:20 +1100778
Damien Millerec932372002-01-22 22:16:03 +1100779# Sanity check OpenSSL headers
780AC_MSG_CHECKING([whether OpenSSL's headers match the library])
781AC_TRY_RUN(
782 [
783#include <string.h>
784#include <openssl/opensslv.h>
785int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
786 ],
787 [
788 AC_MSG_RESULT(yes)
789 ],
790 [
791 AC_MSG_RESULT(no)
792 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
793 ]
794)
795
Damien Millera64b57a2001-01-17 10:44:13 +1100796# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
797# version in OpenSSL. Skip this for PAM
798if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100799 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100800fi
801
Damien Miller6c21c512002-01-22 21:57:53 +1100802
803### Configure cryptographic random number support
804
805# Check wheter OpenSSL seeds itself
806AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
807AC_TRY_RUN(
808 [
809#include <string.h>
810#include <openssl/rand.h>
811int main(void) { return(RAND_status() == 1 ? 0 : 1); }
812 ],
813 [
814 OPENSSL_SEEDS_ITSELF=yes
815 AC_MSG_RESULT(yes)
816 ],
817 [
818 AC_MSG_RESULT(no)
819 # Default to use of the rand helper if OpenSSL doesn't
820 # seed itself
821 USE_RAND_HELPER=yes
822 ]
823)
824
825
826# Do we want to force the use of the rand helper?
827AC_ARG_WITH(rand-helper,
828 [ --with-rand-helper Use subprocess to gather strong randomness ],
829 [
830 if test "x$withval" = "xno" ; then
831 # Force use of OpenSSL's internal RNG, even if
832 # the previous test showed it to be unseeded.
833 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
834 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
835 OPENSSL_SEEDS_ITSELF=yes
836 USE_RAND_HELPER=""
837 fi
838 else
839 USE_RAND_HELPER=yes
840 fi
841 ],
842)
843
844# Which randomness source do we use?
845if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
846 # OpenSSL only
847 AC_DEFINE(OPENSSL_PRNG_ONLY)
848 RAND_MSG="OpenSSL internal ONLY"
849 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800850elif test ! -z "$USE_RAND_HELPER" ; then
851 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100852 RAND_MSG="ssh-rand-helper"
853 INSTALL_SSH_RAND_HELPER="yes"
854fi
855AC_SUBST(INSTALL_SSH_RAND_HELPER)
856
857### Configuration of ssh-rand-helper
858
859# PRNGD TCP socket
860AC_ARG_WITH(prngd-port,
861 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
862 [
Damien Millere996d722002-01-23 11:20:59 +1100863 case "$withval" in
864 no)
865 withval=""
866 ;;
867 [[0-9]]*)
868 ;;
869 *)
870 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
871 ;;
872 esac
873 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100874 PRNGD_PORT="$withval"
875 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
876 fi
877 ]
878)
879
880# PRNGD Unix domain socket
881AC_ARG_WITH(prngd-socket,
882 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
883 [
Damien Millere996d722002-01-23 11:20:59 +1100884 case "$withval" in
885 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100886 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100887 ;;
888 no)
889 withval=""
890 ;;
891 /*)
892 ;;
893 *)
894 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
895 ;;
896 esac
897
898 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100899 if test ! -z "$PRNGD_PORT" ; then
900 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
901 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100902 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100903 AC_MSG_WARN(Entropy socket is not readable)
904 fi
905 PRNGD_SOCKET="$withval"
906 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
907 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800908 ],
909 [
910 # Check for existing socket only if we don't have a random device already
911 if test "$USE_RAND_HELPER" = yes ; then
912 AC_MSG_CHECKING(for PRNGD/EGD socket)
913 # Insert other locations here
914 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
915 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
916 PRNGD_SOCKET="$sock"
917 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
918 break;
919 fi
920 done
921 if test ! -z "$PRNGD_SOCKET" ; then
922 AC_MSG_RESULT($PRNGD_SOCKET)
923 else
924 AC_MSG_RESULT(not found)
925 fi
926 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100927 ]
928)
929
930# Change default command timeout for hashing entropy source
931entropy_timeout=200
932AC_ARG_WITH(entropy-timeout,
933 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
934 [
935 if test "x$withval" != "xno" ; then
936 entropy_timeout=$withval
937 fi
938 ]
939)
Damien Miller6c21c512002-01-22 21:57:53 +1100940AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
941
Damien Millerd3f6ad22002-06-25 10:24:47 +1000942SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +0000943AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +0000944 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +0000945 [
946 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +1000947 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +0000948 fi
949 ]
950)
Damien Millerd3f6ad22002-06-25 10:24:47 +1000951AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
952AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +0000953
Tim Rice88f2ab52002-03-17 12:17:34 -0800954# We do this little dance with the search path to insure
955# that programs that we select for use by installed programs
956# (which may be run by the super-user) come from trusted
957# locations before they come from the user's private area.
958# This should help avoid accidentally configuring some
959# random version of a program in someone's personal bin.
960
961OPATH=$PATH
962PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -0700963test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -0800964test -d /sbin && PATH=$PATH:/sbin
965test -d /usr/sbin && PATH=$PATH:/usr/sbin
966PATH=$PATH:/etc:$OPATH
967
Damien Miller6c21c512002-01-22 21:57:53 +1100968# These programs are used by the command hashing source to gather entropy
969OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
970OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
971OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
972OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
973OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
974OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
975OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
976OSSH_PATH_ENTROPY_PROG(PROG_W, w)
977OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
978OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
979OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
980OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
981OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
982OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
983OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
984OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -0800985# restore PATH
986PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +1100987
988# Where does ssh-rand-helper get its randomness from?
989INSTALL_SSH_PRNG_CMDS=""
990if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
991 if test ! -z "$PRNGD_PORT" ; then
992 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
993 elif test ! -z "$PRNGD_SOCKET" ; then
994 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
995 else
996 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
997 RAND_HELPER_CMDHASH=yes
998 INSTALL_SSH_PRNG_CMDS="yes"
999 fi
1000fi
1001AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1002
1003
Ben Lindstromb5628642000-10-18 00:02:25 +00001004# Cheap hack to ensure NEWS-OS libraries are arranged right.
1005if test ! -z "$SONY" ; then
1006 LIBS="$LIBS -liberty";
1007fi
1008
Damien Millera22ba012000-03-02 23:09:20 +11001009# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001010AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001011AC_CHECK_SIZEOF(short int, 2)
1012AC_CHECK_SIZEOF(int, 4)
1013AC_CHECK_SIZEOF(long int, 4)
1014AC_CHECK_SIZEOF(long long int, 8)
1015
Damien Millerfa2bb692002-04-23 23:22:25 +10001016# Sanity check long long for some platforms (AIX)
1017if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1018 ac_cv_sizeof_long_long_int=0
1019fi
1020
Damien Millera22ba012000-03-02 23:09:20 +11001021# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001022AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1023 AC_TRY_COMPILE(
1024 [ #include <sys/types.h> ],
1025 [ u_int a; a = 1;],
1026 [ ac_cv_have_u_int="yes" ],
1027 [ ac_cv_have_u_int="no" ]
1028 )
1029])
1030if test "x$ac_cv_have_u_int" = "xyes" ; then
1031 AC_DEFINE(HAVE_U_INT)
1032 have_u_int=1
1033fi
1034
Damien Miller61e50f12000-05-08 20:49:37 +10001035AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1036 AC_TRY_COMPILE(
1037 [ #include <sys/types.h> ],
1038 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1039 [ ac_cv_have_intxx_t="yes" ],
1040 [ ac_cv_have_intxx_t="no" ]
1041 )
1042])
1043if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1044 AC_DEFINE(HAVE_INTXX_T)
1045 have_intxx_t=1
1046fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001047
1048if (test -z "$have_intxx_t" && \
1049 test "x$ac_cv_header_stdint_h" = "xyes")
1050then
1051 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1052 AC_TRY_COMPILE(
1053 [ #include <stdint.h> ],
1054 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1055 [
1056 AC_DEFINE(HAVE_INTXX_T)
1057 AC_MSG_RESULT(yes)
1058 ],
1059 [ AC_MSG_RESULT(no) ]
1060 )
1061fi
1062
Damien Miller578783e2000-09-23 14:12:24 +11001063AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1064 AC_TRY_COMPILE(
1065 [ #include <sys/types.h> ],
1066 [ int64_t a; a = 1;],
1067 [ ac_cv_have_int64_t="yes" ],
1068 [ ac_cv_have_int64_t="no" ]
1069 )
1070])
1071if test "x$ac_cv_have_int64_t" = "xyes" ; then
1072 AC_DEFINE(HAVE_INT64_T)
1073 have_int64_t=1
1074fi
1075
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001076if test -z "$have_int64_t" ; then
1077 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1078 AC_TRY_COMPILE(
1079 [ #include <sys/socket.h> ],
1080 [ int64_t a; a = 1],
1081 [
1082 AC_DEFINE(HAVE_INT64_T)
1083 AC_MSG_RESULT(yes)
1084 ],
1085 [ AC_MSG_RESULT(no) ]
1086 )
1087fi
1088
Tim Rice4cec93f2002-02-26 08:40:48 -08001089if test -z "$have_int64_t" ; then
1090 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1091 AC_TRY_COMPILE(
1092 [ #include <sys/bitypes.h> ],
1093 [ int64_t a; a = 1],
1094 [
1095 AC_DEFINE(HAVE_INT64_T)
1096 AC_MSG_RESULT(yes)
1097 ],
1098 [ AC_MSG_RESULT(no) ]
1099 )
1100fi
1101
Damien Miller61e50f12000-05-08 20:49:37 +10001102AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1103 AC_TRY_COMPILE(
1104 [ #include <sys/types.h> ],
1105 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1106 [ ac_cv_have_u_intxx_t="yes" ],
1107 [ ac_cv_have_u_intxx_t="no" ]
1108 )
1109])
1110if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1111 AC_DEFINE(HAVE_U_INTXX_T)
1112 have_u_intxx_t=1
1113fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001114
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001115if test -z "$have_u_intxx_t" ; then
1116 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1117 AC_TRY_COMPILE(
1118 [ #include <sys/socket.h> ],
1119 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1120 [
1121 AC_DEFINE(HAVE_U_INTXX_T)
1122 AC_MSG_RESULT(yes)
1123 ],
1124 [ AC_MSG_RESULT(no) ]
1125 )
1126fi
1127
Damien Miller578783e2000-09-23 14:12:24 +11001128AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1129 AC_TRY_COMPILE(
1130 [ #include <sys/types.h> ],
1131 [ u_int64_t a; a = 1;],
1132 [ ac_cv_have_u_int64_t="yes" ],
1133 [ ac_cv_have_u_int64_t="no" ]
1134 )
1135])
1136if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1137 AC_DEFINE(HAVE_U_INT64_T)
1138 have_u_int64_t=1
1139fi
1140
Tim Rice4cec93f2002-02-26 08:40:48 -08001141if test -z "$have_u_int64_t" ; then
1142 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1143 AC_TRY_COMPILE(
1144 [ #include <sys/bitypes.h> ],
1145 [ u_int64_t a; a = 1],
1146 [
1147 AC_DEFINE(HAVE_U_INT64_T)
1148 AC_MSG_RESULT(yes)
1149 ],
1150 [ AC_MSG_RESULT(no) ]
1151 )
1152fi
1153
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001154if test -z "$have_u_intxx_t" ; then
1155 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1156 AC_TRY_COMPILE(
1157 [
1158#include <sys/types.h>
1159 ],
1160 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1161 [ ac_cv_have_uintxx_t="yes" ],
1162 [ ac_cv_have_uintxx_t="no" ]
1163 )
1164 ])
1165 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1166 AC_DEFINE(HAVE_UINTXX_T)
1167 fi
1168fi
1169
1170if test -z "$have_uintxx_t" ; then
1171 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1172 AC_TRY_COMPILE(
1173 [ #include <stdint.h> ],
1174 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1175 [
1176 AC_DEFINE(HAVE_UINTXX_T)
1177 AC_MSG_RESULT(yes)
1178 ],
1179 [ AC_MSG_RESULT(no) ]
1180 )
1181fi
1182
Damien Milleredb82922000-06-20 13:25:52 +10001183if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1184 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001185then
1186 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1187 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001188 [
1189#include <sys/bitypes.h>
1190 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001191 [
Damien Miller70494d12000-04-03 15:57:06 +10001192 int8_t a; int16_t b; int32_t c;
1193 u_int8_t e; u_int16_t f; u_int32_t g;
1194 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001195 ],
1196 [
1197 AC_DEFINE(HAVE_U_INTXX_T)
1198 AC_DEFINE(HAVE_INTXX_T)
1199 AC_MSG_RESULT(yes)
1200 ],
1201 [AC_MSG_RESULT(no)]
1202 )
1203fi
1204
Damien Miller58be7382001-09-15 21:31:54 +10001205
1206AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1207 AC_TRY_COMPILE(
1208 [
1209#include <sys/types.h>
1210 ],
1211 [ u_char foo; foo = 125; ],
1212 [ ac_cv_have_u_char="yes" ],
1213 [ ac_cv_have_u_char="no" ]
1214 )
1215])
1216if test "x$ac_cv_have_u_char" = "xyes" ; then
1217 AC_DEFINE(HAVE_U_CHAR)
1218fi
1219
Tim Rice13aae5e2001-10-21 17:53:58 -07001220TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001221
Tim Rice200a5c02002-02-26 22:12:34 -08001222AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001223
Damien Miller61e50f12000-05-08 20:49:37 +10001224AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1225 AC_TRY_COMPILE(
1226 [
1227#include <sys/types.h>
1228 ],
1229 [ size_t foo; foo = 1235; ],
1230 [ ac_cv_have_size_t="yes" ],
1231 [ ac_cv_have_size_t="no" ]
1232 )
1233])
1234if test "x$ac_cv_have_size_t" = "xyes" ; then
1235 AC_DEFINE(HAVE_SIZE_T)
1236fi
Damien Miller95058511999-12-29 10:36:45 +11001237
Damien Miller615f9392000-05-17 22:53:33 +10001238AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1239 AC_TRY_COMPILE(
1240 [
1241#include <sys/types.h>
1242 ],
1243 [ ssize_t foo; foo = 1235; ],
1244 [ ac_cv_have_ssize_t="yes" ],
1245 [ ac_cv_have_ssize_t="no" ]
1246 )
1247])
1248if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1249 AC_DEFINE(HAVE_SSIZE_T)
1250fi
1251
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001252AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1253 AC_TRY_COMPILE(
1254 [
1255#include <time.h>
1256 ],
1257 [ clock_t foo; foo = 1235; ],
1258 [ ac_cv_have_clock_t="yes" ],
1259 [ ac_cv_have_clock_t="no" ]
1260 )
1261])
1262if test "x$ac_cv_have_clock_t" = "xyes" ; then
1263 AC_DEFINE(HAVE_CLOCK_T)
1264fi
1265
Damien Millerb54b40e2000-06-23 08:23:34 +10001266AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1267 AC_TRY_COMPILE(
1268 [
1269#include <sys/types.h>
1270#include <sys/socket.h>
1271 ],
1272 [ sa_family_t foo; foo = 1235; ],
1273 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001274 [ AC_TRY_COMPILE(
1275 [
1276#include <sys/types.h>
1277#include <sys/socket.h>
1278#include <netinet/in.h>
1279 ],
1280 [ sa_family_t foo; foo = 1235; ],
1281 [ ac_cv_have_sa_family_t="yes" ],
1282
Damien Millerb54b40e2000-06-23 08:23:34 +10001283 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001284 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001285 )
1286])
1287if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1288 AC_DEFINE(HAVE_SA_FAMILY_T)
1289fi
1290
Damien Miller0f91b4e2000-06-18 15:43:25 +10001291AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1292 AC_TRY_COMPILE(
1293 [
1294#include <sys/types.h>
1295 ],
1296 [ pid_t foo; foo = 1235; ],
1297 [ ac_cv_have_pid_t="yes" ],
1298 [ ac_cv_have_pid_t="no" ]
1299 )
1300])
1301if test "x$ac_cv_have_pid_t" = "xyes" ; then
1302 AC_DEFINE(HAVE_PID_T)
1303fi
1304
1305AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1306 AC_TRY_COMPILE(
1307 [
1308#include <sys/types.h>
1309 ],
1310 [ mode_t foo; foo = 1235; ],
1311 [ ac_cv_have_mode_t="yes" ],
1312 [ ac_cv_have_mode_t="no" ]
1313 )
1314])
1315if test "x$ac_cv_have_mode_t" = "xyes" ; then
1316 AC_DEFINE(HAVE_MODE_T)
1317fi
1318
Damien Miller61e50f12000-05-08 20:49:37 +10001319
1320AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1321 AC_TRY_COMPILE(
1322 [
Damien Miller81171112000-04-23 11:14:01 +10001323#include <sys/types.h>
1324#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001325 ],
1326 [ struct sockaddr_storage s; ],
1327 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1328 [ ac_cv_have_struct_sockaddr_storage="no" ]
1329 )
1330])
1331if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1332 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1333fi
Damien Miller34132e52000-01-14 15:45:46 +11001334
Damien Miller61e50f12000-05-08 20:49:37 +10001335AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1336 AC_TRY_COMPILE(
1337 [
Damien Miller7b22d652000-06-18 14:07:04 +10001338#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001339#include <netinet/in.h>
1340 ],
1341 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1342 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1343 [ ac_cv_have_struct_sockaddr_in6="no" ]
1344 )
1345])
1346if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1347 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1348fi
Damien Miller34132e52000-01-14 15:45:46 +11001349
Damien Miller61e50f12000-05-08 20:49:37 +10001350AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1351 AC_TRY_COMPILE(
1352 [
Damien Miller7b22d652000-06-18 14:07:04 +10001353#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001354#include <netinet/in.h>
1355 ],
1356 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1357 [ ac_cv_have_struct_in6_addr="yes" ],
1358 [ ac_cv_have_struct_in6_addr="no" ]
1359 )
1360])
1361if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1362 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1363fi
Damien Miller34132e52000-01-14 15:45:46 +11001364
Damien Miller61e50f12000-05-08 20:49:37 +10001365AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1366 AC_TRY_COMPILE(
1367 [
Damien Miller81171112000-04-23 11:14:01 +10001368#include <sys/types.h>
1369#include <sys/socket.h>
1370#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001371 ],
1372 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1373 [ ac_cv_have_struct_addrinfo="yes" ],
1374 [ ac_cv_have_struct_addrinfo="no" ]
1375 )
1376])
1377if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1378 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1379fi
1380
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001381AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1382 AC_TRY_COMPILE(
1383 [ #include <sys/time.h> ],
1384 [ struct timeval tv; tv.tv_sec = 1;],
1385 [ ac_cv_have_struct_timeval="yes" ],
1386 [ ac_cv_have_struct_timeval="no" ]
1387 )
1388])
1389if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1390 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1391 have_struct_timeval=1
1392fi
1393
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001394# If we don't have int64_t then we can't compile sftp-server. So don't
1395# even attempt to do it.
1396if test "x$ac_cv_have_int64_t" = "xno" -a \
1397 "x$ac_cv_sizeof_long_int" != "x8" -a \
1398 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1399 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001400else
1401dnl test snprintf (broken on SCO w/gcc)
1402 AC_TRY_RUN(
1403 [
1404#include <stdio.h>
1405#include <string.h>
1406#ifdef HAVE_SNPRINTF
1407main()
1408{
1409 char buf[50];
1410 char expected_out[50];
1411 int mazsize = 50 ;
1412#if (SIZEOF_LONG_INT == 8)
1413 long int num = 0x7fffffffffffffff;
1414#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001415 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001416#endif
1417 strcpy(expected_out, "9223372036854775807");
1418 snprintf(buf, mazsize, "%lld", num);
1419 if(strcmp(buf, expected_out) != 0)
1420 exit(1);
1421 exit(0);
1422}
1423#else
1424main() { exit(0); }
1425#endif
1426 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1427 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001428fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001429AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001430
Damien Miller78315eb2000-09-29 23:01:36 +11001431dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001432OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1433OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1434OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1435OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1436OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001437OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001438OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1439OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001440OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001441OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1442OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1443OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1444OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001445OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1446OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1447OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1448OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001449
1450AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001451
Damien Miller61e50f12000-05-08 20:49:37 +10001452AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1453 ac_cv_have_ss_family_in_struct_ss, [
1454 AC_TRY_COMPILE(
1455 [
Damien Miller81171112000-04-23 11:14:01 +10001456#include <sys/types.h>
1457#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001458 ],
1459 [ struct sockaddr_storage s; s.ss_family = 1; ],
1460 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1461 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1462 )
1463])
1464if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1465 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1466fi
1467
Damien Miller61e50f12000-05-08 20:49:37 +10001468AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1469 ac_cv_have___ss_family_in_struct_ss, [
1470 AC_TRY_COMPILE(
1471 [
Damien Miller81171112000-04-23 11:14:01 +10001472#include <sys/types.h>
1473#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001474 ],
1475 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1476 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1477 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1478 )
1479])
1480if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1481 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1482fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001483
Damien Millerad833b32000-08-23 10:46:23 +10001484AC_CACHE_CHECK([for pw_class field in struct passwd],
1485 ac_cv_have_pw_class_in_struct_passwd, [
1486 AC_TRY_COMPILE(
1487 [
Damien Millerad833b32000-08-23 10:46:23 +10001488#include <pwd.h>
1489 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001490 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001491 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1492 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1493 )
1494])
1495if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1496 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1497fi
1498
Kevin Steves82456952001-06-22 21:14:18 +00001499AC_CACHE_CHECK([for pw_expire field in struct passwd],
1500 ac_cv_have_pw_expire_in_struct_passwd, [
1501 AC_TRY_COMPILE(
1502 [
1503#include <pwd.h>
1504 ],
1505 [ struct passwd p; p.pw_expire = 0; ],
1506 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1507 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1508 )
1509])
1510if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1511 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1512fi
1513
1514AC_CACHE_CHECK([for pw_change field in struct passwd],
1515 ac_cv_have_pw_change_in_struct_passwd, [
1516 AC_TRY_COMPILE(
1517 [
1518#include <pwd.h>
1519 ],
1520 [ struct passwd p; p.pw_change = 0; ],
1521 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1522 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1523 )
1524])
1525if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1526 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1527fi
Damien Miller61e50f12000-05-08 20:49:37 +10001528
Tim Rice28bbb0c2002-05-27 17:37:32 -07001529dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001530AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1531 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001532 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001533 [
Tim Riceae49fe62002-04-12 10:26:21 -07001534#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001535#include <sys/socket.h>
1536#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001537int main() {
1538#ifdef msg_accrights
1539exit(1);
1540#endif
1541struct msghdr m;
1542m.msg_accrights = 0;
1543exit(0);
1544}
Kevin Steves939c9db2002-03-22 17:23:25 +00001545 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001546 [ ac_cv_have_accrights_in_msghdr="yes" ],
1547 [ ac_cv_have_accrights_in_msghdr="no" ]
1548 )
1549])
1550if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1551 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1552fi
1553
Kevin Stevesa44e0352002-04-07 16:18:03 +00001554AC_CACHE_CHECK([for msg_control field in struct msghdr],
1555 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001556 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001557 [
Tim Riceae49fe62002-04-12 10:26:21 -07001558#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001559#include <sys/socket.h>
1560#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001561int main() {
1562#ifdef msg_control
1563exit(1);
1564#endif
1565struct msghdr m;
1566m.msg_control = 0;
1567exit(0);
1568}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001569 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001570 [ ac_cv_have_control_in_msghdr="yes" ],
1571 [ ac_cv_have_control_in_msghdr="no" ]
1572 )
1573])
1574if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1575 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1576fi
1577
Damien Miller61e50f12000-05-08 20:49:37 +10001578AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1579 AC_TRY_LINK([],
1580 [ extern char *__progname; printf("%s", __progname); ],
1581 [ ac_cv_libc_defines___progname="yes" ],
1582 [ ac_cv_libc_defines___progname="no" ]
1583 )
1584])
1585if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1586 AC_DEFINE(HAVE___PROGNAME)
1587fi
1588
Kevin Steves4846f4a2002-03-22 18:19:53 +00001589AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1590 AC_TRY_LINK([
1591#include <stdio.h>
1592],
1593 [ printf("%s", __FUNCTION__); ],
1594 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1595 [ ac_cv_cc_implements___FUNCTION__="no" ]
1596 )
1597])
1598if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1599 AC_DEFINE(HAVE___FUNCTION__)
1600fi
1601
1602AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1603 AC_TRY_LINK([
1604#include <stdio.h>
1605],
1606 [ printf("%s", __func__); ],
1607 [ ac_cv_cc_implements___func__="yes" ],
1608 [ ac_cv_cc_implements___func__="no" ]
1609 )
1610])
1611if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1612 AC_DEFINE(HAVE___func__)
1613fi
1614
Damien Miller4f8e6692001-07-14 13:22:53 +10001615AC_CACHE_CHECK([whether getopt has optreset support],
1616 ac_cv_have_getopt_optreset, [
1617 AC_TRY_LINK(
1618 [
1619#include <getopt.h>
1620 ],
1621 [ extern int optreset; optreset = 0; ],
1622 [ ac_cv_have_getopt_optreset="yes" ],
1623 [ ac_cv_have_getopt_optreset="no" ]
1624 )
1625])
1626if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1627 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1628fi
Damien Millera22ba012000-03-02 23:09:20 +11001629
Damien Millerecbb26d2000-07-15 14:59:14 +10001630AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1631 AC_TRY_LINK([],
1632 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1633 [ ac_cv_libc_defines_sys_errlist="yes" ],
1634 [ ac_cv_libc_defines_sys_errlist="no" ]
1635 )
1636])
1637if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1638 AC_DEFINE(HAVE_SYS_ERRLIST)
1639fi
1640
1641
Damien Miller11fa2cc2000-08-16 10:35:58 +10001642AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1643 AC_TRY_LINK([],
1644 [ extern int sys_nerr; printf("%i", sys_nerr);],
1645 [ ac_cv_libc_defines_sys_nerr="yes" ],
1646 [ ac_cv_libc_defines_sys_nerr="no" ]
1647 )
1648])
1649if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1650 AC_DEFINE(HAVE_SYS_NERR)
1651fi
1652
Damien Miller85de5802001-09-18 14:01:11 +10001653SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001654
1655# Check whether user wants sectok support
1656AC_ARG_WITH(sectok,
1657 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001658 [
1659 if test "x$withval" != "xno" ; then
1660 if test "x$withval" != "xyes" ; then
1661 CPPFLAGS="$CPPFLAGS -I${withval}"
1662 LDFLAGS="$LDFLAGS -L${withval}"
1663 if test ! -z "$need_dash_r" ; then
1664 LDFLAGS="$LDFLAGS -R${withval}"
1665 fi
1666 if test ! -z "$blibpath" ; then
1667 blibpath="$blibpath:${withval}"
1668 fi
1669 fi
1670 AC_CHECK_HEADERS(sectok.h)
1671 if test "$ac_cv_header_sectok_h" != yes; then
1672 AC_MSG_ERROR(Can't find sectok.h)
1673 fi
1674 AC_CHECK_LIB(sectok, sectok_open)
1675 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1676 AC_MSG_ERROR(Can't find libsectok)
1677 fi
1678 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001679 AC_DEFINE(USE_SECTOK)
1680 SCARD_MSG="yes, using sectok"
1681 fi
1682 ]
1683)
1684
1685# Check whether user wants OpenSC support
1686AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001687 AC_HELP_STRING([--with-opensc=PFX],
1688 [Enable smartcard support using OpenSC]),
1689 opensc_config_prefix="$withval", opensc_config_prefix="")
1690if test x$opensc_config_prefix != x ; then
1691 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1692 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1693 if test "$OPENSC_CONFIG" != "no"; then
1694 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1695 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1696 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1697 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1698 AC_DEFINE(SMARTCARD)
1699 AC_DEFINE(USE_OPENSC)
1700 SCARD_MSG="yes, using OpenSC"
1701 fi
1702fi
Damien Miller85de5802001-09-18 14:01:11 +10001703
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001704# Check whether user wants Kerberos 5 support
1705KRB5_MSG="no"
1706AC_ARG_WITH(kerberos5,
1707 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1708 [
1709 if test "x$withval" != "xno" ; then
1710 if test "x$withval" = "xyes" ; then
1711 KRB5ROOT="/usr/local"
1712 else
1713 KRB5ROOT=${withval}
1714 fi
1715 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1716 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1717 AC_DEFINE(KRB5)
1718 KRB5_MSG="yes"
1719 AC_MSG_CHECKING(whether we are using Heimdal)
1720 AC_TRY_COMPILE([ #include <krb5.h> ],
1721 [ char *tmp = heimdal_version; ],
1722 [ AC_MSG_RESULT(yes)
1723 AC_DEFINE(HEIMDAL)
1724 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1725 ],
1726 [ AC_MSG_RESULT(no)
1727 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1728 ]
1729 )
1730 if test ! -z "$need_dash_r" ; then
1731 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1732 fi
1733 if test ! -z "$blibpath" ; then
1734 blibpath="$blibpath:${KRB5ROOT}/lib"
1735 fi
1736 AC_CHECK_LIB(resolv, dn_expand, , )
1737
1738 KRB5=yes
1739 fi
1740 ]
1741)
1742# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001743KRB4_MSG="no"
1744AC_ARG_WITH(kerberos4,
1745 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1746 [
1747 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001748 if test "x$withval" != "xyes" ; then
1749 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1750 LDFLAGS="$LDFLAGS -L${withval}/lib"
1751 if test ! -z "$need_dash_r" ; then
1752 LDFLAGS="$LDFLAGS -R${withval}/lib"
1753 fi
1754 if test ! -z "$blibpath" ; then
1755 blibpath="$blibpath:${withval}/lib"
1756 fi
1757 else
1758 if test -d /usr/include/kerberosIV ; then
1759 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1760 fi
1761 fi
1762
1763 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001764 if test "$ac_cv_header_krb_h" != yes; then
1765 AC_MSG_WARN([Cannot find krb.h, build may fail])
1766 fi
Damien Miller98344742001-03-28 14:37:06 +10001767 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001768 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001769 AC_CHECK_LIB(krb4, main)
1770 if test "$ac_cv_lib_krb4_main" != yes; then
1771 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1772 else
1773 KLIBS="-lkrb4"
1774 fi
1775 else
1776 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001777 fi
Damien Miller98344742001-03-28 14:37:06 +10001778 AC_CHECK_LIB(des, des_cbc_encrypt)
1779 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1780 AC_CHECK_LIB(des425, des_cbc_encrypt)
1781 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1782 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1783 else
1784 KLIBS="-ldes425"
1785 fi
1786 else
1787 KLIBS="-ldes"
1788 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001789 AC_CHECK_LIB(resolv, dn_expand, , )
1790 KRB4=yes
1791 KRB4_MSG="yes"
1792 AC_DEFINE(KRB4)
1793 fi
1794 ]
1795)
1796
1797# Check whether user wants AFS support
1798AFS_MSG="no"
1799AC_ARG_WITH(afs,
1800 [ --with-afs=PATH Enable AFS support],
1801 [
1802 if test "x$withval" != "xno" ; then
1803
1804 if test "x$withval" != "xyes" ; then
1805 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1806 LDFLAGS="$LDFLAGS -L${withval}/lib"
1807 fi
1808
1809 if test -z "$KRB4" ; then
1810 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1811 fi
1812
1813 LIBS="-lkafs $LIBS"
1814 if test ! -z "$AFS_LIBS" ; then
1815 LIBS="$LIBS $AFS_LIBS"
1816 fi
1817 AC_DEFINE(AFS)
1818 AFS_MSG="yes"
1819 fi
1820 ]
1821)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001822LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001823
Damien Millera22ba012000-03-02 23:09:20 +11001824# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11001825
Damien Millerf58c6722002-05-13 13:15:42 +10001826PRIVSEP_PATH=/var/empty
1827AC_ARG_WITH(privsep-path,
Damien Miller74cc5bb2002-05-22 11:02:15 +10001828 [ --with-privsep-path=xxx Path for privilege separation chroot ],
Damien Millerf58c6722002-05-13 13:15:42 +10001829 [
1830 if test "x$withval" != "$no" ; then
1831 PRIVSEP_PATH=$withval
1832 fi
1833 ]
1834)
1835AC_SUBST(PRIVSEP_PATH)
1836
Damien Millera22ba012000-03-02 23:09:20 +11001837AC_ARG_WITH(xauth,
1838 [ --with-xauth=PATH Specify path to xauth program ],
1839 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001840 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001841 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001842 fi
1843 ],
1844 [
Damien Miller78315eb2000-09-29 23:01:36 +11001845 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 +10001846 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001847 xauth_path="/usr/openwin/bin/xauth"
1848 fi
1849 ]
1850)
1851
Damien Millera19cf472000-11-29 13:28:50 +11001852if test -z "$xauth_path" ; then
1853 XAUTH_PATH="undefined"
1854 AC_SUBST(XAUTH_PATH)
1855else
Damien Millera22ba012000-03-02 23:09:20 +11001856 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001857 XAUTH_PATH=$xauth_path
1858 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001859fi
Damien Millera22ba012000-03-02 23:09:20 +11001860
1861# Check for mail directory (last resort if we cannot get it from headers)
1862if test ! -z "$MAIL" ; then
1863 maildir=`dirname $MAIL`
1864 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1865fi
1866
Damien Millera22ba012000-03-02 23:09:20 +11001867if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00001868 if test "x$disable_ptmx_check" != "xyes" ; then
1869 AC_CHECK_FILE("/dev/ptmx",
1870 [
1871 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1872 have_dev_ptmx=1
1873 ]
1874 )
1875 fi
Damien Millera22ba012000-03-02 23:09:20 +11001876fi
Damien Miller204ad072000-03-02 23:56:12 +11001877AC_CHECK_FILE("/dev/ptc",
1878 [
1879 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1880 have_dev_ptc=1
1881 ]
1882)
1883
Damien Millera22ba012000-03-02 23:09:20 +11001884# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001885AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001886 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001887 [
Damien Miller897741e2001-04-16 10:41:46 +10001888 case "$withval" in
1889 man|cat|doc)
1890 MANTYPE=$withval
1891 ;;
1892 *)
1893 AC_MSG_ERROR(invalid man type: $withval)
1894 ;;
1895 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001896 ]
1897)
Ben Lindstrombc709922001-04-18 18:04:21 +00001898if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001899 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001900 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1901 MANTYPE=doc
1902 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1903 MANTYPE=man
1904 else
1905 MANTYPE=cat
1906 fi
1907fi
Damien Miller670a4b82000-01-22 13:53:11 +11001908AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001909if test "$MANTYPE" = "doc"; then
1910 mansubdir=man;
1911else
1912 mansubdir=$MANTYPE;
1913fi
1914AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001915
Damien Millera22ba012000-03-02 23:09:20 +11001916# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001917MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001918AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001919 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001920 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001921 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001922 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001923 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001924 fi
1925 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001926)
1927
Damien Millera22ba012000-03-02 23:09:20 +11001928# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001929AC_ARG_WITH(shadow,
1930 [ --without-shadow Disable shadow password support],
1931 [
1932 if test "x$withval" = "xno" ; then
1933 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001934 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001935 fi
1936 ]
1937)
1938
Damien Miller1f335fb2000-06-26 11:31:33 +10001939if test -z "$disable_shadow" ; then
1940 AC_MSG_CHECKING([if the systems has expire shadow information])
1941 AC_TRY_COMPILE(
1942 [
1943#include <sys/types.h>
1944#include <shadow.h>
1945 struct spwd sp;
1946 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1947 [ sp_expire_available=yes ], []
1948 )
1949
1950 if test "x$sp_expire_available" = "xyes" ; then
1951 AC_MSG_RESULT(yes)
1952 AC_DEFINE(HAS_SHADOW_EXPIRE)
1953 else
1954 AC_MSG_RESULT(no)
1955 fi
1956fi
1957
Damien Millera22ba012000-03-02 23:09:20 +11001958# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001959if test ! -z "$IPADDR_IN_DISPLAY" ; then
1960 DISPLAY_HACK_MSG="yes"
1961 AC_DEFINE(IPADDR_IN_DISPLAY)
1962else
1963 DISPLAY_HACK_MSG="no"
1964 AC_ARG_WITH(ipaddr-display,
1965 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1966 [
1967 if test "x$withval" != "xno" ; then
1968 AC_DEFINE(IPADDR_IN_DISPLAY)
1969 DISPLAY_HACK_MSG="yes"
1970 fi
1971 ]
1972 )
1973fi
Damien Miller76112de1999-12-21 11:18:08 +11001974
Tim Rice43a1c132002-04-17 21:19:14 -07001975dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
1976if test $ac_cv_func_login_getcapbool = "yes" -a \
1977 $ac_cv_header_login_cap_h = "yes" ; then
1978 USES_LOGIN_CONF=yes
1979fi
Damien Millera22ba012000-03-02 23:09:20 +11001980# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001981SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001982AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10001983 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11001984 [
Tim Rice43a1c132002-04-17 21:19:14 -07001985 if test "$USES_LOGIN_CONF" = "yes" ; then
1986 AC_MSG_WARN([
1987--with-default-path=PATH has no effect on this system.
1988Edit /etc/login.conf instead.])
1989 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001990 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001991 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001992 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001993 ],
Tim Rice43a1c132002-04-17 21:19:14 -07001994 [ if test "$USES_LOGIN_CONF" = "yes" ; then
1995 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
1996 else
Tim Rice59ea0a02001-03-10 13:50:45 -08001997 AC_TRY_RUN(
1998 [
1999/* find out what STDPATH is */
2000#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002001#ifdef HAVE_PATHS_H
2002# include <paths.h>
2003#endif
2004#ifndef _PATH_STDPATH
2005# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2006#endif
2007#include <sys/types.h>
2008#include <sys/stat.h>
2009#include <fcntl.h>
2010#define DATA "conftest.stdpath"
2011
2012main()
2013{
2014 FILE *fd;
2015 int rc;
2016
2017 fd = fopen(DATA,"w");
2018 if(fd == NULL)
2019 exit(1);
2020
2021 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2022 exit(1);
2023
2024 exit(0);
2025}
2026 ], [ user_path=`cat conftest.stdpath` ],
2027 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2028 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2029 )
2030# make sure $bindir is in USER_PATH so scp will work
2031 t_bindir=`eval echo ${bindir}`
2032 case $t_bindir in
2033 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2034 esac
2035 case $t_bindir in
2036 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2037 esac
2038 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2039 if test $? -ne 0 ; then
2040 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2041 if test $? -ne 0 ; then
2042 user_path=$user_path:$t_bindir
2043 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2044 fi
2045 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002046 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002047)
Tim Rice43a1c132002-04-17 21:19:14 -07002048if test "$USES_LOGIN_CONF" != "yes" ; then
2049 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2050 AC_SUBST(user_path)
2051fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002052
Damien Millera18bbd32002-05-13 10:48:57 +10002053# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002054AC_ARG_WITH(superuser-path,
2055 [ --with-superuser-path= Specify different path for super-user],
2056 [
2057 if test "x$withval" != "xno" ; then
2058 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2059 superuser_path=$withval
2060 fi
2061 ]
2062)
2063
2064
Damien Millera22ba012000-03-02 23:09:20 +11002065# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002066IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002067AC_ARG_WITH(ipv4-default,
2068 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2069 [
2070 if test "x$withval" != "xno" ; then
2071 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002072 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002073 fi
2074 ]
2075)
2076
Damien Miller61e50f12000-05-08 20:49:37 +10002077AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002078IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002079AC_ARG_WITH(4in6,
2080 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2081 [
2082 if test "x$withval" != "xno" ; then
2083 AC_MSG_RESULT(yes)
2084 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002085 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002086 else
2087 AC_MSG_RESULT(no)
2088 fi
2089 ],[
2090 if test "x$inet6_default_4in6" = "xyes"; then
2091 AC_MSG_RESULT([yes (default)])
2092 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002093 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002094 else
2095 AC_MSG_RESULT([no (default)])
2096 fi
2097 ]
2098)
2099
Damien Miller60396b02001-02-18 17:01:00 +11002100# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002101BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002102AC_ARG_WITH(bsd-auth,
2103 [ --with-bsd-auth Enable BSD auth support],
2104 [
2105 if test "x$withval" != "xno" ; then
2106 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002107 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002108 fi
2109 ]
2110)
2111
Damien Millera22ba012000-03-02 23:09:20 +11002112# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002113piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002114# make sure the directory exists
2115if test ! -d $piddir ; then
2116 piddir=`eval echo ${sysconfdir}`
2117 case $piddir in
2118 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2119 esac
2120fi
2121
Tim Rice88f2ab52002-03-17 12:17:34 -08002122AC_ARG_WITH(pid-dir,
2123 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2124 [
2125 if test "x$withval" != "xno" ; then
2126 piddir=$withval
2127 if test ! -d $piddir ; then
2128 AC_MSG_WARN([** no $piddir directory on this system **])
2129 fi
2130 fi
2131 ]
2132)
2133
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002134AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002135AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002136
andre2ff7b5d2000-06-03 14:57:40 +00002137dnl allow user to disable some login recording features
2138AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002139 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002140 [ AC_DEFINE(DISABLE_LASTLOG) ]
2141)
2142AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002143 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002144 [ AC_DEFINE(DISABLE_UTMP) ]
2145)
2146AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002147 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002148 [ AC_DEFINE(DISABLE_UTMPX) ]
2149)
2150AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002151 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002152 [ AC_DEFINE(DISABLE_WTMP) ]
2153)
2154AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002155 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002156 [ AC_DEFINE(DISABLE_WTMPX) ]
2157)
2158AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002159 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002160 [ AC_DEFINE(DISABLE_LOGIN) ]
2161)
2162AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002163 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002164 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2165)
2166AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002167 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002168 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2169)
2170AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002171 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002172 [
2173 if test "x$withval" = "xno" ; then
2174 AC_DEFINE(DISABLE_LASTLOG)
2175 else
2176 conf_lastlog_location=$withval
2177 fi
2178 ]
2179)
andre2ff7b5d2000-06-03 14:57:40 +00002180
2181dnl lastlog, [uw]tmpx? detection
2182dnl NOTE: set the paths in the platform section to avoid the
2183dnl need for command-line parameters
2184dnl lastlog and [uw]tmp are subject to a file search if all else fails
2185
2186dnl lastlog detection
2187dnl NOTE: the code itself will detect if lastlog is a directory
2188AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2189AC_TRY_COMPILE([
2190#include <sys/types.h>
2191#include <utmp.h>
2192#ifdef HAVE_LASTLOG_H
2193# include <lastlog.h>
2194#endif
Damien Miller2994e082000-06-04 15:51:47 +10002195#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002196# include <paths.h>
2197#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002198#ifdef HAVE_LOGIN_H
2199# include <login.h>
2200#endif
andre2ff7b5d2000-06-03 14:57:40 +00002201 ],
2202 [ char *lastlog = LASTLOG_FILE; ],
2203 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002204 [
2205 AC_MSG_RESULT(no)
2206 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2207 AC_TRY_COMPILE([
2208#include <sys/types.h>
2209#include <utmp.h>
2210#ifdef HAVE_LASTLOG_H
2211# include <lastlog.h>
2212#endif
2213#ifdef HAVE_PATHS_H
2214# include <paths.h>
2215#endif
2216 ],
2217 [ char *lastlog = _PATH_LASTLOG; ],
2218 [ AC_MSG_RESULT(yes) ],
2219 [
andree441aa32000-06-12 22:34:38 +00002220 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002221 system_lastlog_path=no
2222 ])
2223 ]
andre2ff7b5d2000-06-03 14:57:40 +00002224)
Damien Miller2994e082000-06-04 15:51:47 +10002225
andre2ff7b5d2000-06-03 14:57:40 +00002226if test -z "$conf_lastlog_location"; then
2227 if test x"$system_lastlog_path" = x"no" ; then
2228 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002229 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002230 conf_lastlog_location=$f
2231 fi
2232 done
2233 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002234 AC_MSG_WARN([** Cannot find lastlog **])
2235 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002236 fi
2237 fi
2238fi
2239
2240if test -n "$conf_lastlog_location"; then
2241 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2242fi
2243
2244dnl utmp detection
2245AC_MSG_CHECKING([if your system defines UTMP_FILE])
2246AC_TRY_COMPILE([
2247#include <sys/types.h>
2248#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002249#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002250# include <paths.h>
2251#endif
2252 ],
2253 [ char *utmp = UTMP_FILE; ],
2254 [ AC_MSG_RESULT(yes) ],
2255 [ AC_MSG_RESULT(no)
2256 system_utmp_path=no ]
2257)
2258if test -z "$conf_utmp_location"; then
2259 if test x"$system_utmp_path" = x"no" ; then
2260 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2261 if test -f $f ; then
2262 conf_utmp_location=$f
2263 fi
2264 done
2265 if test -z "$conf_utmp_location"; then
2266 AC_DEFINE(DISABLE_UTMP)
2267 fi
2268 fi
2269fi
2270if test -n "$conf_utmp_location"; then
2271 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2272fi
2273
2274dnl wtmp detection
2275AC_MSG_CHECKING([if your system defines WTMP_FILE])
2276AC_TRY_COMPILE([
2277#include <sys/types.h>
2278#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002279#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002280# include <paths.h>
2281#endif
2282 ],
2283 [ char *wtmp = WTMP_FILE; ],
2284 [ AC_MSG_RESULT(yes) ],
2285 [ AC_MSG_RESULT(no)
2286 system_wtmp_path=no ]
2287)
2288if test -z "$conf_wtmp_location"; then
2289 if test x"$system_wtmp_path" = x"no" ; then
2290 for f in /usr/adm/wtmp /var/log/wtmp; do
2291 if test -f $f ; then
2292 conf_wtmp_location=$f
2293 fi
2294 done
2295 if test -z "$conf_wtmp_location"; then
2296 AC_DEFINE(DISABLE_WTMP)
2297 fi
2298 fi
2299fi
2300if test -n "$conf_wtmp_location"; then
2301 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2302fi
2303
2304
2305dnl utmpx detection - I don't know any system so perverse as to require
2306dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2307dnl there, though.
2308AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2309AC_TRY_COMPILE([
2310#include <sys/types.h>
2311#include <utmp.h>
2312#ifdef HAVE_UTMPX_H
2313#include <utmpx.h>
2314#endif
Damien Miller2994e082000-06-04 15:51:47 +10002315#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002316# include <paths.h>
2317#endif
2318 ],
2319 [ char *utmpx = UTMPX_FILE; ],
2320 [ AC_MSG_RESULT(yes) ],
2321 [ AC_MSG_RESULT(no)
2322 system_utmpx_path=no ]
2323)
2324if test -z "$conf_utmpx_location"; then
2325 if test x"$system_utmpx_path" = x"no" ; then
2326 AC_DEFINE(DISABLE_UTMPX)
2327 fi
2328else
2329 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2330fi
2331
2332dnl wtmpx detection
2333AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2334AC_TRY_COMPILE([
2335#include <sys/types.h>
2336#include <utmp.h>
2337#ifdef HAVE_UTMPX_H
2338#include <utmpx.h>
2339#endif
Damien Miller2994e082000-06-04 15:51:47 +10002340#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002341# include <paths.h>
2342#endif
2343 ],
2344 [ char *wtmpx = WTMPX_FILE; ],
2345 [ AC_MSG_RESULT(yes) ],
2346 [ AC_MSG_RESULT(no)
2347 system_wtmpx_path=no ]
2348)
2349if test -z "$conf_wtmpx_location"; then
2350 if test x"$system_wtmpx_path" = x"no" ; then
2351 AC_DEFINE(DISABLE_WTMPX)
2352 fi
2353else
2354 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2355fi
2356
Damien Miller4018c192000-04-30 09:30:44 +10002357
Damien Miller29ea30d2000-03-17 10:54:15 +11002358if test ! -z "$blibpath" ; then
2359 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2360 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2361fi
2362
Tim Rice4cec93f2002-02-26 08:40:48 -08002363dnl remove pam and dl because they are in $LIBPAM
2364if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002365 LIBS=`echo $LIBS | sed 's/-lpam //'`
2366fi
2367if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2368 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002369fi
2370
Damien Millerbac2d8a2000-09-05 16:13:06 +11002371AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002372AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2373AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002374
Damien Miller7b22d652000-06-18 14:07:04 +10002375# Print summary of options
2376
Damien Miller7b22d652000-06-18 14:07:04 +10002377# Someone please show me a better way :)
2378A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2379B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2380C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2381D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002382E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002383F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002384G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002385H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2386I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2387J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002388
2389echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002390echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002391echo " User binaries: $B"
2392echo " System binaries: $C"
2393echo " Configuration files: $D"
2394echo " Askpass program: $E"
2395echo " Manual pages: $F"
2396echo " PID file: $G"
2397echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002398if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002399echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002400else
Damien Millerf58c6722002-05-13 13:15:42 +10002401echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002402fi
Damien Millera18bbd32002-05-13 10:48:57 +10002403if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002404echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002405fi
Damien Millerf58c6722002-05-13 13:15:42 +10002406echo " Manpage format: $MANTYPE"
2407echo " PAM support: ${PAM_MSG}"
2408echo " KerberosIV support: $KRB4_MSG"
2409echo " KerberosV support: $KRB5_MSG"
2410echo " Smartcard support: $SCARD_MSG"
2411echo " AFS support: $AFS_MSG"
2412echo " S/KEY support: $SKEY_MSG"
2413echo " TCP Wrappers support: $TCPW_MSG"
2414echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002415echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002416echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2417echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2418echo " BSD Auth support: $BSD_AUTH_MSG"
2419echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002420if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002421echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002422fi
2423
Damien Miller7b22d652000-06-18 14:07:04 +10002424echo ""
2425
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002426echo " Host: ${host}"
2427echo " Compiler: ${CC}"
2428echo " Compiler flags: ${CFLAGS}"
2429echo "Preprocessor flags: ${CPPFLAGS}"
2430echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002431echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002432
2433echo ""
2434
Damien Miller82cf0ce2000-12-20 13:34:48 +11002435if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002436 echo "PAM is enabled. You may need to install a PAM control file "
2437 echo "for sshd, otherwise password authentication may fail. "
2438 echo "Example PAM control files can be found in the contrib/ "
2439 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002440 echo ""
2441fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002442
2443if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002444 echo "sftp-server will be disabled. Your compiler does not "
2445 echo "support 64bit integers."
2446 echo ""
2447fi
2448
2449if test ! -z "$RAND_HELPER_CMDHASH" ; then
2450 echo "WARNING: you are using the builtin random number collection "
2451 echo "service. Please read WARNING.RNG and request that your OS "
2452 echo "vendor includes kernel-based random number collection in "
2453 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002454 echo ""
2455fi
Damien Miller60396b02001-02-18 17:01:00 +11002456