blob: c8aa7e18401c8bbac730978c9c5bc549ea12838d [file] [log] [blame]
Ben Lindstrom232ccf72002-07-22 23:34:25 +00001# $Id: configure.ac,v 1.83 2002/07/22 23:34:25 mouring Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Tim Rice13aae5e2001-10-21 17:53:58 -07003AC_INIT
4AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +10005
6AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11007AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11008AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11009AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100010
Damien Millera22ba012000-03-02 23:09:20 +110011# Checks for programs.
Damien Millerab18c411999-11-11 10:40:23 +110012AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100013AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110014AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000015AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070016AC_PATH_PROGS(PERL, perl5 perl)
Damien Millere79334a1999-12-29 10:03:37 +110017AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100018AC_PATH_PROG(ENT, ent)
19AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110020AC_PATH_PROG(TEST_MINUS_S_SH, bash)
21AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
22AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070023AC_PATH_PROG(SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110024
Damien Millere8bb4502001-09-25 16:39:35 +100025# System features
26AC_SYS_LARGEFILE
27
Damien Miller3f62aba2000-11-29 11:56:35 +110028if test -z "$AR" ; then
29 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
30fi
31
Damien Millerad833b32000-08-23 10:46:23 +100032# Use LOGIN_PROGRAM from environment if possible
33if test ! -z "$LOGIN_PROGRAM" ; then
34 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
35else
36 # Search for login
37 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
38 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
39 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
40 fi
41fi
42
Damien Miller166bd442000-03-16 10:48:25 +110043if test -z "$LD" ; then
44 LD=$CC
45fi
46AC_SUBST(LD)
47
Damien Miller166bd442000-03-16 10:48:25 +110048AC_C_INLINE
Damien Miller649d9992001-06-27 23:35:51 +100049if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
50 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110051fi
52
Damien Millera22ba012000-03-02 23:09:20 +110053# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110054case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110055*-*-aix*)
56 AFS_LIBS="-lld"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000057 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110058 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100059 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Millerfa2bb692002-04-23 23:22:25 +100060 AC_MSG_CHECKING([if linkage editor ($LD) accepts -blibpath])
61 saved_LDFLAGS="$LDFLAGS"
62 LDFLAGS="$LDFLAGS -blibpath:/usr/lib:/lib:/usr/local/lib"
63 AC_TRY_LINK([],
64 [],
65 [
66 AC_MSG_RESULT(yes)
67 blibpath="/usr/lib:/lib:/usr/local/lib"
68 ],
69 [ AC_MSG_RESULT(no) ]
70 )
71 LDFLAGS="$saved_LDFLAGS"
Damien Miller29ea30d2000-03-17 10:54:15 +110072 fi
Tim Ricee958ed32002-07-05 07:12:33 -070073 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
74 [AC_CHECK_LIB(s,authenticate,
75 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
76 LIBS="$LIBS -ls"
77 ])
78 ])
Damien Millereca71f82000-01-20 22:38:27 +110079 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +100080 AC_DEFINE(BROKEN_REALPATH)
andre60f3c982000-06-03 16:18:19 +000081 dnl AIX handles lastlog as part of its login message
82 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +000083 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller75b1d102000-01-07 14:01:41 +110084 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110085*-*-cygwin*)
Tim Ricefe1d1002001-11-26 17:19:43 -080086 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110087 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +000088 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +110089 AC_DEFINE(DISABLE_SHADOW)
90 AC_DEFINE(IPV4_DEFAULT)
91 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +000092 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +000093 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -070094 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +000095 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +110096 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000097*-*-dgux*)
98 AC_DEFINE(IP_TOS_IS_BROKEN)
99 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000100*-*-darwin*)
101 AC_DEFINE(BROKEN_GETADDRINFO)
102 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000103*-*-hpux10.26)
104 if test -z "$GCC"; then
105 CFLAGS="$CFLAGS -Ae"
106 fi
107 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
108 IPADDR_IN_DISPLAY=yes
109 AC_DEFINE(HAVE_SECUREWARE)
110 AC_DEFINE(USE_PIPES)
111 AC_DEFINE(LOGIN_NO_ENDOPT)
112 AC_DEFINE(LOGIN_NEEDS_UTMPX)
113 AC_DEFINE(DISABLE_SHADOW)
114 AC_DEFINE(DISABLE_UTMP)
115 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700116 LIBS="$LIBS -lsec -lsecpw"
117 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000118 disable_ptmx_check=yes
119 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100120*-*-hpux10*)
121 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000122 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100123 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000124 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100125 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000126 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000127 AC_DEFINE(LOGIN_NO_ENDOPT)
128 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100129 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100130 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000131 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700132 LIBS="$LIBS -lsec"
133 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100134 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000135*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000136 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100137 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100138 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100139 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000140 AC_DEFINE(LOGIN_NO_ENDOPT)
141 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100142 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100143 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000144 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700145 LIBS="$LIBS -lsec"
146 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000147 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100148*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000149 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000150 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100151 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000152 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000153 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller1808f382000-01-06 12:03:12 +1100154 ;;
155*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000156 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000157 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100158 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000159 AC_DEFINE(WITH_IRIX_ARRAY)
160 AC_DEFINE(WITH_IRIX_PROJECT)
161 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000162 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000163 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000164 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100165 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100166*-*-linux*)
167 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100168 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100169 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000170 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100171 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100172 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000173mips-sony-bsd|mips-sony-newsos4)
174 AC_DEFINE(HAVE_NEWS4)
175 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000176 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100177*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100178 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100179 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100180*-*-freebsd*)
181 check_for_libcrypt_later=1
182 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000183*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000184 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100185 conf_utmp_location=/etc/utmp
186 conf_wtmp_location=/usr/adm/wtmp
187 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000188 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000189 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000190 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100191 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000192 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000193 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000194 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100195*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000196 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000197 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100198 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100199 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000200 AC_DEFINE(LOGIN_NEEDS_UTMPX)
201 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000202 AC_DEFINE(PAM_TTY_KLUDGE)
andre2ff7b5d2000-06-03 14:57:40 +0000203 # hardwire lastlog location (can't detect it on some versions)
204 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000205 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
206 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
207 if test "$sol2ver" -ge 8; then
208 AC_MSG_RESULT(yes)
209 AC_DEFINE(DISABLE_UTMP)
210 AC_DEFINE(DISABLE_WTMP)
211 else
212 AC_MSG_RESULT(no)
213 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100214 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000215*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000216 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000217 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100218 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000219 conf_utmp_location=/etc/utmp
220 conf_wtmp_location=/var/adm/wtmp
221 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000222 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000223 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000224*-ncr-sysv*)
225 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
226 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700227 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000228 AC_DEFINE(USE_PIPES)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000229 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000230*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000231 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700232 # /usr/ucblib MUST NOT be searched on ReliantUNIX
233 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100234 IPADDR_IN_DISPLAY=yes
235 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000236 AC_DEFINE(IP_TOS_IS_BROKEN)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700237 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
238 # Attention: always take care to bind libsocket and libnsl before libc,
239 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000240 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100241*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000242 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100243 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100244 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100245 ;;
246*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000247 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100248 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100249 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100250 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100251*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000252 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100253 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100254 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100255*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000256 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100257 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700258 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100259 RANLIB=true
260 no_dev_ptmx=1
261 AC_DEFINE(BROKEN_SYS_TERMIO_H)
262 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000263 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000264 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100265 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100266 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700267 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700268 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100269 ;;
270*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000271 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000272 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100273 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000274 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100275 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000276 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000277 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700278 AC_DEFINE(DISABLE_FD_PASSING)
Damien Miller217f5672001-02-16 12:12:41 +1100279 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700280 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000281 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000282*-*-unicosmk*)
283 no_libsocket=1
284 no_libnsl=1
285 AC_DEFINE(USE_PIPES)
286 AC_DEFINE(DISABLE_FD_PASSING)
287 LDFLAGS="$LDFLAGS"
288 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
289 MANTYPE=cat
Ben Lindstromd9e08242001-07-22 19:32:00 +0000290*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700291 no_libsocket=1
292 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000293 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700294 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000295 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
296 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
297 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700298 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000299*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000300 AC_MSG_CHECKING(for Digital Unix SIA)
301 no_osfsia=""
302 AC_ARG_WITH(osfsia,
303 [ --with-osfsia Enable Digital Unix SIA],
304 [
305 if test "x$withval" = "xno" ; then
306 AC_MSG_RESULT(disabled)
307 no_osfsia=1
308 fi
309 ],
310 )
311 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000312 if test -f /etc/sia/matrix.conf; then
313 AC_MSG_RESULT(yes)
314 AC_DEFINE(HAVE_OSF_SIA)
315 AC_DEFINE(DISABLE_LOGIN)
316 LIBS="$LIBS -lsecurity -ldb -lm -laud"
317 else
318 AC_MSG_RESULT(no)
319 fi
320 fi
321 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000322
323*-*-nto-qnx)
324 AC_DEFINE(USE_PIPES)
325 AC_DEFINE(NO_X11_UNIX_SOCKETS)
326 AC_DEFINE(MISSING_NFDBITS)
327 AC_DEFINE(MISSING_HOWMANY)
328 AC_DEFINE(MISSING_FD_MASK)
329 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100330esac
331
Damien Millere37bfc12000-06-05 09:37:43 +1000332# Allow user to specify flags
333AC_ARG_WITH(cflags,
334 [ --with-cflags Specify additional flags to pass to compiler],
335 [
336 if test "x$withval" != "xno" ; then
337 CFLAGS="$CFLAGS $withval"
338 fi
339 ]
340)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000341AC_ARG_WITH(cppflags,
342 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
343 [
344 if test "x$withval" != "xno"; then
345 CPPFLAGS="$CPPFLAGS $withval"
346 fi
347 ]
348)
Damien Millere37bfc12000-06-05 09:37:43 +1000349AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000350 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000351 [
352 if test "x$withval" != "xno" ; then
353 LDFLAGS="$LDFLAGS $withval"
354 fi
355 ]
356)
357AC_ARG_WITH(libs,
358 [ --with-libs Specify additional libraries to link with],
359 [
360 if test "x$withval" != "xno" ; then
361 LIBS="$LIBS $withval"
362 fi
363 ]
364)
365
Tim Rice4cec93f2002-02-26 08:40:48 -0800366# Checks for header files.
367AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
368 getopt.h glob.h lastlog.h limits.h login.h \
369 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000370 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000371 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800372 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000373 sys/mman.h sys/select.h sys/stat.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800374 sys/stropts.h sys/sysmacros.h sys/time.h \
Kevin Steves117b06d2002-03-30 17:55:21 +0000375 sys/un.h time.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800376 util.h utime.h utmp.h utmpx.h)
377
Damien Millera22ba012000-03-02 23:09:20 +1100378# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700379AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
380AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000381
Damien Millerdf288022001-02-18 13:07:07 +1100382dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700383if test "x$with_tcp_wrappers" != "xno" ; then
384 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
385 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
386 fi
387fi
Damien Millerdf288022001-02-18 13:07:07 +1100388
Tim Rice13aae5e2001-10-21 17:53:58 -0700389AC_CHECK_FUNC(getspnam, ,
390 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700391
Damien Miller150c8b52002-02-13 23:06:56 +1100392AC_ARG_WITH(rpath,
393 [ --without-rpath Disable auto-added -R linker paths],
394 [
395 if test "x$withval" = "xno" ; then
396 need_dash_r=""
397 fi
398 if test "x$withval" = "xyes" ; then
399 need_dash_r=1
400 fi
401 ]
402)
403
Tim Rice13aae5e2001-10-21 17:53:58 -0700404dnl zlib is required
405AC_ARG_WITH(zlib,
406 [ --with-zlib=PATH Use zlib in PATH],
407 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000408 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100409 AC_MSG_ERROR([*** zlib is required ***])
410 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700411 if test -d "$withval/lib"; then
412 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700413 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700414 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700415 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700416 fi
417 else
418 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700419 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700420 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700421 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700422 fi
423 fi
424 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700425 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700426 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700427 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700428 fi
429 ]
430)
431
Tim Rice17b93e52001-10-23 22:36:54 -0700432AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100433
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000434dnl UnixWare 2.x
435AC_CHECK_FUNC(strcasecmp,
436 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
437)
438AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700439 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
440 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000441)
Damien Millerab18c411999-11-11 10:40:23 +1100442
Tim Ricee589a292001-11-03 11:09:32 -0800443dnl Checks for libutil functions
444AC_CHECK_HEADERS(libutil.h)
445AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
446AC_CHECK_FUNCS(logout updwtmp logwtmp)
447
Ben Lindstrom8697e082001-02-24 21:41:10 +0000448AC_FUNC_STRFTIME
449
Damien Miller3c027682001-03-14 11:39:45 +1100450# Check for ALTDIRFUNC glob() extension
451AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
452AC_EGREP_CPP(FOUNDIT,
453 [
454 #include <glob.h>
455 #ifdef GLOB_ALTDIRFUNC
456 FOUNDIT
457 #endif
458 ],
459 [
460 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
461 AC_MSG_RESULT(yes)
462 ],
463 [
464 AC_MSG_RESULT(no)
465 ]
466)
Damien Millerab18c411999-11-11 10:40:23 +1100467
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000468# Check for g.gl_matchc glob() extension
469AC_MSG_CHECKING(for gl_matchc field in glob_t)
470AC_EGREP_CPP(FOUNDIT,
471 [
472 #include <glob.h>
473 int main(void){glob_t g; g.gl_matchc = 1;}
474 ],
475 [
476 AC_DEFINE(GLOB_HAS_GL_MATCHC)
477 AC_MSG_RESULT(yes)
478 ],
479 [
480 AC_MSG_RESULT(no)
481 ]
482)
483
Damien Miller18bb4732001-03-28 14:35:30 +1000484AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
485AC_TRY_RUN(
486 [
487#include <sys/types.h>
488#include <dirent.h>
489int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
490 ],
491 [AC_MSG_RESULT(yes)],
492 [
493 AC_MSG_RESULT(no)
494 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
495 ]
496)
497
Damien Millerc547bf12001-02-16 10:18:12 +1100498# Check whether user wants S/Key support
499SKEY_MSG="no"
500AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700501 [ --with-skey[[=PATH]] Enable S/Key support
502 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100503 [
504 if test "x$withval" != "xno" ; then
505
506 if test "x$withval" != "xyes" ; then
507 CPPFLAGS="$CPPFLAGS -I${withval}/include"
508 LDFLAGS="$LDFLAGS -L${withval}/lib"
509 fi
510
511 AC_DEFINE(SKEY)
512 LIBS="-lskey $LIBS"
513 SKEY_MSG="yes"
514
Tim Rice4cec93f2002-02-26 08:40:48 -0800515 AC_MSG_CHECKING([for s/key support])
516 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100517 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800518#include <stdio.h>
519#include <skey.h>
520int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
521 ],
522 [AC_MSG_RESULT(yes)],
523 [
524 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100525 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
526 ])
527 fi
528 ]
529)
530
531# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700532TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100533AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700534 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
535 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100536 [
537 if test "x$withval" != "xno" ; then
538 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700539 saved_LDFLAGS="$LDFLAGS"
540 saved_CPPFLAGS="$CPPFLAGS"
541 if test -n "${withval}" -a "${withval}" != "yes"; then
542 if test -d "${withval}/lib"; then
543 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700544 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700545 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700546 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700547 fi
548 else
549 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700550 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700551 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700552 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700553 fi
554 fi
555 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700556 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700557 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700558 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700559 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700560 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800561 LIBWRAP="-lwrap"
562 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100563 AC_MSG_CHECKING(for libwrap)
564 AC_TRY_LINK(
565 [
566#include <tcpd.h>
567 int deny_severity = 0, allow_severity = 0;
568 ],
569 [hosts_access(0);],
570 [
571 AC_MSG_RESULT(yes)
572 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800573 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700574 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100575 ],
576 [
577 AC_MSG_ERROR([*** libwrap missing])
578 ]
579 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800580 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100581 fi
582 ]
583)
584
Damien Millerad833b32000-08-23 10:46:23 +1000585dnl Checks for library functions.
Ben Lindstromfdee8ef2002-04-06 23:52:02 +0000586AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
Tim Rice13aae5e2001-10-21 17:53:58 -0700587 clock fchmod fchown freeaddrinfo futimes gai_strerror \
588 getaddrinfo getcwd getgrouplist getnameinfo getopt \
589 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
590 inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller594a71b2002-04-23 20:22:59 +1000591 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
592 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
Ben Lindstrom837461b2002-06-12 16:57:14 +0000593 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
Ben Lindstromf0bfa832002-06-21 00:01:18 +0000594 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
595 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
596 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
Tim Rice13aae5e2001-10-21 17:53:58 -0700597
598dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700599AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700600 AC_CHECK_LIB(gen, dirname,[
601 AC_CACHE_CHECK([for broken dirname],
602 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700603 save_LIBS="$LIBS"
604 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700605 AC_TRY_RUN(
606 [
607#include <libgen.h>
608#include <string.h>
609
610int main(int argc, char **argv) {
611 char *s, buf[32];
612
613 strncpy(buf,"/etc", 32);
614 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700615 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700616 exit(1);
617 } else {
618 exit(0);
619 }
620}
621 ],
622 [ ac_cv_have_broken_dirname="no" ],
623 [ ac_cv_have_broken_dirname="yes" ]
624 )
Tim Rice17b93e52001-10-23 22:36:54 -0700625 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700626 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700627 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700628 LIBS="$LIBS -lgen"
629 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700630 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700631 fi
632 ])
633])
634
Damien Millerad833b32000-08-23 10:46:23 +1000635dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000636AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000637dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000638AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000639AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000640dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000641AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000642AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100643
Damien Miller04f80141999-11-19 15:32:34 +1100644AC_CHECK_FUNC(daemon,
645 [AC_DEFINE(HAVE_DAEMON)],
646 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
647)
648
Damien Miller9fb07e42000-03-05 16:22:59 +1100649AC_CHECK_FUNC(getpagesize,
650 [AC_DEFINE(HAVE_GETPAGESIZE)],
651 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
652)
653
Damien Millercb170cb2000-07-01 16:52:55 +1000654# Check for broken snprintf
655if test "x$ac_cv_func_snprintf" = "xyes" ; then
656 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
657 AC_TRY_RUN(
658 [
659#include <stdio.h>
660int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
661 ],
662 [AC_MSG_RESULT(yes)],
663 [
664 AC_MSG_RESULT(no)
665 AC_DEFINE(BROKEN_SNPRINTF)
666 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
667 ]
668 )
669fi
670
Damien Miller606f8802000-09-16 15:39:56 +1100671AC_FUNC_GETPGRP
672
Damien Millera64b57a2001-01-17 10:44:13 +1100673# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000674PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100675AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100676 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100677 [
Damien Millera64b57a2001-01-17 10:44:13 +1100678 if test "x$withval" != "xno" ; then
679 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
680 AC_MSG_ERROR([PAM headers not found])
681 fi
682
683 AC_CHECK_LIB(dl, dlopen, , )
684 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
685 AC_CHECK_FUNCS(pam_getenvlist)
686
687 disable_shadow=yes
688 PAM_MSG="yes"
689
690 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800691 if test $ac_cv_lib_dl_dlopen = yes; then
692 LIBPAM="-lpam -ldl"
693 else
694 LIBPAM="-lpam"
695 fi
696 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100697 fi
698 ]
699)
Damien Millera22ba012000-03-02 23:09:20 +1100700
Damien Millera64b57a2001-01-17 10:44:13 +1100701# Check for older PAM
702if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100703 # Check PAM strerror arguments (old PAM)
704 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
705 AC_TRY_COMPILE(
706 [
Damien Miller81171112000-04-23 11:14:01 +1000707#include <stdlib.h>
708#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100709 ],
710 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
711 [AC_MSG_RESULT(no)],
712 [
713 AC_DEFINE(HAVE_OLD_PAM)
714 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000715 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100716 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100717 )
Damien Millera22ba012000-03-02 23:09:20 +1100718fi
719
Tim Riceaef73712002-05-11 13:17:42 -0700720# Search for OpenSSL
721saved_CPPFLAGS="$CPPFLAGS"
722saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100723AC_ARG_WITH(ssl-dir,
724 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
725 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000726 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700727 if test -d "$withval/lib"; then
728 if test -n "${need_dash_r}"; then
729 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
730 else
731 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
732 fi
733 else
734 if test -n "${need_dash_r}"; then
735 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
736 else
737 LDFLAGS="-L${withval} ${LDFLAGS}"
738 fi
739 fi
740 if test -d "$withval/include"; then
741 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
742 else
743 CPPFLAGS="-I${withval} ${CPPFLAGS}"
744 fi
Damien Millera22ba012000-03-02 23:09:20 +1100745 fi
746 ]
747)
Tim Riceaef73712002-05-11 13:17:42 -0700748LIBS="$LIBS -lcrypto"
749AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000750 [
Tim Riceaef73712002-05-11 13:17:42 -0700751 dnl Check default openssl install dir
752 if test -n "${need_dash_r}"; then
753 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000754 else
Tim Riceaef73712002-05-11 13:17:42 -0700755 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000756 fi
Tim Riceaef73712002-05-11 13:17:42 -0700757 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
758 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
759 [
760 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
761 ]
762 )
763 ]
764)
765
Damien Millera22ba012000-03-02 23:09:20 +1100766
Damien Millerec932372002-01-22 22:16:03 +1100767# Sanity check OpenSSL headers
768AC_MSG_CHECKING([whether OpenSSL's headers match the library])
769AC_TRY_RUN(
770 [
771#include <string.h>
772#include <openssl/opensslv.h>
773int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
774 ],
775 [
776 AC_MSG_RESULT(yes)
777 ],
778 [
779 AC_MSG_RESULT(no)
780 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
781 ]
782)
783
Damien Millera64b57a2001-01-17 10:44:13 +1100784# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
785# version in OpenSSL. Skip this for PAM
786if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100787 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100788fi
789
Damien Miller6c21c512002-01-22 21:57:53 +1100790
791### Configure cryptographic random number support
792
793# Check wheter OpenSSL seeds itself
794AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
795AC_TRY_RUN(
796 [
797#include <string.h>
798#include <openssl/rand.h>
799int main(void) { return(RAND_status() == 1 ? 0 : 1); }
800 ],
801 [
802 OPENSSL_SEEDS_ITSELF=yes
803 AC_MSG_RESULT(yes)
804 ],
805 [
806 AC_MSG_RESULT(no)
807 # Default to use of the rand helper if OpenSSL doesn't
808 # seed itself
809 USE_RAND_HELPER=yes
810 ]
811)
812
813
814# Do we want to force the use of the rand helper?
815AC_ARG_WITH(rand-helper,
816 [ --with-rand-helper Use subprocess to gather strong randomness ],
817 [
818 if test "x$withval" = "xno" ; then
819 # Force use of OpenSSL's internal RNG, even if
820 # the previous test showed it to be unseeded.
821 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
822 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
823 OPENSSL_SEEDS_ITSELF=yes
824 USE_RAND_HELPER=""
825 fi
826 else
827 USE_RAND_HELPER=yes
828 fi
829 ],
830)
831
832# Which randomness source do we use?
833if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
834 # OpenSSL only
835 AC_DEFINE(OPENSSL_PRNG_ONLY)
836 RAND_MSG="OpenSSL internal ONLY"
837 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800838elif test ! -z "$USE_RAND_HELPER" ; then
839 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100840 RAND_MSG="ssh-rand-helper"
841 INSTALL_SSH_RAND_HELPER="yes"
842fi
843AC_SUBST(INSTALL_SSH_RAND_HELPER)
844
845### Configuration of ssh-rand-helper
846
847# PRNGD TCP socket
848AC_ARG_WITH(prngd-port,
849 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
850 [
Damien Millere996d722002-01-23 11:20:59 +1100851 case "$withval" in
852 no)
853 withval=""
854 ;;
855 [[0-9]]*)
856 ;;
857 *)
858 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
859 ;;
860 esac
861 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100862 PRNGD_PORT="$withval"
863 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
864 fi
865 ]
866)
867
868# PRNGD Unix domain socket
869AC_ARG_WITH(prngd-socket,
870 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
871 [
Damien Millere996d722002-01-23 11:20:59 +1100872 case "$withval" in
873 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100874 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100875 ;;
876 no)
877 withval=""
878 ;;
879 /*)
880 ;;
881 *)
882 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
883 ;;
884 esac
885
886 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100887 if test ! -z "$PRNGD_PORT" ; then
888 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
889 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100890 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100891 AC_MSG_WARN(Entropy socket is not readable)
892 fi
893 PRNGD_SOCKET="$withval"
894 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
895 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800896 ],
897 [
898 # Check for existing socket only if we don't have a random device already
899 if test "$USE_RAND_HELPER" = yes ; then
900 AC_MSG_CHECKING(for PRNGD/EGD socket)
901 # Insert other locations here
902 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
903 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
904 PRNGD_SOCKET="$sock"
905 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
906 break;
907 fi
908 done
909 if test ! -z "$PRNGD_SOCKET" ; then
910 AC_MSG_RESULT($PRNGD_SOCKET)
911 else
912 AC_MSG_RESULT(not found)
913 fi
914 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100915 ]
916)
917
918# Change default command timeout for hashing entropy source
919entropy_timeout=200
920AC_ARG_WITH(entropy-timeout,
921 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
922 [
923 if test "x$withval" != "xno" ; then
924 entropy_timeout=$withval
925 fi
926 ]
927)
Damien Miller6c21c512002-01-22 21:57:53 +1100928AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
929
Damien Millerd3f6ad22002-06-25 10:24:47 +1000930SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +0000931AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +0000932 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +0000933 [
934 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +1000935 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +0000936 fi
937 ]
938)
Damien Millerd3f6ad22002-06-25 10:24:47 +1000939AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
940AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +0000941
Tim Rice88f2ab52002-03-17 12:17:34 -0800942# We do this little dance with the search path to insure
943# that programs that we select for use by installed programs
944# (which may be run by the super-user) come from trusted
945# locations before they come from the user's private area.
946# This should help avoid accidentally configuring some
947# random version of a program in someone's personal bin.
948
949OPATH=$PATH
950PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -0700951test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -0800952test -d /sbin && PATH=$PATH:/sbin
953test -d /usr/sbin && PATH=$PATH:/usr/sbin
954PATH=$PATH:/etc:$OPATH
955
Damien Miller6c21c512002-01-22 21:57:53 +1100956# These programs are used by the command hashing source to gather entropy
957OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
958OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
959OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
960OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
961OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
962OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
963OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
964OSSH_PATH_ENTROPY_PROG(PROG_W, w)
965OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
966OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
967OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
968OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
969OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
970OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
971OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
972OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -0800973# restore PATH
974PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +1100975
976# Where does ssh-rand-helper get its randomness from?
977INSTALL_SSH_PRNG_CMDS=""
978if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
979 if test ! -z "$PRNGD_PORT" ; then
980 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
981 elif test ! -z "$PRNGD_SOCKET" ; then
982 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
983 else
984 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
985 RAND_HELPER_CMDHASH=yes
986 INSTALL_SSH_PRNG_CMDS="yes"
987 fi
988fi
989AC_SUBST(INSTALL_SSH_PRNG_CMDS)
990
991
Ben Lindstromb5628642000-10-18 00:02:25 +0000992# Cheap hack to ensure NEWS-OS libraries are arranged right.
993if test ! -z "$SONY" ; then
994 LIBS="$LIBS -liberty";
995fi
996
Damien Millera22ba012000-03-02 23:09:20 +1100997# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100998AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100999AC_CHECK_SIZEOF(short int, 2)
1000AC_CHECK_SIZEOF(int, 4)
1001AC_CHECK_SIZEOF(long int, 4)
1002AC_CHECK_SIZEOF(long long int, 8)
1003
Damien Millerfa2bb692002-04-23 23:22:25 +10001004# Sanity check long long for some platforms (AIX)
1005if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1006 ac_cv_sizeof_long_long_int=0
1007fi
1008
Damien Millera22ba012000-03-02 23:09:20 +11001009# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001010AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1011 AC_TRY_COMPILE(
1012 [ #include <sys/types.h> ],
1013 [ u_int a; a = 1;],
1014 [ ac_cv_have_u_int="yes" ],
1015 [ ac_cv_have_u_int="no" ]
1016 )
1017])
1018if test "x$ac_cv_have_u_int" = "xyes" ; then
1019 AC_DEFINE(HAVE_U_INT)
1020 have_u_int=1
1021fi
1022
Damien Miller61e50f12000-05-08 20:49:37 +10001023AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1024 AC_TRY_COMPILE(
1025 [ #include <sys/types.h> ],
1026 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1027 [ ac_cv_have_intxx_t="yes" ],
1028 [ ac_cv_have_intxx_t="no" ]
1029 )
1030])
1031if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1032 AC_DEFINE(HAVE_INTXX_T)
1033 have_intxx_t=1
1034fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001035
1036if (test -z "$have_intxx_t" && \
1037 test "x$ac_cv_header_stdint_h" = "xyes")
1038then
1039 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1040 AC_TRY_COMPILE(
1041 [ #include <stdint.h> ],
1042 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1043 [
1044 AC_DEFINE(HAVE_INTXX_T)
1045 AC_MSG_RESULT(yes)
1046 ],
1047 [ AC_MSG_RESULT(no) ]
1048 )
1049fi
1050
Damien Miller578783e2000-09-23 14:12:24 +11001051AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1052 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001053 [
1054#include <sys/types.h>
1055#ifdef HAVE_STDINT_H
1056# include <stdint.h>
1057#endif
1058#include <sys/socket.h>
1059#ifdef HAVE_SYS_BITYPES_H
1060# include <sys/bitypes.h>
1061#endif
1062 ],
Damien Miller578783e2000-09-23 14:12:24 +11001063 [ int64_t a; a = 1;],
1064 [ ac_cv_have_int64_t="yes" ],
1065 [ ac_cv_have_int64_t="no" ]
1066 )
1067])
1068if test "x$ac_cv_have_int64_t" = "xyes" ; then
1069 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001070fi
1071
Damien Miller61e50f12000-05-08 20:49:37 +10001072AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1073 AC_TRY_COMPILE(
1074 [ #include <sys/types.h> ],
1075 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1076 [ ac_cv_have_u_intxx_t="yes" ],
1077 [ ac_cv_have_u_intxx_t="no" ]
1078 )
1079])
1080if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1081 AC_DEFINE(HAVE_U_INTXX_T)
1082 have_u_intxx_t=1
1083fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001084
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001085if test -z "$have_u_intxx_t" ; then
1086 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1087 AC_TRY_COMPILE(
1088 [ #include <sys/socket.h> ],
1089 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1090 [
1091 AC_DEFINE(HAVE_U_INTXX_T)
1092 AC_MSG_RESULT(yes)
1093 ],
1094 [ AC_MSG_RESULT(no) ]
1095 )
1096fi
1097
Damien Miller578783e2000-09-23 14:12:24 +11001098AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1099 AC_TRY_COMPILE(
1100 [ #include <sys/types.h> ],
1101 [ u_int64_t a; a = 1;],
1102 [ ac_cv_have_u_int64_t="yes" ],
1103 [ ac_cv_have_u_int64_t="no" ]
1104 )
1105])
1106if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1107 AC_DEFINE(HAVE_U_INT64_T)
1108 have_u_int64_t=1
1109fi
1110
Tim Rice4cec93f2002-02-26 08:40:48 -08001111if test -z "$have_u_int64_t" ; then
1112 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1113 AC_TRY_COMPILE(
1114 [ #include <sys/bitypes.h> ],
1115 [ u_int64_t a; a = 1],
1116 [
1117 AC_DEFINE(HAVE_U_INT64_T)
1118 AC_MSG_RESULT(yes)
1119 ],
1120 [ AC_MSG_RESULT(no) ]
1121 )
1122fi
1123
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001124if test -z "$have_u_intxx_t" ; then
1125 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1126 AC_TRY_COMPILE(
1127 [
1128#include <sys/types.h>
1129 ],
1130 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1131 [ ac_cv_have_uintxx_t="yes" ],
1132 [ ac_cv_have_uintxx_t="no" ]
1133 )
1134 ])
1135 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1136 AC_DEFINE(HAVE_UINTXX_T)
1137 fi
1138fi
1139
1140if test -z "$have_uintxx_t" ; then
1141 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1142 AC_TRY_COMPILE(
1143 [ #include <stdint.h> ],
1144 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1145 [
1146 AC_DEFINE(HAVE_UINTXX_T)
1147 AC_MSG_RESULT(yes)
1148 ],
1149 [ AC_MSG_RESULT(no) ]
1150 )
1151fi
1152
Damien Milleredb82922000-06-20 13:25:52 +10001153if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1154 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001155then
1156 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1157 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001158 [
1159#include <sys/bitypes.h>
1160 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001161 [
Damien Miller70494d12000-04-03 15:57:06 +10001162 int8_t a; int16_t b; int32_t c;
1163 u_int8_t e; u_int16_t f; u_int32_t g;
1164 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001165 ],
1166 [
1167 AC_DEFINE(HAVE_U_INTXX_T)
1168 AC_DEFINE(HAVE_INTXX_T)
1169 AC_MSG_RESULT(yes)
1170 ],
1171 [AC_MSG_RESULT(no)]
1172 )
1173fi
1174
Damien Miller58be7382001-09-15 21:31:54 +10001175
1176AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1177 AC_TRY_COMPILE(
1178 [
1179#include <sys/types.h>
1180 ],
1181 [ u_char foo; foo = 125; ],
1182 [ ac_cv_have_u_char="yes" ],
1183 [ ac_cv_have_u_char="no" ]
1184 )
1185])
1186if test "x$ac_cv_have_u_char" = "xyes" ; then
1187 AC_DEFINE(HAVE_U_CHAR)
1188fi
1189
Tim Rice13aae5e2001-10-21 17:53:58 -07001190TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001191
Tim Rice200a5c02002-02-26 22:12:34 -08001192AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001193
Damien Miller61e50f12000-05-08 20:49:37 +10001194AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1195 AC_TRY_COMPILE(
1196 [
1197#include <sys/types.h>
1198 ],
1199 [ size_t foo; foo = 1235; ],
1200 [ ac_cv_have_size_t="yes" ],
1201 [ ac_cv_have_size_t="no" ]
1202 )
1203])
1204if test "x$ac_cv_have_size_t" = "xyes" ; then
1205 AC_DEFINE(HAVE_SIZE_T)
1206fi
Damien Miller95058511999-12-29 10:36:45 +11001207
Damien Miller615f9392000-05-17 22:53:33 +10001208AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1209 AC_TRY_COMPILE(
1210 [
1211#include <sys/types.h>
1212 ],
1213 [ ssize_t foo; foo = 1235; ],
1214 [ ac_cv_have_ssize_t="yes" ],
1215 [ ac_cv_have_ssize_t="no" ]
1216 )
1217])
1218if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1219 AC_DEFINE(HAVE_SSIZE_T)
1220fi
1221
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001222AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1223 AC_TRY_COMPILE(
1224 [
1225#include <time.h>
1226 ],
1227 [ clock_t foo; foo = 1235; ],
1228 [ ac_cv_have_clock_t="yes" ],
1229 [ ac_cv_have_clock_t="no" ]
1230 )
1231])
1232if test "x$ac_cv_have_clock_t" = "xyes" ; then
1233 AC_DEFINE(HAVE_CLOCK_T)
1234fi
1235
Damien Millerb54b40e2000-06-23 08:23:34 +10001236AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1237 AC_TRY_COMPILE(
1238 [
1239#include <sys/types.h>
1240#include <sys/socket.h>
1241 ],
1242 [ sa_family_t foo; foo = 1235; ],
1243 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001244 [ AC_TRY_COMPILE(
1245 [
1246#include <sys/types.h>
1247#include <sys/socket.h>
1248#include <netinet/in.h>
1249 ],
1250 [ sa_family_t foo; foo = 1235; ],
1251 [ ac_cv_have_sa_family_t="yes" ],
1252
Damien Millerb54b40e2000-06-23 08:23:34 +10001253 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001254 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001255 )
1256])
1257if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1258 AC_DEFINE(HAVE_SA_FAMILY_T)
1259fi
1260
Damien Miller0f91b4e2000-06-18 15:43:25 +10001261AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1262 AC_TRY_COMPILE(
1263 [
1264#include <sys/types.h>
1265 ],
1266 [ pid_t foo; foo = 1235; ],
1267 [ ac_cv_have_pid_t="yes" ],
1268 [ ac_cv_have_pid_t="no" ]
1269 )
1270])
1271if test "x$ac_cv_have_pid_t" = "xyes" ; then
1272 AC_DEFINE(HAVE_PID_T)
1273fi
1274
1275AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1276 AC_TRY_COMPILE(
1277 [
1278#include <sys/types.h>
1279 ],
1280 [ mode_t foo; foo = 1235; ],
1281 [ ac_cv_have_mode_t="yes" ],
1282 [ ac_cv_have_mode_t="no" ]
1283 )
1284])
1285if test "x$ac_cv_have_mode_t" = "xyes" ; then
1286 AC_DEFINE(HAVE_MODE_T)
1287fi
1288
Damien Miller61e50f12000-05-08 20:49:37 +10001289
1290AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1291 AC_TRY_COMPILE(
1292 [
Damien Miller81171112000-04-23 11:14:01 +10001293#include <sys/types.h>
1294#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001295 ],
1296 [ struct sockaddr_storage s; ],
1297 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1298 [ ac_cv_have_struct_sockaddr_storage="no" ]
1299 )
1300])
1301if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1302 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1303fi
Damien Miller34132e52000-01-14 15:45:46 +11001304
Damien Miller61e50f12000-05-08 20:49:37 +10001305AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1306 AC_TRY_COMPILE(
1307 [
Damien Miller7b22d652000-06-18 14:07:04 +10001308#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001309#include <netinet/in.h>
1310 ],
1311 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1312 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1313 [ ac_cv_have_struct_sockaddr_in6="no" ]
1314 )
1315])
1316if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1317 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1318fi
Damien Miller34132e52000-01-14 15:45:46 +11001319
Damien Miller61e50f12000-05-08 20:49:37 +10001320AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1321 AC_TRY_COMPILE(
1322 [
Damien Miller7b22d652000-06-18 14:07:04 +10001323#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001324#include <netinet/in.h>
1325 ],
1326 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1327 [ ac_cv_have_struct_in6_addr="yes" ],
1328 [ ac_cv_have_struct_in6_addr="no" ]
1329 )
1330])
1331if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1332 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1333fi
Damien Miller34132e52000-01-14 15:45:46 +11001334
Damien Miller61e50f12000-05-08 20:49:37 +10001335AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1336 AC_TRY_COMPILE(
1337 [
Damien Miller81171112000-04-23 11:14:01 +10001338#include <sys/types.h>
1339#include <sys/socket.h>
1340#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001341 ],
1342 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1343 [ ac_cv_have_struct_addrinfo="yes" ],
1344 [ ac_cv_have_struct_addrinfo="no" ]
1345 )
1346])
1347if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1348 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1349fi
1350
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001351AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1352 AC_TRY_COMPILE(
1353 [ #include <sys/time.h> ],
1354 [ struct timeval tv; tv.tv_sec = 1;],
1355 [ ac_cv_have_struct_timeval="yes" ],
1356 [ ac_cv_have_struct_timeval="no" ]
1357 )
1358])
1359if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1360 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1361 have_struct_timeval=1
1362fi
1363
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001364# If we don't have int64_t then we can't compile sftp-server. So don't
1365# even attempt to do it.
1366if test "x$ac_cv_have_int64_t" = "xno" -a \
1367 "x$ac_cv_sizeof_long_int" != "x8" -a \
1368 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1369 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001370else
1371dnl test snprintf (broken on SCO w/gcc)
1372 AC_TRY_RUN(
1373 [
1374#include <stdio.h>
1375#include <string.h>
1376#ifdef HAVE_SNPRINTF
1377main()
1378{
1379 char buf[50];
1380 char expected_out[50];
1381 int mazsize = 50 ;
1382#if (SIZEOF_LONG_INT == 8)
1383 long int num = 0x7fffffffffffffff;
1384#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001385 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001386#endif
1387 strcpy(expected_out, "9223372036854775807");
1388 snprintf(buf, mazsize, "%lld", num);
1389 if(strcmp(buf, expected_out) != 0)
1390 exit(1);
1391 exit(0);
1392}
1393#else
1394main() { exit(0); }
1395#endif
1396 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1397 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001398fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001399AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001400
Damien Miller78315eb2000-09-29 23:01:36 +11001401dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001402OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1403OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1404OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1405OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1406OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001407OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001408OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1409OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001410OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001411OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1412OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1413OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1414OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001415OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1416OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1417OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1418OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001419
1420AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001421
Damien Miller61e50f12000-05-08 20:49:37 +10001422AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1423 ac_cv_have_ss_family_in_struct_ss, [
1424 AC_TRY_COMPILE(
1425 [
Damien Miller81171112000-04-23 11:14:01 +10001426#include <sys/types.h>
1427#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001428 ],
1429 [ struct sockaddr_storage s; s.ss_family = 1; ],
1430 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1431 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1432 )
1433])
1434if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1435 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1436fi
1437
Damien Miller61e50f12000-05-08 20:49:37 +10001438AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1439 ac_cv_have___ss_family_in_struct_ss, [
1440 AC_TRY_COMPILE(
1441 [
Damien Miller81171112000-04-23 11:14:01 +10001442#include <sys/types.h>
1443#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001444 ],
1445 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1446 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1447 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1448 )
1449])
1450if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1451 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1452fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001453
Damien Millerad833b32000-08-23 10:46:23 +10001454AC_CACHE_CHECK([for pw_class field in struct passwd],
1455 ac_cv_have_pw_class_in_struct_passwd, [
1456 AC_TRY_COMPILE(
1457 [
Damien Millerad833b32000-08-23 10:46:23 +10001458#include <pwd.h>
1459 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001460 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001461 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1462 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1463 )
1464])
1465if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1466 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1467fi
1468
Kevin Steves82456952001-06-22 21:14:18 +00001469AC_CACHE_CHECK([for pw_expire field in struct passwd],
1470 ac_cv_have_pw_expire_in_struct_passwd, [
1471 AC_TRY_COMPILE(
1472 [
1473#include <pwd.h>
1474 ],
1475 [ struct passwd p; p.pw_expire = 0; ],
1476 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1477 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1478 )
1479])
1480if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1481 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1482fi
1483
1484AC_CACHE_CHECK([for pw_change field in struct passwd],
1485 ac_cv_have_pw_change_in_struct_passwd, [
1486 AC_TRY_COMPILE(
1487 [
1488#include <pwd.h>
1489 ],
1490 [ struct passwd p; p.pw_change = 0; ],
1491 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1492 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1493 )
1494])
1495if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1496 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1497fi
Damien Miller61e50f12000-05-08 20:49:37 +10001498
Tim Rice28bbb0c2002-05-27 17:37:32 -07001499dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001500AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1501 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001502 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001503 [
Tim Riceae49fe62002-04-12 10:26:21 -07001504#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001505#include <sys/socket.h>
1506#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001507int main() {
1508#ifdef msg_accrights
1509exit(1);
1510#endif
1511struct msghdr m;
1512m.msg_accrights = 0;
1513exit(0);
1514}
Kevin Steves939c9db2002-03-22 17:23:25 +00001515 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001516 [ ac_cv_have_accrights_in_msghdr="yes" ],
1517 [ ac_cv_have_accrights_in_msghdr="no" ]
1518 )
1519])
1520if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1521 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1522fi
1523
Kevin Stevesa44e0352002-04-07 16:18:03 +00001524AC_CACHE_CHECK([for msg_control field in struct msghdr],
1525 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001526 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001527 [
Tim Riceae49fe62002-04-12 10:26:21 -07001528#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001529#include <sys/socket.h>
1530#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001531int main() {
1532#ifdef msg_control
1533exit(1);
1534#endif
1535struct msghdr m;
1536m.msg_control = 0;
1537exit(0);
1538}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001539 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001540 [ ac_cv_have_control_in_msghdr="yes" ],
1541 [ ac_cv_have_control_in_msghdr="no" ]
1542 )
1543])
1544if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1545 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1546fi
1547
Damien Miller61e50f12000-05-08 20:49:37 +10001548AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1549 AC_TRY_LINK([],
1550 [ extern char *__progname; printf("%s", __progname); ],
1551 [ ac_cv_libc_defines___progname="yes" ],
1552 [ ac_cv_libc_defines___progname="no" ]
1553 )
1554])
1555if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1556 AC_DEFINE(HAVE___PROGNAME)
1557fi
1558
Kevin Steves4846f4a2002-03-22 18:19:53 +00001559AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1560 AC_TRY_LINK([
1561#include <stdio.h>
1562],
1563 [ printf("%s", __FUNCTION__); ],
1564 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1565 [ ac_cv_cc_implements___FUNCTION__="no" ]
1566 )
1567])
1568if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1569 AC_DEFINE(HAVE___FUNCTION__)
1570fi
1571
1572AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1573 AC_TRY_LINK([
1574#include <stdio.h>
1575],
1576 [ printf("%s", __func__); ],
1577 [ ac_cv_cc_implements___func__="yes" ],
1578 [ ac_cv_cc_implements___func__="no" ]
1579 )
1580])
1581if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1582 AC_DEFINE(HAVE___func__)
1583fi
1584
Damien Miller4f8e6692001-07-14 13:22:53 +10001585AC_CACHE_CHECK([whether getopt has optreset support],
1586 ac_cv_have_getopt_optreset, [
1587 AC_TRY_LINK(
1588 [
1589#include <getopt.h>
1590 ],
1591 [ extern int optreset; optreset = 0; ],
1592 [ ac_cv_have_getopt_optreset="yes" ],
1593 [ ac_cv_have_getopt_optreset="no" ]
1594 )
1595])
1596if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1597 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1598fi
Damien Millera22ba012000-03-02 23:09:20 +11001599
Damien Millerecbb26d2000-07-15 14:59:14 +10001600AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1601 AC_TRY_LINK([],
1602 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1603 [ ac_cv_libc_defines_sys_errlist="yes" ],
1604 [ ac_cv_libc_defines_sys_errlist="no" ]
1605 )
1606])
1607if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1608 AC_DEFINE(HAVE_SYS_ERRLIST)
1609fi
1610
1611
Damien Miller11fa2cc2000-08-16 10:35:58 +10001612AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1613 AC_TRY_LINK([],
1614 [ extern int sys_nerr; printf("%i", sys_nerr);],
1615 [ ac_cv_libc_defines_sys_nerr="yes" ],
1616 [ ac_cv_libc_defines_sys_nerr="no" ]
1617 )
1618])
1619if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1620 AC_DEFINE(HAVE_SYS_NERR)
1621fi
1622
Damien Miller85de5802001-09-18 14:01:11 +10001623SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001624
1625# Check whether user wants sectok support
1626AC_ARG_WITH(sectok,
1627 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001628 [
1629 if test "x$withval" != "xno" ; then
1630 if test "x$withval" != "xyes" ; then
1631 CPPFLAGS="$CPPFLAGS -I${withval}"
1632 LDFLAGS="$LDFLAGS -L${withval}"
1633 if test ! -z "$need_dash_r" ; then
1634 LDFLAGS="$LDFLAGS -R${withval}"
1635 fi
1636 if test ! -z "$blibpath" ; then
1637 blibpath="$blibpath:${withval}"
1638 fi
1639 fi
1640 AC_CHECK_HEADERS(sectok.h)
1641 if test "$ac_cv_header_sectok_h" != yes; then
1642 AC_MSG_ERROR(Can't find sectok.h)
1643 fi
1644 AC_CHECK_LIB(sectok, sectok_open)
1645 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1646 AC_MSG_ERROR(Can't find libsectok)
1647 fi
1648 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001649 AC_DEFINE(USE_SECTOK)
1650 SCARD_MSG="yes, using sectok"
1651 fi
1652 ]
1653)
1654
1655# Check whether user wants OpenSC support
1656AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001657 AC_HELP_STRING([--with-opensc=PFX],
1658 [Enable smartcard support using OpenSC]),
1659 opensc_config_prefix="$withval", opensc_config_prefix="")
1660if test x$opensc_config_prefix != x ; then
1661 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1662 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1663 if test "$OPENSC_CONFIG" != "no"; then
1664 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1665 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1666 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1667 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1668 AC_DEFINE(SMARTCARD)
1669 AC_DEFINE(USE_OPENSC)
1670 SCARD_MSG="yes, using OpenSC"
1671 fi
1672fi
Damien Miller85de5802001-09-18 14:01:11 +10001673
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001674# Check whether user wants Kerberos 5 support
1675KRB5_MSG="no"
1676AC_ARG_WITH(kerberos5,
1677 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1678 [
1679 if test "x$withval" != "xno" ; then
1680 if test "x$withval" = "xyes" ; then
1681 KRB5ROOT="/usr/local"
1682 else
1683 KRB5ROOT=${withval}
1684 fi
1685 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1686 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1687 AC_DEFINE(KRB5)
1688 KRB5_MSG="yes"
1689 AC_MSG_CHECKING(whether we are using Heimdal)
1690 AC_TRY_COMPILE([ #include <krb5.h> ],
1691 [ char *tmp = heimdal_version; ],
1692 [ AC_MSG_RESULT(yes)
1693 AC_DEFINE(HEIMDAL)
1694 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1695 ],
1696 [ AC_MSG_RESULT(no)
1697 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1698 ]
1699 )
1700 if test ! -z "$need_dash_r" ; then
1701 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1702 fi
1703 if test ! -z "$blibpath" ; then
1704 blibpath="$blibpath:${KRB5ROOT}/lib"
1705 fi
1706 AC_CHECK_LIB(resolv, dn_expand, , )
1707
1708 KRB5=yes
1709 fi
1710 ]
1711)
1712# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001713KRB4_MSG="no"
1714AC_ARG_WITH(kerberos4,
1715 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1716 [
1717 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001718 if test "x$withval" != "xyes" ; then
1719 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1720 LDFLAGS="$LDFLAGS -L${withval}/lib"
1721 if test ! -z "$need_dash_r" ; then
1722 LDFLAGS="$LDFLAGS -R${withval}/lib"
1723 fi
1724 if test ! -z "$blibpath" ; then
1725 blibpath="$blibpath:${withval}/lib"
1726 fi
1727 else
1728 if test -d /usr/include/kerberosIV ; then
1729 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1730 fi
1731 fi
1732
1733 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001734 if test "$ac_cv_header_krb_h" != yes; then
1735 AC_MSG_WARN([Cannot find krb.h, build may fail])
1736 fi
Damien Miller98344742001-03-28 14:37:06 +10001737 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001738 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001739 AC_CHECK_LIB(krb4, main)
1740 if test "$ac_cv_lib_krb4_main" != yes; then
1741 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1742 else
1743 KLIBS="-lkrb4"
1744 fi
1745 else
1746 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001747 fi
Damien Miller98344742001-03-28 14:37:06 +10001748 AC_CHECK_LIB(des, des_cbc_encrypt)
1749 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1750 AC_CHECK_LIB(des425, des_cbc_encrypt)
1751 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1752 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1753 else
1754 KLIBS="-ldes425"
1755 fi
1756 else
1757 KLIBS="-ldes"
1758 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001759 AC_CHECK_LIB(resolv, dn_expand, , )
1760 KRB4=yes
1761 KRB4_MSG="yes"
1762 AC_DEFINE(KRB4)
1763 fi
1764 ]
1765)
1766
1767# Check whether user wants AFS support
1768AFS_MSG="no"
1769AC_ARG_WITH(afs,
1770 [ --with-afs=PATH Enable AFS support],
1771 [
1772 if test "x$withval" != "xno" ; then
1773
1774 if test "x$withval" != "xyes" ; then
1775 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1776 LDFLAGS="$LDFLAGS -L${withval}/lib"
1777 fi
1778
1779 if test -z "$KRB4" ; then
1780 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1781 fi
1782
1783 LIBS="-lkafs $LIBS"
1784 if test ! -z "$AFS_LIBS" ; then
1785 LIBS="$LIBS $AFS_LIBS"
1786 fi
1787 AC_DEFINE(AFS)
1788 AFS_MSG="yes"
1789 fi
1790 ]
1791)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001792LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001793
Damien Millera22ba012000-03-02 23:09:20 +11001794# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11001795
Damien Millerf58c6722002-05-13 13:15:42 +10001796PRIVSEP_PATH=/var/empty
1797AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07001798 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10001799 [
1800 if test "x$withval" != "$no" ; then
1801 PRIVSEP_PATH=$withval
1802 fi
1803 ]
1804)
1805AC_SUBST(PRIVSEP_PATH)
1806
Damien Millera22ba012000-03-02 23:09:20 +11001807AC_ARG_WITH(xauth,
1808 [ --with-xauth=PATH Specify path to xauth program ],
1809 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001810 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001811 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001812 fi
1813 ],
1814 [
Tim Ricee22be3b2002-07-17 19:20:07 -07001815 TestPath="$PATH"
1816 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
1817 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
1818 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
1819 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
1820 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10001821 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001822 xauth_path="/usr/openwin/bin/xauth"
1823 fi
1824 ]
1825)
1826
Damien Millera19cf472000-11-29 13:28:50 +11001827if test -z "$xauth_path" ; then
1828 XAUTH_PATH="undefined"
1829 AC_SUBST(XAUTH_PATH)
1830else
Damien Millera22ba012000-03-02 23:09:20 +11001831 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001832 XAUTH_PATH=$xauth_path
1833 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001834fi
Damien Millera22ba012000-03-02 23:09:20 +11001835
1836# Check for mail directory (last resort if we cannot get it from headers)
1837if test ! -z "$MAIL" ; then
1838 maildir=`dirname $MAIL`
1839 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1840fi
1841
Damien Millera22ba012000-03-02 23:09:20 +11001842if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00001843 if test "x$disable_ptmx_check" != "xyes" ; then
1844 AC_CHECK_FILE("/dev/ptmx",
1845 [
1846 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1847 have_dev_ptmx=1
1848 ]
1849 )
1850 fi
Damien Millera22ba012000-03-02 23:09:20 +11001851fi
Damien Miller204ad072000-03-02 23:56:12 +11001852AC_CHECK_FILE("/dev/ptc",
1853 [
1854 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1855 have_dev_ptc=1
1856 ]
1857)
1858
Damien Millera22ba012000-03-02 23:09:20 +11001859# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001860AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001861 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001862 [
Damien Miller897741e2001-04-16 10:41:46 +10001863 case "$withval" in
1864 man|cat|doc)
1865 MANTYPE=$withval
1866 ;;
1867 *)
1868 AC_MSG_ERROR(invalid man type: $withval)
1869 ;;
1870 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001871 ]
1872)
Ben Lindstrombc709922001-04-18 18:04:21 +00001873if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07001874 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
1875 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00001876 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1877 MANTYPE=doc
1878 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1879 MANTYPE=man
1880 else
1881 MANTYPE=cat
1882 fi
1883fi
Damien Miller670a4b82000-01-22 13:53:11 +11001884AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001885if test "$MANTYPE" = "doc"; then
1886 mansubdir=man;
1887else
1888 mansubdir=$MANTYPE;
1889fi
1890AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001891
Damien Millera22ba012000-03-02 23:09:20 +11001892# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001893MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001894AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001895 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001896 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001897 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001898 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001899 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001900 fi
1901 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001902)
1903
Damien Millera22ba012000-03-02 23:09:20 +11001904# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001905AC_ARG_WITH(shadow,
1906 [ --without-shadow Disable shadow password support],
1907 [
1908 if test "x$withval" = "xno" ; then
1909 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001910 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001911 fi
1912 ]
1913)
1914
Damien Miller1f335fb2000-06-26 11:31:33 +10001915if test -z "$disable_shadow" ; then
1916 AC_MSG_CHECKING([if the systems has expire shadow information])
1917 AC_TRY_COMPILE(
1918 [
1919#include <sys/types.h>
1920#include <shadow.h>
1921 struct spwd sp;
1922 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1923 [ sp_expire_available=yes ], []
1924 )
1925
1926 if test "x$sp_expire_available" = "xyes" ; then
1927 AC_MSG_RESULT(yes)
1928 AC_DEFINE(HAS_SHADOW_EXPIRE)
1929 else
1930 AC_MSG_RESULT(no)
1931 fi
1932fi
1933
Damien Millera22ba012000-03-02 23:09:20 +11001934# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001935if test ! -z "$IPADDR_IN_DISPLAY" ; then
1936 DISPLAY_HACK_MSG="yes"
1937 AC_DEFINE(IPADDR_IN_DISPLAY)
1938else
1939 DISPLAY_HACK_MSG="no"
1940 AC_ARG_WITH(ipaddr-display,
1941 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1942 [
1943 if test "x$withval" != "xno" ; then
1944 AC_DEFINE(IPADDR_IN_DISPLAY)
1945 DISPLAY_HACK_MSG="yes"
1946 fi
1947 ]
1948 )
1949fi
Damien Miller76112de1999-12-21 11:18:08 +11001950
Tim Rice43a1c132002-04-17 21:19:14 -07001951dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
1952if test $ac_cv_func_login_getcapbool = "yes" -a \
1953 $ac_cv_header_login_cap_h = "yes" ; then
1954 USES_LOGIN_CONF=yes
1955fi
Damien Millera22ba012000-03-02 23:09:20 +11001956# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001957SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001958AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10001959 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11001960 [
Tim Rice43a1c132002-04-17 21:19:14 -07001961 if test "$USES_LOGIN_CONF" = "yes" ; then
1962 AC_MSG_WARN([
1963--with-default-path=PATH has no effect on this system.
1964Edit /etc/login.conf instead.])
1965 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001966 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001967 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001968 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001969 ],
Tim Rice43a1c132002-04-17 21:19:14 -07001970 [ if test "$USES_LOGIN_CONF" = "yes" ; then
1971 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
1972 else
Tim Rice59ea0a02001-03-10 13:50:45 -08001973 AC_TRY_RUN(
1974 [
1975/* find out what STDPATH is */
1976#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001977#ifdef HAVE_PATHS_H
1978# include <paths.h>
1979#endif
1980#ifndef _PATH_STDPATH
1981# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1982#endif
1983#include <sys/types.h>
1984#include <sys/stat.h>
1985#include <fcntl.h>
1986#define DATA "conftest.stdpath"
1987
1988main()
1989{
1990 FILE *fd;
1991 int rc;
1992
1993 fd = fopen(DATA,"w");
1994 if(fd == NULL)
1995 exit(1);
1996
1997 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1998 exit(1);
1999
2000 exit(0);
2001}
2002 ], [ user_path=`cat conftest.stdpath` ],
2003 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2004 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2005 )
2006# make sure $bindir is in USER_PATH so scp will work
2007 t_bindir=`eval echo ${bindir}`
2008 case $t_bindir in
2009 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2010 esac
2011 case $t_bindir in
2012 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2013 esac
2014 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2015 if test $? -ne 0 ; then
2016 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2017 if test $? -ne 0 ; then
2018 user_path=$user_path:$t_bindir
2019 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2020 fi
2021 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002022 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002023)
Tim Rice43a1c132002-04-17 21:19:14 -07002024if test "$USES_LOGIN_CONF" != "yes" ; then
2025 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2026 AC_SUBST(user_path)
2027fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002028
Damien Millera18bbd32002-05-13 10:48:57 +10002029# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002030AC_ARG_WITH(superuser-path,
2031 [ --with-superuser-path= Specify different path for super-user],
2032 [
2033 if test "x$withval" != "xno" ; then
2034 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2035 superuser_path=$withval
2036 fi
2037 ]
2038)
2039
2040
Damien Millera22ba012000-03-02 23:09:20 +11002041# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002042IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002043AC_ARG_WITH(ipv4-default,
2044 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2045 [
2046 if test "x$withval" != "xno" ; then
2047 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002048 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002049 fi
2050 ]
2051)
2052
Damien Miller61e50f12000-05-08 20:49:37 +10002053AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002054IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002055AC_ARG_WITH(4in6,
2056 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2057 [
2058 if test "x$withval" != "xno" ; then
2059 AC_MSG_RESULT(yes)
2060 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002061 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002062 else
2063 AC_MSG_RESULT(no)
2064 fi
2065 ],[
2066 if test "x$inet6_default_4in6" = "xyes"; then
2067 AC_MSG_RESULT([yes (default)])
2068 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002069 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002070 else
2071 AC_MSG_RESULT([no (default)])
2072 fi
2073 ]
2074)
2075
Damien Miller60396b02001-02-18 17:01:00 +11002076# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002077BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002078AC_ARG_WITH(bsd-auth,
2079 [ --with-bsd-auth Enable BSD auth support],
2080 [
2081 if test "x$withval" != "xno" ; then
2082 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002083 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002084 fi
2085 ]
2086)
2087
Damien Millera22ba012000-03-02 23:09:20 +11002088# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002089piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002090# make sure the directory exists
2091if test ! -d $piddir ; then
2092 piddir=`eval echo ${sysconfdir}`
2093 case $piddir in
2094 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2095 esac
2096fi
2097
Tim Rice88f2ab52002-03-17 12:17:34 -08002098AC_ARG_WITH(pid-dir,
2099 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2100 [
2101 if test "x$withval" != "xno" ; then
2102 piddir=$withval
2103 if test ! -d $piddir ; then
2104 AC_MSG_WARN([** no $piddir directory on this system **])
2105 fi
2106 fi
2107 ]
2108)
2109
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002110AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002111AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002112
andre2ff7b5d2000-06-03 14:57:40 +00002113dnl allow user to disable some login recording features
2114AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002115 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002116 [ AC_DEFINE(DISABLE_LASTLOG) ]
2117)
2118AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002119 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002120 [ AC_DEFINE(DISABLE_UTMP) ]
2121)
2122AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002123 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002124 [ AC_DEFINE(DISABLE_UTMPX) ]
2125)
2126AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002127 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002128 [ AC_DEFINE(DISABLE_WTMP) ]
2129)
2130AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002131 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002132 [ AC_DEFINE(DISABLE_WTMPX) ]
2133)
2134AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002135 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002136 [ AC_DEFINE(DISABLE_LOGIN) ]
2137)
2138AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002139 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002140 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2141)
2142AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002143 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002144 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2145)
2146AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002147 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002148 [
2149 if test "x$withval" = "xno" ; then
2150 AC_DEFINE(DISABLE_LASTLOG)
2151 else
2152 conf_lastlog_location=$withval
2153 fi
2154 ]
2155)
andre2ff7b5d2000-06-03 14:57:40 +00002156
2157dnl lastlog, [uw]tmpx? detection
2158dnl NOTE: set the paths in the platform section to avoid the
2159dnl need for command-line parameters
2160dnl lastlog and [uw]tmp are subject to a file search if all else fails
2161
2162dnl lastlog detection
2163dnl NOTE: the code itself will detect if lastlog is a directory
2164AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2165AC_TRY_COMPILE([
2166#include <sys/types.h>
2167#include <utmp.h>
2168#ifdef HAVE_LASTLOG_H
2169# include <lastlog.h>
2170#endif
Damien Miller2994e082000-06-04 15:51:47 +10002171#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002172# include <paths.h>
2173#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002174#ifdef HAVE_LOGIN_H
2175# include <login.h>
2176#endif
andre2ff7b5d2000-06-03 14:57:40 +00002177 ],
2178 [ char *lastlog = LASTLOG_FILE; ],
2179 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002180 [
2181 AC_MSG_RESULT(no)
2182 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2183 AC_TRY_COMPILE([
2184#include <sys/types.h>
2185#include <utmp.h>
2186#ifdef HAVE_LASTLOG_H
2187# include <lastlog.h>
2188#endif
2189#ifdef HAVE_PATHS_H
2190# include <paths.h>
2191#endif
2192 ],
2193 [ char *lastlog = _PATH_LASTLOG; ],
2194 [ AC_MSG_RESULT(yes) ],
2195 [
andree441aa32000-06-12 22:34:38 +00002196 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002197 system_lastlog_path=no
2198 ])
2199 ]
andre2ff7b5d2000-06-03 14:57:40 +00002200)
Damien Miller2994e082000-06-04 15:51:47 +10002201
andre2ff7b5d2000-06-03 14:57:40 +00002202if test -z "$conf_lastlog_location"; then
2203 if test x"$system_lastlog_path" = x"no" ; then
2204 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002205 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002206 conf_lastlog_location=$f
2207 fi
2208 done
2209 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002210 AC_MSG_WARN([** Cannot find lastlog **])
2211 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002212 fi
2213 fi
2214fi
2215
2216if test -n "$conf_lastlog_location"; then
2217 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2218fi
2219
2220dnl utmp detection
2221AC_MSG_CHECKING([if your system defines UTMP_FILE])
2222AC_TRY_COMPILE([
2223#include <sys/types.h>
2224#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002225#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002226# include <paths.h>
2227#endif
2228 ],
2229 [ char *utmp = UTMP_FILE; ],
2230 [ AC_MSG_RESULT(yes) ],
2231 [ AC_MSG_RESULT(no)
2232 system_utmp_path=no ]
2233)
2234if test -z "$conf_utmp_location"; then
2235 if test x"$system_utmp_path" = x"no" ; then
2236 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2237 if test -f $f ; then
2238 conf_utmp_location=$f
2239 fi
2240 done
2241 if test -z "$conf_utmp_location"; then
2242 AC_DEFINE(DISABLE_UTMP)
2243 fi
2244 fi
2245fi
2246if test -n "$conf_utmp_location"; then
2247 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2248fi
2249
2250dnl wtmp detection
2251AC_MSG_CHECKING([if your system defines WTMP_FILE])
2252AC_TRY_COMPILE([
2253#include <sys/types.h>
2254#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002255#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002256# include <paths.h>
2257#endif
2258 ],
2259 [ char *wtmp = WTMP_FILE; ],
2260 [ AC_MSG_RESULT(yes) ],
2261 [ AC_MSG_RESULT(no)
2262 system_wtmp_path=no ]
2263)
2264if test -z "$conf_wtmp_location"; then
2265 if test x"$system_wtmp_path" = x"no" ; then
2266 for f in /usr/adm/wtmp /var/log/wtmp; do
2267 if test -f $f ; then
2268 conf_wtmp_location=$f
2269 fi
2270 done
2271 if test -z "$conf_wtmp_location"; then
2272 AC_DEFINE(DISABLE_WTMP)
2273 fi
2274 fi
2275fi
2276if test -n "$conf_wtmp_location"; then
2277 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2278fi
2279
2280
2281dnl utmpx detection - I don't know any system so perverse as to require
2282dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2283dnl there, though.
2284AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2285AC_TRY_COMPILE([
2286#include <sys/types.h>
2287#include <utmp.h>
2288#ifdef HAVE_UTMPX_H
2289#include <utmpx.h>
2290#endif
Damien Miller2994e082000-06-04 15:51:47 +10002291#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002292# include <paths.h>
2293#endif
2294 ],
2295 [ char *utmpx = UTMPX_FILE; ],
2296 [ AC_MSG_RESULT(yes) ],
2297 [ AC_MSG_RESULT(no)
2298 system_utmpx_path=no ]
2299)
2300if test -z "$conf_utmpx_location"; then
2301 if test x"$system_utmpx_path" = x"no" ; then
2302 AC_DEFINE(DISABLE_UTMPX)
2303 fi
2304else
2305 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2306fi
2307
2308dnl wtmpx detection
2309AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2310AC_TRY_COMPILE([
2311#include <sys/types.h>
2312#include <utmp.h>
2313#ifdef HAVE_UTMPX_H
2314#include <utmpx.h>
2315#endif
Damien Miller2994e082000-06-04 15:51:47 +10002316#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002317# include <paths.h>
2318#endif
2319 ],
2320 [ char *wtmpx = WTMPX_FILE; ],
2321 [ AC_MSG_RESULT(yes) ],
2322 [ AC_MSG_RESULT(no)
2323 system_wtmpx_path=no ]
2324)
2325if test -z "$conf_wtmpx_location"; then
2326 if test x"$system_wtmpx_path" = x"no" ; then
2327 AC_DEFINE(DISABLE_WTMPX)
2328 fi
2329else
2330 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2331fi
2332
Damien Miller4018c192000-04-30 09:30:44 +10002333
Damien Miller29ea30d2000-03-17 10:54:15 +11002334if test ! -z "$blibpath" ; then
2335 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2336 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2337fi
2338
Tim Rice4cec93f2002-02-26 08:40:48 -08002339dnl remove pam and dl because they are in $LIBPAM
2340if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002341 LIBS=`echo $LIBS | sed 's/-lpam //'`
2342fi
2343if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2344 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002345fi
2346
Damien Millerbac2d8a2000-09-05 16:13:06 +11002347AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002348AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2349AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002350
Damien Miller7b22d652000-06-18 14:07:04 +10002351# Print summary of options
2352
Damien Miller7b22d652000-06-18 14:07:04 +10002353# Someone please show me a better way :)
2354A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2355B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2356C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2357D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002358E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002359F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002360G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002361H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2362I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2363J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002364
2365echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002366echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002367echo " User binaries: $B"
2368echo " System binaries: $C"
2369echo " Configuration files: $D"
2370echo " Askpass program: $E"
2371echo " Manual pages: $F"
2372echo " PID file: $G"
2373echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002374if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002375echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002376else
Damien Millerf58c6722002-05-13 13:15:42 +10002377echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002378fi
Damien Millera18bbd32002-05-13 10:48:57 +10002379if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002380echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002381fi
Damien Millerf58c6722002-05-13 13:15:42 +10002382echo " Manpage format: $MANTYPE"
2383echo " PAM support: ${PAM_MSG}"
2384echo " KerberosIV support: $KRB4_MSG"
2385echo " KerberosV support: $KRB5_MSG"
2386echo " Smartcard support: $SCARD_MSG"
2387echo " AFS support: $AFS_MSG"
2388echo " S/KEY support: $SKEY_MSG"
2389echo " TCP Wrappers support: $TCPW_MSG"
2390echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002391echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002392echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2393echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2394echo " BSD Auth support: $BSD_AUTH_MSG"
2395echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002396if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002397echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002398fi
2399
Damien Miller7b22d652000-06-18 14:07:04 +10002400echo ""
2401
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002402echo " Host: ${host}"
2403echo " Compiler: ${CC}"
2404echo " Compiler flags: ${CFLAGS}"
2405echo "Preprocessor flags: ${CPPFLAGS}"
2406echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002407echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002408
2409echo ""
2410
Damien Miller82cf0ce2000-12-20 13:34:48 +11002411if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002412 echo "PAM is enabled. You may need to install a PAM control file "
2413 echo "for sshd, otherwise password authentication may fail. "
2414 echo "Example PAM control files can be found in the contrib/ "
2415 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002416 echo ""
2417fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002418
2419if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002420 echo "sftp-server will be disabled. Your compiler does not "
2421 echo "support 64bit integers."
2422 echo ""
2423fi
2424
2425if test ! -z "$RAND_HELPER_CMDHASH" ; then
2426 echo "WARNING: you are using the builtin random number collection "
2427 echo "service. Please read WARNING.RNG and request that your OS "
2428 echo "vendor includes kernel-based random number collection in "
2429 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002430 echo ""
2431fi
Damien Miller60396b02001-02-18 17:01:00 +11002432