blob: aa9a5d215ab61a6c2ca47f870d4a882c82d14ab6 [file] [log] [blame]
Tim Ricecbb90662002-07-08 19:17:10 -07001# $Id: configure.ac,v 1.76 2002/07/09 02:17:10 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 Rice9dd30812002-07-07 13:43:36 -070094 AC_DEFINE(DISABLE_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 Rice9dd30812002-07-07 13:43:36 -0700275 AC_DEFINE(DISABLE_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 Rice9dd30812002-07-07 13:43:36 -0700283 AC_DEFINE(DISABLE_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,
Tim Ricecbb90662002-07-08 19:17:10 -0700427 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
428 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000429)
Damien Millerab18c411999-11-11 10:40:23 +1100430
Tim Ricee589a292001-11-03 11:09:32 -0800431dnl Checks for libutil functions
432AC_CHECK_HEADERS(libutil.h)
433AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
434AC_CHECK_FUNCS(logout updwtmp logwtmp)
435
Ben Lindstrom8697e082001-02-24 21:41:10 +0000436AC_FUNC_STRFTIME
437
Damien Miller3c027682001-03-14 11:39:45 +1100438# Check for ALTDIRFUNC glob() extension
439AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
440AC_EGREP_CPP(FOUNDIT,
441 [
442 #include <glob.h>
443 #ifdef GLOB_ALTDIRFUNC
444 FOUNDIT
445 #endif
446 ],
447 [
448 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
449 AC_MSG_RESULT(yes)
450 ],
451 [
452 AC_MSG_RESULT(no)
453 ]
454)
Damien Millerab18c411999-11-11 10:40:23 +1100455
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000456# Check for g.gl_matchc glob() extension
457AC_MSG_CHECKING(for gl_matchc field in glob_t)
458AC_EGREP_CPP(FOUNDIT,
459 [
460 #include <glob.h>
461 int main(void){glob_t g; g.gl_matchc = 1;}
462 ],
463 [
464 AC_DEFINE(GLOB_HAS_GL_MATCHC)
465 AC_MSG_RESULT(yes)
466 ],
467 [
468 AC_MSG_RESULT(no)
469 ]
470)
471
Damien Miller18bb4732001-03-28 14:35:30 +1000472AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
473AC_TRY_RUN(
474 [
475#include <sys/types.h>
476#include <dirent.h>
477int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
478 ],
479 [AC_MSG_RESULT(yes)],
480 [
481 AC_MSG_RESULT(no)
482 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
483 ]
484)
485
Damien Millerc547bf12001-02-16 10:18:12 +1100486# Check whether user wants S/Key support
487SKEY_MSG="no"
488AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700489 [ --with-skey[[=PATH]] Enable S/Key support
490 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100491 [
492 if test "x$withval" != "xno" ; then
493
494 if test "x$withval" != "xyes" ; then
495 CPPFLAGS="$CPPFLAGS -I${withval}/include"
496 LDFLAGS="$LDFLAGS -L${withval}/lib"
497 fi
498
499 AC_DEFINE(SKEY)
500 LIBS="-lskey $LIBS"
501 SKEY_MSG="yes"
502
Tim Rice4cec93f2002-02-26 08:40:48 -0800503 AC_MSG_CHECKING([for s/key support])
504 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100505 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800506#include <stdio.h>
507#include <skey.h>
508int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
509 ],
510 [AC_MSG_RESULT(yes)],
511 [
512 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100513 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
514 ])
515 fi
516 ]
517)
518
519# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700520TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100521AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700522 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
523 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100524 [
525 if test "x$withval" != "xno" ; then
526 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700527 saved_LDFLAGS="$LDFLAGS"
528 saved_CPPFLAGS="$CPPFLAGS"
529 if test -n "${withval}" -a "${withval}" != "yes"; then
530 if test -d "${withval}/lib"; then
531 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700532 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700533 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700534 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700535 fi
536 else
537 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700538 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700539 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700540 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700541 fi
542 fi
543 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700544 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700545 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700546 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700547 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700548 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800549 LIBWRAP="-lwrap"
550 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100551 AC_MSG_CHECKING(for libwrap)
552 AC_TRY_LINK(
553 [
554#include <tcpd.h>
555 int deny_severity = 0, allow_severity = 0;
556 ],
557 [hosts_access(0);],
558 [
559 AC_MSG_RESULT(yes)
560 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800561 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700562 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100563 ],
564 [
565 AC_MSG_ERROR([*** libwrap missing])
566 ]
567 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800568 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100569 fi
570 ]
571)
572
Damien Millerad833b32000-08-23 10:46:23 +1000573dnl Checks for library functions.
Ben Lindstromfdee8ef2002-04-06 23:52:02 +0000574AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
Tim Rice13aae5e2001-10-21 17:53:58 -0700575 clock fchmod fchown freeaddrinfo futimes gai_strerror \
576 getaddrinfo getcwd getgrouplist getnameinfo getopt \
577 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
578 inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller594a71b2002-04-23 20:22:59 +1000579 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
580 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
Ben Lindstrom837461b2002-06-12 16:57:14 +0000581 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
Ben Lindstromf0bfa832002-06-21 00:01:18 +0000582 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
583 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
584 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
Tim Rice13aae5e2001-10-21 17:53:58 -0700585
Ben Lindstrom6b0c96a2002-06-25 03:22:03 +0000586if test $ac_cv_func_mmap = yes ; then
587AC_MSG_CHECKING([for mmap anon shared])
588AC_TRY_RUN(
589 [
590#include <stdio.h>
Ben Lindstrom68e83112002-06-28 00:37:33 +0000591#include <sys/types.h>
Ben Lindstrom6b0c96a2002-06-25 03:22:03 +0000592#include <sys/mman.h>
593#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
594#define MAP_ANON MAP_ANONYMOUS
595#endif
596main() { char *p;
597p = (char *) mmap(NULL, 10, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED, -1, 0);
598if (p == (char *)-1)
599 exit(1);
600exit(0);
601}
602 ],
603 [
604 AC_MSG_RESULT(yes)
605 AC_DEFINE(HAVE_MMAP_ANON_SHARED)
606 ],
607 [ AC_MSG_RESULT(no) ]
608)
609fi
610
Tim Rice13aae5e2001-10-21 17:53:58 -0700611dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700612AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700613 AC_CHECK_LIB(gen, dirname,[
614 AC_CACHE_CHECK([for broken dirname],
615 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700616 save_LIBS="$LIBS"
617 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700618 AC_TRY_RUN(
619 [
620#include <libgen.h>
621#include <string.h>
622
623int main(int argc, char **argv) {
624 char *s, buf[32];
625
626 strncpy(buf,"/etc", 32);
627 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700628 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700629 exit(1);
630 } else {
631 exit(0);
632 }
633}
634 ],
635 [ ac_cv_have_broken_dirname="no" ],
636 [ ac_cv_have_broken_dirname="yes" ]
637 )
Tim Rice17b93e52001-10-23 22:36:54 -0700638 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700639 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700640 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700641 LIBS="$LIBS -lgen"
642 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700643 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700644 fi
645 ])
646])
647
Damien Millerad833b32000-08-23 10:46:23 +1000648dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000649AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000650dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000651AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000652AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000653dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000654AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000655AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100656
Damien Miller04f80141999-11-19 15:32:34 +1100657AC_CHECK_FUNC(daemon,
658 [AC_DEFINE(HAVE_DAEMON)],
659 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
660)
661
Damien Miller9fb07e42000-03-05 16:22:59 +1100662AC_CHECK_FUNC(getpagesize,
663 [AC_DEFINE(HAVE_GETPAGESIZE)],
664 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
665)
666
Damien Millercb170cb2000-07-01 16:52:55 +1000667# Check for broken snprintf
668if test "x$ac_cv_func_snprintf" = "xyes" ; then
669 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
670 AC_TRY_RUN(
671 [
672#include <stdio.h>
673int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
674 ],
675 [AC_MSG_RESULT(yes)],
676 [
677 AC_MSG_RESULT(no)
678 AC_DEFINE(BROKEN_SNPRINTF)
679 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
680 ]
681 )
682fi
683
Damien Miller606f8802000-09-16 15:39:56 +1100684AC_FUNC_GETPGRP
685
Damien Millera64b57a2001-01-17 10:44:13 +1100686# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000687PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100688AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100689 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100690 [
Damien Millera64b57a2001-01-17 10:44:13 +1100691 if test "x$withval" != "xno" ; then
692 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
693 AC_MSG_ERROR([PAM headers not found])
694 fi
695
696 AC_CHECK_LIB(dl, dlopen, , )
697 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
698 AC_CHECK_FUNCS(pam_getenvlist)
699
700 disable_shadow=yes
701 PAM_MSG="yes"
702
703 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800704 if test $ac_cv_lib_dl_dlopen = yes; then
705 LIBPAM="-lpam -ldl"
706 else
707 LIBPAM="-lpam"
708 fi
709 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100710 fi
711 ]
712)
Damien Millera22ba012000-03-02 23:09:20 +1100713
Damien Millera64b57a2001-01-17 10:44:13 +1100714# Check for older PAM
715if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100716 # Check PAM strerror arguments (old PAM)
717 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
718 AC_TRY_COMPILE(
719 [
Damien Miller81171112000-04-23 11:14:01 +1000720#include <stdlib.h>
721#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100722 ],
723 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
724 [AC_MSG_RESULT(no)],
725 [
726 AC_DEFINE(HAVE_OLD_PAM)
727 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000728 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100729 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100730 )
Damien Millera22ba012000-03-02 23:09:20 +1100731fi
732
Tim Riceaef73712002-05-11 13:17:42 -0700733# Search for OpenSSL
734saved_CPPFLAGS="$CPPFLAGS"
735saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100736AC_ARG_WITH(ssl-dir,
737 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
738 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000739 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700740 if test -d "$withval/lib"; then
741 if test -n "${need_dash_r}"; then
742 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
743 else
744 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
745 fi
746 else
747 if test -n "${need_dash_r}"; then
748 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
749 else
750 LDFLAGS="-L${withval} ${LDFLAGS}"
751 fi
752 fi
753 if test -d "$withval/include"; then
754 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
755 else
756 CPPFLAGS="-I${withval} ${CPPFLAGS}"
757 fi
Damien Millera22ba012000-03-02 23:09:20 +1100758 fi
759 ]
760)
Tim Riceaef73712002-05-11 13:17:42 -0700761LIBS="$LIBS -lcrypto"
762AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000763 [
Tim Riceaef73712002-05-11 13:17:42 -0700764 dnl Check default openssl install dir
765 if test -n "${need_dash_r}"; then
766 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000767 else
Tim Riceaef73712002-05-11 13:17:42 -0700768 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000769 fi
Tim Riceaef73712002-05-11 13:17:42 -0700770 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
771 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
772 [
773 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
774 ]
775 )
776 ]
777)
778
Damien Millera22ba012000-03-02 23:09:20 +1100779
Damien Millerec932372002-01-22 22:16:03 +1100780# Sanity check OpenSSL headers
781AC_MSG_CHECKING([whether OpenSSL's headers match the library])
782AC_TRY_RUN(
783 [
784#include <string.h>
785#include <openssl/opensslv.h>
786int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
787 ],
788 [
789 AC_MSG_RESULT(yes)
790 ],
791 [
792 AC_MSG_RESULT(no)
793 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
794 ]
795)
796
Damien Millera64b57a2001-01-17 10:44:13 +1100797# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
798# version in OpenSSL. Skip this for PAM
799if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100800 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100801fi
802
Damien Miller6c21c512002-01-22 21:57:53 +1100803
804### Configure cryptographic random number support
805
806# Check wheter OpenSSL seeds itself
807AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
808AC_TRY_RUN(
809 [
810#include <string.h>
811#include <openssl/rand.h>
812int main(void) { return(RAND_status() == 1 ? 0 : 1); }
813 ],
814 [
815 OPENSSL_SEEDS_ITSELF=yes
816 AC_MSG_RESULT(yes)
817 ],
818 [
819 AC_MSG_RESULT(no)
820 # Default to use of the rand helper if OpenSSL doesn't
821 # seed itself
822 USE_RAND_HELPER=yes
823 ]
824)
825
826
827# Do we want to force the use of the rand helper?
828AC_ARG_WITH(rand-helper,
829 [ --with-rand-helper Use subprocess to gather strong randomness ],
830 [
831 if test "x$withval" = "xno" ; then
832 # Force use of OpenSSL's internal RNG, even if
833 # the previous test showed it to be unseeded.
834 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
835 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
836 OPENSSL_SEEDS_ITSELF=yes
837 USE_RAND_HELPER=""
838 fi
839 else
840 USE_RAND_HELPER=yes
841 fi
842 ],
843)
844
845# Which randomness source do we use?
846if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
847 # OpenSSL only
848 AC_DEFINE(OPENSSL_PRNG_ONLY)
849 RAND_MSG="OpenSSL internal ONLY"
850 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800851elif test ! -z "$USE_RAND_HELPER" ; then
852 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100853 RAND_MSG="ssh-rand-helper"
854 INSTALL_SSH_RAND_HELPER="yes"
855fi
856AC_SUBST(INSTALL_SSH_RAND_HELPER)
857
858### Configuration of ssh-rand-helper
859
860# PRNGD TCP socket
861AC_ARG_WITH(prngd-port,
862 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
863 [
Damien Millere996d722002-01-23 11:20:59 +1100864 case "$withval" in
865 no)
866 withval=""
867 ;;
868 [[0-9]]*)
869 ;;
870 *)
871 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
872 ;;
873 esac
874 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100875 PRNGD_PORT="$withval"
876 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
877 fi
878 ]
879)
880
881# PRNGD Unix domain socket
882AC_ARG_WITH(prngd-socket,
883 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
884 [
Damien Millere996d722002-01-23 11:20:59 +1100885 case "$withval" in
886 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100887 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100888 ;;
889 no)
890 withval=""
891 ;;
892 /*)
893 ;;
894 *)
895 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
896 ;;
897 esac
898
899 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100900 if test ! -z "$PRNGD_PORT" ; then
901 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
902 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100903 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100904 AC_MSG_WARN(Entropy socket is not readable)
905 fi
906 PRNGD_SOCKET="$withval"
907 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
908 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800909 ],
910 [
911 # Check for existing socket only if we don't have a random device already
912 if test "$USE_RAND_HELPER" = yes ; then
913 AC_MSG_CHECKING(for PRNGD/EGD socket)
914 # Insert other locations here
915 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
916 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
917 PRNGD_SOCKET="$sock"
918 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
919 break;
920 fi
921 done
922 if test ! -z "$PRNGD_SOCKET" ; then
923 AC_MSG_RESULT($PRNGD_SOCKET)
924 else
925 AC_MSG_RESULT(not found)
926 fi
927 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100928 ]
929)
930
931# Change default command timeout for hashing entropy source
932entropy_timeout=200
933AC_ARG_WITH(entropy-timeout,
934 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
935 [
936 if test "x$withval" != "xno" ; then
937 entropy_timeout=$withval
938 fi
939 ]
940)
Damien Miller6c21c512002-01-22 21:57:53 +1100941AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
942
Damien Millerd3f6ad22002-06-25 10:24:47 +1000943SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +0000944AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +0000945 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +0000946 [
947 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +1000948 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +0000949 fi
950 ]
951)
Damien Millerd3f6ad22002-06-25 10:24:47 +1000952AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
953AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +0000954
Tim Rice88f2ab52002-03-17 12:17:34 -0800955# We do this little dance with the search path to insure
956# that programs that we select for use by installed programs
957# (which may be run by the super-user) come from trusted
958# locations before they come from the user's private area.
959# This should help avoid accidentally configuring some
960# random version of a program in someone's personal bin.
961
962OPATH=$PATH
963PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -0700964test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -0800965test -d /sbin && PATH=$PATH:/sbin
966test -d /usr/sbin && PATH=$PATH:/usr/sbin
967PATH=$PATH:/etc:$OPATH
968
Damien Miller6c21c512002-01-22 21:57:53 +1100969# These programs are used by the command hashing source to gather entropy
970OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
971OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
972OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
973OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
974OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
975OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
976OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
977OSSH_PATH_ENTROPY_PROG(PROG_W, w)
978OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
979OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
980OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
981OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
982OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
983OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
984OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
985OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -0800986# restore PATH
987PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +1100988
989# Where does ssh-rand-helper get its randomness from?
990INSTALL_SSH_PRNG_CMDS=""
991if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
992 if test ! -z "$PRNGD_PORT" ; then
993 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
994 elif test ! -z "$PRNGD_SOCKET" ; then
995 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
996 else
997 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
998 RAND_HELPER_CMDHASH=yes
999 INSTALL_SSH_PRNG_CMDS="yes"
1000 fi
1001fi
1002AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1003
1004
Ben Lindstromb5628642000-10-18 00:02:25 +00001005# Cheap hack to ensure NEWS-OS libraries are arranged right.
1006if test ! -z "$SONY" ; then
1007 LIBS="$LIBS -liberty";
1008fi
1009
Damien Millera22ba012000-03-02 23:09:20 +11001010# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001011AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001012AC_CHECK_SIZEOF(short int, 2)
1013AC_CHECK_SIZEOF(int, 4)
1014AC_CHECK_SIZEOF(long int, 4)
1015AC_CHECK_SIZEOF(long long int, 8)
1016
Damien Millerfa2bb692002-04-23 23:22:25 +10001017# Sanity check long long for some platforms (AIX)
1018if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1019 ac_cv_sizeof_long_long_int=0
1020fi
1021
Damien Millera22ba012000-03-02 23:09:20 +11001022# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001023AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1024 AC_TRY_COMPILE(
1025 [ #include <sys/types.h> ],
1026 [ u_int a; a = 1;],
1027 [ ac_cv_have_u_int="yes" ],
1028 [ ac_cv_have_u_int="no" ]
1029 )
1030])
1031if test "x$ac_cv_have_u_int" = "xyes" ; then
1032 AC_DEFINE(HAVE_U_INT)
1033 have_u_int=1
1034fi
1035
Damien Miller61e50f12000-05-08 20:49:37 +10001036AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1037 AC_TRY_COMPILE(
1038 [ #include <sys/types.h> ],
1039 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1040 [ ac_cv_have_intxx_t="yes" ],
1041 [ ac_cv_have_intxx_t="no" ]
1042 )
1043])
1044if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1045 AC_DEFINE(HAVE_INTXX_T)
1046 have_intxx_t=1
1047fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001048
1049if (test -z "$have_intxx_t" && \
1050 test "x$ac_cv_header_stdint_h" = "xyes")
1051then
1052 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1053 AC_TRY_COMPILE(
1054 [ #include <stdint.h> ],
1055 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1056 [
1057 AC_DEFINE(HAVE_INTXX_T)
1058 AC_MSG_RESULT(yes)
1059 ],
1060 [ AC_MSG_RESULT(no) ]
1061 )
1062fi
1063
Damien Miller578783e2000-09-23 14:12:24 +11001064AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1065 AC_TRY_COMPILE(
1066 [ #include <sys/types.h> ],
1067 [ int64_t a; a = 1;],
1068 [ ac_cv_have_int64_t="yes" ],
1069 [ ac_cv_have_int64_t="no" ]
1070 )
1071])
1072if test "x$ac_cv_have_int64_t" = "xyes" ; then
1073 AC_DEFINE(HAVE_INT64_T)
1074 have_int64_t=1
1075fi
1076
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001077if test -z "$have_int64_t" ; then
1078 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1079 AC_TRY_COMPILE(
1080 [ #include <sys/socket.h> ],
1081 [ int64_t a; a = 1],
1082 [
1083 AC_DEFINE(HAVE_INT64_T)
1084 AC_MSG_RESULT(yes)
1085 ],
1086 [ AC_MSG_RESULT(no) ]
1087 )
1088fi
1089
Tim Rice4cec93f2002-02-26 08:40:48 -08001090if test -z "$have_int64_t" ; then
1091 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1092 AC_TRY_COMPILE(
1093 [ #include <sys/bitypes.h> ],
1094 [ int64_t a; a = 1],
1095 [
1096 AC_DEFINE(HAVE_INT64_T)
1097 AC_MSG_RESULT(yes)
1098 ],
1099 [ AC_MSG_RESULT(no) ]
1100 )
1101fi
1102
Damien Miller61e50f12000-05-08 20:49:37 +10001103AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1104 AC_TRY_COMPILE(
1105 [ #include <sys/types.h> ],
1106 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1107 [ ac_cv_have_u_intxx_t="yes" ],
1108 [ ac_cv_have_u_intxx_t="no" ]
1109 )
1110])
1111if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1112 AC_DEFINE(HAVE_U_INTXX_T)
1113 have_u_intxx_t=1
1114fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001115
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001116if test -z "$have_u_intxx_t" ; then
1117 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1118 AC_TRY_COMPILE(
1119 [ #include <sys/socket.h> ],
1120 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1121 [
1122 AC_DEFINE(HAVE_U_INTXX_T)
1123 AC_MSG_RESULT(yes)
1124 ],
1125 [ AC_MSG_RESULT(no) ]
1126 )
1127fi
1128
Damien Miller578783e2000-09-23 14:12:24 +11001129AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1130 AC_TRY_COMPILE(
1131 [ #include <sys/types.h> ],
1132 [ u_int64_t a; a = 1;],
1133 [ ac_cv_have_u_int64_t="yes" ],
1134 [ ac_cv_have_u_int64_t="no" ]
1135 )
1136])
1137if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1138 AC_DEFINE(HAVE_U_INT64_T)
1139 have_u_int64_t=1
1140fi
1141
Tim Rice4cec93f2002-02-26 08:40:48 -08001142if test -z "$have_u_int64_t" ; then
1143 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1144 AC_TRY_COMPILE(
1145 [ #include <sys/bitypes.h> ],
1146 [ u_int64_t a; a = 1],
1147 [
1148 AC_DEFINE(HAVE_U_INT64_T)
1149 AC_MSG_RESULT(yes)
1150 ],
1151 [ AC_MSG_RESULT(no) ]
1152 )
1153fi
1154
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001155if test -z "$have_u_intxx_t" ; then
1156 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1157 AC_TRY_COMPILE(
1158 [
1159#include <sys/types.h>
1160 ],
1161 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1162 [ ac_cv_have_uintxx_t="yes" ],
1163 [ ac_cv_have_uintxx_t="no" ]
1164 )
1165 ])
1166 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1167 AC_DEFINE(HAVE_UINTXX_T)
1168 fi
1169fi
1170
1171if test -z "$have_uintxx_t" ; then
1172 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1173 AC_TRY_COMPILE(
1174 [ #include <stdint.h> ],
1175 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1176 [
1177 AC_DEFINE(HAVE_UINTXX_T)
1178 AC_MSG_RESULT(yes)
1179 ],
1180 [ AC_MSG_RESULT(no) ]
1181 )
1182fi
1183
Damien Milleredb82922000-06-20 13:25:52 +10001184if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1185 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001186then
1187 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1188 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001189 [
1190#include <sys/bitypes.h>
1191 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001192 [
Damien Miller70494d12000-04-03 15:57:06 +10001193 int8_t a; int16_t b; int32_t c;
1194 u_int8_t e; u_int16_t f; u_int32_t g;
1195 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001196 ],
1197 [
1198 AC_DEFINE(HAVE_U_INTXX_T)
1199 AC_DEFINE(HAVE_INTXX_T)
1200 AC_MSG_RESULT(yes)
1201 ],
1202 [AC_MSG_RESULT(no)]
1203 )
1204fi
1205
Damien Miller58be7382001-09-15 21:31:54 +10001206
1207AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1208 AC_TRY_COMPILE(
1209 [
1210#include <sys/types.h>
1211 ],
1212 [ u_char foo; foo = 125; ],
1213 [ ac_cv_have_u_char="yes" ],
1214 [ ac_cv_have_u_char="no" ]
1215 )
1216])
1217if test "x$ac_cv_have_u_char" = "xyes" ; then
1218 AC_DEFINE(HAVE_U_CHAR)
1219fi
1220
Tim Rice13aae5e2001-10-21 17:53:58 -07001221TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001222
Tim Rice200a5c02002-02-26 22:12:34 -08001223AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001224
Damien Miller61e50f12000-05-08 20:49:37 +10001225AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1226 AC_TRY_COMPILE(
1227 [
1228#include <sys/types.h>
1229 ],
1230 [ size_t foo; foo = 1235; ],
1231 [ ac_cv_have_size_t="yes" ],
1232 [ ac_cv_have_size_t="no" ]
1233 )
1234])
1235if test "x$ac_cv_have_size_t" = "xyes" ; then
1236 AC_DEFINE(HAVE_SIZE_T)
1237fi
Damien Miller95058511999-12-29 10:36:45 +11001238
Damien Miller615f9392000-05-17 22:53:33 +10001239AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1240 AC_TRY_COMPILE(
1241 [
1242#include <sys/types.h>
1243 ],
1244 [ ssize_t foo; foo = 1235; ],
1245 [ ac_cv_have_ssize_t="yes" ],
1246 [ ac_cv_have_ssize_t="no" ]
1247 )
1248])
1249if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1250 AC_DEFINE(HAVE_SSIZE_T)
1251fi
1252
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001253AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1254 AC_TRY_COMPILE(
1255 [
1256#include <time.h>
1257 ],
1258 [ clock_t foo; foo = 1235; ],
1259 [ ac_cv_have_clock_t="yes" ],
1260 [ ac_cv_have_clock_t="no" ]
1261 )
1262])
1263if test "x$ac_cv_have_clock_t" = "xyes" ; then
1264 AC_DEFINE(HAVE_CLOCK_T)
1265fi
1266
Damien Millerb54b40e2000-06-23 08:23:34 +10001267AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1268 AC_TRY_COMPILE(
1269 [
1270#include <sys/types.h>
1271#include <sys/socket.h>
1272 ],
1273 [ sa_family_t foo; foo = 1235; ],
1274 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001275 [ AC_TRY_COMPILE(
1276 [
1277#include <sys/types.h>
1278#include <sys/socket.h>
1279#include <netinet/in.h>
1280 ],
1281 [ sa_family_t foo; foo = 1235; ],
1282 [ ac_cv_have_sa_family_t="yes" ],
1283
Damien Millerb54b40e2000-06-23 08:23:34 +10001284 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001285 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001286 )
1287])
1288if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1289 AC_DEFINE(HAVE_SA_FAMILY_T)
1290fi
1291
Damien Miller0f91b4e2000-06-18 15:43:25 +10001292AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1293 AC_TRY_COMPILE(
1294 [
1295#include <sys/types.h>
1296 ],
1297 [ pid_t foo; foo = 1235; ],
1298 [ ac_cv_have_pid_t="yes" ],
1299 [ ac_cv_have_pid_t="no" ]
1300 )
1301])
1302if test "x$ac_cv_have_pid_t" = "xyes" ; then
1303 AC_DEFINE(HAVE_PID_T)
1304fi
1305
1306AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1307 AC_TRY_COMPILE(
1308 [
1309#include <sys/types.h>
1310 ],
1311 [ mode_t foo; foo = 1235; ],
1312 [ ac_cv_have_mode_t="yes" ],
1313 [ ac_cv_have_mode_t="no" ]
1314 )
1315])
1316if test "x$ac_cv_have_mode_t" = "xyes" ; then
1317 AC_DEFINE(HAVE_MODE_T)
1318fi
1319
Damien Miller61e50f12000-05-08 20:49:37 +10001320
1321AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1322 AC_TRY_COMPILE(
1323 [
Damien Miller81171112000-04-23 11:14:01 +10001324#include <sys/types.h>
1325#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001326 ],
1327 [ struct sockaddr_storage s; ],
1328 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1329 [ ac_cv_have_struct_sockaddr_storage="no" ]
1330 )
1331])
1332if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1333 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1334fi
Damien Miller34132e52000-01-14 15:45:46 +11001335
Damien Miller61e50f12000-05-08 20:49:37 +10001336AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1337 AC_TRY_COMPILE(
1338 [
Damien Miller7b22d652000-06-18 14:07:04 +10001339#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001340#include <netinet/in.h>
1341 ],
1342 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1343 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1344 [ ac_cv_have_struct_sockaddr_in6="no" ]
1345 )
1346])
1347if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1348 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1349fi
Damien Miller34132e52000-01-14 15:45:46 +11001350
Damien Miller61e50f12000-05-08 20:49:37 +10001351AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1352 AC_TRY_COMPILE(
1353 [
Damien Miller7b22d652000-06-18 14:07:04 +10001354#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001355#include <netinet/in.h>
1356 ],
1357 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1358 [ ac_cv_have_struct_in6_addr="yes" ],
1359 [ ac_cv_have_struct_in6_addr="no" ]
1360 )
1361])
1362if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1363 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1364fi
Damien Miller34132e52000-01-14 15:45:46 +11001365
Damien Miller61e50f12000-05-08 20:49:37 +10001366AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1367 AC_TRY_COMPILE(
1368 [
Damien Miller81171112000-04-23 11:14:01 +10001369#include <sys/types.h>
1370#include <sys/socket.h>
1371#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001372 ],
1373 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1374 [ ac_cv_have_struct_addrinfo="yes" ],
1375 [ ac_cv_have_struct_addrinfo="no" ]
1376 )
1377])
1378if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1379 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1380fi
1381
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001382AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1383 AC_TRY_COMPILE(
1384 [ #include <sys/time.h> ],
1385 [ struct timeval tv; tv.tv_sec = 1;],
1386 [ ac_cv_have_struct_timeval="yes" ],
1387 [ ac_cv_have_struct_timeval="no" ]
1388 )
1389])
1390if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1391 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1392 have_struct_timeval=1
1393fi
1394
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001395# If we don't have int64_t then we can't compile sftp-server. So don't
1396# even attempt to do it.
1397if test "x$ac_cv_have_int64_t" = "xno" -a \
1398 "x$ac_cv_sizeof_long_int" != "x8" -a \
1399 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1400 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001401else
1402dnl test snprintf (broken on SCO w/gcc)
1403 AC_TRY_RUN(
1404 [
1405#include <stdio.h>
1406#include <string.h>
1407#ifdef HAVE_SNPRINTF
1408main()
1409{
1410 char buf[50];
1411 char expected_out[50];
1412 int mazsize = 50 ;
1413#if (SIZEOF_LONG_INT == 8)
1414 long int num = 0x7fffffffffffffff;
1415#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001416 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001417#endif
1418 strcpy(expected_out, "9223372036854775807");
1419 snprintf(buf, mazsize, "%lld", num);
1420 if(strcmp(buf, expected_out) != 0)
1421 exit(1);
1422 exit(0);
1423}
1424#else
1425main() { exit(0); }
1426#endif
1427 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1428 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001429fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001430AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001431
Damien Miller78315eb2000-09-29 23:01:36 +11001432dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001433OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1434OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1435OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1436OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1437OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001438OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001439OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1440OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001441OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001442OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1443OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1444OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1445OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001446OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1447OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1448OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1449OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001450
1451AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001452
Damien Miller61e50f12000-05-08 20:49:37 +10001453AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1454 ac_cv_have_ss_family_in_struct_ss, [
1455 AC_TRY_COMPILE(
1456 [
Damien Miller81171112000-04-23 11:14:01 +10001457#include <sys/types.h>
1458#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001459 ],
1460 [ struct sockaddr_storage s; s.ss_family = 1; ],
1461 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1462 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1463 )
1464])
1465if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1466 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1467fi
1468
Damien Miller61e50f12000-05-08 20:49:37 +10001469AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1470 ac_cv_have___ss_family_in_struct_ss, [
1471 AC_TRY_COMPILE(
1472 [
Damien Miller81171112000-04-23 11:14:01 +10001473#include <sys/types.h>
1474#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001475 ],
1476 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1477 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1478 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1479 )
1480])
1481if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1482 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1483fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001484
Damien Millerad833b32000-08-23 10:46:23 +10001485AC_CACHE_CHECK([for pw_class field in struct passwd],
1486 ac_cv_have_pw_class_in_struct_passwd, [
1487 AC_TRY_COMPILE(
1488 [
Damien Millerad833b32000-08-23 10:46:23 +10001489#include <pwd.h>
1490 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001491 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001492 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1493 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1494 )
1495])
1496if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1497 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1498fi
1499
Kevin Steves82456952001-06-22 21:14:18 +00001500AC_CACHE_CHECK([for pw_expire field in struct passwd],
1501 ac_cv_have_pw_expire_in_struct_passwd, [
1502 AC_TRY_COMPILE(
1503 [
1504#include <pwd.h>
1505 ],
1506 [ struct passwd p; p.pw_expire = 0; ],
1507 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1508 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1509 )
1510])
1511if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1512 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1513fi
1514
1515AC_CACHE_CHECK([for pw_change field in struct passwd],
1516 ac_cv_have_pw_change_in_struct_passwd, [
1517 AC_TRY_COMPILE(
1518 [
1519#include <pwd.h>
1520 ],
1521 [ struct passwd p; p.pw_change = 0; ],
1522 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1523 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1524 )
1525])
1526if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1527 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1528fi
Damien Miller61e50f12000-05-08 20:49:37 +10001529
Tim Rice28bbb0c2002-05-27 17:37:32 -07001530dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001531AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1532 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001533 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001534 [
Tim Riceae49fe62002-04-12 10:26:21 -07001535#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001536#include <sys/socket.h>
1537#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001538int main() {
1539#ifdef msg_accrights
1540exit(1);
1541#endif
1542struct msghdr m;
1543m.msg_accrights = 0;
1544exit(0);
1545}
Kevin Steves939c9db2002-03-22 17:23:25 +00001546 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001547 [ ac_cv_have_accrights_in_msghdr="yes" ],
1548 [ ac_cv_have_accrights_in_msghdr="no" ]
1549 )
1550])
1551if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1552 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1553fi
1554
Kevin Stevesa44e0352002-04-07 16:18:03 +00001555AC_CACHE_CHECK([for msg_control field in struct msghdr],
1556 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001557 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001558 [
Tim Riceae49fe62002-04-12 10:26:21 -07001559#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001560#include <sys/socket.h>
1561#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001562int main() {
1563#ifdef msg_control
1564exit(1);
1565#endif
1566struct msghdr m;
1567m.msg_control = 0;
1568exit(0);
1569}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001570 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001571 [ ac_cv_have_control_in_msghdr="yes" ],
1572 [ ac_cv_have_control_in_msghdr="no" ]
1573 )
1574])
1575if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1576 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1577fi
1578
Damien Miller61e50f12000-05-08 20:49:37 +10001579AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1580 AC_TRY_LINK([],
1581 [ extern char *__progname; printf("%s", __progname); ],
1582 [ ac_cv_libc_defines___progname="yes" ],
1583 [ ac_cv_libc_defines___progname="no" ]
1584 )
1585])
1586if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1587 AC_DEFINE(HAVE___PROGNAME)
1588fi
1589
Kevin Steves4846f4a2002-03-22 18:19:53 +00001590AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1591 AC_TRY_LINK([
1592#include <stdio.h>
1593],
1594 [ printf("%s", __FUNCTION__); ],
1595 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1596 [ ac_cv_cc_implements___FUNCTION__="no" ]
1597 )
1598])
1599if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1600 AC_DEFINE(HAVE___FUNCTION__)
1601fi
1602
1603AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1604 AC_TRY_LINK([
1605#include <stdio.h>
1606],
1607 [ printf("%s", __func__); ],
1608 [ ac_cv_cc_implements___func__="yes" ],
1609 [ ac_cv_cc_implements___func__="no" ]
1610 )
1611])
1612if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1613 AC_DEFINE(HAVE___func__)
1614fi
1615
Damien Miller4f8e6692001-07-14 13:22:53 +10001616AC_CACHE_CHECK([whether getopt has optreset support],
1617 ac_cv_have_getopt_optreset, [
1618 AC_TRY_LINK(
1619 [
1620#include <getopt.h>
1621 ],
1622 [ extern int optreset; optreset = 0; ],
1623 [ ac_cv_have_getopt_optreset="yes" ],
1624 [ ac_cv_have_getopt_optreset="no" ]
1625 )
1626])
1627if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1628 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1629fi
Damien Millera22ba012000-03-02 23:09:20 +11001630
Damien Millerecbb26d2000-07-15 14:59:14 +10001631AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1632 AC_TRY_LINK([],
1633 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1634 [ ac_cv_libc_defines_sys_errlist="yes" ],
1635 [ ac_cv_libc_defines_sys_errlist="no" ]
1636 )
1637])
1638if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1639 AC_DEFINE(HAVE_SYS_ERRLIST)
1640fi
1641
1642
Damien Miller11fa2cc2000-08-16 10:35:58 +10001643AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1644 AC_TRY_LINK([],
1645 [ extern int sys_nerr; printf("%i", sys_nerr);],
1646 [ ac_cv_libc_defines_sys_nerr="yes" ],
1647 [ ac_cv_libc_defines_sys_nerr="no" ]
1648 )
1649])
1650if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1651 AC_DEFINE(HAVE_SYS_NERR)
1652fi
1653
Damien Miller85de5802001-09-18 14:01:11 +10001654SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001655
1656# Check whether user wants sectok support
1657AC_ARG_WITH(sectok,
1658 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001659 [
1660 if test "x$withval" != "xno" ; then
1661 if test "x$withval" != "xyes" ; then
1662 CPPFLAGS="$CPPFLAGS -I${withval}"
1663 LDFLAGS="$LDFLAGS -L${withval}"
1664 if test ! -z "$need_dash_r" ; then
1665 LDFLAGS="$LDFLAGS -R${withval}"
1666 fi
1667 if test ! -z "$blibpath" ; then
1668 blibpath="$blibpath:${withval}"
1669 fi
1670 fi
1671 AC_CHECK_HEADERS(sectok.h)
1672 if test "$ac_cv_header_sectok_h" != yes; then
1673 AC_MSG_ERROR(Can't find sectok.h)
1674 fi
1675 AC_CHECK_LIB(sectok, sectok_open)
1676 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1677 AC_MSG_ERROR(Can't find libsectok)
1678 fi
1679 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001680 AC_DEFINE(USE_SECTOK)
1681 SCARD_MSG="yes, using sectok"
1682 fi
1683 ]
1684)
1685
1686# Check whether user wants OpenSC support
1687AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001688 AC_HELP_STRING([--with-opensc=PFX],
1689 [Enable smartcard support using OpenSC]),
1690 opensc_config_prefix="$withval", opensc_config_prefix="")
1691if test x$opensc_config_prefix != x ; then
1692 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1693 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1694 if test "$OPENSC_CONFIG" != "no"; then
1695 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1696 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1697 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1698 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1699 AC_DEFINE(SMARTCARD)
1700 AC_DEFINE(USE_OPENSC)
1701 SCARD_MSG="yes, using OpenSC"
1702 fi
1703fi
Damien Miller85de5802001-09-18 14:01:11 +10001704
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001705# Check whether user wants Kerberos 5 support
1706KRB5_MSG="no"
1707AC_ARG_WITH(kerberos5,
1708 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1709 [
1710 if test "x$withval" != "xno" ; then
1711 if test "x$withval" = "xyes" ; then
1712 KRB5ROOT="/usr/local"
1713 else
1714 KRB5ROOT=${withval}
1715 fi
1716 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1717 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1718 AC_DEFINE(KRB5)
1719 KRB5_MSG="yes"
1720 AC_MSG_CHECKING(whether we are using Heimdal)
1721 AC_TRY_COMPILE([ #include <krb5.h> ],
1722 [ char *tmp = heimdal_version; ],
1723 [ AC_MSG_RESULT(yes)
1724 AC_DEFINE(HEIMDAL)
1725 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1726 ],
1727 [ AC_MSG_RESULT(no)
1728 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1729 ]
1730 )
1731 if test ! -z "$need_dash_r" ; then
1732 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1733 fi
1734 if test ! -z "$blibpath" ; then
1735 blibpath="$blibpath:${KRB5ROOT}/lib"
1736 fi
1737 AC_CHECK_LIB(resolv, dn_expand, , )
1738
1739 KRB5=yes
1740 fi
1741 ]
1742)
1743# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001744KRB4_MSG="no"
1745AC_ARG_WITH(kerberos4,
1746 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1747 [
1748 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001749 if test "x$withval" != "xyes" ; then
1750 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1751 LDFLAGS="$LDFLAGS -L${withval}/lib"
1752 if test ! -z "$need_dash_r" ; then
1753 LDFLAGS="$LDFLAGS -R${withval}/lib"
1754 fi
1755 if test ! -z "$blibpath" ; then
1756 blibpath="$blibpath:${withval}/lib"
1757 fi
1758 else
1759 if test -d /usr/include/kerberosIV ; then
1760 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1761 fi
1762 fi
1763
1764 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001765 if test "$ac_cv_header_krb_h" != yes; then
1766 AC_MSG_WARN([Cannot find krb.h, build may fail])
1767 fi
Damien Miller98344742001-03-28 14:37:06 +10001768 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001769 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001770 AC_CHECK_LIB(krb4, main)
1771 if test "$ac_cv_lib_krb4_main" != yes; then
1772 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1773 else
1774 KLIBS="-lkrb4"
1775 fi
1776 else
1777 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001778 fi
Damien Miller98344742001-03-28 14:37:06 +10001779 AC_CHECK_LIB(des, des_cbc_encrypt)
1780 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1781 AC_CHECK_LIB(des425, des_cbc_encrypt)
1782 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1783 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1784 else
1785 KLIBS="-ldes425"
1786 fi
1787 else
1788 KLIBS="-ldes"
1789 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001790 AC_CHECK_LIB(resolv, dn_expand, , )
1791 KRB4=yes
1792 KRB4_MSG="yes"
1793 AC_DEFINE(KRB4)
1794 fi
1795 ]
1796)
1797
1798# Check whether user wants AFS support
1799AFS_MSG="no"
1800AC_ARG_WITH(afs,
1801 [ --with-afs=PATH Enable AFS support],
1802 [
1803 if test "x$withval" != "xno" ; then
1804
1805 if test "x$withval" != "xyes" ; then
1806 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1807 LDFLAGS="$LDFLAGS -L${withval}/lib"
1808 fi
1809
1810 if test -z "$KRB4" ; then
1811 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1812 fi
1813
1814 LIBS="-lkafs $LIBS"
1815 if test ! -z "$AFS_LIBS" ; then
1816 LIBS="$LIBS $AFS_LIBS"
1817 fi
1818 AC_DEFINE(AFS)
1819 AFS_MSG="yes"
1820 fi
1821 ]
1822)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001823LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001824
Damien Millera22ba012000-03-02 23:09:20 +11001825# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11001826
Damien Millerf58c6722002-05-13 13:15:42 +10001827PRIVSEP_PATH=/var/empty
1828AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07001829 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10001830 [
1831 if test "x$withval" != "$no" ; then
1832 PRIVSEP_PATH=$withval
1833 fi
1834 ]
1835)
1836AC_SUBST(PRIVSEP_PATH)
1837
Damien Millera22ba012000-03-02 23:09:20 +11001838AC_ARG_WITH(xauth,
1839 [ --with-xauth=PATH Specify path to xauth program ],
1840 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001841 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001842 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001843 fi
1844 ],
1845 [
Damien Miller78315eb2000-09-29 23:01:36 +11001846 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 +10001847 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001848 xauth_path="/usr/openwin/bin/xauth"
1849 fi
1850 ]
1851)
1852
Damien Millera19cf472000-11-29 13:28:50 +11001853if test -z "$xauth_path" ; then
1854 XAUTH_PATH="undefined"
1855 AC_SUBST(XAUTH_PATH)
1856else
Damien Millera22ba012000-03-02 23:09:20 +11001857 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001858 XAUTH_PATH=$xauth_path
1859 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001860fi
Damien Millera22ba012000-03-02 23:09:20 +11001861
1862# Check for mail directory (last resort if we cannot get it from headers)
1863if test ! -z "$MAIL" ; then
1864 maildir=`dirname $MAIL`
1865 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1866fi
1867
Damien Millera22ba012000-03-02 23:09:20 +11001868if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00001869 if test "x$disable_ptmx_check" != "xyes" ; then
1870 AC_CHECK_FILE("/dev/ptmx",
1871 [
1872 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1873 have_dev_ptmx=1
1874 ]
1875 )
1876 fi
Damien Millera22ba012000-03-02 23:09:20 +11001877fi
Damien Miller204ad072000-03-02 23:56:12 +11001878AC_CHECK_FILE("/dev/ptc",
1879 [
1880 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1881 have_dev_ptc=1
1882 ]
1883)
1884
Damien Millera22ba012000-03-02 23:09:20 +11001885# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001886AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001887 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001888 [
Damien Miller897741e2001-04-16 10:41:46 +10001889 case "$withval" in
1890 man|cat|doc)
1891 MANTYPE=$withval
1892 ;;
1893 *)
1894 AC_MSG_ERROR(invalid man type: $withval)
1895 ;;
1896 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001897 ]
1898)
Ben Lindstrombc709922001-04-18 18:04:21 +00001899if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001900 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001901 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1902 MANTYPE=doc
1903 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1904 MANTYPE=man
1905 else
1906 MANTYPE=cat
1907 fi
1908fi
Damien Miller670a4b82000-01-22 13:53:11 +11001909AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001910if test "$MANTYPE" = "doc"; then
1911 mansubdir=man;
1912else
1913 mansubdir=$MANTYPE;
1914fi
1915AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001916
Damien Millera22ba012000-03-02 23:09:20 +11001917# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001918MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001919AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001920 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001921 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001922 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001923 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001924 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001925 fi
1926 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001927)
1928
Damien Millera22ba012000-03-02 23:09:20 +11001929# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001930AC_ARG_WITH(shadow,
1931 [ --without-shadow Disable shadow password support],
1932 [
1933 if test "x$withval" = "xno" ; then
1934 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001935 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001936 fi
1937 ]
1938)
1939
Damien Miller1f335fb2000-06-26 11:31:33 +10001940if test -z "$disable_shadow" ; then
1941 AC_MSG_CHECKING([if the systems has expire shadow information])
1942 AC_TRY_COMPILE(
1943 [
1944#include <sys/types.h>
1945#include <shadow.h>
1946 struct spwd sp;
1947 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1948 [ sp_expire_available=yes ], []
1949 )
1950
1951 if test "x$sp_expire_available" = "xyes" ; then
1952 AC_MSG_RESULT(yes)
1953 AC_DEFINE(HAS_SHADOW_EXPIRE)
1954 else
1955 AC_MSG_RESULT(no)
1956 fi
1957fi
1958
Damien Millera22ba012000-03-02 23:09:20 +11001959# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001960if test ! -z "$IPADDR_IN_DISPLAY" ; then
1961 DISPLAY_HACK_MSG="yes"
1962 AC_DEFINE(IPADDR_IN_DISPLAY)
1963else
1964 DISPLAY_HACK_MSG="no"
1965 AC_ARG_WITH(ipaddr-display,
1966 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1967 [
1968 if test "x$withval" != "xno" ; then
1969 AC_DEFINE(IPADDR_IN_DISPLAY)
1970 DISPLAY_HACK_MSG="yes"
1971 fi
1972 ]
1973 )
1974fi
Damien Miller76112de1999-12-21 11:18:08 +11001975
Tim Rice43a1c132002-04-17 21:19:14 -07001976dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
1977if test $ac_cv_func_login_getcapbool = "yes" -a \
1978 $ac_cv_header_login_cap_h = "yes" ; then
1979 USES_LOGIN_CONF=yes
1980fi
Damien Millera22ba012000-03-02 23:09:20 +11001981# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001982SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001983AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10001984 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11001985 [
Tim Rice43a1c132002-04-17 21:19:14 -07001986 if test "$USES_LOGIN_CONF" = "yes" ; then
1987 AC_MSG_WARN([
1988--with-default-path=PATH has no effect on this system.
1989Edit /etc/login.conf instead.])
1990 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001991 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001992 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001993 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001994 ],
Tim Rice43a1c132002-04-17 21:19:14 -07001995 [ if test "$USES_LOGIN_CONF" = "yes" ; then
1996 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
1997 else
Tim Rice59ea0a02001-03-10 13:50:45 -08001998 AC_TRY_RUN(
1999 [
2000/* find out what STDPATH is */
2001#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002002#ifdef HAVE_PATHS_H
2003# include <paths.h>
2004#endif
2005#ifndef _PATH_STDPATH
2006# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2007#endif
2008#include <sys/types.h>
2009#include <sys/stat.h>
2010#include <fcntl.h>
2011#define DATA "conftest.stdpath"
2012
2013main()
2014{
2015 FILE *fd;
2016 int rc;
2017
2018 fd = fopen(DATA,"w");
2019 if(fd == NULL)
2020 exit(1);
2021
2022 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2023 exit(1);
2024
2025 exit(0);
2026}
2027 ], [ user_path=`cat conftest.stdpath` ],
2028 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2029 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2030 )
2031# make sure $bindir is in USER_PATH so scp will work
2032 t_bindir=`eval echo ${bindir}`
2033 case $t_bindir in
2034 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2035 esac
2036 case $t_bindir in
2037 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2038 esac
2039 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2040 if test $? -ne 0 ; then
2041 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2042 if test $? -ne 0 ; then
2043 user_path=$user_path:$t_bindir
2044 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2045 fi
2046 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002047 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002048)
Tim Rice43a1c132002-04-17 21:19:14 -07002049if test "$USES_LOGIN_CONF" != "yes" ; then
2050 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2051 AC_SUBST(user_path)
2052fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002053
Damien Millera18bbd32002-05-13 10:48:57 +10002054# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002055AC_ARG_WITH(superuser-path,
2056 [ --with-superuser-path= Specify different path for super-user],
2057 [
2058 if test "x$withval" != "xno" ; then
2059 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2060 superuser_path=$withval
2061 fi
2062 ]
2063)
2064
2065
Damien Millera22ba012000-03-02 23:09:20 +11002066# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002067IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002068AC_ARG_WITH(ipv4-default,
2069 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2070 [
2071 if test "x$withval" != "xno" ; then
2072 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002073 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002074 fi
2075 ]
2076)
2077
Damien Miller61e50f12000-05-08 20:49:37 +10002078AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002079IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002080AC_ARG_WITH(4in6,
2081 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2082 [
2083 if test "x$withval" != "xno" ; then
2084 AC_MSG_RESULT(yes)
2085 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002086 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002087 else
2088 AC_MSG_RESULT(no)
2089 fi
2090 ],[
2091 if test "x$inet6_default_4in6" = "xyes"; then
2092 AC_MSG_RESULT([yes (default)])
2093 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002094 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002095 else
2096 AC_MSG_RESULT([no (default)])
2097 fi
2098 ]
2099)
2100
Damien Miller60396b02001-02-18 17:01:00 +11002101# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002102BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002103AC_ARG_WITH(bsd-auth,
2104 [ --with-bsd-auth Enable BSD auth support],
2105 [
2106 if test "x$withval" != "xno" ; then
2107 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002108 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002109 fi
2110 ]
2111)
2112
Damien Millera22ba012000-03-02 23:09:20 +11002113# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002114piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002115# make sure the directory exists
2116if test ! -d $piddir ; then
2117 piddir=`eval echo ${sysconfdir}`
2118 case $piddir in
2119 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2120 esac
2121fi
2122
Tim Rice88f2ab52002-03-17 12:17:34 -08002123AC_ARG_WITH(pid-dir,
2124 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2125 [
2126 if test "x$withval" != "xno" ; then
2127 piddir=$withval
2128 if test ! -d $piddir ; then
2129 AC_MSG_WARN([** no $piddir directory on this system **])
2130 fi
2131 fi
2132 ]
2133)
2134
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002135AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002136AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002137
andre2ff7b5d2000-06-03 14:57:40 +00002138dnl allow user to disable some login recording features
2139AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002140 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002141 [ AC_DEFINE(DISABLE_LASTLOG) ]
2142)
2143AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002144 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002145 [ AC_DEFINE(DISABLE_UTMP) ]
2146)
2147AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002148 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002149 [ AC_DEFINE(DISABLE_UTMPX) ]
2150)
2151AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002152 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002153 [ AC_DEFINE(DISABLE_WTMP) ]
2154)
2155AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002156 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002157 [ AC_DEFINE(DISABLE_WTMPX) ]
2158)
2159AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002160 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002161 [ AC_DEFINE(DISABLE_LOGIN) ]
2162)
2163AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002164 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002165 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2166)
2167AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002168 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002169 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2170)
2171AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002172 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002173 [
2174 if test "x$withval" = "xno" ; then
2175 AC_DEFINE(DISABLE_LASTLOG)
2176 else
2177 conf_lastlog_location=$withval
2178 fi
2179 ]
2180)
andre2ff7b5d2000-06-03 14:57:40 +00002181
2182dnl lastlog, [uw]tmpx? detection
2183dnl NOTE: set the paths in the platform section to avoid the
2184dnl need for command-line parameters
2185dnl lastlog and [uw]tmp are subject to a file search if all else fails
2186
2187dnl lastlog detection
2188dnl NOTE: the code itself will detect if lastlog is a directory
2189AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2190AC_TRY_COMPILE([
2191#include <sys/types.h>
2192#include <utmp.h>
2193#ifdef HAVE_LASTLOG_H
2194# include <lastlog.h>
2195#endif
Damien Miller2994e082000-06-04 15:51:47 +10002196#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002197# include <paths.h>
2198#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002199#ifdef HAVE_LOGIN_H
2200# include <login.h>
2201#endif
andre2ff7b5d2000-06-03 14:57:40 +00002202 ],
2203 [ char *lastlog = LASTLOG_FILE; ],
2204 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002205 [
2206 AC_MSG_RESULT(no)
2207 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2208 AC_TRY_COMPILE([
2209#include <sys/types.h>
2210#include <utmp.h>
2211#ifdef HAVE_LASTLOG_H
2212# include <lastlog.h>
2213#endif
2214#ifdef HAVE_PATHS_H
2215# include <paths.h>
2216#endif
2217 ],
2218 [ char *lastlog = _PATH_LASTLOG; ],
2219 [ AC_MSG_RESULT(yes) ],
2220 [
andree441aa32000-06-12 22:34:38 +00002221 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002222 system_lastlog_path=no
2223 ])
2224 ]
andre2ff7b5d2000-06-03 14:57:40 +00002225)
Damien Miller2994e082000-06-04 15:51:47 +10002226
andre2ff7b5d2000-06-03 14:57:40 +00002227if test -z "$conf_lastlog_location"; then
2228 if test x"$system_lastlog_path" = x"no" ; then
2229 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002230 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002231 conf_lastlog_location=$f
2232 fi
2233 done
2234 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002235 AC_MSG_WARN([** Cannot find lastlog **])
2236 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002237 fi
2238 fi
2239fi
2240
2241if test -n "$conf_lastlog_location"; then
2242 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2243fi
2244
2245dnl utmp detection
2246AC_MSG_CHECKING([if your system defines UTMP_FILE])
2247AC_TRY_COMPILE([
2248#include <sys/types.h>
2249#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002250#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002251# include <paths.h>
2252#endif
2253 ],
2254 [ char *utmp = UTMP_FILE; ],
2255 [ AC_MSG_RESULT(yes) ],
2256 [ AC_MSG_RESULT(no)
2257 system_utmp_path=no ]
2258)
2259if test -z "$conf_utmp_location"; then
2260 if test x"$system_utmp_path" = x"no" ; then
2261 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2262 if test -f $f ; then
2263 conf_utmp_location=$f
2264 fi
2265 done
2266 if test -z "$conf_utmp_location"; then
2267 AC_DEFINE(DISABLE_UTMP)
2268 fi
2269 fi
2270fi
2271if test -n "$conf_utmp_location"; then
2272 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2273fi
2274
2275dnl wtmp detection
2276AC_MSG_CHECKING([if your system defines WTMP_FILE])
2277AC_TRY_COMPILE([
2278#include <sys/types.h>
2279#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002280#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002281# include <paths.h>
2282#endif
2283 ],
2284 [ char *wtmp = WTMP_FILE; ],
2285 [ AC_MSG_RESULT(yes) ],
2286 [ AC_MSG_RESULT(no)
2287 system_wtmp_path=no ]
2288)
2289if test -z "$conf_wtmp_location"; then
2290 if test x"$system_wtmp_path" = x"no" ; then
2291 for f in /usr/adm/wtmp /var/log/wtmp; do
2292 if test -f $f ; then
2293 conf_wtmp_location=$f
2294 fi
2295 done
2296 if test -z "$conf_wtmp_location"; then
2297 AC_DEFINE(DISABLE_WTMP)
2298 fi
2299 fi
2300fi
2301if test -n "$conf_wtmp_location"; then
2302 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2303fi
2304
2305
2306dnl utmpx detection - I don't know any system so perverse as to require
2307dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2308dnl there, though.
2309AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2310AC_TRY_COMPILE([
2311#include <sys/types.h>
2312#include <utmp.h>
2313#ifdef HAVE_UTMPX_H
2314#include <utmpx.h>
2315#endif
Damien Miller2994e082000-06-04 15:51:47 +10002316#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002317# include <paths.h>
2318#endif
2319 ],
2320 [ char *utmpx = UTMPX_FILE; ],
2321 [ AC_MSG_RESULT(yes) ],
2322 [ AC_MSG_RESULT(no)
2323 system_utmpx_path=no ]
2324)
2325if test -z "$conf_utmpx_location"; then
2326 if test x"$system_utmpx_path" = x"no" ; then
2327 AC_DEFINE(DISABLE_UTMPX)
2328 fi
2329else
2330 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2331fi
2332
2333dnl wtmpx detection
2334AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2335AC_TRY_COMPILE([
2336#include <sys/types.h>
2337#include <utmp.h>
2338#ifdef HAVE_UTMPX_H
2339#include <utmpx.h>
2340#endif
Damien Miller2994e082000-06-04 15:51:47 +10002341#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002342# include <paths.h>
2343#endif
2344 ],
2345 [ char *wtmpx = WTMPX_FILE; ],
2346 [ AC_MSG_RESULT(yes) ],
2347 [ AC_MSG_RESULT(no)
2348 system_wtmpx_path=no ]
2349)
2350if test -z "$conf_wtmpx_location"; then
2351 if test x"$system_wtmpx_path" = x"no" ; then
2352 AC_DEFINE(DISABLE_WTMPX)
2353 fi
2354else
2355 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2356fi
2357
Damien Miller4018c192000-04-30 09:30:44 +10002358
Damien Miller29ea30d2000-03-17 10:54:15 +11002359if test ! -z "$blibpath" ; then
2360 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2361 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2362fi
2363
Tim Rice4cec93f2002-02-26 08:40:48 -08002364dnl remove pam and dl because they are in $LIBPAM
2365if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002366 LIBS=`echo $LIBS | sed 's/-lpam //'`
2367fi
2368if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2369 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002370fi
2371
Damien Millerbac2d8a2000-09-05 16:13:06 +11002372AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002373AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2374AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002375
Damien Miller7b22d652000-06-18 14:07:04 +10002376# Print summary of options
2377
Damien Miller7b22d652000-06-18 14:07:04 +10002378# Someone please show me a better way :)
2379A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2380B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2381C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2382D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002383E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002384F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002385G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002386H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2387I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2388J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002389
2390echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002391echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002392echo " User binaries: $B"
2393echo " System binaries: $C"
2394echo " Configuration files: $D"
2395echo " Askpass program: $E"
2396echo " Manual pages: $F"
2397echo " PID file: $G"
2398echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002399if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002400echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002401else
Damien Millerf58c6722002-05-13 13:15:42 +10002402echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002403fi
Damien Millera18bbd32002-05-13 10:48:57 +10002404if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002405echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002406fi
Damien Millerf58c6722002-05-13 13:15:42 +10002407echo " Manpage format: $MANTYPE"
2408echo " PAM support: ${PAM_MSG}"
2409echo " KerberosIV support: $KRB4_MSG"
2410echo " KerberosV support: $KRB5_MSG"
2411echo " Smartcard support: $SCARD_MSG"
2412echo " AFS support: $AFS_MSG"
2413echo " S/KEY support: $SKEY_MSG"
2414echo " TCP Wrappers support: $TCPW_MSG"
2415echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002416echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002417echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2418echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2419echo " BSD Auth support: $BSD_AUTH_MSG"
2420echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002421if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002422echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002423fi
2424
Damien Miller7b22d652000-06-18 14:07:04 +10002425echo ""
2426
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002427echo " Host: ${host}"
2428echo " Compiler: ${CC}"
2429echo " Compiler flags: ${CFLAGS}"
2430echo "Preprocessor flags: ${CPPFLAGS}"
2431echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002432echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002433
2434echo ""
2435
Damien Miller82cf0ce2000-12-20 13:34:48 +11002436if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002437 echo "PAM is enabled. You may need to install a PAM control file "
2438 echo "for sshd, otherwise password authentication may fail. "
2439 echo "Example PAM control files can be found in the contrib/ "
2440 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002441 echo ""
2442fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002443
2444if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002445 echo "sftp-server will be disabled. Your compiler does not "
2446 echo "support 64bit integers."
2447 echo ""
2448fi
2449
2450if test ! -z "$RAND_HELPER_CMDHASH" ; then
2451 echo "WARNING: you are using the builtin random number collection "
2452 echo "service. Please read WARNING.RNG and request that your OS "
2453 echo "vendor includes kernel-based random number collection in "
2454 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002455 echo ""
2456fi
Damien Miller60396b02001-02-18 17:01:00 +11002457