blob: e7249b9c96802b65a03d6fe6b5fe88c072f7c1bd [file] [log] [blame]
Tim Rice88368a32003-12-08 12:35:59 -08001# $Id: configure.ac,v 1.176 2003/12/08 20:35:59 tim Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Tim Rice13aae5e2001-10-21 17:53:58 -07003AC_INIT
4AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +10005
6AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11007AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11008AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11009AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100010
Damien Millera22ba012000-03-02 23:09:20 +110011# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100012AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110013AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100014AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110015AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000016AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070017AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080018AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110019AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100020AC_PATH_PROG(ENT, ent)
21AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110022AC_PATH_PROG(TEST_MINUS_S_SH, bash)
23AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
24AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070025AC_PATH_PROG(SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110026
Damien Millere8bb4502001-09-25 16:39:35 +100027# System features
28AC_SYS_LARGEFILE
29
Damien Miller3f62aba2000-11-29 11:56:35 +110030if test -z "$AR" ; then
31 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
32fi
33
Damien Millerad833b32000-08-23 10:46:23 +100034# Use LOGIN_PROGRAM from environment if possible
35if test ! -z "$LOGIN_PROGRAM" ; then
36 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
37else
38 # Search for login
39 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
40 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
41 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
42 fi
43fi
44
Damien Miller166bd442000-03-16 10:48:25 +110045if test -z "$LD" ; then
46 LD=$CC
47fi
48AC_SUBST(LD)
49
Damien Miller166bd442000-03-16 10:48:25 +110050AC_C_INLINE
Damien Millera8e06ce2003-11-21 23:48:55 +110051if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100052 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110053fi
54
Tim Rice88368a32003-12-08 12:35:59 -080055AC_ARG_WITH(rpath,
56 [ --without-rpath Disable auto-added -R linker paths],
57 [
58 if test "x$withval" = "xno" ; then
59 need_dash_r=""
60 fi
61 if test "x$withval" = "xyes" ; then
62 need_dash_r=1
63 fi
64 ]
65)
66
Damien Millera22ba012000-03-02 23:09:20 +110067# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110068case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110069*-*-aix*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000070 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110071 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +110072 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +100073 if (test -z "$blibpath"); then
74 blibpath="/usr/lib:/lib:/usr/local/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +110075 fi
Damien Millereab4bae2003-04-29 23:22:40 +100076 saved_LDFLAGS="$LDFLAGS"
77 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
78 if (test -z "$blibflags"); then
79 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
80 AC_TRY_LINK([], [], [blibflags=$tryflags])
81 fi
82 done
83 if (test -z "$blibflags"); then
84 AC_MSG_RESULT(not found)
85 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
86 else
87 AC_MSG_RESULT($blibflags)
88 fi
89 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +100090 dnl Check for authenticate. Might be in libs.a on older AIXes
91 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -070092 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +100093 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -070094 LIBS="$LIBS -ls"
95 ])
96 ])
Darren Tucker5c6a91a2003-07-14 16:21:44 +100097 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
98 AC_CHECK_DECL(loginfailed,
99 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
100 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000101 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000102 [(void)loginfailed("user","host","tty",0);],
103 [AC_MSG_RESULT(yes)
104 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000105 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000106 )],
107 [],
108 [#include <usersec.h>]
109 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000110 AC_CHECK_FUNCS(setauthdb)
Damien Millereca71f82000-01-20 22:38:27 +1100111 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +1000112 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000113 AC_DEFINE(SETEUID_BREAKS_SETUID)
114 AC_DEFINE(BROKEN_SETREUID)
115 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000116 dnl AIX handles lastlog as part of its login message
117 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000118 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000119 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100120 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100121*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100122 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800123 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100124 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000125 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100126 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100127 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000128 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000129 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700130 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +0000131 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100132 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000133*-*-dgux*)
134 AC_DEFINE(IP_TOS_IS_BROKEN)
135 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000136*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000137 AC_MSG_CHECKING(if we have working getaddrinfo)
138 AC_TRY_RUN([#include <mach-o/dyld.h>
139main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
140 exit(0);
141 else
142 exit(1);
143}], [AC_MSG_RESULT(working)],
144 [AC_MSG_RESULT(buggy)
145 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700146 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000147 AC_DEFINE(SETEUID_BREAKS_SETUID)
148 AC_DEFINE(BROKEN_SETREUID)
149 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000150 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000151*-*-hpux10.26)
152 if test -z "$GCC"; then
153 CFLAGS="$CFLAGS -Ae"
154 fi
155 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
156 IPADDR_IN_DISPLAY=yes
157 AC_DEFINE(HAVE_SECUREWARE)
158 AC_DEFINE(USE_PIPES)
159 AC_DEFINE(LOGIN_NO_ENDOPT)
160 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000161 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000162 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000163 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700164 LIBS="$LIBS -lsec -lsecpw"
165 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000166 disable_ptmx_check=yes
167 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100168*-*-hpux10*)
169 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000170 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100171 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000172 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100173 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000174 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000175 AC_DEFINE(LOGIN_NO_ENDOPT)
176 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100177 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000178 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000179 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700180 LIBS="$LIBS -lsec"
181 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100182 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000183*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000184 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100185 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100186 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100187 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000188 AC_DEFINE(LOGIN_NO_ENDOPT)
189 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100190 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000191 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000192 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700193 LIBS="$LIBS -lsec"
194 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000195 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100196*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000197 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000198 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100199 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000200 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000201 AC_DEFINE(SETEUID_BREAKS_SETUID)
202 AC_DEFINE(BROKEN_SETREUID)
203 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000204 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000205 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100206 ;;
207*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000208 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000209 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100210 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000211 AC_DEFINE(WITH_IRIX_ARRAY)
212 AC_DEFINE(WITH_IRIX_PROJECT)
213 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000214 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000215 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000216 AC_DEFINE(SETEUID_BREAKS_SETUID)
217 AC_DEFINE(BROKEN_SETREUID)
218 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000219 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000220 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100221 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100222*-*-linux*)
223 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100224 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000225 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100226 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000227 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000228 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
Damien Miller35276252003-06-03 10:14:28 +1000229 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller7bcb0892000-03-11 20:45:40 +1100230 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000231 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000232 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000233 AC_DEFINE(BROKEN_CMSG_TYPE)
234 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000235 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100236 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000237mips-sony-bsd|mips-sony-newsos4)
238 AC_DEFINE(HAVE_NEWS4)
239 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000240 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100241*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000242 check_for_libcrypt_before=1
Tim Rice88368a32003-12-08 12:35:59 -0800243 if test "x$withval" != "xno" ; then
244 need_dash_r=1
245 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100246 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100247*-*-freebsd*)
248 check_for_libcrypt_later=1
249 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000250*-*-bsdi*)
251 AC_DEFINE(SETEUID_BREAKS_SETUID)
252 AC_DEFINE(BROKEN_SETREUID)
253 AC_DEFINE(BROKEN_SETREGID)
254 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000255*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000256 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100257 conf_utmp_location=/etc/utmp
258 conf_wtmp_location=/usr/adm/wtmp
259 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000260 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000261 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000262 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100263 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000264 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000265 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000266 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100267*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000268 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Rice88368a32003-12-08 12:35:59 -0800269 if test "x$withval" = "xno" ; then
270 LDFLAGS="$LDFLAGS -L/usr/local/lib"
271 else
272 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
273 need_dash_r=1
274 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100275 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000276 AC_DEFINE(LOGIN_NEEDS_UTMPX)
277 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000278 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000279 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000280 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
281 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000282 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000283 # hardwire lastlog location (can't detect it on some versions)
284 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000285 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
286 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
287 if test "$sol2ver" -ge 8; then
288 AC_MSG_RESULT(yes)
289 AC_DEFINE(DISABLE_UTMP)
290 AC_DEFINE(DISABLE_WTMP)
291 else
292 AC_MSG_RESULT(no)
293 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100294 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000295*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000296 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000297 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100298 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000299 conf_utmp_location=/etc/utmp
300 conf_wtmp_location=/var/adm/wtmp
301 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000302 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000303 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000304*-ncr-sysv*)
305 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
306 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700307 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000308 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000309 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000310 AC_DEFINE(SETEUID_BREAKS_SETUID)
311 AC_DEFINE(BROKEN_SETREUID)
312 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000313 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000314*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000315 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700316 # /usr/ucblib MUST NOT be searched on ReliantUNIX
317 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Darren Tucker89df7a32003-10-07 20:35:57 +1000318 AC_CHECK_LIB(dl, dlsym, ,)
Damien Millerfd9885e2001-01-10 08:16:53 +1100319 IPADDR_IN_DISPLAY=yes
320 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000321 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000322 AC_DEFINE(SETEUID_BREAKS_SETUID)
323 AC_DEFINE(BROKEN_SETREUID)
324 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000325 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000326 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700327 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
328 # Attention: always take care to bind libsocket and libnsl before libc,
329 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000330 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100331*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000332 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100333 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100334 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700335 AC_DEFINE(SETEUID_BREAKS_SETUID)
336 AC_DEFINE(BROKEN_SETREUID)
337 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100338 ;;
339*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000340 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100341 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100342 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700343 AC_DEFINE(SETEUID_BREAKS_SETUID)
344 AC_DEFINE(BROKEN_SETREUID)
345 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100346 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100347*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000348 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100349 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100350 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100351*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000352 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100353 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700354 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100355 RANLIB=true
356 no_dev_ptmx=1
357 AC_DEFINE(BROKEN_SYS_TERMIO_H)
358 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000359 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000360 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100361 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Riceae477e92003-09-12 18:15:15 -0700362 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100363 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700364 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700365 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100366 ;;
367*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800368 if test -z "$GCC"; then
369 CFLAGS="$CFLAGS -belf"
370 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000371 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000372 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100373 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000374 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100375 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000376 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000377 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700378 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700379 AC_DEFINE(SETEUID_BREAKS_SETUID)
380 AC_DEFINE(BROKEN_SETREUID)
381 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700382 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100383 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700384 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000385 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000386*-*-unicosmk*)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000387 AC_DEFINE(USE_PIPES)
388 AC_DEFINE(DISABLE_FD_PASSING)
389 LDFLAGS="$LDFLAGS"
390 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
391 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000392 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000393*-*-unicosmp*)
394 AC_DEFINE(WITH_ABBREV_NO_TTY)
395 AC_DEFINE(USE_PIPES)
396 AC_DEFINE(DISABLE_FD_PASSING)
397 LDFLAGS="$LDFLAGS"
398 LIBS="$LIBS -lgen -lacid"
399 MANTYPE=cat
400 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000401*-*-unicos*)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000402 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700403 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700404 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000405 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
406 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
407 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700408 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000409*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000410 AC_MSG_CHECKING(for Digital Unix SIA)
411 no_osfsia=""
412 AC_ARG_WITH(osfsia,
413 [ --with-osfsia Enable Digital Unix SIA],
414 [
415 if test "x$withval" = "xno" ; then
416 AC_MSG_RESULT(disabled)
417 no_osfsia=1
418 fi
419 ],
420 )
421 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000422 if test -f /etc/sia/matrix.conf; then
423 AC_MSG_RESULT(yes)
424 AC_DEFINE(HAVE_OSF_SIA)
425 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000426 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000427 LIBS="$LIBS -lsecurity -ldb -lm -laud"
428 else
429 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100430 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000431 fi
432 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000433 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700434 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000435 AC_DEFINE(BROKEN_SETREUID)
436 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000437 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000438
439*-*-nto-qnx)
440 AC_DEFINE(USE_PIPES)
441 AC_DEFINE(NO_X11_UNIX_SOCKETS)
442 AC_DEFINE(MISSING_NFDBITS)
443 AC_DEFINE(MISSING_HOWMANY)
444 AC_DEFINE(MISSING_FD_MASK)
445 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100446esac
447
Damien Millere37bfc12000-06-05 09:37:43 +1000448# Allow user to specify flags
449AC_ARG_WITH(cflags,
450 [ --with-cflags Specify additional flags to pass to compiler],
451 [
452 if test "x$withval" != "xno" ; then
453 CFLAGS="$CFLAGS $withval"
454 fi
455 ]
456)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000457AC_ARG_WITH(cppflags,
458 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
459 [
460 if test "x$withval" != "xno"; then
461 CPPFLAGS="$CPPFLAGS $withval"
462 fi
463 ]
464)
Damien Millere37bfc12000-06-05 09:37:43 +1000465AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000466 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000467 [
468 if test "x$withval" != "xno" ; then
469 LDFLAGS="$LDFLAGS $withval"
470 fi
471 ]
472)
473AC_ARG_WITH(libs,
474 [ --with-libs Specify additional libraries to link with],
475 [
476 if test "x$withval" != "xno" ; then
477 LIBS="$LIBS $withval"
478 fi
479 ]
480)
481
Darren Tucker6eb93042003-06-29 21:30:41 +1000482AC_MSG_CHECKING(compiler and flags for sanity)
483AC_TRY_RUN([
484#include <stdio.h>
485int main(){exit(0);}
486 ],
487 [ AC_MSG_RESULT(yes) ],
488 [
489 AC_MSG_RESULT(no)
490 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
491 ]
492)
493
Tim Rice4cec93f2002-02-26 08:40:48 -0800494# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000495AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000496 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800497 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000498 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000499 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000500 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
501 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
Ben Lindstrom4b0f1ad2003-02-01 04:43:34 +0000502 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
Tim Rice81ed5182002-09-25 17:38:46 -0700503 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
Damien Miller5c3a5582003-09-23 22:12:38 +1000504 util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800505
Damien Millera22ba012000-03-02 23:09:20 +1100506# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700507AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
508AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000509
Damien Millerdf288022001-02-18 13:07:07 +1100510dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700511if test "x$with_tcp_wrappers" != "xno" ; then
512 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
513 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
514 fi
515fi
Damien Millerdf288022001-02-18 13:07:07 +1100516
Tim Rice1e1ef642003-09-11 22:19:31 -0700517dnl IRIX and Solaris 2.5.1 have dirname() in libgen
518AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
519 AC_CHECK_LIB(gen, dirname,[
520 AC_CACHE_CHECK([for broken dirname],
521 ac_cv_have_broken_dirname, [
522 save_LIBS="$LIBS"
523 LIBS="$LIBS -lgen"
524 AC_TRY_RUN(
525 [
526#include <libgen.h>
527#include <string.h>
528
529int main(int argc, char **argv) {
530 char *s, buf[32];
531
532 strncpy(buf,"/etc", 32);
533 s = dirname(buf);
534 if (!s || strncmp(s, "/", 32) != 0) {
535 exit(1);
536 } else {
537 exit(0);
538 }
539}
540 ],
541 [ ac_cv_have_broken_dirname="no" ],
542 [ ac_cv_have_broken_dirname="yes" ]
543 )
544 LIBS="$save_LIBS"
545 ])
546 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
547 LIBS="$LIBS -lgen"
548 AC_DEFINE(HAVE_DIRNAME)
549 AC_CHECK_HEADERS(libgen.h)
550 fi
551 ])
552])
553
554AC_CHECK_FUNC(getspnam, ,
555 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
556AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
557
Tim Rice13aae5e2001-10-21 17:53:58 -0700558dnl zlib is required
559AC_ARG_WITH(zlib,
560 [ --with-zlib=PATH Use zlib in PATH],
561 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000562 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100563 AC_MSG_ERROR([*** zlib is required ***])
564 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700565 if test -d "$withval/lib"; then
566 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700567 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700568 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700569 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700570 fi
571 else
572 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700573 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700574 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700575 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700576 fi
577 fi
578 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700579 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700580 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700581 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700582 fi
583 ]
584)
585
Tim Rice17b93e52001-10-23 22:36:54 -0700586AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100587
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000588dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100589AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000590 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
591)
Damien Millera8e06ce2003-11-21 23:48:55 +1100592AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700593 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
594 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000595)
Damien Millerab18c411999-11-11 10:40:23 +1100596
Tim Ricee589a292001-11-03 11:09:32 -0800597dnl Checks for libutil functions
598AC_CHECK_HEADERS(libutil.h)
599AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
600AC_CHECK_FUNCS(logout updwtmp logwtmp)
601
Ben Lindstrom8697e082001-02-24 21:41:10 +0000602AC_FUNC_STRFTIME
603
Damien Miller3c027682001-03-14 11:39:45 +1100604# Check for ALTDIRFUNC glob() extension
605AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
606AC_EGREP_CPP(FOUNDIT,
607 [
608 #include <glob.h>
609 #ifdef GLOB_ALTDIRFUNC
610 FOUNDIT
611 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100612 ],
Damien Miller3c027682001-03-14 11:39:45 +1100613 [
614 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
615 AC_MSG_RESULT(yes)
616 ],
617 [
618 AC_MSG_RESULT(no)
619 ]
620)
Damien Millerab18c411999-11-11 10:40:23 +1100621
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000622# Check for g.gl_matchc glob() extension
623AC_MSG_CHECKING(for gl_matchc field in glob_t)
624AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100625 [
626 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000627 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100628 ],
629 [
630 AC_DEFINE(GLOB_HAS_GL_MATCHC)
631 AC_MSG_RESULT(yes)
632 ],
633 [
634 AC_MSG_RESULT(no)
635 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000636)
637
Damien Miller18bb4732001-03-28 14:35:30 +1000638AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
639AC_TRY_RUN(
640 [
641#include <sys/types.h>
642#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700643int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000644 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100645 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000646 [
647 AC_MSG_RESULT(no)
648 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
649 ]
650)
651
Damien Millerc547bf12001-02-16 10:18:12 +1100652# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100653SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100654AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700655 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100656 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100657 [
658 if test "x$withval" != "xno" ; then
659
660 if test "x$withval" != "xyes" ; then
661 CPPFLAGS="$CPPFLAGS -I${withval}/include"
662 LDFLAGS="$LDFLAGS -L${withval}/lib"
663 fi
664
665 AC_DEFINE(SKEY)
666 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100667 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100668
Tim Rice4cec93f2002-02-26 08:40:48 -0800669 AC_MSG_CHECKING([for s/key support])
670 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100671 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800672#include <stdio.h>
673#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700674int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800675 ],
676 [AC_MSG_RESULT(yes)],
677 [
678 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100679 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
680 ])
681 fi
682 ]
683)
684
685# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700686TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100687AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700688 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100689 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100690 [
691 if test "x$withval" != "xno" ; then
692 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700693 saved_LDFLAGS="$LDFLAGS"
694 saved_CPPFLAGS="$CPPFLAGS"
695 if test -n "${withval}" -a "${withval}" != "yes"; then
696 if test -d "${withval}/lib"; then
697 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700698 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700699 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700700 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700701 fi
702 else
703 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700704 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700705 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700706 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700707 fi
708 fi
709 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700710 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700711 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700712 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700713 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700714 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800715 LIBWRAP="-lwrap"
716 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100717 AC_MSG_CHECKING(for libwrap)
718 AC_TRY_LINK(
719 [
720#include <tcpd.h>
721 int deny_severity = 0, allow_severity = 0;
722 ],
723 [hosts_access(0);],
724 [
725 AC_MSG_RESULT(yes)
726 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800727 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700728 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100729 ],
730 [
731 AC_MSG_ERROR([*** libwrap missing])
732 ]
733 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800734 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100735 fi
736 ]
737)
738
Damien Millerfe1f1432003-02-24 15:45:42 +1100739dnl Checks for library functions. Please keep in alphabetical order
740AC_CHECK_FUNCS(\
Damien Millerf09ad862003-09-19 16:41:01 +1000741 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
Damien Miller5fe46a42003-06-05 09:53:31 +1000742 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000743 getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000744 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100745 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000746 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
747 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
748 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Damien Miller5fe46a42003-06-05 09:53:31 +1000749 setproctitle setregid setresgid setresuid setreuid setrlimit \
750 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000751 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tuckerf38ea772003-08-13 20:48:07 +1000752 truncate utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100753)
Tim Rice13aae5e2001-10-21 17:53:58 -0700754
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000755# IRIX has a const char return value for gai_strerror()
756AC_CHECK_FUNCS(gai_strerror,[
757 AC_DEFINE(HAVE_GAI_STRERROR)
758 AC_TRY_COMPILE([
759#include <sys/types.h>
760#include <sys/socket.h>
761#include <netdb.h>
762
763const char *gai_strerror(int);],[
764char *str;
765
766str = gai_strerror(0);],[
767 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
768 [Define if gai_strerror() returns const char *])])])
769
Damien Millercd6853c2003-01-28 11:33:42 +1100770AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
771
Darren Tuckerf1159b52003-07-07 19:44:01 +1000772dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000773AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000774AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000775
Darren Tuckerb2427c82003-09-10 15:22:44 +1000776dnl tcsendbreak might be a macro
777AC_CHECK_DECL(tcsendbreak,
778 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100779 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000780 [#include <termios.h>]
781)
782
Damien Millerad833b32000-08-23 10:46:23 +1000783dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000784AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000785dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000786AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000787AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000788dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000789AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000790AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100791
Damien Millera8e06ce2003-11-21 23:48:55 +1100792AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100793 [AC_DEFINE(HAVE_DAEMON)],
794 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
795)
796
Damien Millera8e06ce2003-11-21 23:48:55 +1100797AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100798 [AC_DEFINE(HAVE_GETPAGESIZE)],
799 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
800)
801
Damien Millercb170cb2000-07-01 16:52:55 +1000802# Check for broken snprintf
803if test "x$ac_cv_func_snprintf" = "xyes" ; then
804 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
805 AC_TRY_RUN(
806 [
807#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700808int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000809 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100810 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000811 [
812 AC_MSG_RESULT(no)
813 AC_DEFINE(BROKEN_SNPRINTF)
814 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
815 ]
816 )
817fi
818
Damien Millere8328192003-01-07 15:18:32 +1100819dnl see whether mkstemp() requires XXXXXX
820if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
821AC_MSG_CHECKING([for (overly) strict mkstemp])
822AC_TRY_RUN(
823 [
824#include <stdlib.h>
825main() { char template[]="conftest.mkstemp-test";
826if (mkstemp(template) == -1)
827 exit(1);
828unlink(template); exit(0);
829}
830 ],
831 [
832 AC_MSG_RESULT(no)
833 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100834 [
Damien Millere8328192003-01-07 15:18:32 +1100835 AC_MSG_RESULT(yes)
836 AC_DEFINE(HAVE_STRICT_MKSTEMP)
837 ],
838 [
839 AC_MSG_RESULT(yes)
840 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +1100841 ]
Damien Millere8328192003-01-07 15:18:32 +1100842)
843fi
844
Darren Tucker70a3d552003-08-21 17:58:29 +1000845dnl make sure that openpty does not reacquire controlling terminal
846if test ! -z "$check_for_openpty_ctty_bug"; then
847 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
848 AC_TRY_RUN(
849 [
850#include <stdio.h>
851#include <sys/fcntl.h>
852#include <sys/types.h>
853#include <sys/wait.h>
854
855int
856main()
857{
858 pid_t pid;
859 int fd, ptyfd, ttyfd, status;
860
861 pid = fork();
862 if (pid < 0) { /* failed */
863 exit(1);
864 } else if (pid > 0) { /* parent */
865 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +1100866 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +1000867 exit(WEXITSTATUS(status));
868 else
869 exit(2);
870 } else { /* child */
871 close(0); close(1); close(2);
872 setsid();
873 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
874 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
875 if (fd >= 0)
876 exit(3); /* Acquired ctty: broken */
877 else
878 exit(0); /* Did not acquire ctty: OK */
879 }
880}
881 ],
882 [
883 AC_MSG_RESULT(yes)
884 ],
885 [
886 AC_MSG_RESULT(no)
887 AC_DEFINE(SSHD_ACQUIRES_CTTY)
888 ]
889 )
890fi
891
Damien Miller606f8802000-09-16 15:39:56 +1100892AC_FUNC_GETPGRP
893
Damien Millera64b57a2001-01-17 10:44:13 +1100894# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000895PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100896AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100897 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100898 [
Damien Millera64b57a2001-01-17 10:44:13 +1100899 if test "x$withval" != "xno" ; then
900 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
901 AC_MSG_ERROR([PAM headers not found])
902 fi
903
904 AC_CHECK_LIB(dl, dlopen, , )
905 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
906 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000907 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +1100908
Damien Millera64b57a2001-01-17 10:44:13 +1100909 PAM_MSG="yes"
910
911 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800912 if test $ac_cv_lib_dl_dlopen = yes; then
913 LIBPAM="-lpam -ldl"
914 else
915 LIBPAM="-lpam"
916 fi
917 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100918 fi
919 ]
920)
Damien Millera22ba012000-03-02 23:09:20 +1100921
Damien Millera64b57a2001-01-17 10:44:13 +1100922# Check for older PAM
923if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100924 # Check PAM strerror arguments (old PAM)
925 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
926 AC_TRY_COMPILE(
927 [
Damien Miller81171112000-04-23 11:14:01 +1000928#include <stdlib.h>
929#include <security/pam_appl.h>
Damien Millera8e06ce2003-11-21 23:48:55 +1100930 ],
931 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +1100932 [AC_MSG_RESULT(no)],
933 [
934 AC_DEFINE(HAVE_OLD_PAM)
935 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000936 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100937 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100938 )
Damien Millera22ba012000-03-02 23:09:20 +1100939fi
940
Damien Millerfc93d4b2002-09-04 23:26:29 +1000941# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
942# because the system crypt() is more featureful.
943if test "x$check_for_libcrypt_before" = "x1"; then
944 AC_CHECK_LIB(crypt, crypt)
945fi
946
Tim Riceaef73712002-05-11 13:17:42 -0700947# Search for OpenSSL
948saved_CPPFLAGS="$CPPFLAGS"
949saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100950AC_ARG_WITH(ssl-dir,
951 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
952 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000953 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700954 if test -d "$withval/lib"; then
955 if test -n "${need_dash_r}"; then
956 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
957 else
958 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
959 fi
960 else
961 if test -n "${need_dash_r}"; then
962 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
963 else
964 LDFLAGS="-L${withval} ${LDFLAGS}"
965 fi
966 fi
967 if test -d "$withval/include"; then
968 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
969 else
970 CPPFLAGS="-I${withval} ${CPPFLAGS}"
971 fi
Damien Millera22ba012000-03-02 23:09:20 +1100972 fi
973 ]
974)
Tim Riceaef73712002-05-11 13:17:42 -0700975LIBS="$LIBS -lcrypto"
976AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000977 [
Tim Riceaef73712002-05-11 13:17:42 -0700978 dnl Check default openssl install dir
979 if test -n "${need_dash_r}"; then
980 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000981 else
Tim Riceaef73712002-05-11 13:17:42 -0700982 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000983 fi
Tim Riceaef73712002-05-11 13:17:42 -0700984 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
985 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
986 [
987 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
988 ]
989 )
990 ]
991)
992
Tim Riced730b782002-08-13 18:52:10 -0700993# Determine OpenSSL header version
994AC_MSG_CHECKING([OpenSSL header version])
995AC_TRY_RUN(
996 [
997#include <stdio.h>
998#include <string.h>
999#include <openssl/opensslv.h>
1000#define DATA "conftest.sslincver"
1001int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001002 FILE *fd;
1003 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001004
Damien Millera8e06ce2003-11-21 23:48:55 +11001005 fd = fopen(DATA,"w");
1006 if(fd == NULL)
1007 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001008
1009 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1010 exit(1);
1011
1012 exit(0);
1013}
1014 ],
1015 [
1016 ssl_header_ver=`cat conftest.sslincver`
1017 AC_MSG_RESULT($ssl_header_ver)
1018 ],
1019 [
1020 AC_MSG_RESULT(not found)
1021 AC_MSG_ERROR(OpenSSL version header not found.)
1022 ]
1023)
1024
1025# Determine OpenSSL library version
1026AC_MSG_CHECKING([OpenSSL library version])
1027AC_TRY_RUN(
1028 [
1029#include <stdio.h>
1030#include <string.h>
1031#include <openssl/opensslv.h>
1032#include <openssl/crypto.h>
1033#define DATA "conftest.ssllibver"
1034int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001035 FILE *fd;
1036 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001037
Damien Millera8e06ce2003-11-21 23:48:55 +11001038 fd = fopen(DATA,"w");
1039 if(fd == NULL)
1040 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001041
1042 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1043 exit(1);
1044
1045 exit(0);
1046}
1047 ],
1048 [
1049 ssl_library_ver=`cat conftest.ssllibver`
1050 AC_MSG_RESULT($ssl_library_ver)
1051 ],
1052 [
1053 AC_MSG_RESULT(not found)
1054 AC_MSG_ERROR(OpenSSL library not found.)
1055 ]
1056)
Damien Millera22ba012000-03-02 23:09:20 +11001057
Damien Millerec932372002-01-22 22:16:03 +11001058# Sanity check OpenSSL headers
1059AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1060AC_TRY_RUN(
1061 [
1062#include <string.h>
1063#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001064int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001065 ],
1066 [
1067 AC_MSG_RESULT(yes)
1068 ],
1069 [
1070 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001071 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1072Check config.log for details.
1073Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001074 ]
1075)
1076
Damien Millera8e06ce2003-11-21 23:48:55 +11001077# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Damien Millera64b57a2001-01-17 10:44:13 +11001078# version in OpenSSL. Skip this for PAM
Damien Miller4f9f42a2003-05-10 19:28:02 +10001079if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001080 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001081fi
1082
Damien Miller6c21c512002-01-22 21:57:53 +11001083
1084### Configure cryptographic random number support
1085
1086# Check wheter OpenSSL seeds itself
1087AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1088AC_TRY_RUN(
1089 [
1090#include <string.h>
1091#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001092int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001093 ],
1094 [
1095 OPENSSL_SEEDS_ITSELF=yes
1096 AC_MSG_RESULT(yes)
1097 ],
1098 [
1099 AC_MSG_RESULT(no)
1100 # Default to use of the rand helper if OpenSSL doesn't
1101 # seed itself
1102 USE_RAND_HELPER=yes
1103 ]
1104)
1105
1106
1107# Do we want to force the use of the rand helper?
1108AC_ARG_WITH(rand-helper,
1109 [ --with-rand-helper Use subprocess to gather strong randomness ],
1110 [
1111 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001112 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001113 # the previous test showed it to be unseeded.
1114 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1115 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1116 OPENSSL_SEEDS_ITSELF=yes
1117 USE_RAND_HELPER=""
1118 fi
1119 else
1120 USE_RAND_HELPER=yes
1121 fi
1122 ],
1123)
1124
1125# Which randomness source do we use?
1126if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1127 # OpenSSL only
1128 AC_DEFINE(OPENSSL_PRNG_ONLY)
1129 RAND_MSG="OpenSSL internal ONLY"
1130 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001131elif test ! -z "$USE_RAND_HELPER" ; then
1132 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001133 RAND_MSG="ssh-rand-helper"
1134 INSTALL_SSH_RAND_HELPER="yes"
1135fi
1136AC_SUBST(INSTALL_SSH_RAND_HELPER)
1137
1138### Configuration of ssh-rand-helper
1139
1140# PRNGD TCP socket
1141AC_ARG_WITH(prngd-port,
1142 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1143 [
Damien Millere996d722002-01-23 11:20:59 +11001144 case "$withval" in
1145 no)
1146 withval=""
1147 ;;
1148 [[0-9]]*)
1149 ;;
1150 *)
1151 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1152 ;;
1153 esac
1154 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001155 PRNGD_PORT="$withval"
1156 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1157 fi
1158 ]
1159)
1160
1161# PRNGD Unix domain socket
1162AC_ARG_WITH(prngd-socket,
1163 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1164 [
Damien Millere996d722002-01-23 11:20:59 +11001165 case "$withval" in
1166 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001167 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001168 ;;
1169 no)
1170 withval=""
1171 ;;
1172 /*)
1173 ;;
1174 *)
1175 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1176 ;;
1177 esac
1178
1179 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001180 if test ! -z "$PRNGD_PORT" ; then
1181 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1182 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001183 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001184 AC_MSG_WARN(Entropy socket is not readable)
1185 fi
1186 PRNGD_SOCKET="$withval"
1187 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1188 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001189 ],
1190 [
1191 # Check for existing socket only if we don't have a random device already
1192 if test "$USE_RAND_HELPER" = yes ; then
1193 AC_MSG_CHECKING(for PRNGD/EGD socket)
1194 # Insert other locations here
1195 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1196 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1197 PRNGD_SOCKET="$sock"
1198 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1199 break;
1200 fi
1201 done
1202 if test ! -z "$PRNGD_SOCKET" ; then
1203 AC_MSG_RESULT($PRNGD_SOCKET)
1204 else
1205 AC_MSG_RESULT(not found)
1206 fi
1207 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001208 ]
1209)
1210
1211# Change default command timeout for hashing entropy source
1212entropy_timeout=200
1213AC_ARG_WITH(entropy-timeout,
1214 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1215 [
1216 if test "x$withval" != "xno" ; then
1217 entropy_timeout=$withval
1218 fi
1219 ]
1220)
Damien Miller6c21c512002-01-22 21:57:53 +11001221AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1222
Damien Millerd3f6ad22002-06-25 10:24:47 +10001223SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001224AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001225 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001226 [
1227 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001228 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001229 fi
1230 ]
1231)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001232AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1233AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001234
Tim Rice88f2ab52002-03-17 12:17:34 -08001235# We do this little dance with the search path to insure
1236# that programs that we select for use by installed programs
1237# (which may be run by the super-user) come from trusted
1238# locations before they come from the user's private area.
1239# This should help avoid accidentally configuring some
1240# random version of a program in someone's personal bin.
1241
1242OPATH=$PATH
1243PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001244test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001245test -d /sbin && PATH=$PATH:/sbin
1246test -d /usr/sbin && PATH=$PATH:/usr/sbin
1247PATH=$PATH:/etc:$OPATH
1248
Damien Millera8e06ce2003-11-21 23:48:55 +11001249# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001250OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1251OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1252OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1253OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1254OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1255OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1256OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1257OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1258OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1259OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1260OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1261OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1262OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1263OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1264OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1265OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001266# restore PATH
1267PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001268
1269# Where does ssh-rand-helper get its randomness from?
1270INSTALL_SSH_PRNG_CMDS=""
1271if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1272 if test ! -z "$PRNGD_PORT" ; then
1273 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1274 elif test ! -z "$PRNGD_SOCKET" ; then
1275 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1276 else
1277 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1278 RAND_HELPER_CMDHASH=yes
1279 INSTALL_SSH_PRNG_CMDS="yes"
1280 fi
1281fi
1282AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1283
1284
Ben Lindstromb5628642000-10-18 00:02:25 +00001285# Cheap hack to ensure NEWS-OS libraries are arranged right.
1286if test ! -z "$SONY" ; then
1287 LIBS="$LIBS -liberty";
1288fi
1289
Damien Millera22ba012000-03-02 23:09:20 +11001290# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001291AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001292AC_CHECK_SIZEOF(short int, 2)
1293AC_CHECK_SIZEOF(int, 4)
1294AC_CHECK_SIZEOF(long int, 4)
1295AC_CHECK_SIZEOF(long long int, 8)
1296
Damien Millerfa2bb692002-04-23 23:22:25 +10001297# Sanity check long long for some platforms (AIX)
1298if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1299 ac_cv_sizeof_long_long_int=0
1300fi
1301
Damien Millera22ba012000-03-02 23:09:20 +11001302# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001303AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1304 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001305 [ #include <sys/types.h> ],
1306 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001307 [ ac_cv_have_u_int="yes" ],
1308 [ ac_cv_have_u_int="no" ]
1309 )
1310])
1311if test "x$ac_cv_have_u_int" = "xyes" ; then
1312 AC_DEFINE(HAVE_U_INT)
1313 have_u_int=1
1314fi
1315
Damien Miller61e50f12000-05-08 20:49:37 +10001316AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1317 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001318 [ #include <sys/types.h> ],
1319 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001320 [ ac_cv_have_intxx_t="yes" ],
1321 [ ac_cv_have_intxx_t="no" ]
1322 )
1323])
1324if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1325 AC_DEFINE(HAVE_INTXX_T)
1326 have_intxx_t=1
1327fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001328
1329if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001330 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001331then
1332 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1333 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001334 [ #include <stdint.h> ],
1335 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001336 [
1337 AC_DEFINE(HAVE_INTXX_T)
1338 AC_MSG_RESULT(yes)
1339 ],
1340 [ AC_MSG_RESULT(no) ]
1341 )
1342fi
1343
Damien Miller578783e2000-09-23 14:12:24 +11001344AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1345 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001346 [
1347#include <sys/types.h>
1348#ifdef HAVE_STDINT_H
1349# include <stdint.h>
1350#endif
1351#include <sys/socket.h>
1352#ifdef HAVE_SYS_BITYPES_H
1353# include <sys/bitypes.h>
1354#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001355 ],
1356 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001357 [ ac_cv_have_int64_t="yes" ],
1358 [ ac_cv_have_int64_t="no" ]
1359 )
1360])
1361if test "x$ac_cv_have_int64_t" = "xyes" ; then
1362 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001363fi
1364
Damien Miller61e50f12000-05-08 20:49:37 +10001365AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1366 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001367 [ #include <sys/types.h> ],
1368 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001369 [ ac_cv_have_u_intxx_t="yes" ],
1370 [ ac_cv_have_u_intxx_t="no" ]
1371 )
1372])
1373if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1374 AC_DEFINE(HAVE_U_INTXX_T)
1375 have_u_intxx_t=1
1376fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001377
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001378if test -z "$have_u_intxx_t" ; then
1379 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1380 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001381 [ #include <sys/socket.h> ],
1382 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001383 [
1384 AC_DEFINE(HAVE_U_INTXX_T)
1385 AC_MSG_RESULT(yes)
1386 ],
1387 [ AC_MSG_RESULT(no) ]
1388 )
1389fi
1390
Damien Miller578783e2000-09-23 14:12:24 +11001391AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1392 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001393 [ #include <sys/types.h> ],
1394 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001395 [ ac_cv_have_u_int64_t="yes" ],
1396 [ ac_cv_have_u_int64_t="no" ]
1397 )
1398])
1399if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1400 AC_DEFINE(HAVE_U_INT64_T)
1401 have_u_int64_t=1
1402fi
1403
Tim Rice4cec93f2002-02-26 08:40:48 -08001404if test -z "$have_u_int64_t" ; then
1405 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1406 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001407 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001408 [ u_int64_t a; a = 1],
1409 [
1410 AC_DEFINE(HAVE_U_INT64_T)
1411 AC_MSG_RESULT(yes)
1412 ],
1413 [ AC_MSG_RESULT(no) ]
1414 )
1415fi
1416
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001417if test -z "$have_u_intxx_t" ; then
1418 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1419 AC_TRY_COMPILE(
1420 [
1421#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001422 ],
1423 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001424 [ ac_cv_have_uintxx_t="yes" ],
1425 [ ac_cv_have_uintxx_t="no" ]
1426 )
1427 ])
1428 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1429 AC_DEFINE(HAVE_UINTXX_T)
1430 fi
1431fi
1432
1433if test -z "$have_uintxx_t" ; then
1434 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1435 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001436 [ #include <stdint.h> ],
1437 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001438 [
1439 AC_DEFINE(HAVE_UINTXX_T)
1440 AC_MSG_RESULT(yes)
1441 ],
1442 [ AC_MSG_RESULT(no) ]
1443 )
1444fi
1445
Damien Milleredb82922000-06-20 13:25:52 +10001446if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001447 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001448then
1449 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1450 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001451 [
1452#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001453 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001454 [
Damien Miller70494d12000-04-03 15:57:06 +10001455 int8_t a; int16_t b; int32_t c;
1456 u_int8_t e; u_int16_t f; u_int32_t g;
1457 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001458 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001459 [
1460 AC_DEFINE(HAVE_U_INTXX_T)
1461 AC_DEFINE(HAVE_INTXX_T)
1462 AC_MSG_RESULT(yes)
1463 ],
1464 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001465 )
Damien Millerb29ea912000-01-15 14:12:03 +11001466fi
1467
Damien Miller58be7382001-09-15 21:31:54 +10001468
1469AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1470 AC_TRY_COMPILE(
1471 [
1472#include <sys/types.h>
1473 ],
1474 [ u_char foo; foo = 125; ],
1475 [ ac_cv_have_u_char="yes" ],
1476 [ ac_cv_have_u_char="no" ]
1477 )
1478])
1479if test "x$ac_cv_have_u_char" = "xyes" ; then
1480 AC_DEFINE(HAVE_U_CHAR)
1481fi
1482
Tim Rice13aae5e2001-10-21 17:53:58 -07001483TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001484
Tim Rice200a5c02002-02-26 22:12:34 -08001485AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001486
Damien Miller61e50f12000-05-08 20:49:37 +10001487AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1488 AC_TRY_COMPILE(
1489 [
1490#include <sys/types.h>
1491 ],
1492 [ size_t foo; foo = 1235; ],
1493 [ ac_cv_have_size_t="yes" ],
1494 [ ac_cv_have_size_t="no" ]
1495 )
1496])
1497if test "x$ac_cv_have_size_t" = "xyes" ; then
1498 AC_DEFINE(HAVE_SIZE_T)
1499fi
Damien Miller95058511999-12-29 10:36:45 +11001500
Damien Miller615f9392000-05-17 22:53:33 +10001501AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1502 AC_TRY_COMPILE(
1503 [
1504#include <sys/types.h>
1505 ],
1506 [ ssize_t foo; foo = 1235; ],
1507 [ ac_cv_have_ssize_t="yes" ],
1508 [ ac_cv_have_ssize_t="no" ]
1509 )
1510])
1511if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1512 AC_DEFINE(HAVE_SSIZE_T)
1513fi
1514
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001515AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1516 AC_TRY_COMPILE(
1517 [
1518#include <time.h>
1519 ],
1520 [ clock_t foo; foo = 1235; ],
1521 [ ac_cv_have_clock_t="yes" ],
1522 [ ac_cv_have_clock_t="no" ]
1523 )
1524])
1525if test "x$ac_cv_have_clock_t" = "xyes" ; then
1526 AC_DEFINE(HAVE_CLOCK_T)
1527fi
1528
Damien Millerb54b40e2000-06-23 08:23:34 +10001529AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1530 AC_TRY_COMPILE(
1531 [
1532#include <sys/types.h>
1533#include <sys/socket.h>
1534 ],
1535 [ sa_family_t foo; foo = 1235; ],
1536 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001537 [ AC_TRY_COMPILE(
1538 [
1539#include <sys/types.h>
1540#include <sys/socket.h>
1541#include <netinet/in.h>
1542 ],
1543 [ sa_family_t foo; foo = 1235; ],
1544 [ ac_cv_have_sa_family_t="yes" ],
1545
Damien Millerb54b40e2000-06-23 08:23:34 +10001546 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001547 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001548 )
1549])
1550if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1551 AC_DEFINE(HAVE_SA_FAMILY_T)
1552fi
1553
Damien Miller0f91b4e2000-06-18 15:43:25 +10001554AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1555 AC_TRY_COMPILE(
1556 [
1557#include <sys/types.h>
1558 ],
1559 [ pid_t foo; foo = 1235; ],
1560 [ ac_cv_have_pid_t="yes" ],
1561 [ ac_cv_have_pid_t="no" ]
1562 )
1563])
1564if test "x$ac_cv_have_pid_t" = "xyes" ; then
1565 AC_DEFINE(HAVE_PID_T)
1566fi
1567
1568AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1569 AC_TRY_COMPILE(
1570 [
1571#include <sys/types.h>
1572 ],
1573 [ mode_t foo; foo = 1235; ],
1574 [ ac_cv_have_mode_t="yes" ],
1575 [ ac_cv_have_mode_t="no" ]
1576 )
1577])
1578if test "x$ac_cv_have_mode_t" = "xyes" ; then
1579 AC_DEFINE(HAVE_MODE_T)
1580fi
1581
Damien Miller61e50f12000-05-08 20:49:37 +10001582
1583AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1584 AC_TRY_COMPILE(
1585 [
Damien Miller81171112000-04-23 11:14:01 +10001586#include <sys/types.h>
1587#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001588 ],
1589 [ struct sockaddr_storage s; ],
1590 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1591 [ ac_cv_have_struct_sockaddr_storage="no" ]
1592 )
1593])
1594if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1595 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1596fi
Damien Miller34132e52000-01-14 15:45:46 +11001597
Damien Miller61e50f12000-05-08 20:49:37 +10001598AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1599 AC_TRY_COMPILE(
1600 [
Damien Miller7b22d652000-06-18 14:07:04 +10001601#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001602#include <netinet/in.h>
1603 ],
1604 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1605 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1606 [ ac_cv_have_struct_sockaddr_in6="no" ]
1607 )
1608])
1609if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1610 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1611fi
Damien Miller34132e52000-01-14 15:45:46 +11001612
Damien Miller61e50f12000-05-08 20:49:37 +10001613AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1614 AC_TRY_COMPILE(
1615 [
Damien Miller7b22d652000-06-18 14:07:04 +10001616#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001617#include <netinet/in.h>
1618 ],
1619 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1620 [ ac_cv_have_struct_in6_addr="yes" ],
1621 [ ac_cv_have_struct_in6_addr="no" ]
1622 )
1623])
1624if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1625 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1626fi
Damien Miller34132e52000-01-14 15:45:46 +11001627
Damien Miller61e50f12000-05-08 20:49:37 +10001628AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1629 AC_TRY_COMPILE(
1630 [
Damien Miller81171112000-04-23 11:14:01 +10001631#include <sys/types.h>
1632#include <sys/socket.h>
1633#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001634 ],
1635 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1636 [ ac_cv_have_struct_addrinfo="yes" ],
1637 [ ac_cv_have_struct_addrinfo="no" ]
1638 )
1639])
1640if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1641 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1642fi
1643
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001644AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1645 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001646 [ #include <sys/time.h> ],
1647 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001648 [ ac_cv_have_struct_timeval="yes" ],
1649 [ ac_cv_have_struct_timeval="no" ]
1650 )
1651])
1652if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1653 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1654 have_struct_timeval=1
1655fi
1656
Tim Rice4e4dc562003-03-18 10:21:40 -08001657AC_CHECK_TYPES(struct timespec)
1658
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001659# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001660if test "x$ac_cv_have_int64_t" = "xno" -a \
1661 "x$ac_cv_sizeof_long_int" != "x8" -a \
1662 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001663 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1664 echo "an alternative compiler (I.E., GCC) before continuing."
1665 echo ""
1666 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001667else
1668dnl test snprintf (broken on SCO w/gcc)
1669 AC_TRY_RUN(
1670 [
1671#include <stdio.h>
1672#include <string.h>
1673#ifdef HAVE_SNPRINTF
1674main()
1675{
1676 char buf[50];
1677 char expected_out[50];
1678 int mazsize = 50 ;
1679#if (SIZEOF_LONG_INT == 8)
1680 long int num = 0x7fffffffffffffff;
1681#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001682 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001683#endif
1684 strcpy(expected_out, "9223372036854775807");
1685 snprintf(buf, mazsize, "%lld", num);
1686 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001687 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001688 exit(0);
1689}
1690#else
1691main() { exit(0); }
1692#endif
1693 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1694 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001695fi
1696
Damien Miller78315eb2000-09-29 23:01:36 +11001697dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001698OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1699OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1700OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1701OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1702OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001703OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001704OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1705OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001706OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001707OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1708OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1709OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1710OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001711OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1712OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1713OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1714OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001715
1716AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001717
Damien Miller61e50f12000-05-08 20:49:37 +10001718AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1719 ac_cv_have_ss_family_in_struct_ss, [
1720 AC_TRY_COMPILE(
1721 [
Damien Miller81171112000-04-23 11:14:01 +10001722#include <sys/types.h>
1723#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001724 ],
1725 [ struct sockaddr_storage s; s.ss_family = 1; ],
1726 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1727 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1728 )
1729])
1730if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1731 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1732fi
1733
Damien Miller61e50f12000-05-08 20:49:37 +10001734AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1735 ac_cv_have___ss_family_in_struct_ss, [
1736 AC_TRY_COMPILE(
1737 [
Damien Miller81171112000-04-23 11:14:01 +10001738#include <sys/types.h>
1739#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001740 ],
1741 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1742 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1743 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1744 )
1745])
1746if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1747 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1748fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001749
Damien Millerad833b32000-08-23 10:46:23 +10001750AC_CACHE_CHECK([for pw_class field in struct passwd],
1751 ac_cv_have_pw_class_in_struct_passwd, [
1752 AC_TRY_COMPILE(
1753 [
Damien Millerad833b32000-08-23 10:46:23 +10001754#include <pwd.h>
1755 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001756 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001757 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1758 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1759 )
1760])
1761if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1762 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1763fi
1764
Kevin Steves82456952001-06-22 21:14:18 +00001765AC_CACHE_CHECK([for pw_expire field in struct passwd],
1766 ac_cv_have_pw_expire_in_struct_passwd, [
1767 AC_TRY_COMPILE(
1768 [
1769#include <pwd.h>
1770 ],
1771 [ struct passwd p; p.pw_expire = 0; ],
1772 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1773 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1774 )
1775])
1776if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1777 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1778fi
1779
1780AC_CACHE_CHECK([for pw_change field in struct passwd],
1781 ac_cv_have_pw_change_in_struct_passwd, [
1782 AC_TRY_COMPILE(
1783 [
1784#include <pwd.h>
1785 ],
1786 [ struct passwd p; p.pw_change = 0; ],
1787 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1788 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1789 )
1790])
1791if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1792 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1793fi
Damien Miller61e50f12000-05-08 20:49:37 +10001794
Tim Rice28bbb0c2002-05-27 17:37:32 -07001795dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001796AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1797 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001798 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001799 [
Tim Riceae49fe62002-04-12 10:26:21 -07001800#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001801#include <sys/socket.h>
1802#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001803int main() {
1804#ifdef msg_accrights
1805exit(1);
1806#endif
1807struct msghdr m;
1808m.msg_accrights = 0;
1809exit(0);
1810}
Kevin Steves939c9db2002-03-22 17:23:25 +00001811 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001812 [ ac_cv_have_accrights_in_msghdr="yes" ],
1813 [ ac_cv_have_accrights_in_msghdr="no" ]
1814 )
1815])
1816if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1817 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1818fi
1819
Kevin Stevesa44e0352002-04-07 16:18:03 +00001820AC_CACHE_CHECK([for msg_control field in struct msghdr],
1821 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001822 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001823 [
Tim Riceae49fe62002-04-12 10:26:21 -07001824#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001825#include <sys/socket.h>
1826#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001827int main() {
1828#ifdef msg_control
1829exit(1);
1830#endif
1831struct msghdr m;
1832m.msg_control = 0;
1833exit(0);
1834}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001835 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001836 [ ac_cv_have_control_in_msghdr="yes" ],
1837 [ ac_cv_have_control_in_msghdr="no" ]
1838 )
1839])
1840if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1841 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1842fi
1843
Damien Miller61e50f12000-05-08 20:49:37 +10001844AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11001845 AC_TRY_LINK([],
1846 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10001847 [ ac_cv_libc_defines___progname="yes" ],
1848 [ ac_cv_libc_defines___progname="no" ]
1849 )
1850])
1851if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1852 AC_DEFINE(HAVE___PROGNAME)
1853fi
1854
Kevin Steves4846f4a2002-03-22 18:19:53 +00001855AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1856 AC_TRY_LINK([
1857#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001858],
1859 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00001860 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1861 [ ac_cv_cc_implements___FUNCTION__="no" ]
1862 )
1863])
1864if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1865 AC_DEFINE(HAVE___FUNCTION__)
1866fi
1867
1868AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1869 AC_TRY_LINK([
1870#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001871],
1872 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00001873 [ ac_cv_cc_implements___func__="yes" ],
1874 [ ac_cv_cc_implements___func__="no" ]
1875 )
1876])
1877if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1878 AC_DEFINE(HAVE___func__)
1879fi
1880
Damien Miller4f8e6692001-07-14 13:22:53 +10001881AC_CACHE_CHECK([whether getopt has optreset support],
1882 ac_cv_have_getopt_optreset, [
1883 AC_TRY_LINK(
1884 [
1885#include <getopt.h>
1886 ],
1887 [ extern int optreset; optreset = 0; ],
1888 [ ac_cv_have_getopt_optreset="yes" ],
1889 [ ac_cv_have_getopt_optreset="no" ]
1890 )
1891])
1892if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1893 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1894fi
Damien Millera22ba012000-03-02 23:09:20 +11001895
Damien Millerecbb26d2000-07-15 14:59:14 +10001896AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11001897 AC_TRY_LINK([],
1898 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10001899 [ ac_cv_libc_defines_sys_errlist="yes" ],
1900 [ ac_cv_libc_defines_sys_errlist="no" ]
1901 )
1902])
1903if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1904 AC_DEFINE(HAVE_SYS_ERRLIST)
1905fi
1906
1907
Damien Miller11fa2cc2000-08-16 10:35:58 +10001908AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11001909 AC_TRY_LINK([],
1910 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10001911 [ ac_cv_libc_defines_sys_nerr="yes" ],
1912 [ ac_cv_libc_defines_sys_nerr="no" ]
1913 )
1914])
1915if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1916 AC_DEFINE(HAVE_SYS_NERR)
1917fi
1918
Damien Millera8e06ce2003-11-21 23:48:55 +11001919SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001920# Check whether user wants sectok support
1921AC_ARG_WITH(sectok,
1922 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001923 [
1924 if test "x$withval" != "xno" ; then
1925 if test "x$withval" != "xyes" ; then
1926 CPPFLAGS="$CPPFLAGS -I${withval}"
1927 LDFLAGS="$LDFLAGS -L${withval}"
1928 if test ! -z "$need_dash_r" ; then
1929 LDFLAGS="$LDFLAGS -R${withval}"
1930 fi
1931 if test ! -z "$blibpath" ; then
1932 blibpath="$blibpath:${withval}"
1933 fi
1934 fi
1935 AC_CHECK_HEADERS(sectok.h)
1936 if test "$ac_cv_header_sectok_h" != yes; then
1937 AC_MSG_ERROR(Can't find sectok.h)
1938 fi
1939 AC_CHECK_LIB(sectok, sectok_open)
1940 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1941 AC_MSG_ERROR(Can't find libsectok)
1942 fi
1943 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001944 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11001945 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001946 fi
1947 ]
1948)
1949
1950# Check whether user wants OpenSC support
1951AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001952 AC_HELP_STRING([--with-opensc=PFX],
1953 [Enable smartcard support using OpenSC]),
1954 opensc_config_prefix="$withval", opensc_config_prefix="")
1955if test x$opensc_config_prefix != x ; then
1956 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1957 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1958 if test "$OPENSC_CONFIG" != "no"; then
1959 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1960 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1961 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1962 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1963 AC_DEFINE(SMARTCARD)
1964 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11001965 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10001966 fi
1967fi
Damien Miller85de5802001-09-18 14:01:11 +10001968
Darren Tucker5f88d342003-10-15 16:57:57 +10001969# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11001970AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10001971 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10001972 [
Darren Tucker5f88d342003-10-15 16:57:57 +10001973 # Needed by our getrrsetbyname()
1974 AC_SEARCH_LIBS(res_query, resolv)
1975 AC_SEARCH_LIBS(dn_expand, resolv)
1976 AC_CHECK_FUNCS(_getshort _getlong)
1977 AC_CHECK_MEMBER(HEADER.ad,
1978 [AC_DEFINE(HAVE_HEADER_AD)],,
1979 [#include <arpa/nameser.h>])
1980 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10001981
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001982# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11001983KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001984AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11001985 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1986 [
1987 if test "x$withval" != "xno" ; then
1988 if test "x$withval" = "xyes" ; then
1989 KRB5ROOT="/usr/local"
1990 else
1991 KRB5ROOT=${withval}
1992 fi
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001993 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11001994 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1995 AC_DEFINE(KRB5)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001996 KRB5_MSG="yes"
Damien Millera8e06ce2003-11-21 23:48:55 +11001997 AC_MSG_CHECKING(whether we are using Heimdal)
1998 AC_TRY_COMPILE([ #include <krb5.h> ],
1999 [ char *tmp = heimdal_version; ],
2000 [ AC_MSG_RESULT(yes)
2001 AC_DEFINE(HEIMDAL)
2002 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2003 ],
2004 [ AC_MSG_RESULT(no)
2005 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2006 ]
2007 )
2008 if test ! -z "$need_dash_r" ; then
2009 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2010 fi
2011 if test ! -z "$blibpath" ; then
2012 blibpath="$blibpath:${KRB5ROOT}/lib"
2013 fi
Damien Miller200d0a72003-06-30 19:21:36 +10002014 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002015
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002016 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2017 [ AC_DEFINE(GSSAPI)
2018 K5LIBS="-lgssapi $K5LIBS" ],
2019 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2020 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002021 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002022 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2023 $K5LIBS)
2024 ],
2025 $K5LIBS)
2026
2027 AC_CHECK_HEADER(gssapi.h, ,
2028 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002029 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002030 AC_CHECK_HEADERS(gssapi.h, ,
2031 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002032 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002033 ]
2034 )
2035
2036 oldCPP="$CPPFLAGS"
2037 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2038 AC_CHECK_HEADER(gssapi_krb5.h, ,
2039 [ CPPFLAGS="$oldCPP" ])
2040
Damien Millera8e06ce2003-11-21 23:48:55 +11002041 KRB5=yes
2042 fi
2043 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002044)
Darren Tucker6aaa58c2003-08-02 22:24:49 +10002045LIBS="$LIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10002046
Damien Millera22ba012000-03-02 23:09:20 +11002047# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002048
Damien Millerf58c6722002-05-13 13:15:42 +10002049PRIVSEP_PATH=/var/empty
2050AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002051 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002052 [
2053 if test "x$withval" != "$no" ; then
2054 PRIVSEP_PATH=$withval
2055 fi
2056 ]
2057)
2058AC_SUBST(PRIVSEP_PATH)
2059
Damien Millera22ba012000-03-02 23:09:20 +11002060AC_ARG_WITH(xauth,
2061 [ --with-xauth=PATH Specify path to xauth program ],
2062 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002063 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002064 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002065 fi
2066 ],
2067 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002068 TestPath="$PATH"
2069 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2070 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2071 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2072 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2073 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002074 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002075 xauth_path="/usr/openwin/bin/xauth"
2076 fi
2077 ]
2078)
2079
Damien Miller7d901272003-01-13 16:55:22 +11002080STRIP_OPT=-s
2081AC_ARG_ENABLE(strip,
2082 [ --disable-strip Disable calling strip(1) on install],
2083 [
2084 if test "x$enableval" = "xno" ; then
2085 STRIP_OPT=
2086 fi
2087 ]
2088)
2089AC_SUBST(STRIP_OPT)
2090
Damien Millera19cf472000-11-29 13:28:50 +11002091if test -z "$xauth_path" ; then
2092 XAUTH_PATH="undefined"
2093 AC_SUBST(XAUTH_PATH)
2094else
Damien Millera22ba012000-03-02 23:09:20 +11002095 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002096 XAUTH_PATH=$xauth_path
2097 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002098fi
Damien Millera22ba012000-03-02 23:09:20 +11002099
2100# Check for mail directory (last resort if we cannot get it from headers)
2101if test ! -z "$MAIL" ; then
2102 maildir=`dirname $MAIL`
2103 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2104fi
2105
Damien Millera22ba012000-03-02 23:09:20 +11002106if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002107 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002108 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002109 [
2110 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2111 have_dev_ptmx=1
2112 ]
2113 )
2114 fi
Damien Millera22ba012000-03-02 23:09:20 +11002115fi
Damien Millera8e06ce2003-11-21 23:48:55 +11002116AC_CHECK_FILE("/dev/ptc",
Damien Miller204ad072000-03-02 23:56:12 +11002117 [
2118 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2119 have_dev_ptc=1
2120 ]
2121)
2122
Damien Millera22ba012000-03-02 23:09:20 +11002123# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002124AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002125 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002126 [
Damien Miller897741e2001-04-16 10:41:46 +10002127 case "$withval" in
2128 man|cat|doc)
2129 MANTYPE=$withval
2130 ;;
2131 *)
2132 AC_MSG_ERROR(invalid man type: $withval)
2133 ;;
2134 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002135 ]
2136)
Ben Lindstrombc709922001-04-18 18:04:21 +00002137if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002138 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2139 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002140 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2141 MANTYPE=doc
2142 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2143 MANTYPE=man
2144 else
2145 MANTYPE=cat
2146 fi
2147fi
Damien Miller670a4b82000-01-22 13:53:11 +11002148AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002149if test "$MANTYPE" = "doc"; then
2150 mansubdir=man;
2151else
2152 mansubdir=$MANTYPE;
2153fi
2154AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002155
Damien Millera22ba012000-03-02 23:09:20 +11002156# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002157MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002158AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002159 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002160 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002161 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002162 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002163 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002164 fi
2165 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002166)
2167
Damien Millera22ba012000-03-02 23:09:20 +11002168# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002169AC_ARG_WITH(shadow,
2170 [ --without-shadow Disable shadow password support],
2171 [
2172 if test "x$withval" = "xno" ; then
2173 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002174 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002175 fi
2176 ]
2177)
2178
Damien Miller1f335fb2000-06-26 11:31:33 +10002179if test -z "$disable_shadow" ; then
2180 AC_MSG_CHECKING([if the systems has expire shadow information])
2181 AC_TRY_COMPILE(
2182 [
2183#include <sys/types.h>
2184#include <shadow.h>
2185 struct spwd sp;
2186 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2187 [ sp_expire_available=yes ], []
2188 )
2189
2190 if test "x$sp_expire_available" = "xyes" ; then
2191 AC_MSG_RESULT(yes)
2192 AC_DEFINE(HAS_SHADOW_EXPIRE)
2193 else
2194 AC_MSG_RESULT(no)
2195 fi
2196fi
2197
Damien Millera22ba012000-03-02 23:09:20 +11002198# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002199if test ! -z "$IPADDR_IN_DISPLAY" ; then
2200 DISPLAY_HACK_MSG="yes"
2201 AC_DEFINE(IPADDR_IN_DISPLAY)
2202else
Damien Millera8e06ce2003-11-21 23:48:55 +11002203 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002204 AC_ARG_WITH(ipaddr-display,
2205 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2206 [
2207 if test "x$withval" != "xno" ; then
2208 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002209 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002210 fi
2211 ]
2212 )
2213fi
Damien Miller76112de1999-12-21 11:18:08 +11002214
Darren Tuckere1a790d2003-09-16 11:52:19 +10002215# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002216AC_ARG_ENABLE(etc-default-login,
2217 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2218[
Darren Tuckere1a790d2003-09-16 11:52:19 +10002219AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2220
2221if test "x$external_path_file" = "x/etc/default/login"; then
2222 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2223fi
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002224])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002225
Tim Rice43a1c132002-04-17 21:19:14 -07002226dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2227if test $ac_cv_func_login_getcapbool = "yes" -a \
2228 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002229 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002230fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002231
Damien Millera22ba012000-03-02 23:09:20 +11002232# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002233SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002234AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002235 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002236 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002237 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002238 AC_MSG_WARN([
2239--with-default-path=PATH has no effect on this system.
2240Edit /etc/login.conf instead.])
2241 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002242 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002243 AC_MSG_WARN([
2244--with-default-path=PATH will only be used if PATH is not defined in
2245$external_path_file .])
2246 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002247 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002248 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002249 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002250 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002251 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2252 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002253 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002254 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002255 AC_MSG_WARN([
2256If PATH is defined in $external_path_file, ensure the path to scp is included,
2257otherwise scp will not work.])
2258 fi
2259 AC_TRY_RUN(
2260 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002261/* find out what STDPATH is */
2262#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002263#ifdef HAVE_PATHS_H
2264# include <paths.h>
2265#endif
2266#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002267# ifdef _PATH_USERPATH /* Irix */
2268# define _PATH_STDPATH _PATH_USERPATH
2269# else
2270# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2271# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002272#endif
2273#include <sys/types.h>
2274#include <sys/stat.h>
2275#include <fcntl.h>
2276#define DATA "conftest.stdpath"
2277
2278main()
2279{
2280 FILE *fd;
2281 int rc;
2282
2283 fd = fopen(DATA,"w");
2284 if(fd == NULL)
2285 exit(1);
2286
2287 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2288 exit(1);
2289
2290 exit(0);
2291}
2292 ], [ user_path=`cat conftest.stdpath` ],
2293 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2294 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2295 )
2296# make sure $bindir is in USER_PATH so scp will work
2297 t_bindir=`eval echo ${bindir}`
2298 case $t_bindir in
2299 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2300 esac
2301 case $t_bindir in
2302 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2303 esac
2304 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2305 if test $? -ne 0 ; then
2306 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2307 if test $? -ne 0 ; then
2308 user_path=$user_path:$t_bindir
2309 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2310 fi
2311 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002312 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002313)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002314if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002315 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2316 AC_SUBST(user_path)
2317fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002318
Damien Millera18bbd32002-05-13 10:48:57 +10002319# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002320AC_ARG_WITH(superuser-path,
2321 [ --with-superuser-path= Specify different path for super-user],
2322 [
2323 if test "x$withval" != "xno" ; then
2324 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2325 superuser_path=$withval
2326 fi
2327 ]
2328)
2329
2330
Damien Miller61e50f12000-05-08 20:49:37 +10002331AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002332IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002333AC_ARG_WITH(4in6,
2334 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2335 [
2336 if test "x$withval" != "xno" ; then
2337 AC_MSG_RESULT(yes)
2338 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002339 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002340 else
2341 AC_MSG_RESULT(no)
2342 fi
2343 ],[
2344 if test "x$inet6_default_4in6" = "xyes"; then
2345 AC_MSG_RESULT([yes (default)])
2346 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002347 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002348 else
2349 AC_MSG_RESULT([no (default)])
2350 fi
2351 ]
2352)
2353
Damien Miller60396b02001-02-18 17:01:00 +11002354# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002355BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002356AC_ARG_WITH(bsd-auth,
2357 [ --with-bsd-auth Enable BSD auth support],
2358 [
2359 if test "x$withval" != "xno" ; then
2360 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002361 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002362 fi
2363 ]
2364)
2365
Damien Millera22ba012000-03-02 23:09:20 +11002366# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002367piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002368# make sure the directory exists
2369if test ! -d $piddir ; then
2370 piddir=`eval echo ${sysconfdir}`
2371 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002372 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002373 esac
2374fi
2375
Tim Rice88f2ab52002-03-17 12:17:34 -08002376AC_ARG_WITH(pid-dir,
2377 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2378 [
2379 if test "x$withval" != "xno" ; then
2380 piddir=$withval
2381 if test ! -d $piddir ; then
2382 AC_MSG_WARN([** no $piddir directory on this system **])
2383 fi
2384 fi
2385 ]
2386)
2387
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002388AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002389AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002390
andre2ff7b5d2000-06-03 14:57:40 +00002391dnl allow user to disable some login recording features
2392AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002393 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002394 [
2395 if test "x$enableval" = "xno" ; then
2396 AC_DEFINE(DISABLE_LASTLOG)
2397 fi
2398 ]
andre2ff7b5d2000-06-03 14:57:40 +00002399)
2400AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002401 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002402 [
2403 if test "x$enableval" = "xno" ; then
2404 AC_DEFINE(DISABLE_UTMP)
2405 fi
2406 ]
andre2ff7b5d2000-06-03 14:57:40 +00002407)
2408AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002409 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002410 [
2411 if test "x$enableval" = "xno" ; then
2412 AC_DEFINE(DISABLE_UTMPX)
2413 fi
2414 ]
andre2ff7b5d2000-06-03 14:57:40 +00002415)
2416AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002417 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002418 [
2419 if test "x$enableval" = "xno" ; then
2420 AC_DEFINE(DISABLE_WTMP)
2421 fi
2422 ]
andre2ff7b5d2000-06-03 14:57:40 +00002423)
2424AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002425 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002426 [
2427 if test "x$enableval" = "xno" ; then
2428 AC_DEFINE(DISABLE_WTMPX)
2429 fi
2430 ]
andre2ff7b5d2000-06-03 14:57:40 +00002431)
2432AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002433 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002434 [
2435 if test "x$enableval" = "xno" ; then
2436 AC_DEFINE(DISABLE_LOGIN)
2437 fi
2438 ]
andre2ff7b5d2000-06-03 14:57:40 +00002439)
2440AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002441 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002442 [
2443 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002444 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002445 fi
2446 ]
andre2ff7b5d2000-06-03 14:57:40 +00002447)
2448AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002449 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002450 [
2451 if test "x$enableval" = "xno" ; then
2452 AC_DEFINE(DISABLE_PUTUTXLINE)
2453 fi
2454 ]
andre2ff7b5d2000-06-03 14:57:40 +00002455)
2456AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002457 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002458 [
2459 if test "x$withval" = "xno" ; then
2460 AC_DEFINE(DISABLE_LASTLOG)
2461 else
2462 conf_lastlog_location=$withval
2463 fi
2464 ]
2465)
andre2ff7b5d2000-06-03 14:57:40 +00002466
2467dnl lastlog, [uw]tmpx? detection
2468dnl NOTE: set the paths in the platform section to avoid the
2469dnl need for command-line parameters
2470dnl lastlog and [uw]tmp are subject to a file search if all else fails
2471
2472dnl lastlog detection
2473dnl NOTE: the code itself will detect if lastlog is a directory
2474AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2475AC_TRY_COMPILE([
2476#include <sys/types.h>
2477#include <utmp.h>
2478#ifdef HAVE_LASTLOG_H
2479# include <lastlog.h>
2480#endif
Damien Miller2994e082000-06-04 15:51:47 +10002481#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002482# include <paths.h>
2483#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002484#ifdef HAVE_LOGIN_H
2485# include <login.h>
2486#endif
andre2ff7b5d2000-06-03 14:57:40 +00002487 ],
2488 [ char *lastlog = LASTLOG_FILE; ],
2489 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002490 [
2491 AC_MSG_RESULT(no)
2492 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2493 AC_TRY_COMPILE([
2494#include <sys/types.h>
2495#include <utmp.h>
2496#ifdef HAVE_LASTLOG_H
2497# include <lastlog.h>
2498#endif
2499#ifdef HAVE_PATHS_H
2500# include <paths.h>
2501#endif
2502 ],
2503 [ char *lastlog = _PATH_LASTLOG; ],
2504 [ AC_MSG_RESULT(yes) ],
2505 [
andree441aa32000-06-12 22:34:38 +00002506 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002507 system_lastlog_path=no
2508 ])
2509 ]
andre2ff7b5d2000-06-03 14:57:40 +00002510)
Damien Miller2994e082000-06-04 15:51:47 +10002511
andre2ff7b5d2000-06-03 14:57:40 +00002512if test -z "$conf_lastlog_location"; then
2513 if test x"$system_lastlog_path" = x"no" ; then
2514 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002515 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002516 conf_lastlog_location=$f
2517 fi
2518 done
2519 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002520 AC_MSG_WARN([** Cannot find lastlog **])
2521 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002522 fi
2523 fi
2524fi
2525
2526if test -n "$conf_lastlog_location"; then
2527 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2528fi
2529
2530dnl utmp detection
2531AC_MSG_CHECKING([if your system defines UTMP_FILE])
2532AC_TRY_COMPILE([
2533#include <sys/types.h>
2534#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002535#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002536# include <paths.h>
2537#endif
2538 ],
2539 [ char *utmp = UTMP_FILE; ],
2540 [ AC_MSG_RESULT(yes) ],
2541 [ AC_MSG_RESULT(no)
2542 system_utmp_path=no ]
2543)
2544if test -z "$conf_utmp_location"; then
2545 if test x"$system_utmp_path" = x"no" ; then
2546 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2547 if test -f $f ; then
2548 conf_utmp_location=$f
2549 fi
2550 done
2551 if test -z "$conf_utmp_location"; then
2552 AC_DEFINE(DISABLE_UTMP)
2553 fi
2554 fi
2555fi
2556if test -n "$conf_utmp_location"; then
2557 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2558fi
2559
2560dnl wtmp detection
2561AC_MSG_CHECKING([if your system defines WTMP_FILE])
2562AC_TRY_COMPILE([
2563#include <sys/types.h>
2564#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002565#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002566# include <paths.h>
2567#endif
2568 ],
2569 [ char *wtmp = WTMP_FILE; ],
2570 [ AC_MSG_RESULT(yes) ],
2571 [ AC_MSG_RESULT(no)
2572 system_wtmp_path=no ]
2573)
2574if test -z "$conf_wtmp_location"; then
2575 if test x"$system_wtmp_path" = x"no" ; then
2576 for f in /usr/adm/wtmp /var/log/wtmp; do
2577 if test -f $f ; then
2578 conf_wtmp_location=$f
2579 fi
2580 done
2581 if test -z "$conf_wtmp_location"; then
2582 AC_DEFINE(DISABLE_WTMP)
2583 fi
2584 fi
2585fi
2586if test -n "$conf_wtmp_location"; then
2587 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2588fi
2589
2590
2591dnl utmpx detection - I don't know any system so perverse as to require
2592dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2593dnl there, though.
2594AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2595AC_TRY_COMPILE([
2596#include <sys/types.h>
2597#include <utmp.h>
2598#ifdef HAVE_UTMPX_H
2599#include <utmpx.h>
2600#endif
Damien Miller2994e082000-06-04 15:51:47 +10002601#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002602# include <paths.h>
2603#endif
2604 ],
2605 [ char *utmpx = UTMPX_FILE; ],
2606 [ AC_MSG_RESULT(yes) ],
2607 [ AC_MSG_RESULT(no)
2608 system_utmpx_path=no ]
2609)
2610if test -z "$conf_utmpx_location"; then
2611 if test x"$system_utmpx_path" = x"no" ; then
2612 AC_DEFINE(DISABLE_UTMPX)
2613 fi
2614else
2615 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2616fi
2617
2618dnl wtmpx detection
2619AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2620AC_TRY_COMPILE([
2621#include <sys/types.h>
2622#include <utmp.h>
2623#ifdef HAVE_UTMPX_H
2624#include <utmpx.h>
2625#endif
Damien Miller2994e082000-06-04 15:51:47 +10002626#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002627# include <paths.h>
2628#endif
2629 ],
2630 [ char *wtmpx = WTMPX_FILE; ],
2631 [ AC_MSG_RESULT(yes) ],
2632 [ AC_MSG_RESULT(no)
2633 system_wtmpx_path=no ]
2634)
2635if test -z "$conf_wtmpx_location"; then
2636 if test x"$system_wtmpx_path" = x"no" ; then
2637 AC_DEFINE(DISABLE_WTMPX)
2638 fi
2639else
2640 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2641fi
2642
Damien Miller4018c192000-04-30 09:30:44 +10002643
Damien Miller29ea30d2000-03-17 10:54:15 +11002644if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002645 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2646 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002647fi
2648
Tim Rice4cec93f2002-02-26 08:40:48 -08002649dnl remove pam and dl because they are in $LIBPAM
2650if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002651 LIBS=`echo $LIBS | sed 's/-lpam //'`
2652fi
2653if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2654 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002655fi
2656
Damien Millerbac2d8a2000-09-05 16:13:06 +11002657AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002658AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2659AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002660
Damien Miller7b22d652000-06-18 14:07:04 +10002661# Print summary of options
2662
Damien Miller7b22d652000-06-18 14:07:04 +10002663# Someone please show me a better way :)
2664A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2665B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2666C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2667D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002668E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002669F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002670G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002671H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2672I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2673J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002674
2675echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002676echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002677echo " User binaries: $B"
2678echo " System binaries: $C"
2679echo " Configuration files: $D"
2680echo " Askpass program: $E"
2681echo " Manual pages: $F"
2682echo " PID file: $G"
2683echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002684if test "x$external_path_file" = "x/etc/login.conf" ; then
2685echo " At runtime, sshd will use the path defined in $external_path_file"
2686echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002687else
Damien Millerf58c6722002-05-13 13:15:42 +10002688echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002689 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002690echo " (If PATH is set in $external_path_file it will be used instead. If"
2691echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2692 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002693fi
Damien Millera18bbd32002-05-13 10:48:57 +10002694if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002695echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002696fi
Damien Millerf58c6722002-05-13 13:15:42 +10002697echo " Manpage format: $MANTYPE"
Damien Miller9d2be482003-05-15 11:12:19 +10002698echo " DNS support: $DNS_MSG"
Damien Miller7abe09b2003-05-15 10:53:49 +10002699echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002700echo " KerberosV support: $KRB5_MSG"
2701echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002702echo " S/KEY support: $SKEY_MSG"
2703echo " TCP Wrappers support: $TCPW_MSG"
2704echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002705echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002706echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2707echo " BSD Auth support: $BSD_AUTH_MSG"
2708echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002709if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002710echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002711fi
2712
Damien Miller7b22d652000-06-18 14:07:04 +10002713echo ""
2714
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002715echo " Host: ${host}"
2716echo " Compiler: ${CC}"
2717echo " Compiler flags: ${CFLAGS}"
2718echo "Preprocessor flags: ${CPPFLAGS}"
2719echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002720echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002721
2722echo ""
2723
Damien Miller82cf0ce2000-12-20 13:34:48 +11002724if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002725 echo "PAM is enabled. You may need to install a PAM control file "
2726 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11002727 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11002728 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002729 echo ""
2730fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002731
Damien Miller6c21c512002-01-22 21:57:53 +11002732if test ! -z "$RAND_HELPER_CMDHASH" ; then
2733 echo "WARNING: you are using the builtin random number collection "
2734 echo "service. Please read WARNING.RNG and request that your OS "
2735 echo "vendor includes kernel-based random number collection in "
2736 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002737 echo ""
2738fi
Damien Miller60396b02001-02-18 17:01:00 +11002739