blob: 25d72e6c7d223a3e26d554856695445e9d6b588c [file] [log] [blame]
Ben Lindstrom762104e2002-07-23 00:00:05 +00001# $Id: configure.ac,v 1.84 2002/07/23 00:00:06 mouring Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Tim Rice13aae5e2001-10-21 17:53:58 -07003AC_INIT
4AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +10005
6AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11007AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11008AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11009AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100010
Damien Millera22ba012000-03-02 23:09:20 +110011# Checks for programs.
Damien Millerab18c411999-11-11 10:40:23 +110012AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100013AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110014AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000015AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070016AC_PATH_PROGS(PERL, perl5 perl)
Damien Millere79334a1999-12-29 10:03:37 +110017AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100018AC_PATH_PROG(ENT, ent)
19AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110020AC_PATH_PROG(TEST_MINUS_S_SH, bash)
21AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
22AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070023AC_PATH_PROG(SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110024
Damien Millere8bb4502001-09-25 16:39:35 +100025# System features
26AC_SYS_LARGEFILE
27
Damien Miller3f62aba2000-11-29 11:56:35 +110028if test -z "$AR" ; then
29 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
30fi
31
Damien Millerad833b32000-08-23 10:46:23 +100032# Use LOGIN_PROGRAM from environment if possible
33if test ! -z "$LOGIN_PROGRAM" ; then
34 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
35else
36 # Search for login
37 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
38 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
39 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
40 fi
41fi
42
Damien Miller166bd442000-03-16 10:48:25 +110043if test -z "$LD" ; then
44 LD=$CC
45fi
46AC_SUBST(LD)
47
Damien Miller166bd442000-03-16 10:48:25 +110048AC_C_INLINE
Damien Miller649d9992001-06-27 23:35:51 +100049if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
50 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110051fi
52
Damien Millera22ba012000-03-02 23:09:20 +110053# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110054case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110055*-*-aix*)
56 AFS_LIBS="-lld"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000057 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110058 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100059 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Millerfa2bb692002-04-23 23:22:25 +100060 AC_MSG_CHECKING([if linkage editor ($LD) accepts -blibpath])
61 saved_LDFLAGS="$LDFLAGS"
62 LDFLAGS="$LDFLAGS -blibpath:/usr/lib:/lib:/usr/local/lib"
63 AC_TRY_LINK([],
64 [],
65 [
66 AC_MSG_RESULT(yes)
67 blibpath="/usr/lib:/lib:/usr/local/lib"
68 ],
69 [ AC_MSG_RESULT(no) ]
70 )
71 LDFLAGS="$saved_LDFLAGS"
Damien Miller29ea30d2000-03-17 10:54:15 +110072 fi
Tim Ricee958ed32002-07-05 07:12:33 -070073 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
74 [AC_CHECK_LIB(s,authenticate,
75 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
76 LIBS="$LIBS -ls"
77 ])
78 ])
Damien Millereca71f82000-01-20 22:38:27 +110079 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +100080 AC_DEFINE(BROKEN_REALPATH)
andre60f3c982000-06-03 16:18:19 +000081 dnl AIX handles lastlog as part of its login message
82 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +000083 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller75b1d102000-01-07 14:01:41 +110084 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110085*-*-cygwin*)
Tim Ricefe1d1002001-11-26 17:19:43 -080086 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110087 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +000088 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +110089 AC_DEFINE(DISABLE_SHADOW)
90 AC_DEFINE(IPV4_DEFAULT)
91 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +000092 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +000093 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
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)
Tim Ricef028f1e2002-07-19 12:41:10 -0700116 LIBS="$LIBS -lsec -lsecpw"
117 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000118 disable_ptmx_check=yes
119 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100120*-*-hpux10*)
121 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000122 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100123 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000124 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100125 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000126 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000127 AC_DEFINE(LOGIN_NO_ENDOPT)
128 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100129 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100130 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000131 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700132 LIBS="$LIBS -lsec"
133 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100134 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000135*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000136 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100137 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100138 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100139 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000140 AC_DEFINE(LOGIN_NO_ENDOPT)
141 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100142 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100143 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000144 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700145 LIBS="$LIBS -lsec"
146 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000147 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100148*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000149 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000150 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100151 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000152 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000153 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller1808f382000-01-06 12:03:12 +1100154 ;;
155*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000156 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000157 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100158 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000159 AC_DEFINE(WITH_IRIX_ARRAY)
160 AC_DEFINE(WITH_IRIX_PROJECT)
161 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000162 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000163 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000164 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100165 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100166*-*-linux*)
167 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100168 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100169 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000170 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100171 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100172 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000173mips-sony-bsd|mips-sony-newsos4)
174 AC_DEFINE(HAVE_NEWS4)
175 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000176 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100177*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100178 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100179 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100180*-*-freebsd*)
181 check_for_libcrypt_later=1
182 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000183*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000184 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100185 conf_utmp_location=/etc/utmp
186 conf_wtmp_location=/usr/adm/wtmp
187 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000188 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000189 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000190 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100191 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000192 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000193 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000194 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100195*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000196 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000197 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100198 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100199 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000200 AC_DEFINE(LOGIN_NEEDS_UTMPX)
201 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000202 AC_DEFINE(PAM_TTY_KLUDGE)
andre2ff7b5d2000-06-03 14:57:40 +0000203 # hardwire lastlog location (can't detect it on some versions)
204 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000205 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
206 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
207 if test "$sol2ver" -ge 8; then
208 AC_MSG_RESULT(yes)
209 AC_DEFINE(DISABLE_UTMP)
210 AC_DEFINE(DISABLE_WTMP)
211 else
212 AC_MSG_RESULT(no)
213 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100214 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000215*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000216 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000217 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100218 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000219 conf_utmp_location=/etc/utmp
220 conf_wtmp_location=/var/adm/wtmp
221 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000222 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000223 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000224*-ncr-sysv*)
225 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
226 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700227 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000228 AC_DEFINE(USE_PIPES)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000229 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000230*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000231 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700232 # /usr/ucblib MUST NOT be searched on ReliantUNIX
233 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100234 IPADDR_IN_DISPLAY=yes
235 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000236 AC_DEFINE(IP_TOS_IS_BROKEN)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700237 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
238 # Attention: always take care to bind libsocket and libnsl before libc,
239 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000240 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100241*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000242 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100243 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100244 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100245 ;;
246*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000247 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100248 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100249 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100250 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100251*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000252 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100253 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100254 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100255*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000256 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100257 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700258 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100259 RANLIB=true
260 no_dev_ptmx=1
261 AC_DEFINE(BROKEN_SYS_TERMIO_H)
262 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000263 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000264 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100265 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100266 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700267 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700268 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100269 ;;
270*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000271 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000272 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100273 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000274 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100275 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000276 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000277 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700278 AC_DEFINE(DISABLE_FD_PASSING)
Damien Miller217f5672001-02-16 12:12:41 +1100279 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700280 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000281 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000282*-*-unicosmk*)
283 no_libsocket=1
284 no_libnsl=1
285 AC_DEFINE(USE_PIPES)
286 AC_DEFINE(DISABLE_FD_PASSING)
287 LDFLAGS="$LDFLAGS"
288 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
289 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000290 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000291*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700292 no_libsocket=1
293 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000294 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700295 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000296 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
297 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
298 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700299 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000300*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000301 AC_MSG_CHECKING(for Digital Unix SIA)
302 no_osfsia=""
303 AC_ARG_WITH(osfsia,
304 [ --with-osfsia Enable Digital Unix SIA],
305 [
306 if test "x$withval" = "xno" ; then
307 AC_MSG_RESULT(disabled)
308 no_osfsia=1
309 fi
310 ],
311 )
312 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000313 if test -f /etc/sia/matrix.conf; then
314 AC_MSG_RESULT(yes)
315 AC_DEFINE(HAVE_OSF_SIA)
316 AC_DEFINE(DISABLE_LOGIN)
317 LIBS="$LIBS -lsecurity -ldb -lm -laud"
318 else
319 AC_MSG_RESULT(no)
320 fi
321 fi
322 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000323
324*-*-nto-qnx)
325 AC_DEFINE(USE_PIPES)
326 AC_DEFINE(NO_X11_UNIX_SOCKETS)
327 AC_DEFINE(MISSING_NFDBITS)
328 AC_DEFINE(MISSING_HOWMANY)
329 AC_DEFINE(MISSING_FD_MASK)
330 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100331esac
332
Damien Millere37bfc12000-06-05 09:37:43 +1000333# Allow user to specify flags
334AC_ARG_WITH(cflags,
335 [ --with-cflags Specify additional flags to pass to compiler],
336 [
337 if test "x$withval" != "xno" ; then
338 CFLAGS="$CFLAGS $withval"
339 fi
340 ]
341)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000342AC_ARG_WITH(cppflags,
343 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
344 [
345 if test "x$withval" != "xno"; then
346 CPPFLAGS="$CPPFLAGS $withval"
347 fi
348 ]
349)
Damien Millere37bfc12000-06-05 09:37:43 +1000350AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000351 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000352 [
353 if test "x$withval" != "xno" ; then
354 LDFLAGS="$LDFLAGS $withval"
355 fi
356 ]
357)
358AC_ARG_WITH(libs,
359 [ --with-libs Specify additional libraries to link with],
360 [
361 if test "x$withval" != "xno" ; then
362 LIBS="$LIBS $withval"
363 fi
364 ]
365)
366
Tim Rice4cec93f2002-02-26 08:40:48 -0800367# Checks for header files.
368AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
369 getopt.h glob.h lastlog.h limits.h login.h \
370 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000371 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000372 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800373 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000374 sys/mman.h sys/select.h sys/stat.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800375 sys/stropts.h sys/sysmacros.h sys/time.h \
Kevin Steves117b06d2002-03-30 17:55:21 +0000376 sys/un.h time.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800377 util.h utime.h utmp.h utmpx.h)
378
Damien Millera22ba012000-03-02 23:09:20 +1100379# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700380AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
381AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000382
Damien Millerdf288022001-02-18 13:07:07 +1100383dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700384if test "x$with_tcp_wrappers" != "xno" ; then
385 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
386 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
387 fi
388fi
Damien Millerdf288022001-02-18 13:07:07 +1100389
Tim Rice13aae5e2001-10-21 17:53:58 -0700390AC_CHECK_FUNC(getspnam, ,
391 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700392
Damien Miller150c8b52002-02-13 23:06:56 +1100393AC_ARG_WITH(rpath,
394 [ --without-rpath Disable auto-added -R linker paths],
395 [
396 if test "x$withval" = "xno" ; then
397 need_dash_r=""
398 fi
399 if test "x$withval" = "xyes" ; then
400 need_dash_r=1
401 fi
402 ]
403)
404
Tim Rice13aae5e2001-10-21 17:53:58 -0700405dnl zlib is required
406AC_ARG_WITH(zlib,
407 [ --with-zlib=PATH Use zlib in PATH],
408 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000409 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100410 AC_MSG_ERROR([*** zlib is required ***])
411 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700412 if test -d "$withval/lib"; then
413 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700414 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700415 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700416 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700417 fi
418 else
419 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700420 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700421 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700422 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700423 fi
424 fi
425 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700426 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700427 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700428 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700429 fi
430 ]
431)
432
Tim Rice17b93e52001-10-23 22:36:54 -0700433AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100434
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000435dnl UnixWare 2.x
436AC_CHECK_FUNC(strcasecmp,
437 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
438)
439AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700440 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
441 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000442)
Damien Millerab18c411999-11-11 10:40:23 +1100443
Tim Ricee589a292001-11-03 11:09:32 -0800444dnl Checks for libutil functions
445AC_CHECK_HEADERS(libutil.h)
446AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
447AC_CHECK_FUNCS(logout updwtmp logwtmp)
448
Ben Lindstrom8697e082001-02-24 21:41:10 +0000449AC_FUNC_STRFTIME
450
Damien Miller3c027682001-03-14 11:39:45 +1100451# Check for ALTDIRFUNC glob() extension
452AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
453AC_EGREP_CPP(FOUNDIT,
454 [
455 #include <glob.h>
456 #ifdef GLOB_ALTDIRFUNC
457 FOUNDIT
458 #endif
459 ],
460 [
461 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
462 AC_MSG_RESULT(yes)
463 ],
464 [
465 AC_MSG_RESULT(no)
466 ]
467)
Damien Millerab18c411999-11-11 10:40:23 +1100468
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000469# Check for g.gl_matchc glob() extension
470AC_MSG_CHECKING(for gl_matchc field in glob_t)
471AC_EGREP_CPP(FOUNDIT,
472 [
473 #include <glob.h>
474 int main(void){glob_t g; g.gl_matchc = 1;}
475 ],
476 [
477 AC_DEFINE(GLOB_HAS_GL_MATCHC)
478 AC_MSG_RESULT(yes)
479 ],
480 [
481 AC_MSG_RESULT(no)
482 ]
483)
484
Damien Miller18bb4732001-03-28 14:35:30 +1000485AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
486AC_TRY_RUN(
487 [
488#include <sys/types.h>
489#include <dirent.h>
490int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
491 ],
492 [AC_MSG_RESULT(yes)],
493 [
494 AC_MSG_RESULT(no)
495 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
496 ]
497)
498
Damien Millerc547bf12001-02-16 10:18:12 +1100499# Check whether user wants S/Key support
500SKEY_MSG="no"
501AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700502 [ --with-skey[[=PATH]] Enable S/Key support
503 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100504 [
505 if test "x$withval" != "xno" ; then
506
507 if test "x$withval" != "xyes" ; then
508 CPPFLAGS="$CPPFLAGS -I${withval}/include"
509 LDFLAGS="$LDFLAGS -L${withval}/lib"
510 fi
511
512 AC_DEFINE(SKEY)
513 LIBS="-lskey $LIBS"
514 SKEY_MSG="yes"
515
Tim Rice4cec93f2002-02-26 08:40:48 -0800516 AC_MSG_CHECKING([for s/key support])
517 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100518 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800519#include <stdio.h>
520#include <skey.h>
521int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
522 ],
523 [AC_MSG_RESULT(yes)],
524 [
525 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100526 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
527 ])
528 fi
529 ]
530)
531
532# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700533TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100534AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700535 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
536 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100537 [
538 if test "x$withval" != "xno" ; then
539 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700540 saved_LDFLAGS="$LDFLAGS"
541 saved_CPPFLAGS="$CPPFLAGS"
542 if test -n "${withval}" -a "${withval}" != "yes"; then
543 if test -d "${withval}/lib"; then
544 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700545 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700546 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700547 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700548 fi
549 else
550 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700551 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700552 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700553 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700554 fi
555 fi
556 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700557 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700558 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700559 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700560 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700561 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800562 LIBWRAP="-lwrap"
563 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100564 AC_MSG_CHECKING(for libwrap)
565 AC_TRY_LINK(
566 [
567#include <tcpd.h>
568 int deny_severity = 0, allow_severity = 0;
569 ],
570 [hosts_access(0);],
571 [
572 AC_MSG_RESULT(yes)
573 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800574 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700575 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100576 ],
577 [
578 AC_MSG_ERROR([*** libwrap missing])
579 ]
580 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800581 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100582 fi
583 ]
584)
585
Damien Millerad833b32000-08-23 10:46:23 +1000586dnl Checks for library functions.
Ben Lindstromfdee8ef2002-04-06 23:52:02 +0000587AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
Tim Rice13aae5e2001-10-21 17:53:58 -0700588 clock fchmod fchown freeaddrinfo futimes gai_strerror \
589 getaddrinfo getcwd getgrouplist getnameinfo getopt \
590 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
591 inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller594a71b2002-04-23 20:22:59 +1000592 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
593 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
Ben Lindstrom837461b2002-06-12 16:57:14 +0000594 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
Ben Lindstromf0bfa832002-06-21 00:01:18 +0000595 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
596 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
597 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
Tim Rice13aae5e2001-10-21 17:53:58 -0700598
599dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700600AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700601 AC_CHECK_LIB(gen, dirname,[
602 AC_CACHE_CHECK([for broken dirname],
603 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700604 save_LIBS="$LIBS"
605 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700606 AC_TRY_RUN(
607 [
608#include <libgen.h>
609#include <string.h>
610
611int main(int argc, char **argv) {
612 char *s, buf[32];
613
614 strncpy(buf,"/etc", 32);
615 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700616 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700617 exit(1);
618 } else {
619 exit(0);
620 }
621}
622 ],
623 [ ac_cv_have_broken_dirname="no" ],
624 [ ac_cv_have_broken_dirname="yes" ]
625 )
Tim Rice17b93e52001-10-23 22:36:54 -0700626 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700627 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700628 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700629 LIBS="$LIBS -lgen"
630 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700631 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700632 fi
633 ])
634])
635
Damien Millerad833b32000-08-23 10:46:23 +1000636dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000637AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000638dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000639AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000640AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000641dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000642AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000643AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100644
Damien Miller04f80141999-11-19 15:32:34 +1100645AC_CHECK_FUNC(daemon,
646 [AC_DEFINE(HAVE_DAEMON)],
647 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
648)
649
Damien Miller9fb07e42000-03-05 16:22:59 +1100650AC_CHECK_FUNC(getpagesize,
651 [AC_DEFINE(HAVE_GETPAGESIZE)],
652 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
653)
654
Damien Millercb170cb2000-07-01 16:52:55 +1000655# Check for broken snprintf
656if test "x$ac_cv_func_snprintf" = "xyes" ; then
657 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
658 AC_TRY_RUN(
659 [
660#include <stdio.h>
661int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
662 ],
663 [AC_MSG_RESULT(yes)],
664 [
665 AC_MSG_RESULT(no)
666 AC_DEFINE(BROKEN_SNPRINTF)
667 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
668 ]
669 )
670fi
671
Damien Miller606f8802000-09-16 15:39:56 +1100672AC_FUNC_GETPGRP
673
Damien Millera64b57a2001-01-17 10:44:13 +1100674# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000675PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100676AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100677 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100678 [
Damien Millera64b57a2001-01-17 10:44:13 +1100679 if test "x$withval" != "xno" ; then
680 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
681 AC_MSG_ERROR([PAM headers not found])
682 fi
683
684 AC_CHECK_LIB(dl, dlopen, , )
685 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
686 AC_CHECK_FUNCS(pam_getenvlist)
687
688 disable_shadow=yes
689 PAM_MSG="yes"
690
691 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800692 if test $ac_cv_lib_dl_dlopen = yes; then
693 LIBPAM="-lpam -ldl"
694 else
695 LIBPAM="-lpam"
696 fi
697 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100698 fi
699 ]
700)
Damien Millera22ba012000-03-02 23:09:20 +1100701
Damien Millera64b57a2001-01-17 10:44:13 +1100702# Check for older PAM
703if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100704 # Check PAM strerror arguments (old PAM)
705 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
706 AC_TRY_COMPILE(
707 [
Damien Miller81171112000-04-23 11:14:01 +1000708#include <stdlib.h>
709#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100710 ],
711 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
712 [AC_MSG_RESULT(no)],
713 [
714 AC_DEFINE(HAVE_OLD_PAM)
715 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000716 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100717 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100718 )
Damien Millera22ba012000-03-02 23:09:20 +1100719fi
720
Tim Riceaef73712002-05-11 13:17:42 -0700721# Search for OpenSSL
722saved_CPPFLAGS="$CPPFLAGS"
723saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100724AC_ARG_WITH(ssl-dir,
725 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
726 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000727 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700728 if test -d "$withval/lib"; then
729 if test -n "${need_dash_r}"; then
730 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
731 else
732 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
733 fi
734 else
735 if test -n "${need_dash_r}"; then
736 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
737 else
738 LDFLAGS="-L${withval} ${LDFLAGS}"
739 fi
740 fi
741 if test -d "$withval/include"; then
742 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
743 else
744 CPPFLAGS="-I${withval} ${CPPFLAGS}"
745 fi
Damien Millera22ba012000-03-02 23:09:20 +1100746 fi
747 ]
748)
Tim Riceaef73712002-05-11 13:17:42 -0700749LIBS="$LIBS -lcrypto"
750AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000751 [
Tim Riceaef73712002-05-11 13:17:42 -0700752 dnl Check default openssl install dir
753 if test -n "${need_dash_r}"; then
754 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000755 else
Tim Riceaef73712002-05-11 13:17:42 -0700756 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000757 fi
Tim Riceaef73712002-05-11 13:17:42 -0700758 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
759 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
760 [
761 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
762 ]
763 )
764 ]
765)
766
Damien Millera22ba012000-03-02 23:09:20 +1100767
Damien Millerec932372002-01-22 22:16:03 +1100768# Sanity check OpenSSL headers
769AC_MSG_CHECKING([whether OpenSSL's headers match the library])
770AC_TRY_RUN(
771 [
772#include <string.h>
773#include <openssl/opensslv.h>
774int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
775 ],
776 [
777 AC_MSG_RESULT(yes)
778 ],
779 [
780 AC_MSG_RESULT(no)
781 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
782 ]
783)
784
Damien Millera64b57a2001-01-17 10:44:13 +1100785# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
786# version in OpenSSL. Skip this for PAM
787if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100788 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100789fi
790
Damien Miller6c21c512002-01-22 21:57:53 +1100791
792### Configure cryptographic random number support
793
794# Check wheter OpenSSL seeds itself
795AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
796AC_TRY_RUN(
797 [
798#include <string.h>
799#include <openssl/rand.h>
800int main(void) { return(RAND_status() == 1 ? 0 : 1); }
801 ],
802 [
803 OPENSSL_SEEDS_ITSELF=yes
804 AC_MSG_RESULT(yes)
805 ],
806 [
807 AC_MSG_RESULT(no)
808 # Default to use of the rand helper if OpenSSL doesn't
809 # seed itself
810 USE_RAND_HELPER=yes
811 ]
812)
813
814
815# Do we want to force the use of the rand helper?
816AC_ARG_WITH(rand-helper,
817 [ --with-rand-helper Use subprocess to gather strong randomness ],
818 [
819 if test "x$withval" = "xno" ; then
820 # Force use of OpenSSL's internal RNG, even if
821 # the previous test showed it to be unseeded.
822 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
823 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
824 OPENSSL_SEEDS_ITSELF=yes
825 USE_RAND_HELPER=""
826 fi
827 else
828 USE_RAND_HELPER=yes
829 fi
830 ],
831)
832
833# Which randomness source do we use?
834if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
835 # OpenSSL only
836 AC_DEFINE(OPENSSL_PRNG_ONLY)
837 RAND_MSG="OpenSSL internal ONLY"
838 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800839elif test ! -z "$USE_RAND_HELPER" ; then
840 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100841 RAND_MSG="ssh-rand-helper"
842 INSTALL_SSH_RAND_HELPER="yes"
843fi
844AC_SUBST(INSTALL_SSH_RAND_HELPER)
845
846### Configuration of ssh-rand-helper
847
848# PRNGD TCP socket
849AC_ARG_WITH(prngd-port,
850 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
851 [
Damien Millere996d722002-01-23 11:20:59 +1100852 case "$withval" in
853 no)
854 withval=""
855 ;;
856 [[0-9]]*)
857 ;;
858 *)
859 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
860 ;;
861 esac
862 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100863 PRNGD_PORT="$withval"
864 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
865 fi
866 ]
867)
868
869# PRNGD Unix domain socket
870AC_ARG_WITH(prngd-socket,
871 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
872 [
Damien Millere996d722002-01-23 11:20:59 +1100873 case "$withval" in
874 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100875 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100876 ;;
877 no)
878 withval=""
879 ;;
880 /*)
881 ;;
882 *)
883 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
884 ;;
885 esac
886
887 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100888 if test ! -z "$PRNGD_PORT" ; then
889 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
890 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100891 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100892 AC_MSG_WARN(Entropy socket is not readable)
893 fi
894 PRNGD_SOCKET="$withval"
895 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
896 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800897 ],
898 [
899 # Check for existing socket only if we don't have a random device already
900 if test "$USE_RAND_HELPER" = yes ; then
901 AC_MSG_CHECKING(for PRNGD/EGD socket)
902 # Insert other locations here
903 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
904 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
905 PRNGD_SOCKET="$sock"
906 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
907 break;
908 fi
909 done
910 if test ! -z "$PRNGD_SOCKET" ; then
911 AC_MSG_RESULT($PRNGD_SOCKET)
912 else
913 AC_MSG_RESULT(not found)
914 fi
915 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100916 ]
917)
918
919# Change default command timeout for hashing entropy source
920entropy_timeout=200
921AC_ARG_WITH(entropy-timeout,
922 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
923 [
924 if test "x$withval" != "xno" ; then
925 entropy_timeout=$withval
926 fi
927 ]
928)
Damien Miller6c21c512002-01-22 21:57:53 +1100929AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
930
Damien Millerd3f6ad22002-06-25 10:24:47 +1000931SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +0000932AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +0000933 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +0000934 [
935 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +1000936 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +0000937 fi
938 ]
939)
Damien Millerd3f6ad22002-06-25 10:24:47 +1000940AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
941AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +0000942
Tim Rice88f2ab52002-03-17 12:17:34 -0800943# We do this little dance with the search path to insure
944# that programs that we select for use by installed programs
945# (which may be run by the super-user) come from trusted
946# locations before they come from the user's private area.
947# This should help avoid accidentally configuring some
948# random version of a program in someone's personal bin.
949
950OPATH=$PATH
951PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -0700952test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -0800953test -d /sbin && PATH=$PATH:/sbin
954test -d /usr/sbin && PATH=$PATH:/usr/sbin
955PATH=$PATH:/etc:$OPATH
956
Damien Miller6c21c512002-01-22 21:57:53 +1100957# These programs are used by the command hashing source to gather entropy
958OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
959OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
960OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
961OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
962OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
963OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
964OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
965OSSH_PATH_ENTROPY_PROG(PROG_W, w)
966OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
967OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
968OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
969OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
970OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
971OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
972OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
973OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -0800974# restore PATH
975PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +1100976
977# Where does ssh-rand-helper get its randomness from?
978INSTALL_SSH_PRNG_CMDS=""
979if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
980 if test ! -z "$PRNGD_PORT" ; then
981 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
982 elif test ! -z "$PRNGD_SOCKET" ; then
983 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
984 else
985 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
986 RAND_HELPER_CMDHASH=yes
987 INSTALL_SSH_PRNG_CMDS="yes"
988 fi
989fi
990AC_SUBST(INSTALL_SSH_PRNG_CMDS)
991
992
Ben Lindstromb5628642000-10-18 00:02:25 +0000993# Cheap hack to ensure NEWS-OS libraries are arranged right.
994if test ! -z "$SONY" ; then
995 LIBS="$LIBS -liberty";
996fi
997
Damien Millera22ba012000-03-02 23:09:20 +1100998# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100999AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001000AC_CHECK_SIZEOF(short int, 2)
1001AC_CHECK_SIZEOF(int, 4)
1002AC_CHECK_SIZEOF(long int, 4)
1003AC_CHECK_SIZEOF(long long int, 8)
1004
Damien Millerfa2bb692002-04-23 23:22:25 +10001005# Sanity check long long for some platforms (AIX)
1006if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1007 ac_cv_sizeof_long_long_int=0
1008fi
1009
Damien Millera22ba012000-03-02 23:09:20 +11001010# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001011AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1012 AC_TRY_COMPILE(
1013 [ #include <sys/types.h> ],
1014 [ u_int a; a = 1;],
1015 [ ac_cv_have_u_int="yes" ],
1016 [ ac_cv_have_u_int="no" ]
1017 )
1018])
1019if test "x$ac_cv_have_u_int" = "xyes" ; then
1020 AC_DEFINE(HAVE_U_INT)
1021 have_u_int=1
1022fi
1023
Damien Miller61e50f12000-05-08 20:49:37 +10001024AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1025 AC_TRY_COMPILE(
1026 [ #include <sys/types.h> ],
1027 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1028 [ ac_cv_have_intxx_t="yes" ],
1029 [ ac_cv_have_intxx_t="no" ]
1030 )
1031])
1032if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1033 AC_DEFINE(HAVE_INTXX_T)
1034 have_intxx_t=1
1035fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001036
1037if (test -z "$have_intxx_t" && \
1038 test "x$ac_cv_header_stdint_h" = "xyes")
1039then
1040 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1041 AC_TRY_COMPILE(
1042 [ #include <stdint.h> ],
1043 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1044 [
1045 AC_DEFINE(HAVE_INTXX_T)
1046 AC_MSG_RESULT(yes)
1047 ],
1048 [ AC_MSG_RESULT(no) ]
1049 )
1050fi
1051
Damien Miller578783e2000-09-23 14:12:24 +11001052AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1053 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001054 [
1055#include <sys/types.h>
1056#ifdef HAVE_STDINT_H
1057# include <stdint.h>
1058#endif
1059#include <sys/socket.h>
1060#ifdef HAVE_SYS_BITYPES_H
1061# include <sys/bitypes.h>
1062#endif
1063 ],
Damien Miller578783e2000-09-23 14:12:24 +11001064 [ int64_t a; a = 1;],
1065 [ ac_cv_have_int64_t="yes" ],
1066 [ ac_cv_have_int64_t="no" ]
1067 )
1068])
1069if test "x$ac_cv_have_int64_t" = "xyes" ; then
1070 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001071fi
1072
Damien Miller61e50f12000-05-08 20:49:37 +10001073AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1074 AC_TRY_COMPILE(
1075 [ #include <sys/types.h> ],
1076 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1077 [ ac_cv_have_u_intxx_t="yes" ],
1078 [ ac_cv_have_u_intxx_t="no" ]
1079 )
1080])
1081if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1082 AC_DEFINE(HAVE_U_INTXX_T)
1083 have_u_intxx_t=1
1084fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001085
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001086if test -z "$have_u_intxx_t" ; then
1087 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1088 AC_TRY_COMPILE(
1089 [ #include <sys/socket.h> ],
1090 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1091 [
1092 AC_DEFINE(HAVE_U_INTXX_T)
1093 AC_MSG_RESULT(yes)
1094 ],
1095 [ AC_MSG_RESULT(no) ]
1096 )
1097fi
1098
Damien Miller578783e2000-09-23 14:12:24 +11001099AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1100 AC_TRY_COMPILE(
1101 [ #include <sys/types.h> ],
1102 [ u_int64_t a; a = 1;],
1103 [ ac_cv_have_u_int64_t="yes" ],
1104 [ ac_cv_have_u_int64_t="no" ]
1105 )
1106])
1107if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1108 AC_DEFINE(HAVE_U_INT64_T)
1109 have_u_int64_t=1
1110fi
1111
Tim Rice4cec93f2002-02-26 08:40:48 -08001112if test -z "$have_u_int64_t" ; then
1113 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1114 AC_TRY_COMPILE(
1115 [ #include <sys/bitypes.h> ],
1116 [ u_int64_t a; a = 1],
1117 [
1118 AC_DEFINE(HAVE_U_INT64_T)
1119 AC_MSG_RESULT(yes)
1120 ],
1121 [ AC_MSG_RESULT(no) ]
1122 )
1123fi
1124
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001125if test -z "$have_u_intxx_t" ; then
1126 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1127 AC_TRY_COMPILE(
1128 [
1129#include <sys/types.h>
1130 ],
1131 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1132 [ ac_cv_have_uintxx_t="yes" ],
1133 [ ac_cv_have_uintxx_t="no" ]
1134 )
1135 ])
1136 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1137 AC_DEFINE(HAVE_UINTXX_T)
1138 fi
1139fi
1140
1141if test -z "$have_uintxx_t" ; then
1142 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1143 AC_TRY_COMPILE(
1144 [ #include <stdint.h> ],
1145 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1146 [
1147 AC_DEFINE(HAVE_UINTXX_T)
1148 AC_MSG_RESULT(yes)
1149 ],
1150 [ AC_MSG_RESULT(no) ]
1151 )
1152fi
1153
Damien Milleredb82922000-06-20 13:25:52 +10001154if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1155 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001156then
1157 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1158 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001159 [
1160#include <sys/bitypes.h>
1161 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001162 [
Damien Miller70494d12000-04-03 15:57:06 +10001163 int8_t a; int16_t b; int32_t c;
1164 u_int8_t e; u_int16_t f; u_int32_t g;
1165 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001166 ],
1167 [
1168 AC_DEFINE(HAVE_U_INTXX_T)
1169 AC_DEFINE(HAVE_INTXX_T)
1170 AC_MSG_RESULT(yes)
1171 ],
1172 [AC_MSG_RESULT(no)]
1173 )
1174fi
1175
Damien Miller58be7382001-09-15 21:31:54 +10001176
1177AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1178 AC_TRY_COMPILE(
1179 [
1180#include <sys/types.h>
1181 ],
1182 [ u_char foo; foo = 125; ],
1183 [ ac_cv_have_u_char="yes" ],
1184 [ ac_cv_have_u_char="no" ]
1185 )
1186])
1187if test "x$ac_cv_have_u_char" = "xyes" ; then
1188 AC_DEFINE(HAVE_U_CHAR)
1189fi
1190
Tim Rice13aae5e2001-10-21 17:53:58 -07001191TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001192
Tim Rice200a5c02002-02-26 22:12:34 -08001193AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001194
Damien Miller61e50f12000-05-08 20:49:37 +10001195AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1196 AC_TRY_COMPILE(
1197 [
1198#include <sys/types.h>
1199 ],
1200 [ size_t foo; foo = 1235; ],
1201 [ ac_cv_have_size_t="yes" ],
1202 [ ac_cv_have_size_t="no" ]
1203 )
1204])
1205if test "x$ac_cv_have_size_t" = "xyes" ; then
1206 AC_DEFINE(HAVE_SIZE_T)
1207fi
Damien Miller95058511999-12-29 10:36:45 +11001208
Damien Miller615f9392000-05-17 22:53:33 +10001209AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1210 AC_TRY_COMPILE(
1211 [
1212#include <sys/types.h>
1213 ],
1214 [ ssize_t foo; foo = 1235; ],
1215 [ ac_cv_have_ssize_t="yes" ],
1216 [ ac_cv_have_ssize_t="no" ]
1217 )
1218])
1219if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1220 AC_DEFINE(HAVE_SSIZE_T)
1221fi
1222
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001223AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1224 AC_TRY_COMPILE(
1225 [
1226#include <time.h>
1227 ],
1228 [ clock_t foo; foo = 1235; ],
1229 [ ac_cv_have_clock_t="yes" ],
1230 [ ac_cv_have_clock_t="no" ]
1231 )
1232])
1233if test "x$ac_cv_have_clock_t" = "xyes" ; then
1234 AC_DEFINE(HAVE_CLOCK_T)
1235fi
1236
Damien Millerb54b40e2000-06-23 08:23:34 +10001237AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1238 AC_TRY_COMPILE(
1239 [
1240#include <sys/types.h>
1241#include <sys/socket.h>
1242 ],
1243 [ sa_family_t foo; foo = 1235; ],
1244 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001245 [ AC_TRY_COMPILE(
1246 [
1247#include <sys/types.h>
1248#include <sys/socket.h>
1249#include <netinet/in.h>
1250 ],
1251 [ sa_family_t foo; foo = 1235; ],
1252 [ ac_cv_have_sa_family_t="yes" ],
1253
Damien Millerb54b40e2000-06-23 08:23:34 +10001254 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001255 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001256 )
1257])
1258if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1259 AC_DEFINE(HAVE_SA_FAMILY_T)
1260fi
1261
Damien Miller0f91b4e2000-06-18 15:43:25 +10001262AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1263 AC_TRY_COMPILE(
1264 [
1265#include <sys/types.h>
1266 ],
1267 [ pid_t foo; foo = 1235; ],
1268 [ ac_cv_have_pid_t="yes" ],
1269 [ ac_cv_have_pid_t="no" ]
1270 )
1271])
1272if test "x$ac_cv_have_pid_t" = "xyes" ; then
1273 AC_DEFINE(HAVE_PID_T)
1274fi
1275
1276AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1277 AC_TRY_COMPILE(
1278 [
1279#include <sys/types.h>
1280 ],
1281 [ mode_t foo; foo = 1235; ],
1282 [ ac_cv_have_mode_t="yes" ],
1283 [ ac_cv_have_mode_t="no" ]
1284 )
1285])
1286if test "x$ac_cv_have_mode_t" = "xyes" ; then
1287 AC_DEFINE(HAVE_MODE_T)
1288fi
1289
Damien Miller61e50f12000-05-08 20:49:37 +10001290
1291AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1292 AC_TRY_COMPILE(
1293 [
Damien Miller81171112000-04-23 11:14:01 +10001294#include <sys/types.h>
1295#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001296 ],
1297 [ struct sockaddr_storage s; ],
1298 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1299 [ ac_cv_have_struct_sockaddr_storage="no" ]
1300 )
1301])
1302if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1303 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1304fi
Damien Miller34132e52000-01-14 15:45:46 +11001305
Damien Miller61e50f12000-05-08 20:49:37 +10001306AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1307 AC_TRY_COMPILE(
1308 [
Damien Miller7b22d652000-06-18 14:07:04 +10001309#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001310#include <netinet/in.h>
1311 ],
1312 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1313 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1314 [ ac_cv_have_struct_sockaddr_in6="no" ]
1315 )
1316])
1317if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1318 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1319fi
Damien Miller34132e52000-01-14 15:45:46 +11001320
Damien Miller61e50f12000-05-08 20:49:37 +10001321AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1322 AC_TRY_COMPILE(
1323 [
Damien Miller7b22d652000-06-18 14:07:04 +10001324#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001325#include <netinet/in.h>
1326 ],
1327 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1328 [ ac_cv_have_struct_in6_addr="yes" ],
1329 [ ac_cv_have_struct_in6_addr="no" ]
1330 )
1331])
1332if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1333 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1334fi
Damien Miller34132e52000-01-14 15:45:46 +11001335
Damien Miller61e50f12000-05-08 20:49:37 +10001336AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1337 AC_TRY_COMPILE(
1338 [
Damien Miller81171112000-04-23 11:14:01 +10001339#include <sys/types.h>
1340#include <sys/socket.h>
1341#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001342 ],
1343 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1344 [ ac_cv_have_struct_addrinfo="yes" ],
1345 [ ac_cv_have_struct_addrinfo="no" ]
1346 )
1347])
1348if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1349 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1350fi
1351
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001352AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1353 AC_TRY_COMPILE(
1354 [ #include <sys/time.h> ],
1355 [ struct timeval tv; tv.tv_sec = 1;],
1356 [ ac_cv_have_struct_timeval="yes" ],
1357 [ ac_cv_have_struct_timeval="no" ]
1358 )
1359])
1360if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1361 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1362 have_struct_timeval=1
1363fi
1364
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001365# If we don't have int64_t then we can't compile sftp-server. So don't
1366# even attempt to do it.
1367if test "x$ac_cv_have_int64_t" = "xno" -a \
1368 "x$ac_cv_sizeof_long_int" != "x8" -a \
1369 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1370 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001371else
1372dnl test snprintf (broken on SCO w/gcc)
1373 AC_TRY_RUN(
1374 [
1375#include <stdio.h>
1376#include <string.h>
1377#ifdef HAVE_SNPRINTF
1378main()
1379{
1380 char buf[50];
1381 char expected_out[50];
1382 int mazsize = 50 ;
1383#if (SIZEOF_LONG_INT == 8)
1384 long int num = 0x7fffffffffffffff;
1385#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001386 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001387#endif
1388 strcpy(expected_out, "9223372036854775807");
1389 snprintf(buf, mazsize, "%lld", num);
1390 if(strcmp(buf, expected_out) != 0)
1391 exit(1);
1392 exit(0);
1393}
1394#else
1395main() { exit(0); }
1396#endif
1397 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1398 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001399fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001400AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001401
Damien Miller78315eb2000-09-29 23:01:36 +11001402dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001403OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1404OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1405OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1406OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1407OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001408OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001409OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1410OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001411OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001412OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1413OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1414OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1415OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001416OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1417OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1418OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1419OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001420
1421AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001422
Damien Miller61e50f12000-05-08 20:49:37 +10001423AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1424 ac_cv_have_ss_family_in_struct_ss, [
1425 AC_TRY_COMPILE(
1426 [
Damien Miller81171112000-04-23 11:14:01 +10001427#include <sys/types.h>
1428#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001429 ],
1430 [ struct sockaddr_storage s; s.ss_family = 1; ],
1431 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1432 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1433 )
1434])
1435if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1436 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1437fi
1438
Damien Miller61e50f12000-05-08 20:49:37 +10001439AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1440 ac_cv_have___ss_family_in_struct_ss, [
1441 AC_TRY_COMPILE(
1442 [
Damien Miller81171112000-04-23 11:14:01 +10001443#include <sys/types.h>
1444#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001445 ],
1446 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1447 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1448 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1449 )
1450])
1451if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1452 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1453fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001454
Damien Millerad833b32000-08-23 10:46:23 +10001455AC_CACHE_CHECK([for pw_class field in struct passwd],
1456 ac_cv_have_pw_class_in_struct_passwd, [
1457 AC_TRY_COMPILE(
1458 [
Damien Millerad833b32000-08-23 10:46:23 +10001459#include <pwd.h>
1460 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001461 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001462 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1463 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1464 )
1465])
1466if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1467 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1468fi
1469
Kevin Steves82456952001-06-22 21:14:18 +00001470AC_CACHE_CHECK([for pw_expire field in struct passwd],
1471 ac_cv_have_pw_expire_in_struct_passwd, [
1472 AC_TRY_COMPILE(
1473 [
1474#include <pwd.h>
1475 ],
1476 [ struct passwd p; p.pw_expire = 0; ],
1477 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1478 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1479 )
1480])
1481if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1482 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1483fi
1484
1485AC_CACHE_CHECK([for pw_change field in struct passwd],
1486 ac_cv_have_pw_change_in_struct_passwd, [
1487 AC_TRY_COMPILE(
1488 [
1489#include <pwd.h>
1490 ],
1491 [ struct passwd p; p.pw_change = 0; ],
1492 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1493 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1494 )
1495])
1496if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1497 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1498fi
Damien Miller61e50f12000-05-08 20:49:37 +10001499
Tim Rice28bbb0c2002-05-27 17:37:32 -07001500dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001501AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1502 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001503 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001504 [
Tim Riceae49fe62002-04-12 10:26:21 -07001505#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001506#include <sys/socket.h>
1507#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001508int main() {
1509#ifdef msg_accrights
1510exit(1);
1511#endif
1512struct msghdr m;
1513m.msg_accrights = 0;
1514exit(0);
1515}
Kevin Steves939c9db2002-03-22 17:23:25 +00001516 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001517 [ ac_cv_have_accrights_in_msghdr="yes" ],
1518 [ ac_cv_have_accrights_in_msghdr="no" ]
1519 )
1520])
1521if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1522 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1523fi
1524
Kevin Stevesa44e0352002-04-07 16:18:03 +00001525AC_CACHE_CHECK([for msg_control field in struct msghdr],
1526 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001527 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001528 [
Tim Riceae49fe62002-04-12 10:26:21 -07001529#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001530#include <sys/socket.h>
1531#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001532int main() {
1533#ifdef msg_control
1534exit(1);
1535#endif
1536struct msghdr m;
1537m.msg_control = 0;
1538exit(0);
1539}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001540 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001541 [ ac_cv_have_control_in_msghdr="yes" ],
1542 [ ac_cv_have_control_in_msghdr="no" ]
1543 )
1544])
1545if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1546 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1547fi
1548
Damien Miller61e50f12000-05-08 20:49:37 +10001549AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1550 AC_TRY_LINK([],
1551 [ extern char *__progname; printf("%s", __progname); ],
1552 [ ac_cv_libc_defines___progname="yes" ],
1553 [ ac_cv_libc_defines___progname="no" ]
1554 )
1555])
1556if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1557 AC_DEFINE(HAVE___PROGNAME)
1558fi
1559
Kevin Steves4846f4a2002-03-22 18:19:53 +00001560AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1561 AC_TRY_LINK([
1562#include <stdio.h>
1563],
1564 [ printf("%s", __FUNCTION__); ],
1565 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1566 [ ac_cv_cc_implements___FUNCTION__="no" ]
1567 )
1568])
1569if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1570 AC_DEFINE(HAVE___FUNCTION__)
1571fi
1572
1573AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1574 AC_TRY_LINK([
1575#include <stdio.h>
1576],
1577 [ printf("%s", __func__); ],
1578 [ ac_cv_cc_implements___func__="yes" ],
1579 [ ac_cv_cc_implements___func__="no" ]
1580 )
1581])
1582if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1583 AC_DEFINE(HAVE___func__)
1584fi
1585
Damien Miller4f8e6692001-07-14 13:22:53 +10001586AC_CACHE_CHECK([whether getopt has optreset support],
1587 ac_cv_have_getopt_optreset, [
1588 AC_TRY_LINK(
1589 [
1590#include <getopt.h>
1591 ],
1592 [ extern int optreset; optreset = 0; ],
1593 [ ac_cv_have_getopt_optreset="yes" ],
1594 [ ac_cv_have_getopt_optreset="no" ]
1595 )
1596])
1597if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1598 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1599fi
Damien Millera22ba012000-03-02 23:09:20 +11001600
Damien Millerecbb26d2000-07-15 14:59:14 +10001601AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1602 AC_TRY_LINK([],
1603 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1604 [ ac_cv_libc_defines_sys_errlist="yes" ],
1605 [ ac_cv_libc_defines_sys_errlist="no" ]
1606 )
1607])
1608if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1609 AC_DEFINE(HAVE_SYS_ERRLIST)
1610fi
1611
1612
Damien Miller11fa2cc2000-08-16 10:35:58 +10001613AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1614 AC_TRY_LINK([],
1615 [ extern int sys_nerr; printf("%i", sys_nerr);],
1616 [ ac_cv_libc_defines_sys_nerr="yes" ],
1617 [ ac_cv_libc_defines_sys_nerr="no" ]
1618 )
1619])
1620if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1621 AC_DEFINE(HAVE_SYS_NERR)
1622fi
1623
Damien Miller85de5802001-09-18 14:01:11 +10001624SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001625
1626# Check whether user wants sectok support
1627AC_ARG_WITH(sectok,
1628 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001629 [
1630 if test "x$withval" != "xno" ; then
1631 if test "x$withval" != "xyes" ; then
1632 CPPFLAGS="$CPPFLAGS -I${withval}"
1633 LDFLAGS="$LDFLAGS -L${withval}"
1634 if test ! -z "$need_dash_r" ; then
1635 LDFLAGS="$LDFLAGS -R${withval}"
1636 fi
1637 if test ! -z "$blibpath" ; then
1638 blibpath="$blibpath:${withval}"
1639 fi
1640 fi
1641 AC_CHECK_HEADERS(sectok.h)
1642 if test "$ac_cv_header_sectok_h" != yes; then
1643 AC_MSG_ERROR(Can't find sectok.h)
1644 fi
1645 AC_CHECK_LIB(sectok, sectok_open)
1646 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1647 AC_MSG_ERROR(Can't find libsectok)
1648 fi
1649 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001650 AC_DEFINE(USE_SECTOK)
1651 SCARD_MSG="yes, using sectok"
1652 fi
1653 ]
1654)
1655
1656# Check whether user wants OpenSC support
1657AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001658 AC_HELP_STRING([--with-opensc=PFX],
1659 [Enable smartcard support using OpenSC]),
1660 opensc_config_prefix="$withval", opensc_config_prefix="")
1661if test x$opensc_config_prefix != x ; then
1662 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1663 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1664 if test "$OPENSC_CONFIG" != "no"; then
1665 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1666 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1667 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1668 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1669 AC_DEFINE(SMARTCARD)
1670 AC_DEFINE(USE_OPENSC)
1671 SCARD_MSG="yes, using OpenSC"
1672 fi
1673fi
Damien Miller85de5802001-09-18 14:01:11 +10001674
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001675# Check whether user wants Kerberos 5 support
1676KRB5_MSG="no"
1677AC_ARG_WITH(kerberos5,
1678 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1679 [
1680 if test "x$withval" != "xno" ; then
1681 if test "x$withval" = "xyes" ; then
1682 KRB5ROOT="/usr/local"
1683 else
1684 KRB5ROOT=${withval}
1685 fi
1686 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1687 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1688 AC_DEFINE(KRB5)
1689 KRB5_MSG="yes"
1690 AC_MSG_CHECKING(whether we are using Heimdal)
1691 AC_TRY_COMPILE([ #include <krb5.h> ],
1692 [ char *tmp = heimdal_version; ],
1693 [ AC_MSG_RESULT(yes)
1694 AC_DEFINE(HEIMDAL)
1695 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1696 ],
1697 [ AC_MSG_RESULT(no)
1698 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1699 ]
1700 )
1701 if test ! -z "$need_dash_r" ; then
1702 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1703 fi
1704 if test ! -z "$blibpath" ; then
1705 blibpath="$blibpath:${KRB5ROOT}/lib"
1706 fi
1707 AC_CHECK_LIB(resolv, dn_expand, , )
1708
1709 KRB5=yes
1710 fi
1711 ]
1712)
1713# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001714KRB4_MSG="no"
1715AC_ARG_WITH(kerberos4,
1716 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1717 [
1718 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001719 if test "x$withval" != "xyes" ; then
1720 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1721 LDFLAGS="$LDFLAGS -L${withval}/lib"
1722 if test ! -z "$need_dash_r" ; then
1723 LDFLAGS="$LDFLAGS -R${withval}/lib"
1724 fi
1725 if test ! -z "$blibpath" ; then
1726 blibpath="$blibpath:${withval}/lib"
1727 fi
1728 else
1729 if test -d /usr/include/kerberosIV ; then
1730 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1731 fi
1732 fi
1733
1734 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001735 if test "$ac_cv_header_krb_h" != yes; then
1736 AC_MSG_WARN([Cannot find krb.h, build may fail])
1737 fi
Damien Miller98344742001-03-28 14:37:06 +10001738 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001739 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001740 AC_CHECK_LIB(krb4, main)
1741 if test "$ac_cv_lib_krb4_main" != yes; then
1742 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1743 else
1744 KLIBS="-lkrb4"
1745 fi
1746 else
1747 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001748 fi
Damien Miller98344742001-03-28 14:37:06 +10001749 AC_CHECK_LIB(des, des_cbc_encrypt)
1750 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1751 AC_CHECK_LIB(des425, des_cbc_encrypt)
1752 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1753 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1754 else
1755 KLIBS="-ldes425"
1756 fi
1757 else
1758 KLIBS="-ldes"
1759 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001760 AC_CHECK_LIB(resolv, dn_expand, , )
1761 KRB4=yes
1762 KRB4_MSG="yes"
1763 AC_DEFINE(KRB4)
1764 fi
1765 ]
1766)
1767
1768# Check whether user wants AFS support
1769AFS_MSG="no"
1770AC_ARG_WITH(afs,
1771 [ --with-afs=PATH Enable AFS support],
1772 [
1773 if test "x$withval" != "xno" ; then
1774
1775 if test "x$withval" != "xyes" ; then
1776 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1777 LDFLAGS="$LDFLAGS -L${withval}/lib"
1778 fi
1779
1780 if test -z "$KRB4" ; then
1781 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1782 fi
1783
1784 LIBS="-lkafs $LIBS"
1785 if test ! -z "$AFS_LIBS" ; then
1786 LIBS="$LIBS $AFS_LIBS"
1787 fi
1788 AC_DEFINE(AFS)
1789 AFS_MSG="yes"
1790 fi
1791 ]
1792)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001793LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001794
Damien Millera22ba012000-03-02 23:09:20 +11001795# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11001796
Damien Millerf58c6722002-05-13 13:15:42 +10001797PRIVSEP_PATH=/var/empty
1798AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07001799 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10001800 [
1801 if test "x$withval" != "$no" ; then
1802 PRIVSEP_PATH=$withval
1803 fi
1804 ]
1805)
1806AC_SUBST(PRIVSEP_PATH)
1807
Damien Millera22ba012000-03-02 23:09:20 +11001808AC_ARG_WITH(xauth,
1809 [ --with-xauth=PATH Specify path to xauth program ],
1810 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001811 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001812 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001813 fi
1814 ],
1815 [
Tim Ricee22be3b2002-07-17 19:20:07 -07001816 TestPath="$PATH"
1817 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
1818 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
1819 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
1820 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
1821 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10001822 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001823 xauth_path="/usr/openwin/bin/xauth"
1824 fi
1825 ]
1826)
1827
Damien Millera19cf472000-11-29 13:28:50 +11001828if test -z "$xauth_path" ; then
1829 XAUTH_PATH="undefined"
1830 AC_SUBST(XAUTH_PATH)
1831else
Damien Millera22ba012000-03-02 23:09:20 +11001832 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001833 XAUTH_PATH=$xauth_path
1834 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001835fi
Damien Millera22ba012000-03-02 23:09:20 +11001836
1837# Check for mail directory (last resort if we cannot get it from headers)
1838if test ! -z "$MAIL" ; then
1839 maildir=`dirname $MAIL`
1840 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1841fi
1842
Damien Millera22ba012000-03-02 23:09:20 +11001843if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00001844 if test "x$disable_ptmx_check" != "xyes" ; then
1845 AC_CHECK_FILE("/dev/ptmx",
1846 [
1847 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1848 have_dev_ptmx=1
1849 ]
1850 )
1851 fi
Damien Millera22ba012000-03-02 23:09:20 +11001852fi
Damien Miller204ad072000-03-02 23:56:12 +11001853AC_CHECK_FILE("/dev/ptc",
1854 [
1855 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1856 have_dev_ptc=1
1857 ]
1858)
1859
Damien Millera22ba012000-03-02 23:09:20 +11001860# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001861AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001862 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001863 [
Damien Miller897741e2001-04-16 10:41:46 +10001864 case "$withval" in
1865 man|cat|doc)
1866 MANTYPE=$withval
1867 ;;
1868 *)
1869 AC_MSG_ERROR(invalid man type: $withval)
1870 ;;
1871 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001872 ]
1873)
Ben Lindstrombc709922001-04-18 18:04:21 +00001874if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07001875 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
1876 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00001877 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1878 MANTYPE=doc
1879 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1880 MANTYPE=man
1881 else
1882 MANTYPE=cat
1883 fi
1884fi
Damien Miller670a4b82000-01-22 13:53:11 +11001885AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001886if test "$MANTYPE" = "doc"; then
1887 mansubdir=man;
1888else
1889 mansubdir=$MANTYPE;
1890fi
1891AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001892
Damien Millera22ba012000-03-02 23:09:20 +11001893# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001894MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001895AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001896 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001897 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001898 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001899 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001900 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001901 fi
1902 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001903)
1904
Damien Millera22ba012000-03-02 23:09:20 +11001905# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001906AC_ARG_WITH(shadow,
1907 [ --without-shadow Disable shadow password support],
1908 [
1909 if test "x$withval" = "xno" ; then
1910 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001911 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001912 fi
1913 ]
1914)
1915
Damien Miller1f335fb2000-06-26 11:31:33 +10001916if test -z "$disable_shadow" ; then
1917 AC_MSG_CHECKING([if the systems has expire shadow information])
1918 AC_TRY_COMPILE(
1919 [
1920#include <sys/types.h>
1921#include <shadow.h>
1922 struct spwd sp;
1923 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1924 [ sp_expire_available=yes ], []
1925 )
1926
1927 if test "x$sp_expire_available" = "xyes" ; then
1928 AC_MSG_RESULT(yes)
1929 AC_DEFINE(HAS_SHADOW_EXPIRE)
1930 else
1931 AC_MSG_RESULT(no)
1932 fi
1933fi
1934
Damien Millera22ba012000-03-02 23:09:20 +11001935# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001936if test ! -z "$IPADDR_IN_DISPLAY" ; then
1937 DISPLAY_HACK_MSG="yes"
1938 AC_DEFINE(IPADDR_IN_DISPLAY)
1939else
1940 DISPLAY_HACK_MSG="no"
1941 AC_ARG_WITH(ipaddr-display,
1942 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1943 [
1944 if test "x$withval" != "xno" ; then
1945 AC_DEFINE(IPADDR_IN_DISPLAY)
1946 DISPLAY_HACK_MSG="yes"
1947 fi
1948 ]
1949 )
1950fi
Damien Miller76112de1999-12-21 11:18:08 +11001951
Tim Rice43a1c132002-04-17 21:19:14 -07001952dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
1953if test $ac_cv_func_login_getcapbool = "yes" -a \
1954 $ac_cv_header_login_cap_h = "yes" ; then
1955 USES_LOGIN_CONF=yes
1956fi
Damien Millera22ba012000-03-02 23:09:20 +11001957# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001958SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001959AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10001960 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11001961 [
Tim Rice43a1c132002-04-17 21:19:14 -07001962 if test "$USES_LOGIN_CONF" = "yes" ; then
1963 AC_MSG_WARN([
1964--with-default-path=PATH has no effect on this system.
1965Edit /etc/login.conf instead.])
1966 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001967 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001968 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001969 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001970 ],
Tim Rice43a1c132002-04-17 21:19:14 -07001971 [ if test "$USES_LOGIN_CONF" = "yes" ; then
1972 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
1973 else
Tim Rice59ea0a02001-03-10 13:50:45 -08001974 AC_TRY_RUN(
1975 [
1976/* find out what STDPATH is */
1977#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001978#ifdef HAVE_PATHS_H
1979# include <paths.h>
1980#endif
1981#ifndef _PATH_STDPATH
1982# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1983#endif
1984#include <sys/types.h>
1985#include <sys/stat.h>
1986#include <fcntl.h>
1987#define DATA "conftest.stdpath"
1988
1989main()
1990{
1991 FILE *fd;
1992 int rc;
1993
1994 fd = fopen(DATA,"w");
1995 if(fd == NULL)
1996 exit(1);
1997
1998 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1999 exit(1);
2000
2001 exit(0);
2002}
2003 ], [ user_path=`cat conftest.stdpath` ],
2004 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2005 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2006 )
2007# make sure $bindir is in USER_PATH so scp will work
2008 t_bindir=`eval echo ${bindir}`
2009 case $t_bindir in
2010 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2011 esac
2012 case $t_bindir in
2013 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2014 esac
2015 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2016 if test $? -ne 0 ; then
2017 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2018 if test $? -ne 0 ; then
2019 user_path=$user_path:$t_bindir
2020 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2021 fi
2022 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002023 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002024)
Tim Rice43a1c132002-04-17 21:19:14 -07002025if test "$USES_LOGIN_CONF" != "yes" ; then
2026 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2027 AC_SUBST(user_path)
2028fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002029
Damien Millera18bbd32002-05-13 10:48:57 +10002030# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002031AC_ARG_WITH(superuser-path,
2032 [ --with-superuser-path= Specify different path for super-user],
2033 [
2034 if test "x$withval" != "xno" ; then
2035 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2036 superuser_path=$withval
2037 fi
2038 ]
2039)
2040
2041
Damien Millera22ba012000-03-02 23:09:20 +11002042# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002043IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002044AC_ARG_WITH(ipv4-default,
2045 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2046 [
2047 if test "x$withval" != "xno" ; then
2048 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002049 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002050 fi
2051 ]
2052)
2053
Damien Miller61e50f12000-05-08 20:49:37 +10002054AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002055IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002056AC_ARG_WITH(4in6,
2057 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2058 [
2059 if test "x$withval" != "xno" ; then
2060 AC_MSG_RESULT(yes)
2061 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002062 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002063 else
2064 AC_MSG_RESULT(no)
2065 fi
2066 ],[
2067 if test "x$inet6_default_4in6" = "xyes"; then
2068 AC_MSG_RESULT([yes (default)])
2069 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002070 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002071 else
2072 AC_MSG_RESULT([no (default)])
2073 fi
2074 ]
2075)
2076
Damien Miller60396b02001-02-18 17:01:00 +11002077# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002078BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002079AC_ARG_WITH(bsd-auth,
2080 [ --with-bsd-auth Enable BSD auth support],
2081 [
2082 if test "x$withval" != "xno" ; then
2083 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002084 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002085 fi
2086 ]
2087)
2088
Damien Millera22ba012000-03-02 23:09:20 +11002089# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002090piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002091# make sure the directory exists
2092if test ! -d $piddir ; then
2093 piddir=`eval echo ${sysconfdir}`
2094 case $piddir in
2095 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2096 esac
2097fi
2098
Tim Rice88f2ab52002-03-17 12:17:34 -08002099AC_ARG_WITH(pid-dir,
2100 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2101 [
2102 if test "x$withval" != "xno" ; then
2103 piddir=$withval
2104 if test ! -d $piddir ; then
2105 AC_MSG_WARN([** no $piddir directory on this system **])
2106 fi
2107 fi
2108 ]
2109)
2110
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002111AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002112AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002113
andre2ff7b5d2000-06-03 14:57:40 +00002114dnl allow user to disable some login recording features
2115AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002116 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002117 [ AC_DEFINE(DISABLE_LASTLOG) ]
2118)
2119AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002120 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002121 [ AC_DEFINE(DISABLE_UTMP) ]
2122)
2123AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002124 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002125 [ AC_DEFINE(DISABLE_UTMPX) ]
2126)
2127AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002128 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002129 [ AC_DEFINE(DISABLE_WTMP) ]
2130)
2131AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002132 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002133 [ AC_DEFINE(DISABLE_WTMPX) ]
2134)
2135AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002136 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002137 [ AC_DEFINE(DISABLE_LOGIN) ]
2138)
2139AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002140 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002141 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2142)
2143AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002144 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002145 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2146)
2147AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002148 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002149 [
2150 if test "x$withval" = "xno" ; then
2151 AC_DEFINE(DISABLE_LASTLOG)
2152 else
2153 conf_lastlog_location=$withval
2154 fi
2155 ]
2156)
andre2ff7b5d2000-06-03 14:57:40 +00002157
2158dnl lastlog, [uw]tmpx? detection
2159dnl NOTE: set the paths in the platform section to avoid the
2160dnl need for command-line parameters
2161dnl lastlog and [uw]tmp are subject to a file search if all else fails
2162
2163dnl lastlog detection
2164dnl NOTE: the code itself will detect if lastlog is a directory
2165AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2166AC_TRY_COMPILE([
2167#include <sys/types.h>
2168#include <utmp.h>
2169#ifdef HAVE_LASTLOG_H
2170# include <lastlog.h>
2171#endif
Damien Miller2994e082000-06-04 15:51:47 +10002172#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002173# include <paths.h>
2174#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002175#ifdef HAVE_LOGIN_H
2176# include <login.h>
2177#endif
andre2ff7b5d2000-06-03 14:57:40 +00002178 ],
2179 [ char *lastlog = LASTLOG_FILE; ],
2180 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002181 [
2182 AC_MSG_RESULT(no)
2183 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2184 AC_TRY_COMPILE([
2185#include <sys/types.h>
2186#include <utmp.h>
2187#ifdef HAVE_LASTLOG_H
2188# include <lastlog.h>
2189#endif
2190#ifdef HAVE_PATHS_H
2191# include <paths.h>
2192#endif
2193 ],
2194 [ char *lastlog = _PATH_LASTLOG; ],
2195 [ AC_MSG_RESULT(yes) ],
2196 [
andree441aa32000-06-12 22:34:38 +00002197 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002198 system_lastlog_path=no
2199 ])
2200 ]
andre2ff7b5d2000-06-03 14:57:40 +00002201)
Damien Miller2994e082000-06-04 15:51:47 +10002202
andre2ff7b5d2000-06-03 14:57:40 +00002203if test -z "$conf_lastlog_location"; then
2204 if test x"$system_lastlog_path" = x"no" ; then
2205 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002206 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002207 conf_lastlog_location=$f
2208 fi
2209 done
2210 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002211 AC_MSG_WARN([** Cannot find lastlog **])
2212 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002213 fi
2214 fi
2215fi
2216
2217if test -n "$conf_lastlog_location"; then
2218 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2219fi
2220
2221dnl utmp detection
2222AC_MSG_CHECKING([if your system defines UTMP_FILE])
2223AC_TRY_COMPILE([
2224#include <sys/types.h>
2225#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002226#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002227# include <paths.h>
2228#endif
2229 ],
2230 [ char *utmp = UTMP_FILE; ],
2231 [ AC_MSG_RESULT(yes) ],
2232 [ AC_MSG_RESULT(no)
2233 system_utmp_path=no ]
2234)
2235if test -z "$conf_utmp_location"; then
2236 if test x"$system_utmp_path" = x"no" ; then
2237 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2238 if test -f $f ; then
2239 conf_utmp_location=$f
2240 fi
2241 done
2242 if test -z "$conf_utmp_location"; then
2243 AC_DEFINE(DISABLE_UTMP)
2244 fi
2245 fi
2246fi
2247if test -n "$conf_utmp_location"; then
2248 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2249fi
2250
2251dnl wtmp detection
2252AC_MSG_CHECKING([if your system defines WTMP_FILE])
2253AC_TRY_COMPILE([
2254#include <sys/types.h>
2255#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002256#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002257# include <paths.h>
2258#endif
2259 ],
2260 [ char *wtmp = WTMP_FILE; ],
2261 [ AC_MSG_RESULT(yes) ],
2262 [ AC_MSG_RESULT(no)
2263 system_wtmp_path=no ]
2264)
2265if test -z "$conf_wtmp_location"; then
2266 if test x"$system_wtmp_path" = x"no" ; then
2267 for f in /usr/adm/wtmp /var/log/wtmp; do
2268 if test -f $f ; then
2269 conf_wtmp_location=$f
2270 fi
2271 done
2272 if test -z "$conf_wtmp_location"; then
2273 AC_DEFINE(DISABLE_WTMP)
2274 fi
2275 fi
2276fi
2277if test -n "$conf_wtmp_location"; then
2278 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2279fi
2280
2281
2282dnl utmpx detection - I don't know any system so perverse as to require
2283dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2284dnl there, though.
2285AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2286AC_TRY_COMPILE([
2287#include <sys/types.h>
2288#include <utmp.h>
2289#ifdef HAVE_UTMPX_H
2290#include <utmpx.h>
2291#endif
Damien Miller2994e082000-06-04 15:51:47 +10002292#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002293# include <paths.h>
2294#endif
2295 ],
2296 [ char *utmpx = UTMPX_FILE; ],
2297 [ AC_MSG_RESULT(yes) ],
2298 [ AC_MSG_RESULT(no)
2299 system_utmpx_path=no ]
2300)
2301if test -z "$conf_utmpx_location"; then
2302 if test x"$system_utmpx_path" = x"no" ; then
2303 AC_DEFINE(DISABLE_UTMPX)
2304 fi
2305else
2306 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2307fi
2308
2309dnl wtmpx detection
2310AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2311AC_TRY_COMPILE([
2312#include <sys/types.h>
2313#include <utmp.h>
2314#ifdef HAVE_UTMPX_H
2315#include <utmpx.h>
2316#endif
Damien Miller2994e082000-06-04 15:51:47 +10002317#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002318# include <paths.h>
2319#endif
2320 ],
2321 [ char *wtmpx = WTMPX_FILE; ],
2322 [ AC_MSG_RESULT(yes) ],
2323 [ AC_MSG_RESULT(no)
2324 system_wtmpx_path=no ]
2325)
2326if test -z "$conf_wtmpx_location"; then
2327 if test x"$system_wtmpx_path" = x"no" ; then
2328 AC_DEFINE(DISABLE_WTMPX)
2329 fi
2330else
2331 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2332fi
2333
Damien Miller4018c192000-04-30 09:30:44 +10002334
Damien Miller29ea30d2000-03-17 10:54:15 +11002335if test ! -z "$blibpath" ; then
2336 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2337 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2338fi
2339
Tim Rice4cec93f2002-02-26 08:40:48 -08002340dnl remove pam and dl because they are in $LIBPAM
2341if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002342 LIBS=`echo $LIBS | sed 's/-lpam //'`
2343fi
2344if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2345 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002346fi
2347
Damien Millerbac2d8a2000-09-05 16:13:06 +11002348AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002349AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2350AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002351
Damien Miller7b22d652000-06-18 14:07:04 +10002352# Print summary of options
2353
Damien Miller7b22d652000-06-18 14:07:04 +10002354# Someone please show me a better way :)
2355A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2356B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2357C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2358D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002359E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002360F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002361G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002362H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2363I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2364J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002365
2366echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002367echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002368echo " User binaries: $B"
2369echo " System binaries: $C"
2370echo " Configuration files: $D"
2371echo " Askpass program: $E"
2372echo " Manual pages: $F"
2373echo " PID file: $G"
2374echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002375if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002376echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002377else
Damien Millerf58c6722002-05-13 13:15:42 +10002378echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002379fi
Damien Millera18bbd32002-05-13 10:48:57 +10002380if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002381echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002382fi
Damien Millerf58c6722002-05-13 13:15:42 +10002383echo " Manpage format: $MANTYPE"
2384echo " PAM support: ${PAM_MSG}"
2385echo " KerberosIV support: $KRB4_MSG"
2386echo " KerberosV support: $KRB5_MSG"
2387echo " Smartcard support: $SCARD_MSG"
2388echo " AFS support: $AFS_MSG"
2389echo " S/KEY support: $SKEY_MSG"
2390echo " TCP Wrappers support: $TCPW_MSG"
2391echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002392echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002393echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2394echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2395echo " BSD Auth support: $BSD_AUTH_MSG"
2396echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002397if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002398echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002399fi
2400
Damien Miller7b22d652000-06-18 14:07:04 +10002401echo ""
2402
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002403echo " Host: ${host}"
2404echo " Compiler: ${CC}"
2405echo " Compiler flags: ${CFLAGS}"
2406echo "Preprocessor flags: ${CPPFLAGS}"
2407echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002408echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002409
2410echo ""
2411
Damien Miller82cf0ce2000-12-20 13:34:48 +11002412if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002413 echo "PAM is enabled. You may need to install a PAM control file "
2414 echo "for sshd, otherwise password authentication may fail. "
2415 echo "Example PAM control files can be found in the contrib/ "
2416 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002417 echo ""
2418fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002419
2420if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002421 echo "sftp-server will be disabled. Your compiler does not "
2422 echo "support 64bit integers."
2423 echo ""
2424fi
2425
2426if test ! -z "$RAND_HELPER_CMDHASH" ; then
2427 echo "WARNING: you are using the builtin random number collection "
2428 echo "service. Please read WARNING.RNG and request that your OS "
2429 echo "vendor includes kernel-based random number collection in "
2430 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002431 echo ""
2432fi
Damien Miller60396b02001-02-18 17:01:00 +11002433