blob: 615fec2a5b247e808b4d4536b76de6e04ee9c90d [file] [log] [blame]
Tim Riced730b782002-08-13 18:52:10 -07001# $Id: configure.ac,v 1.85 2002/08/14 01:52:11 tim Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Tim Rice13aae5e2001-10-21 17:53:58 -07003AC_INIT
4AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +10005
6AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11007AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11008AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11009AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100010
Damien Millera22ba012000-03-02 23:09:20 +110011# Checks for programs.
Damien Millerab18c411999-11-11 10:40:23 +110012AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100013AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110014AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000015AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070016AC_PATH_PROGS(PERL, perl5 perl)
Damien Millere79334a1999-12-29 10:03:37 +110017AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100018AC_PATH_PROG(ENT, ent)
19AC_SUBST(ENT)
Damien 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
Tim Riced730b782002-08-13 18:52:10 -0700767# Determine OpenSSL header version
768AC_MSG_CHECKING([OpenSSL header version])
769AC_TRY_RUN(
770 [
771#include <stdio.h>
772#include <string.h>
773#include <openssl/opensslv.h>
774#define DATA "conftest.sslincver"
775int main(void) {
776 FILE *fd;
777 int rc;
778
779 fd = fopen(DATA,"w");
780 if(fd == NULL)
781 exit(1);
782
783 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
784 exit(1);
785
786 exit(0);
787}
788 ],
789 [
790 ssl_header_ver=`cat conftest.sslincver`
791 AC_MSG_RESULT($ssl_header_ver)
792 ],
793 [
794 AC_MSG_RESULT(not found)
795 AC_MSG_ERROR(OpenSSL version header not found.)
796 ]
797)
798
799# Determine OpenSSL library version
800AC_MSG_CHECKING([OpenSSL library version])
801AC_TRY_RUN(
802 [
803#include <stdio.h>
804#include <string.h>
805#include <openssl/opensslv.h>
806#include <openssl/crypto.h>
807#define DATA "conftest.ssllibver"
808int main(void) {
809 FILE *fd;
810 int rc;
811
812 fd = fopen(DATA,"w");
813 if(fd == NULL)
814 exit(1);
815
816 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
817 exit(1);
818
819 exit(0);
820}
821 ],
822 [
823 ssl_library_ver=`cat conftest.ssllibver`
824 AC_MSG_RESULT($ssl_library_ver)
825 ],
826 [
827 AC_MSG_RESULT(not found)
828 AC_MSG_ERROR(OpenSSL library not found.)
829 ]
830)
Damien Millera22ba012000-03-02 23:09:20 +1100831
Damien Millerec932372002-01-22 22:16:03 +1100832# Sanity check OpenSSL headers
833AC_MSG_CHECKING([whether OpenSSL's headers match the library])
834AC_TRY_RUN(
835 [
836#include <string.h>
837#include <openssl/opensslv.h>
838int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
839 ],
840 [
841 AC_MSG_RESULT(yes)
842 ],
843 [
844 AC_MSG_RESULT(no)
845 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
846 ]
847)
848
Damien Millera64b57a2001-01-17 10:44:13 +1100849# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
850# version in OpenSSL. Skip this for PAM
851if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100852 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100853fi
854
Damien Miller6c21c512002-01-22 21:57:53 +1100855
856### Configure cryptographic random number support
857
858# Check wheter OpenSSL seeds itself
859AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
860AC_TRY_RUN(
861 [
862#include <string.h>
863#include <openssl/rand.h>
864int main(void) { return(RAND_status() == 1 ? 0 : 1); }
865 ],
866 [
867 OPENSSL_SEEDS_ITSELF=yes
868 AC_MSG_RESULT(yes)
869 ],
870 [
871 AC_MSG_RESULT(no)
872 # Default to use of the rand helper if OpenSSL doesn't
873 # seed itself
874 USE_RAND_HELPER=yes
875 ]
876)
877
878
879# Do we want to force the use of the rand helper?
880AC_ARG_WITH(rand-helper,
881 [ --with-rand-helper Use subprocess to gather strong randomness ],
882 [
883 if test "x$withval" = "xno" ; then
884 # Force use of OpenSSL's internal RNG, even if
885 # the previous test showed it to be unseeded.
886 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
887 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
888 OPENSSL_SEEDS_ITSELF=yes
889 USE_RAND_HELPER=""
890 fi
891 else
892 USE_RAND_HELPER=yes
893 fi
894 ],
895)
896
897# Which randomness source do we use?
898if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
899 # OpenSSL only
900 AC_DEFINE(OPENSSL_PRNG_ONLY)
901 RAND_MSG="OpenSSL internal ONLY"
902 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800903elif test ! -z "$USE_RAND_HELPER" ; then
904 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100905 RAND_MSG="ssh-rand-helper"
906 INSTALL_SSH_RAND_HELPER="yes"
907fi
908AC_SUBST(INSTALL_SSH_RAND_HELPER)
909
910### Configuration of ssh-rand-helper
911
912# PRNGD TCP socket
913AC_ARG_WITH(prngd-port,
914 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
915 [
Damien Millere996d722002-01-23 11:20:59 +1100916 case "$withval" in
917 no)
918 withval=""
919 ;;
920 [[0-9]]*)
921 ;;
922 *)
923 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
924 ;;
925 esac
926 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100927 PRNGD_PORT="$withval"
928 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
929 fi
930 ]
931)
932
933# PRNGD Unix domain socket
934AC_ARG_WITH(prngd-socket,
935 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
936 [
Damien Millere996d722002-01-23 11:20:59 +1100937 case "$withval" in
938 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100939 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100940 ;;
941 no)
942 withval=""
943 ;;
944 /*)
945 ;;
946 *)
947 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
948 ;;
949 esac
950
951 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100952 if test ! -z "$PRNGD_PORT" ; then
953 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
954 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100955 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100956 AC_MSG_WARN(Entropy socket is not readable)
957 fi
958 PRNGD_SOCKET="$withval"
959 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
960 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800961 ],
962 [
963 # Check for existing socket only if we don't have a random device already
964 if test "$USE_RAND_HELPER" = yes ; then
965 AC_MSG_CHECKING(for PRNGD/EGD socket)
966 # Insert other locations here
967 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
968 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
969 PRNGD_SOCKET="$sock"
970 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
971 break;
972 fi
973 done
974 if test ! -z "$PRNGD_SOCKET" ; then
975 AC_MSG_RESULT($PRNGD_SOCKET)
976 else
977 AC_MSG_RESULT(not found)
978 fi
979 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100980 ]
981)
982
983# Change default command timeout for hashing entropy source
984entropy_timeout=200
985AC_ARG_WITH(entropy-timeout,
986 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
987 [
988 if test "x$withval" != "xno" ; then
989 entropy_timeout=$withval
990 fi
991 ]
992)
Damien Miller6c21c512002-01-22 21:57:53 +1100993AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
994
Damien Millerd3f6ad22002-06-25 10:24:47 +1000995SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +0000996AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +0000997 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +0000998 [
999 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001000 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001001 fi
1002 ]
1003)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001004AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1005AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001006
Tim Rice88f2ab52002-03-17 12:17:34 -08001007# We do this little dance with the search path to insure
1008# that programs that we select for use by installed programs
1009# (which may be run by the super-user) come from trusted
1010# locations before they come from the user's private area.
1011# This should help avoid accidentally configuring some
1012# random version of a program in someone's personal bin.
1013
1014OPATH=$PATH
1015PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001016test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001017test -d /sbin && PATH=$PATH:/sbin
1018test -d /usr/sbin && PATH=$PATH:/usr/sbin
1019PATH=$PATH:/etc:$OPATH
1020
Damien Miller6c21c512002-01-22 21:57:53 +11001021# These programs are used by the command hashing source to gather entropy
1022OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1023OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1024OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1025OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1026OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1027OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1028OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1029OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1030OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1031OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1032OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1033OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1034OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1035OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1036OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1037OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001038# restore PATH
1039PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001040
1041# Where does ssh-rand-helper get its randomness from?
1042INSTALL_SSH_PRNG_CMDS=""
1043if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1044 if test ! -z "$PRNGD_PORT" ; then
1045 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1046 elif test ! -z "$PRNGD_SOCKET" ; then
1047 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1048 else
1049 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1050 RAND_HELPER_CMDHASH=yes
1051 INSTALL_SSH_PRNG_CMDS="yes"
1052 fi
1053fi
1054AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1055
1056
Ben Lindstromb5628642000-10-18 00:02:25 +00001057# Cheap hack to ensure NEWS-OS libraries are arranged right.
1058if test ! -z "$SONY" ; then
1059 LIBS="$LIBS -liberty";
1060fi
1061
Damien Millera22ba012000-03-02 23:09:20 +11001062# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001063AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001064AC_CHECK_SIZEOF(short int, 2)
1065AC_CHECK_SIZEOF(int, 4)
1066AC_CHECK_SIZEOF(long int, 4)
1067AC_CHECK_SIZEOF(long long int, 8)
1068
Damien Millerfa2bb692002-04-23 23:22:25 +10001069# Sanity check long long for some platforms (AIX)
1070if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1071 ac_cv_sizeof_long_long_int=0
1072fi
1073
Damien Millera22ba012000-03-02 23:09:20 +11001074# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001075AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1076 AC_TRY_COMPILE(
1077 [ #include <sys/types.h> ],
1078 [ u_int a; a = 1;],
1079 [ ac_cv_have_u_int="yes" ],
1080 [ ac_cv_have_u_int="no" ]
1081 )
1082])
1083if test "x$ac_cv_have_u_int" = "xyes" ; then
1084 AC_DEFINE(HAVE_U_INT)
1085 have_u_int=1
1086fi
1087
Damien Miller61e50f12000-05-08 20:49:37 +10001088AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1089 AC_TRY_COMPILE(
1090 [ #include <sys/types.h> ],
1091 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1092 [ ac_cv_have_intxx_t="yes" ],
1093 [ ac_cv_have_intxx_t="no" ]
1094 )
1095])
1096if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1097 AC_DEFINE(HAVE_INTXX_T)
1098 have_intxx_t=1
1099fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001100
1101if (test -z "$have_intxx_t" && \
1102 test "x$ac_cv_header_stdint_h" = "xyes")
1103then
1104 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1105 AC_TRY_COMPILE(
1106 [ #include <stdint.h> ],
1107 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1108 [
1109 AC_DEFINE(HAVE_INTXX_T)
1110 AC_MSG_RESULT(yes)
1111 ],
1112 [ AC_MSG_RESULT(no) ]
1113 )
1114fi
1115
Damien Miller578783e2000-09-23 14:12:24 +11001116AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1117 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001118 [
1119#include <sys/types.h>
1120#ifdef HAVE_STDINT_H
1121# include <stdint.h>
1122#endif
1123#include <sys/socket.h>
1124#ifdef HAVE_SYS_BITYPES_H
1125# include <sys/bitypes.h>
1126#endif
1127 ],
Damien Miller578783e2000-09-23 14:12:24 +11001128 [ int64_t a; a = 1;],
1129 [ ac_cv_have_int64_t="yes" ],
1130 [ ac_cv_have_int64_t="no" ]
1131 )
1132])
1133if test "x$ac_cv_have_int64_t" = "xyes" ; then
1134 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001135fi
1136
Damien Miller61e50f12000-05-08 20:49:37 +10001137AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1138 AC_TRY_COMPILE(
1139 [ #include <sys/types.h> ],
1140 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1141 [ ac_cv_have_u_intxx_t="yes" ],
1142 [ ac_cv_have_u_intxx_t="no" ]
1143 )
1144])
1145if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1146 AC_DEFINE(HAVE_U_INTXX_T)
1147 have_u_intxx_t=1
1148fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001149
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001150if test -z "$have_u_intxx_t" ; then
1151 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1152 AC_TRY_COMPILE(
1153 [ #include <sys/socket.h> ],
1154 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1155 [
1156 AC_DEFINE(HAVE_U_INTXX_T)
1157 AC_MSG_RESULT(yes)
1158 ],
1159 [ AC_MSG_RESULT(no) ]
1160 )
1161fi
1162
Damien Miller578783e2000-09-23 14:12:24 +11001163AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1164 AC_TRY_COMPILE(
1165 [ #include <sys/types.h> ],
1166 [ u_int64_t a; a = 1;],
1167 [ ac_cv_have_u_int64_t="yes" ],
1168 [ ac_cv_have_u_int64_t="no" ]
1169 )
1170])
1171if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1172 AC_DEFINE(HAVE_U_INT64_T)
1173 have_u_int64_t=1
1174fi
1175
Tim Rice4cec93f2002-02-26 08:40:48 -08001176if test -z "$have_u_int64_t" ; then
1177 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1178 AC_TRY_COMPILE(
1179 [ #include <sys/bitypes.h> ],
1180 [ u_int64_t a; a = 1],
1181 [
1182 AC_DEFINE(HAVE_U_INT64_T)
1183 AC_MSG_RESULT(yes)
1184 ],
1185 [ AC_MSG_RESULT(no) ]
1186 )
1187fi
1188
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001189if test -z "$have_u_intxx_t" ; then
1190 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1191 AC_TRY_COMPILE(
1192 [
1193#include <sys/types.h>
1194 ],
1195 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1196 [ ac_cv_have_uintxx_t="yes" ],
1197 [ ac_cv_have_uintxx_t="no" ]
1198 )
1199 ])
1200 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1201 AC_DEFINE(HAVE_UINTXX_T)
1202 fi
1203fi
1204
1205if test -z "$have_uintxx_t" ; then
1206 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1207 AC_TRY_COMPILE(
1208 [ #include <stdint.h> ],
1209 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1210 [
1211 AC_DEFINE(HAVE_UINTXX_T)
1212 AC_MSG_RESULT(yes)
1213 ],
1214 [ AC_MSG_RESULT(no) ]
1215 )
1216fi
1217
Damien Milleredb82922000-06-20 13:25:52 +10001218if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1219 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001220then
1221 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1222 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001223 [
1224#include <sys/bitypes.h>
1225 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001226 [
Damien Miller70494d12000-04-03 15:57:06 +10001227 int8_t a; int16_t b; int32_t c;
1228 u_int8_t e; u_int16_t f; u_int32_t g;
1229 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001230 ],
1231 [
1232 AC_DEFINE(HAVE_U_INTXX_T)
1233 AC_DEFINE(HAVE_INTXX_T)
1234 AC_MSG_RESULT(yes)
1235 ],
1236 [AC_MSG_RESULT(no)]
1237 )
1238fi
1239
Damien Miller58be7382001-09-15 21:31:54 +10001240
1241AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1242 AC_TRY_COMPILE(
1243 [
1244#include <sys/types.h>
1245 ],
1246 [ u_char foo; foo = 125; ],
1247 [ ac_cv_have_u_char="yes" ],
1248 [ ac_cv_have_u_char="no" ]
1249 )
1250])
1251if test "x$ac_cv_have_u_char" = "xyes" ; then
1252 AC_DEFINE(HAVE_U_CHAR)
1253fi
1254
Tim Rice13aae5e2001-10-21 17:53:58 -07001255TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001256
Tim Rice200a5c02002-02-26 22:12:34 -08001257AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001258
Damien Miller61e50f12000-05-08 20:49:37 +10001259AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1260 AC_TRY_COMPILE(
1261 [
1262#include <sys/types.h>
1263 ],
1264 [ size_t foo; foo = 1235; ],
1265 [ ac_cv_have_size_t="yes" ],
1266 [ ac_cv_have_size_t="no" ]
1267 )
1268])
1269if test "x$ac_cv_have_size_t" = "xyes" ; then
1270 AC_DEFINE(HAVE_SIZE_T)
1271fi
Damien Miller95058511999-12-29 10:36:45 +11001272
Damien Miller615f9392000-05-17 22:53:33 +10001273AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1274 AC_TRY_COMPILE(
1275 [
1276#include <sys/types.h>
1277 ],
1278 [ ssize_t foo; foo = 1235; ],
1279 [ ac_cv_have_ssize_t="yes" ],
1280 [ ac_cv_have_ssize_t="no" ]
1281 )
1282])
1283if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1284 AC_DEFINE(HAVE_SSIZE_T)
1285fi
1286
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001287AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1288 AC_TRY_COMPILE(
1289 [
1290#include <time.h>
1291 ],
1292 [ clock_t foo; foo = 1235; ],
1293 [ ac_cv_have_clock_t="yes" ],
1294 [ ac_cv_have_clock_t="no" ]
1295 )
1296])
1297if test "x$ac_cv_have_clock_t" = "xyes" ; then
1298 AC_DEFINE(HAVE_CLOCK_T)
1299fi
1300
Damien Millerb54b40e2000-06-23 08:23:34 +10001301AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1302 AC_TRY_COMPILE(
1303 [
1304#include <sys/types.h>
1305#include <sys/socket.h>
1306 ],
1307 [ sa_family_t foo; foo = 1235; ],
1308 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001309 [ AC_TRY_COMPILE(
1310 [
1311#include <sys/types.h>
1312#include <sys/socket.h>
1313#include <netinet/in.h>
1314 ],
1315 [ sa_family_t foo; foo = 1235; ],
1316 [ ac_cv_have_sa_family_t="yes" ],
1317
Damien Millerb54b40e2000-06-23 08:23:34 +10001318 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001319 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001320 )
1321])
1322if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1323 AC_DEFINE(HAVE_SA_FAMILY_T)
1324fi
1325
Damien Miller0f91b4e2000-06-18 15:43:25 +10001326AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1327 AC_TRY_COMPILE(
1328 [
1329#include <sys/types.h>
1330 ],
1331 [ pid_t foo; foo = 1235; ],
1332 [ ac_cv_have_pid_t="yes" ],
1333 [ ac_cv_have_pid_t="no" ]
1334 )
1335])
1336if test "x$ac_cv_have_pid_t" = "xyes" ; then
1337 AC_DEFINE(HAVE_PID_T)
1338fi
1339
1340AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1341 AC_TRY_COMPILE(
1342 [
1343#include <sys/types.h>
1344 ],
1345 [ mode_t foo; foo = 1235; ],
1346 [ ac_cv_have_mode_t="yes" ],
1347 [ ac_cv_have_mode_t="no" ]
1348 )
1349])
1350if test "x$ac_cv_have_mode_t" = "xyes" ; then
1351 AC_DEFINE(HAVE_MODE_T)
1352fi
1353
Damien Miller61e50f12000-05-08 20:49:37 +10001354
1355AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1356 AC_TRY_COMPILE(
1357 [
Damien Miller81171112000-04-23 11:14:01 +10001358#include <sys/types.h>
1359#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001360 ],
1361 [ struct sockaddr_storage s; ],
1362 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1363 [ ac_cv_have_struct_sockaddr_storage="no" ]
1364 )
1365])
1366if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1367 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1368fi
Damien Miller34132e52000-01-14 15:45:46 +11001369
Damien Miller61e50f12000-05-08 20:49:37 +10001370AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1371 AC_TRY_COMPILE(
1372 [
Damien Miller7b22d652000-06-18 14:07:04 +10001373#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001374#include <netinet/in.h>
1375 ],
1376 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1377 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1378 [ ac_cv_have_struct_sockaddr_in6="no" ]
1379 )
1380])
1381if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1382 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1383fi
Damien Miller34132e52000-01-14 15:45:46 +11001384
Damien Miller61e50f12000-05-08 20:49:37 +10001385AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1386 AC_TRY_COMPILE(
1387 [
Damien Miller7b22d652000-06-18 14:07:04 +10001388#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001389#include <netinet/in.h>
1390 ],
1391 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1392 [ ac_cv_have_struct_in6_addr="yes" ],
1393 [ ac_cv_have_struct_in6_addr="no" ]
1394 )
1395])
1396if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1397 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1398fi
Damien Miller34132e52000-01-14 15:45:46 +11001399
Damien Miller61e50f12000-05-08 20:49:37 +10001400AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1401 AC_TRY_COMPILE(
1402 [
Damien Miller81171112000-04-23 11:14:01 +10001403#include <sys/types.h>
1404#include <sys/socket.h>
1405#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001406 ],
1407 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1408 [ ac_cv_have_struct_addrinfo="yes" ],
1409 [ ac_cv_have_struct_addrinfo="no" ]
1410 )
1411])
1412if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1413 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1414fi
1415
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001416AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1417 AC_TRY_COMPILE(
1418 [ #include <sys/time.h> ],
1419 [ struct timeval tv; tv.tv_sec = 1;],
1420 [ ac_cv_have_struct_timeval="yes" ],
1421 [ ac_cv_have_struct_timeval="no" ]
1422 )
1423])
1424if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1425 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1426 have_struct_timeval=1
1427fi
1428
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001429# If we don't have int64_t then we can't compile sftp-server. So don't
1430# even attempt to do it.
1431if test "x$ac_cv_have_int64_t" = "xno" -a \
1432 "x$ac_cv_sizeof_long_int" != "x8" -a \
1433 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1434 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001435else
1436dnl test snprintf (broken on SCO w/gcc)
1437 AC_TRY_RUN(
1438 [
1439#include <stdio.h>
1440#include <string.h>
1441#ifdef HAVE_SNPRINTF
1442main()
1443{
1444 char buf[50];
1445 char expected_out[50];
1446 int mazsize = 50 ;
1447#if (SIZEOF_LONG_INT == 8)
1448 long int num = 0x7fffffffffffffff;
1449#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001450 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001451#endif
1452 strcpy(expected_out, "9223372036854775807");
1453 snprintf(buf, mazsize, "%lld", num);
1454 if(strcmp(buf, expected_out) != 0)
1455 exit(1);
1456 exit(0);
1457}
1458#else
1459main() { exit(0); }
1460#endif
1461 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1462 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001463fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001464AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001465
Damien Miller78315eb2000-09-29 23:01:36 +11001466dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001467OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1468OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1469OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1470OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1471OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001472OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001473OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1474OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001475OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001476OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1477OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1478OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1479OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001480OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1481OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1482OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1483OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001484
1485AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001486
Damien Miller61e50f12000-05-08 20:49:37 +10001487AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1488 ac_cv_have_ss_family_in_struct_ss, [
1489 AC_TRY_COMPILE(
1490 [
Damien Miller81171112000-04-23 11:14:01 +10001491#include <sys/types.h>
1492#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001493 ],
1494 [ struct sockaddr_storage s; s.ss_family = 1; ],
1495 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1496 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1497 )
1498])
1499if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1500 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1501fi
1502
Damien Miller61e50f12000-05-08 20:49:37 +10001503AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1504 ac_cv_have___ss_family_in_struct_ss, [
1505 AC_TRY_COMPILE(
1506 [
Damien Miller81171112000-04-23 11:14:01 +10001507#include <sys/types.h>
1508#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001509 ],
1510 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1511 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1512 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1513 )
1514])
1515if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1516 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1517fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001518
Damien Millerad833b32000-08-23 10:46:23 +10001519AC_CACHE_CHECK([for pw_class field in struct passwd],
1520 ac_cv_have_pw_class_in_struct_passwd, [
1521 AC_TRY_COMPILE(
1522 [
Damien Millerad833b32000-08-23 10:46:23 +10001523#include <pwd.h>
1524 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001525 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001526 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1527 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1528 )
1529])
1530if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1531 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1532fi
1533
Kevin Steves82456952001-06-22 21:14:18 +00001534AC_CACHE_CHECK([for pw_expire field in struct passwd],
1535 ac_cv_have_pw_expire_in_struct_passwd, [
1536 AC_TRY_COMPILE(
1537 [
1538#include <pwd.h>
1539 ],
1540 [ struct passwd p; p.pw_expire = 0; ],
1541 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1542 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1543 )
1544])
1545if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1546 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1547fi
1548
1549AC_CACHE_CHECK([for pw_change field in struct passwd],
1550 ac_cv_have_pw_change_in_struct_passwd, [
1551 AC_TRY_COMPILE(
1552 [
1553#include <pwd.h>
1554 ],
1555 [ struct passwd p; p.pw_change = 0; ],
1556 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1557 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1558 )
1559])
1560if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1561 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1562fi
Damien Miller61e50f12000-05-08 20:49:37 +10001563
Tim Rice28bbb0c2002-05-27 17:37:32 -07001564dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001565AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1566 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001567 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001568 [
Tim Riceae49fe62002-04-12 10:26:21 -07001569#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001570#include <sys/socket.h>
1571#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001572int main() {
1573#ifdef msg_accrights
1574exit(1);
1575#endif
1576struct msghdr m;
1577m.msg_accrights = 0;
1578exit(0);
1579}
Kevin Steves939c9db2002-03-22 17:23:25 +00001580 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001581 [ ac_cv_have_accrights_in_msghdr="yes" ],
1582 [ ac_cv_have_accrights_in_msghdr="no" ]
1583 )
1584])
1585if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1586 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1587fi
1588
Kevin Stevesa44e0352002-04-07 16:18:03 +00001589AC_CACHE_CHECK([for msg_control field in struct msghdr],
1590 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001591 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001592 [
Tim Riceae49fe62002-04-12 10:26:21 -07001593#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001594#include <sys/socket.h>
1595#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001596int main() {
1597#ifdef msg_control
1598exit(1);
1599#endif
1600struct msghdr m;
1601m.msg_control = 0;
1602exit(0);
1603}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001604 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001605 [ ac_cv_have_control_in_msghdr="yes" ],
1606 [ ac_cv_have_control_in_msghdr="no" ]
1607 )
1608])
1609if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1610 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1611fi
1612
Damien Miller61e50f12000-05-08 20:49:37 +10001613AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1614 AC_TRY_LINK([],
1615 [ extern char *__progname; printf("%s", __progname); ],
1616 [ ac_cv_libc_defines___progname="yes" ],
1617 [ ac_cv_libc_defines___progname="no" ]
1618 )
1619])
1620if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1621 AC_DEFINE(HAVE___PROGNAME)
1622fi
1623
Kevin Steves4846f4a2002-03-22 18:19:53 +00001624AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1625 AC_TRY_LINK([
1626#include <stdio.h>
1627],
1628 [ printf("%s", __FUNCTION__); ],
1629 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1630 [ ac_cv_cc_implements___FUNCTION__="no" ]
1631 )
1632])
1633if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1634 AC_DEFINE(HAVE___FUNCTION__)
1635fi
1636
1637AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1638 AC_TRY_LINK([
1639#include <stdio.h>
1640],
1641 [ printf("%s", __func__); ],
1642 [ ac_cv_cc_implements___func__="yes" ],
1643 [ ac_cv_cc_implements___func__="no" ]
1644 )
1645])
1646if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1647 AC_DEFINE(HAVE___func__)
1648fi
1649
Damien Miller4f8e6692001-07-14 13:22:53 +10001650AC_CACHE_CHECK([whether getopt has optreset support],
1651 ac_cv_have_getopt_optreset, [
1652 AC_TRY_LINK(
1653 [
1654#include <getopt.h>
1655 ],
1656 [ extern int optreset; optreset = 0; ],
1657 [ ac_cv_have_getopt_optreset="yes" ],
1658 [ ac_cv_have_getopt_optreset="no" ]
1659 )
1660])
1661if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1662 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1663fi
Damien Millera22ba012000-03-02 23:09:20 +11001664
Damien Millerecbb26d2000-07-15 14:59:14 +10001665AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1666 AC_TRY_LINK([],
1667 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1668 [ ac_cv_libc_defines_sys_errlist="yes" ],
1669 [ ac_cv_libc_defines_sys_errlist="no" ]
1670 )
1671])
1672if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1673 AC_DEFINE(HAVE_SYS_ERRLIST)
1674fi
1675
1676
Damien Miller11fa2cc2000-08-16 10:35:58 +10001677AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1678 AC_TRY_LINK([],
1679 [ extern int sys_nerr; printf("%i", sys_nerr);],
1680 [ ac_cv_libc_defines_sys_nerr="yes" ],
1681 [ ac_cv_libc_defines_sys_nerr="no" ]
1682 )
1683])
1684if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1685 AC_DEFINE(HAVE_SYS_NERR)
1686fi
1687
Damien Miller85de5802001-09-18 14:01:11 +10001688SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001689
1690# Check whether user wants sectok support
1691AC_ARG_WITH(sectok,
1692 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001693 [
1694 if test "x$withval" != "xno" ; then
1695 if test "x$withval" != "xyes" ; then
1696 CPPFLAGS="$CPPFLAGS -I${withval}"
1697 LDFLAGS="$LDFLAGS -L${withval}"
1698 if test ! -z "$need_dash_r" ; then
1699 LDFLAGS="$LDFLAGS -R${withval}"
1700 fi
1701 if test ! -z "$blibpath" ; then
1702 blibpath="$blibpath:${withval}"
1703 fi
1704 fi
1705 AC_CHECK_HEADERS(sectok.h)
1706 if test "$ac_cv_header_sectok_h" != yes; then
1707 AC_MSG_ERROR(Can't find sectok.h)
1708 fi
1709 AC_CHECK_LIB(sectok, sectok_open)
1710 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1711 AC_MSG_ERROR(Can't find libsectok)
1712 fi
1713 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001714 AC_DEFINE(USE_SECTOK)
1715 SCARD_MSG="yes, using sectok"
1716 fi
1717 ]
1718)
1719
1720# Check whether user wants OpenSC support
1721AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001722 AC_HELP_STRING([--with-opensc=PFX],
1723 [Enable smartcard support using OpenSC]),
1724 opensc_config_prefix="$withval", opensc_config_prefix="")
1725if test x$opensc_config_prefix != x ; then
1726 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1727 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1728 if test "$OPENSC_CONFIG" != "no"; then
1729 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1730 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1731 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1732 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1733 AC_DEFINE(SMARTCARD)
1734 AC_DEFINE(USE_OPENSC)
1735 SCARD_MSG="yes, using OpenSC"
1736 fi
1737fi
Damien Miller85de5802001-09-18 14:01:11 +10001738
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001739# Check whether user wants Kerberos 5 support
1740KRB5_MSG="no"
1741AC_ARG_WITH(kerberos5,
1742 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1743 [
1744 if test "x$withval" != "xno" ; then
1745 if test "x$withval" = "xyes" ; then
1746 KRB5ROOT="/usr/local"
1747 else
1748 KRB5ROOT=${withval}
1749 fi
1750 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1751 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1752 AC_DEFINE(KRB5)
1753 KRB5_MSG="yes"
1754 AC_MSG_CHECKING(whether we are using Heimdal)
1755 AC_TRY_COMPILE([ #include <krb5.h> ],
1756 [ char *tmp = heimdal_version; ],
1757 [ AC_MSG_RESULT(yes)
1758 AC_DEFINE(HEIMDAL)
1759 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1760 ],
1761 [ AC_MSG_RESULT(no)
1762 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1763 ]
1764 )
1765 if test ! -z "$need_dash_r" ; then
1766 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1767 fi
1768 if test ! -z "$blibpath" ; then
1769 blibpath="$blibpath:${KRB5ROOT}/lib"
1770 fi
1771 AC_CHECK_LIB(resolv, dn_expand, , )
1772
1773 KRB5=yes
1774 fi
1775 ]
1776)
1777# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001778KRB4_MSG="no"
1779AC_ARG_WITH(kerberos4,
1780 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1781 [
1782 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001783 if test "x$withval" != "xyes" ; then
1784 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1785 LDFLAGS="$LDFLAGS -L${withval}/lib"
1786 if test ! -z "$need_dash_r" ; then
1787 LDFLAGS="$LDFLAGS -R${withval}/lib"
1788 fi
1789 if test ! -z "$blibpath" ; then
1790 blibpath="$blibpath:${withval}/lib"
1791 fi
1792 else
1793 if test -d /usr/include/kerberosIV ; then
1794 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1795 fi
1796 fi
1797
1798 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001799 if test "$ac_cv_header_krb_h" != yes; then
1800 AC_MSG_WARN([Cannot find krb.h, build may fail])
1801 fi
Damien Miller98344742001-03-28 14:37:06 +10001802 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001803 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001804 AC_CHECK_LIB(krb4, main)
1805 if test "$ac_cv_lib_krb4_main" != yes; then
1806 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1807 else
1808 KLIBS="-lkrb4"
1809 fi
1810 else
1811 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001812 fi
Damien Miller98344742001-03-28 14:37:06 +10001813 AC_CHECK_LIB(des, des_cbc_encrypt)
1814 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1815 AC_CHECK_LIB(des425, des_cbc_encrypt)
1816 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1817 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1818 else
1819 KLIBS="-ldes425"
1820 fi
1821 else
1822 KLIBS="-ldes"
1823 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001824 AC_CHECK_LIB(resolv, dn_expand, , )
1825 KRB4=yes
1826 KRB4_MSG="yes"
1827 AC_DEFINE(KRB4)
1828 fi
1829 ]
1830)
1831
1832# Check whether user wants AFS support
1833AFS_MSG="no"
1834AC_ARG_WITH(afs,
1835 [ --with-afs=PATH Enable AFS support],
1836 [
1837 if test "x$withval" != "xno" ; then
1838
1839 if test "x$withval" != "xyes" ; then
1840 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1841 LDFLAGS="$LDFLAGS -L${withval}/lib"
1842 fi
1843
1844 if test -z "$KRB4" ; then
1845 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1846 fi
1847
1848 LIBS="-lkafs $LIBS"
1849 if test ! -z "$AFS_LIBS" ; then
1850 LIBS="$LIBS $AFS_LIBS"
1851 fi
1852 AC_DEFINE(AFS)
1853 AFS_MSG="yes"
1854 fi
1855 ]
1856)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001857LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001858
Damien Millera22ba012000-03-02 23:09:20 +11001859# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11001860
Damien Millerf58c6722002-05-13 13:15:42 +10001861PRIVSEP_PATH=/var/empty
1862AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07001863 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10001864 [
1865 if test "x$withval" != "$no" ; then
1866 PRIVSEP_PATH=$withval
1867 fi
1868 ]
1869)
1870AC_SUBST(PRIVSEP_PATH)
1871
Damien Millera22ba012000-03-02 23:09:20 +11001872AC_ARG_WITH(xauth,
1873 [ --with-xauth=PATH Specify path to xauth program ],
1874 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001875 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001876 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001877 fi
1878 ],
1879 [
Tim Ricee22be3b2002-07-17 19:20:07 -07001880 TestPath="$PATH"
1881 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
1882 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
1883 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
1884 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
1885 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10001886 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001887 xauth_path="/usr/openwin/bin/xauth"
1888 fi
1889 ]
1890)
1891
Damien Millera19cf472000-11-29 13:28:50 +11001892if test -z "$xauth_path" ; then
1893 XAUTH_PATH="undefined"
1894 AC_SUBST(XAUTH_PATH)
1895else
Damien Millera22ba012000-03-02 23:09:20 +11001896 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001897 XAUTH_PATH=$xauth_path
1898 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001899fi
Damien Millera22ba012000-03-02 23:09:20 +11001900
1901# Check for mail directory (last resort if we cannot get it from headers)
1902if test ! -z "$MAIL" ; then
1903 maildir=`dirname $MAIL`
1904 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1905fi
1906
Damien Millera22ba012000-03-02 23:09:20 +11001907if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00001908 if test "x$disable_ptmx_check" != "xyes" ; then
1909 AC_CHECK_FILE("/dev/ptmx",
1910 [
1911 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1912 have_dev_ptmx=1
1913 ]
1914 )
1915 fi
Damien Millera22ba012000-03-02 23:09:20 +11001916fi
Damien Miller204ad072000-03-02 23:56:12 +11001917AC_CHECK_FILE("/dev/ptc",
1918 [
1919 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1920 have_dev_ptc=1
1921 ]
1922)
1923
Damien Millera22ba012000-03-02 23:09:20 +11001924# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001925AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001926 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001927 [
Damien Miller897741e2001-04-16 10:41:46 +10001928 case "$withval" in
1929 man|cat|doc)
1930 MANTYPE=$withval
1931 ;;
1932 *)
1933 AC_MSG_ERROR(invalid man type: $withval)
1934 ;;
1935 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001936 ]
1937)
Ben Lindstrombc709922001-04-18 18:04:21 +00001938if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07001939 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
1940 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00001941 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1942 MANTYPE=doc
1943 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1944 MANTYPE=man
1945 else
1946 MANTYPE=cat
1947 fi
1948fi
Damien Miller670a4b82000-01-22 13:53:11 +11001949AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001950if test "$MANTYPE" = "doc"; then
1951 mansubdir=man;
1952else
1953 mansubdir=$MANTYPE;
1954fi
1955AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001956
Damien Millera22ba012000-03-02 23:09:20 +11001957# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001958MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001959AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001960 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001961 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001962 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001963 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001964 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001965 fi
1966 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001967)
1968
Damien Millera22ba012000-03-02 23:09:20 +11001969# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001970AC_ARG_WITH(shadow,
1971 [ --without-shadow Disable shadow password support],
1972 [
1973 if test "x$withval" = "xno" ; then
1974 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001975 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001976 fi
1977 ]
1978)
1979
Damien Miller1f335fb2000-06-26 11:31:33 +10001980if test -z "$disable_shadow" ; then
1981 AC_MSG_CHECKING([if the systems has expire shadow information])
1982 AC_TRY_COMPILE(
1983 [
1984#include <sys/types.h>
1985#include <shadow.h>
1986 struct spwd sp;
1987 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1988 [ sp_expire_available=yes ], []
1989 )
1990
1991 if test "x$sp_expire_available" = "xyes" ; then
1992 AC_MSG_RESULT(yes)
1993 AC_DEFINE(HAS_SHADOW_EXPIRE)
1994 else
1995 AC_MSG_RESULT(no)
1996 fi
1997fi
1998
Damien Millera22ba012000-03-02 23:09:20 +11001999# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002000if test ! -z "$IPADDR_IN_DISPLAY" ; then
2001 DISPLAY_HACK_MSG="yes"
2002 AC_DEFINE(IPADDR_IN_DISPLAY)
2003else
2004 DISPLAY_HACK_MSG="no"
2005 AC_ARG_WITH(ipaddr-display,
2006 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2007 [
2008 if test "x$withval" != "xno" ; then
2009 AC_DEFINE(IPADDR_IN_DISPLAY)
2010 DISPLAY_HACK_MSG="yes"
2011 fi
2012 ]
2013 )
2014fi
Damien Miller76112de1999-12-21 11:18:08 +11002015
Tim Rice43a1c132002-04-17 21:19:14 -07002016dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2017if test $ac_cv_func_login_getcapbool = "yes" -a \
2018 $ac_cv_header_login_cap_h = "yes" ; then
2019 USES_LOGIN_CONF=yes
2020fi
Damien Millera22ba012000-03-02 23:09:20 +11002021# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002022SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002023AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002024 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002025 [
Tim Rice43a1c132002-04-17 21:19:14 -07002026 if test "$USES_LOGIN_CONF" = "yes" ; then
2027 AC_MSG_WARN([
2028--with-default-path=PATH has no effect on this system.
2029Edit /etc/login.conf instead.])
2030 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08002031 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002032 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002033 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002034 ],
Tim Rice43a1c132002-04-17 21:19:14 -07002035 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2036 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2037 else
Tim Rice59ea0a02001-03-10 13:50:45 -08002038 AC_TRY_RUN(
2039 [
2040/* find out what STDPATH is */
2041#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002042#ifdef HAVE_PATHS_H
2043# include <paths.h>
2044#endif
2045#ifndef _PATH_STDPATH
2046# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2047#endif
2048#include <sys/types.h>
2049#include <sys/stat.h>
2050#include <fcntl.h>
2051#define DATA "conftest.stdpath"
2052
2053main()
2054{
2055 FILE *fd;
2056 int rc;
2057
2058 fd = fopen(DATA,"w");
2059 if(fd == NULL)
2060 exit(1);
2061
2062 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2063 exit(1);
2064
2065 exit(0);
2066}
2067 ], [ user_path=`cat conftest.stdpath` ],
2068 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2069 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2070 )
2071# make sure $bindir is in USER_PATH so scp will work
2072 t_bindir=`eval echo ${bindir}`
2073 case $t_bindir in
2074 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2075 esac
2076 case $t_bindir in
2077 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2078 esac
2079 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2080 if test $? -ne 0 ; then
2081 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2082 if test $? -ne 0 ; then
2083 user_path=$user_path:$t_bindir
2084 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2085 fi
2086 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002087 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002088)
Tim Rice43a1c132002-04-17 21:19:14 -07002089if test "$USES_LOGIN_CONF" != "yes" ; then
2090 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2091 AC_SUBST(user_path)
2092fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002093
Damien Millera18bbd32002-05-13 10:48:57 +10002094# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002095AC_ARG_WITH(superuser-path,
2096 [ --with-superuser-path= Specify different path for super-user],
2097 [
2098 if test "x$withval" != "xno" ; then
2099 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2100 superuser_path=$withval
2101 fi
2102 ]
2103)
2104
2105
Damien Millera22ba012000-03-02 23:09:20 +11002106# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002107IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002108AC_ARG_WITH(ipv4-default,
2109 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2110 [
2111 if test "x$withval" != "xno" ; then
2112 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002113 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002114 fi
2115 ]
2116)
2117
Damien Miller61e50f12000-05-08 20:49:37 +10002118AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002119IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002120AC_ARG_WITH(4in6,
2121 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2122 [
2123 if test "x$withval" != "xno" ; then
2124 AC_MSG_RESULT(yes)
2125 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002126 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002127 else
2128 AC_MSG_RESULT(no)
2129 fi
2130 ],[
2131 if test "x$inet6_default_4in6" = "xyes"; then
2132 AC_MSG_RESULT([yes (default)])
2133 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002134 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002135 else
2136 AC_MSG_RESULT([no (default)])
2137 fi
2138 ]
2139)
2140
Damien Miller60396b02001-02-18 17:01:00 +11002141# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002142BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002143AC_ARG_WITH(bsd-auth,
2144 [ --with-bsd-auth Enable BSD auth support],
2145 [
2146 if test "x$withval" != "xno" ; then
2147 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002148 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002149 fi
2150 ]
2151)
2152
Damien Millera22ba012000-03-02 23:09:20 +11002153# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002154piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002155# make sure the directory exists
2156if test ! -d $piddir ; then
2157 piddir=`eval echo ${sysconfdir}`
2158 case $piddir in
2159 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2160 esac
2161fi
2162
Tim Rice88f2ab52002-03-17 12:17:34 -08002163AC_ARG_WITH(pid-dir,
2164 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2165 [
2166 if test "x$withval" != "xno" ; then
2167 piddir=$withval
2168 if test ! -d $piddir ; then
2169 AC_MSG_WARN([** no $piddir directory on this system **])
2170 fi
2171 fi
2172 ]
2173)
2174
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002175AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002176AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002177
andre2ff7b5d2000-06-03 14:57:40 +00002178dnl allow user to disable some login recording features
2179AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002180 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002181 [ AC_DEFINE(DISABLE_LASTLOG) ]
2182)
2183AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002184 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002185 [ AC_DEFINE(DISABLE_UTMP) ]
2186)
2187AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002188 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002189 [ AC_DEFINE(DISABLE_UTMPX) ]
2190)
2191AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002192 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002193 [ AC_DEFINE(DISABLE_WTMP) ]
2194)
2195AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002196 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002197 [ AC_DEFINE(DISABLE_WTMPX) ]
2198)
2199AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002200 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002201 [ AC_DEFINE(DISABLE_LOGIN) ]
2202)
2203AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002204 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002205 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2206)
2207AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002208 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002209 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2210)
2211AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002212 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002213 [
2214 if test "x$withval" = "xno" ; then
2215 AC_DEFINE(DISABLE_LASTLOG)
2216 else
2217 conf_lastlog_location=$withval
2218 fi
2219 ]
2220)
andre2ff7b5d2000-06-03 14:57:40 +00002221
2222dnl lastlog, [uw]tmpx? detection
2223dnl NOTE: set the paths in the platform section to avoid the
2224dnl need for command-line parameters
2225dnl lastlog and [uw]tmp are subject to a file search if all else fails
2226
2227dnl lastlog detection
2228dnl NOTE: the code itself will detect if lastlog is a directory
2229AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2230AC_TRY_COMPILE([
2231#include <sys/types.h>
2232#include <utmp.h>
2233#ifdef HAVE_LASTLOG_H
2234# include <lastlog.h>
2235#endif
Damien Miller2994e082000-06-04 15:51:47 +10002236#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002237# include <paths.h>
2238#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002239#ifdef HAVE_LOGIN_H
2240# include <login.h>
2241#endif
andre2ff7b5d2000-06-03 14:57:40 +00002242 ],
2243 [ char *lastlog = LASTLOG_FILE; ],
2244 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002245 [
2246 AC_MSG_RESULT(no)
2247 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2248 AC_TRY_COMPILE([
2249#include <sys/types.h>
2250#include <utmp.h>
2251#ifdef HAVE_LASTLOG_H
2252# include <lastlog.h>
2253#endif
2254#ifdef HAVE_PATHS_H
2255# include <paths.h>
2256#endif
2257 ],
2258 [ char *lastlog = _PATH_LASTLOG; ],
2259 [ AC_MSG_RESULT(yes) ],
2260 [
andree441aa32000-06-12 22:34:38 +00002261 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002262 system_lastlog_path=no
2263 ])
2264 ]
andre2ff7b5d2000-06-03 14:57:40 +00002265)
Damien Miller2994e082000-06-04 15:51:47 +10002266
andre2ff7b5d2000-06-03 14:57:40 +00002267if test -z "$conf_lastlog_location"; then
2268 if test x"$system_lastlog_path" = x"no" ; then
2269 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002270 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002271 conf_lastlog_location=$f
2272 fi
2273 done
2274 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002275 AC_MSG_WARN([** Cannot find lastlog **])
2276 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002277 fi
2278 fi
2279fi
2280
2281if test -n "$conf_lastlog_location"; then
2282 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2283fi
2284
2285dnl utmp detection
2286AC_MSG_CHECKING([if your system defines UTMP_FILE])
2287AC_TRY_COMPILE([
2288#include <sys/types.h>
2289#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002290#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002291# include <paths.h>
2292#endif
2293 ],
2294 [ char *utmp = UTMP_FILE; ],
2295 [ AC_MSG_RESULT(yes) ],
2296 [ AC_MSG_RESULT(no)
2297 system_utmp_path=no ]
2298)
2299if test -z "$conf_utmp_location"; then
2300 if test x"$system_utmp_path" = x"no" ; then
2301 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2302 if test -f $f ; then
2303 conf_utmp_location=$f
2304 fi
2305 done
2306 if test -z "$conf_utmp_location"; then
2307 AC_DEFINE(DISABLE_UTMP)
2308 fi
2309 fi
2310fi
2311if test -n "$conf_utmp_location"; then
2312 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2313fi
2314
2315dnl wtmp detection
2316AC_MSG_CHECKING([if your system defines WTMP_FILE])
2317AC_TRY_COMPILE([
2318#include <sys/types.h>
2319#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002320#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002321# include <paths.h>
2322#endif
2323 ],
2324 [ char *wtmp = WTMP_FILE; ],
2325 [ AC_MSG_RESULT(yes) ],
2326 [ AC_MSG_RESULT(no)
2327 system_wtmp_path=no ]
2328)
2329if test -z "$conf_wtmp_location"; then
2330 if test x"$system_wtmp_path" = x"no" ; then
2331 for f in /usr/adm/wtmp /var/log/wtmp; do
2332 if test -f $f ; then
2333 conf_wtmp_location=$f
2334 fi
2335 done
2336 if test -z "$conf_wtmp_location"; then
2337 AC_DEFINE(DISABLE_WTMP)
2338 fi
2339 fi
2340fi
2341if test -n "$conf_wtmp_location"; then
2342 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2343fi
2344
2345
2346dnl utmpx detection - I don't know any system so perverse as to require
2347dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2348dnl there, though.
2349AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2350AC_TRY_COMPILE([
2351#include <sys/types.h>
2352#include <utmp.h>
2353#ifdef HAVE_UTMPX_H
2354#include <utmpx.h>
2355#endif
Damien Miller2994e082000-06-04 15:51:47 +10002356#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002357# include <paths.h>
2358#endif
2359 ],
2360 [ char *utmpx = UTMPX_FILE; ],
2361 [ AC_MSG_RESULT(yes) ],
2362 [ AC_MSG_RESULT(no)
2363 system_utmpx_path=no ]
2364)
2365if test -z "$conf_utmpx_location"; then
2366 if test x"$system_utmpx_path" = x"no" ; then
2367 AC_DEFINE(DISABLE_UTMPX)
2368 fi
2369else
2370 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2371fi
2372
2373dnl wtmpx detection
2374AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2375AC_TRY_COMPILE([
2376#include <sys/types.h>
2377#include <utmp.h>
2378#ifdef HAVE_UTMPX_H
2379#include <utmpx.h>
2380#endif
Damien Miller2994e082000-06-04 15:51:47 +10002381#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002382# include <paths.h>
2383#endif
2384 ],
2385 [ char *wtmpx = WTMPX_FILE; ],
2386 [ AC_MSG_RESULT(yes) ],
2387 [ AC_MSG_RESULT(no)
2388 system_wtmpx_path=no ]
2389)
2390if test -z "$conf_wtmpx_location"; then
2391 if test x"$system_wtmpx_path" = x"no" ; then
2392 AC_DEFINE(DISABLE_WTMPX)
2393 fi
2394else
2395 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2396fi
2397
Damien Miller4018c192000-04-30 09:30:44 +10002398
Damien Miller29ea30d2000-03-17 10:54:15 +11002399if test ! -z "$blibpath" ; then
2400 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2401 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2402fi
2403
Tim Rice4cec93f2002-02-26 08:40:48 -08002404dnl remove pam and dl because they are in $LIBPAM
2405if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002406 LIBS=`echo $LIBS | sed 's/-lpam //'`
2407fi
2408if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2409 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002410fi
2411
Damien Millerbac2d8a2000-09-05 16:13:06 +11002412AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002413AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2414AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002415
Damien Miller7b22d652000-06-18 14:07:04 +10002416# Print summary of options
2417
Damien Miller7b22d652000-06-18 14:07:04 +10002418# Someone please show me a better way :)
2419A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2420B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2421C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2422D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002423E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002424F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002425G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002426H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2427I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2428J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002429
2430echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002431echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002432echo " User binaries: $B"
2433echo " System binaries: $C"
2434echo " Configuration files: $D"
2435echo " Askpass program: $E"
2436echo " Manual pages: $F"
2437echo " PID file: $G"
2438echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002439if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002440echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002441else
Damien Millerf58c6722002-05-13 13:15:42 +10002442echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002443fi
Damien Millera18bbd32002-05-13 10:48:57 +10002444if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002445echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002446fi
Damien Millerf58c6722002-05-13 13:15:42 +10002447echo " Manpage format: $MANTYPE"
2448echo " PAM support: ${PAM_MSG}"
2449echo " KerberosIV support: $KRB4_MSG"
2450echo " KerberosV support: $KRB5_MSG"
2451echo " Smartcard support: $SCARD_MSG"
2452echo " AFS support: $AFS_MSG"
2453echo " S/KEY support: $SKEY_MSG"
2454echo " TCP Wrappers support: $TCPW_MSG"
2455echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002456echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002457echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2458echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2459echo " BSD Auth support: $BSD_AUTH_MSG"
2460echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002461if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002462echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002463fi
2464
Damien Miller7b22d652000-06-18 14:07:04 +10002465echo ""
2466
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002467echo " Host: ${host}"
2468echo " Compiler: ${CC}"
2469echo " Compiler flags: ${CFLAGS}"
2470echo "Preprocessor flags: ${CPPFLAGS}"
2471echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002472echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002473
2474echo ""
2475
Damien Miller82cf0ce2000-12-20 13:34:48 +11002476if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002477 echo "PAM is enabled. You may need to install a PAM control file "
2478 echo "for sshd, otherwise password authentication may fail. "
2479 echo "Example PAM control files can be found in the contrib/ "
2480 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002481 echo ""
2482fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002483
2484if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002485 echo "sftp-server will be disabled. Your compiler does not "
2486 echo "support 64bit integers."
2487 echo ""
2488fi
2489
2490if test ! -z "$RAND_HELPER_CMDHASH" ; then
2491 echo "WARNING: you are using the builtin random number collection "
2492 echo "service. Please read WARNING.RNG and request that your OS "
2493 echo "vendor includes kernel-based random number collection in "
2494 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002495 echo ""
2496fi
Damien Miller60396b02001-02-18 17:01:00 +11002497