blob: 50b43ae31a7053986b3e4e92ef2b36d71df177d2 [file] [log] [blame]
Darren Tuckere937be32003-12-17 18:53:26 +11001# $Id: configure.ac,v 1.177 2003/12/17 07:53:26 dtucker 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
Darren Tuckere937be32003-12-17 18:53:26 +1100783dnl Some platorms have setresuid that isn't implemented
784AC_MSG_CHECKING(if setresuid seems to work)
785AC_TRY_RUN([
786#include <stdlib.h>
787#include <errno.h>
788int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
789 ],
790 [AC_MSG_RESULT(yes)],
791 [AC_DEFINE(BROKEN_SETRESUID),
792 AC_MSG_RESULT(not implemented)]
793)
794
795dnl Some platorms have setresgid that isn't implemented
796AC_MSG_CHECKING(if setresgid seems to work)
797AC_TRY_RUN([
798#include <stdlib.h>
799#include <errno.h>
800int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
801 ],
802 [AC_MSG_RESULT(yes)],
803 [AC_DEFINE(BROKEN_SETRESGID)
804 AC_MSG_RESULT(not implemented)]
805)
806
Damien Millerad833b32000-08-23 10:46:23 +1000807dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000808AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000809dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000810AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000811AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000812dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000813AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000814AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100815
Damien Millera8e06ce2003-11-21 23:48:55 +1100816AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100817 [AC_DEFINE(HAVE_DAEMON)],
818 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
819)
820
Damien Millera8e06ce2003-11-21 23:48:55 +1100821AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100822 [AC_DEFINE(HAVE_GETPAGESIZE)],
823 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
824)
825
Damien Millercb170cb2000-07-01 16:52:55 +1000826# Check for broken snprintf
827if test "x$ac_cv_func_snprintf" = "xyes" ; then
828 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
829 AC_TRY_RUN(
830 [
831#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700832int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000833 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100834 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000835 [
836 AC_MSG_RESULT(no)
837 AC_DEFINE(BROKEN_SNPRINTF)
838 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
839 ]
840 )
841fi
842
Damien Millere8328192003-01-07 15:18:32 +1100843dnl see whether mkstemp() requires XXXXXX
844if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
845AC_MSG_CHECKING([for (overly) strict mkstemp])
846AC_TRY_RUN(
847 [
848#include <stdlib.h>
849main() { char template[]="conftest.mkstemp-test";
850if (mkstemp(template) == -1)
851 exit(1);
852unlink(template); exit(0);
853}
854 ],
855 [
856 AC_MSG_RESULT(no)
857 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100858 [
Damien Millere8328192003-01-07 15:18:32 +1100859 AC_MSG_RESULT(yes)
860 AC_DEFINE(HAVE_STRICT_MKSTEMP)
861 ],
862 [
863 AC_MSG_RESULT(yes)
864 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +1100865 ]
Damien Millere8328192003-01-07 15:18:32 +1100866)
867fi
868
Darren Tucker70a3d552003-08-21 17:58:29 +1000869dnl make sure that openpty does not reacquire controlling terminal
870if test ! -z "$check_for_openpty_ctty_bug"; then
871 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
872 AC_TRY_RUN(
873 [
874#include <stdio.h>
875#include <sys/fcntl.h>
876#include <sys/types.h>
877#include <sys/wait.h>
878
879int
880main()
881{
882 pid_t pid;
883 int fd, ptyfd, ttyfd, status;
884
885 pid = fork();
886 if (pid < 0) { /* failed */
887 exit(1);
888 } else if (pid > 0) { /* parent */
889 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +1100890 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +1000891 exit(WEXITSTATUS(status));
892 else
893 exit(2);
894 } else { /* child */
895 close(0); close(1); close(2);
896 setsid();
897 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
898 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
899 if (fd >= 0)
900 exit(3); /* Acquired ctty: broken */
901 else
902 exit(0); /* Did not acquire ctty: OK */
903 }
904}
905 ],
906 [
907 AC_MSG_RESULT(yes)
908 ],
909 [
910 AC_MSG_RESULT(no)
911 AC_DEFINE(SSHD_ACQUIRES_CTTY)
912 ]
913 )
914fi
915
Damien Miller606f8802000-09-16 15:39:56 +1100916AC_FUNC_GETPGRP
917
Damien Millera64b57a2001-01-17 10:44:13 +1100918# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000919PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100920AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100921 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100922 [
Damien Millera64b57a2001-01-17 10:44:13 +1100923 if test "x$withval" != "xno" ; then
924 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
925 AC_MSG_ERROR([PAM headers not found])
926 fi
927
928 AC_CHECK_LIB(dl, dlopen, , )
929 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
930 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000931 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +1100932
Damien Millera64b57a2001-01-17 10:44:13 +1100933 PAM_MSG="yes"
934
935 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800936 if test $ac_cv_lib_dl_dlopen = yes; then
937 LIBPAM="-lpam -ldl"
938 else
939 LIBPAM="-lpam"
940 fi
941 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100942 fi
943 ]
944)
Damien Millera22ba012000-03-02 23:09:20 +1100945
Damien Millera64b57a2001-01-17 10:44:13 +1100946# Check for older PAM
947if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100948 # Check PAM strerror arguments (old PAM)
949 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
950 AC_TRY_COMPILE(
951 [
Damien Miller81171112000-04-23 11:14:01 +1000952#include <stdlib.h>
953#include <security/pam_appl.h>
Damien Millera8e06ce2003-11-21 23:48:55 +1100954 ],
955 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +1100956 [AC_MSG_RESULT(no)],
957 [
958 AC_DEFINE(HAVE_OLD_PAM)
959 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000960 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100961 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100962 )
Damien Millera22ba012000-03-02 23:09:20 +1100963fi
964
Damien Millerfc93d4b2002-09-04 23:26:29 +1000965# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
966# because the system crypt() is more featureful.
967if test "x$check_for_libcrypt_before" = "x1"; then
968 AC_CHECK_LIB(crypt, crypt)
969fi
970
Tim Riceaef73712002-05-11 13:17:42 -0700971# Search for OpenSSL
972saved_CPPFLAGS="$CPPFLAGS"
973saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100974AC_ARG_WITH(ssl-dir,
975 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
976 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000977 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700978 if test -d "$withval/lib"; then
979 if test -n "${need_dash_r}"; then
980 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
981 else
982 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
983 fi
984 else
985 if test -n "${need_dash_r}"; then
986 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
987 else
988 LDFLAGS="-L${withval} ${LDFLAGS}"
989 fi
990 fi
991 if test -d "$withval/include"; then
992 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
993 else
994 CPPFLAGS="-I${withval} ${CPPFLAGS}"
995 fi
Damien Millera22ba012000-03-02 23:09:20 +1100996 fi
997 ]
998)
Tim Riceaef73712002-05-11 13:17:42 -0700999LIBS="$LIBS -lcrypto"
1000AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001001 [
Tim Riceaef73712002-05-11 13:17:42 -07001002 dnl Check default openssl install dir
1003 if test -n "${need_dash_r}"; then
1004 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001005 else
Tim Riceaef73712002-05-11 13:17:42 -07001006 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001007 fi
Tim Riceaef73712002-05-11 13:17:42 -07001008 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1009 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1010 [
1011 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1012 ]
1013 )
1014 ]
1015)
1016
Tim Riced730b782002-08-13 18:52:10 -07001017# Determine OpenSSL header version
1018AC_MSG_CHECKING([OpenSSL header version])
1019AC_TRY_RUN(
1020 [
1021#include <stdio.h>
1022#include <string.h>
1023#include <openssl/opensslv.h>
1024#define DATA "conftest.sslincver"
1025int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001026 FILE *fd;
1027 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001028
Damien Millera8e06ce2003-11-21 23:48:55 +11001029 fd = fopen(DATA,"w");
1030 if(fd == NULL)
1031 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001032
1033 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1034 exit(1);
1035
1036 exit(0);
1037}
1038 ],
1039 [
1040 ssl_header_ver=`cat conftest.sslincver`
1041 AC_MSG_RESULT($ssl_header_ver)
1042 ],
1043 [
1044 AC_MSG_RESULT(not found)
1045 AC_MSG_ERROR(OpenSSL version header not found.)
1046 ]
1047)
1048
1049# Determine OpenSSL library version
1050AC_MSG_CHECKING([OpenSSL library version])
1051AC_TRY_RUN(
1052 [
1053#include <stdio.h>
1054#include <string.h>
1055#include <openssl/opensslv.h>
1056#include <openssl/crypto.h>
1057#define DATA "conftest.ssllibver"
1058int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001059 FILE *fd;
1060 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001061
Damien Millera8e06ce2003-11-21 23:48:55 +11001062 fd = fopen(DATA,"w");
1063 if(fd == NULL)
1064 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001065
1066 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1067 exit(1);
1068
1069 exit(0);
1070}
1071 ],
1072 [
1073 ssl_library_ver=`cat conftest.ssllibver`
1074 AC_MSG_RESULT($ssl_library_ver)
1075 ],
1076 [
1077 AC_MSG_RESULT(not found)
1078 AC_MSG_ERROR(OpenSSL library not found.)
1079 ]
1080)
Damien Millera22ba012000-03-02 23:09:20 +11001081
Damien Millerec932372002-01-22 22:16:03 +11001082# Sanity check OpenSSL headers
1083AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1084AC_TRY_RUN(
1085 [
1086#include <string.h>
1087#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001088int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001089 ],
1090 [
1091 AC_MSG_RESULT(yes)
1092 ],
1093 [
1094 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001095 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1096Check config.log for details.
1097Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001098 ]
1099)
1100
Damien Millera8e06ce2003-11-21 23:48:55 +11001101# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Damien Millera64b57a2001-01-17 10:44:13 +11001102# version in OpenSSL. Skip this for PAM
Damien Miller4f9f42a2003-05-10 19:28:02 +10001103if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001104 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001105fi
1106
Damien Miller6c21c512002-01-22 21:57:53 +11001107
1108### Configure cryptographic random number support
1109
1110# Check wheter OpenSSL seeds itself
1111AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1112AC_TRY_RUN(
1113 [
1114#include <string.h>
1115#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001116int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001117 ],
1118 [
1119 OPENSSL_SEEDS_ITSELF=yes
1120 AC_MSG_RESULT(yes)
1121 ],
1122 [
1123 AC_MSG_RESULT(no)
1124 # Default to use of the rand helper if OpenSSL doesn't
1125 # seed itself
1126 USE_RAND_HELPER=yes
1127 ]
1128)
1129
1130
1131# Do we want to force the use of the rand helper?
1132AC_ARG_WITH(rand-helper,
1133 [ --with-rand-helper Use subprocess to gather strong randomness ],
1134 [
1135 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001136 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001137 # the previous test showed it to be unseeded.
1138 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1139 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1140 OPENSSL_SEEDS_ITSELF=yes
1141 USE_RAND_HELPER=""
1142 fi
1143 else
1144 USE_RAND_HELPER=yes
1145 fi
1146 ],
1147)
1148
1149# Which randomness source do we use?
1150if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1151 # OpenSSL only
1152 AC_DEFINE(OPENSSL_PRNG_ONLY)
1153 RAND_MSG="OpenSSL internal ONLY"
1154 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001155elif test ! -z "$USE_RAND_HELPER" ; then
1156 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001157 RAND_MSG="ssh-rand-helper"
1158 INSTALL_SSH_RAND_HELPER="yes"
1159fi
1160AC_SUBST(INSTALL_SSH_RAND_HELPER)
1161
1162### Configuration of ssh-rand-helper
1163
1164# PRNGD TCP socket
1165AC_ARG_WITH(prngd-port,
1166 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1167 [
Damien Millere996d722002-01-23 11:20:59 +11001168 case "$withval" in
1169 no)
1170 withval=""
1171 ;;
1172 [[0-9]]*)
1173 ;;
1174 *)
1175 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1176 ;;
1177 esac
1178 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001179 PRNGD_PORT="$withval"
1180 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1181 fi
1182 ]
1183)
1184
1185# PRNGD Unix domain socket
1186AC_ARG_WITH(prngd-socket,
1187 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1188 [
Damien Millere996d722002-01-23 11:20:59 +11001189 case "$withval" in
1190 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001191 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001192 ;;
1193 no)
1194 withval=""
1195 ;;
1196 /*)
1197 ;;
1198 *)
1199 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1200 ;;
1201 esac
1202
1203 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001204 if test ! -z "$PRNGD_PORT" ; then
1205 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1206 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001207 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001208 AC_MSG_WARN(Entropy socket is not readable)
1209 fi
1210 PRNGD_SOCKET="$withval"
1211 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1212 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001213 ],
1214 [
1215 # Check for existing socket only if we don't have a random device already
1216 if test "$USE_RAND_HELPER" = yes ; then
1217 AC_MSG_CHECKING(for PRNGD/EGD socket)
1218 # Insert other locations here
1219 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1220 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1221 PRNGD_SOCKET="$sock"
1222 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1223 break;
1224 fi
1225 done
1226 if test ! -z "$PRNGD_SOCKET" ; then
1227 AC_MSG_RESULT($PRNGD_SOCKET)
1228 else
1229 AC_MSG_RESULT(not found)
1230 fi
1231 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001232 ]
1233)
1234
1235# Change default command timeout for hashing entropy source
1236entropy_timeout=200
1237AC_ARG_WITH(entropy-timeout,
1238 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1239 [
1240 if test "x$withval" != "xno" ; then
1241 entropy_timeout=$withval
1242 fi
1243 ]
1244)
Damien Miller6c21c512002-01-22 21:57:53 +11001245AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1246
Damien Millerd3f6ad22002-06-25 10:24:47 +10001247SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001248AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001249 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001250 [
1251 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001252 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001253 fi
1254 ]
1255)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001256AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1257AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001258
Tim Rice88f2ab52002-03-17 12:17:34 -08001259# We do this little dance with the search path to insure
1260# that programs that we select for use by installed programs
1261# (which may be run by the super-user) come from trusted
1262# locations before they come from the user's private area.
1263# This should help avoid accidentally configuring some
1264# random version of a program in someone's personal bin.
1265
1266OPATH=$PATH
1267PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001268test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001269test -d /sbin && PATH=$PATH:/sbin
1270test -d /usr/sbin && PATH=$PATH:/usr/sbin
1271PATH=$PATH:/etc:$OPATH
1272
Damien Millera8e06ce2003-11-21 23:48:55 +11001273# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001274OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1275OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1276OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1277OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1278OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1279OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1280OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1281OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1282OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1283OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1284OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1285OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1286OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1287OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1288OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1289OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001290# restore PATH
1291PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001292
1293# Where does ssh-rand-helper get its randomness from?
1294INSTALL_SSH_PRNG_CMDS=""
1295if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1296 if test ! -z "$PRNGD_PORT" ; then
1297 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1298 elif test ! -z "$PRNGD_SOCKET" ; then
1299 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1300 else
1301 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1302 RAND_HELPER_CMDHASH=yes
1303 INSTALL_SSH_PRNG_CMDS="yes"
1304 fi
1305fi
1306AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1307
1308
Ben Lindstromb5628642000-10-18 00:02:25 +00001309# Cheap hack to ensure NEWS-OS libraries are arranged right.
1310if test ! -z "$SONY" ; then
1311 LIBS="$LIBS -liberty";
1312fi
1313
Damien Millera22ba012000-03-02 23:09:20 +11001314# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001315AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001316AC_CHECK_SIZEOF(short int, 2)
1317AC_CHECK_SIZEOF(int, 4)
1318AC_CHECK_SIZEOF(long int, 4)
1319AC_CHECK_SIZEOF(long long int, 8)
1320
Damien Millerfa2bb692002-04-23 23:22:25 +10001321# Sanity check long long for some platforms (AIX)
1322if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1323 ac_cv_sizeof_long_long_int=0
1324fi
1325
Damien Millera22ba012000-03-02 23:09:20 +11001326# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001327AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1328 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001329 [ #include <sys/types.h> ],
1330 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001331 [ ac_cv_have_u_int="yes" ],
1332 [ ac_cv_have_u_int="no" ]
1333 )
1334])
1335if test "x$ac_cv_have_u_int" = "xyes" ; then
1336 AC_DEFINE(HAVE_U_INT)
1337 have_u_int=1
1338fi
1339
Damien Miller61e50f12000-05-08 20:49:37 +10001340AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1341 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001342 [ #include <sys/types.h> ],
1343 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001344 [ ac_cv_have_intxx_t="yes" ],
1345 [ ac_cv_have_intxx_t="no" ]
1346 )
1347])
1348if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1349 AC_DEFINE(HAVE_INTXX_T)
1350 have_intxx_t=1
1351fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001352
1353if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001354 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001355then
1356 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1357 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001358 [ #include <stdint.h> ],
1359 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001360 [
1361 AC_DEFINE(HAVE_INTXX_T)
1362 AC_MSG_RESULT(yes)
1363 ],
1364 [ AC_MSG_RESULT(no) ]
1365 )
1366fi
1367
Damien Miller578783e2000-09-23 14:12:24 +11001368AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1369 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001370 [
1371#include <sys/types.h>
1372#ifdef HAVE_STDINT_H
1373# include <stdint.h>
1374#endif
1375#include <sys/socket.h>
1376#ifdef HAVE_SYS_BITYPES_H
1377# include <sys/bitypes.h>
1378#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001379 ],
1380 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001381 [ ac_cv_have_int64_t="yes" ],
1382 [ ac_cv_have_int64_t="no" ]
1383 )
1384])
1385if test "x$ac_cv_have_int64_t" = "xyes" ; then
1386 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001387fi
1388
Damien Miller61e50f12000-05-08 20:49:37 +10001389AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1390 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001391 [ #include <sys/types.h> ],
1392 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001393 [ ac_cv_have_u_intxx_t="yes" ],
1394 [ ac_cv_have_u_intxx_t="no" ]
1395 )
1396])
1397if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1398 AC_DEFINE(HAVE_U_INTXX_T)
1399 have_u_intxx_t=1
1400fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001401
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001402if test -z "$have_u_intxx_t" ; then
1403 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1404 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001405 [ #include <sys/socket.h> ],
1406 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001407 [
1408 AC_DEFINE(HAVE_U_INTXX_T)
1409 AC_MSG_RESULT(yes)
1410 ],
1411 [ AC_MSG_RESULT(no) ]
1412 )
1413fi
1414
Damien Miller578783e2000-09-23 14:12:24 +11001415AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1416 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001417 [ #include <sys/types.h> ],
1418 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001419 [ ac_cv_have_u_int64_t="yes" ],
1420 [ ac_cv_have_u_int64_t="no" ]
1421 )
1422])
1423if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1424 AC_DEFINE(HAVE_U_INT64_T)
1425 have_u_int64_t=1
1426fi
1427
Tim Rice4cec93f2002-02-26 08:40:48 -08001428if test -z "$have_u_int64_t" ; then
1429 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1430 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001431 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001432 [ u_int64_t a; a = 1],
1433 [
1434 AC_DEFINE(HAVE_U_INT64_T)
1435 AC_MSG_RESULT(yes)
1436 ],
1437 [ AC_MSG_RESULT(no) ]
1438 )
1439fi
1440
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001441if test -z "$have_u_intxx_t" ; then
1442 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1443 AC_TRY_COMPILE(
1444 [
1445#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001446 ],
1447 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001448 [ ac_cv_have_uintxx_t="yes" ],
1449 [ ac_cv_have_uintxx_t="no" ]
1450 )
1451 ])
1452 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1453 AC_DEFINE(HAVE_UINTXX_T)
1454 fi
1455fi
1456
1457if test -z "$have_uintxx_t" ; then
1458 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1459 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001460 [ #include <stdint.h> ],
1461 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001462 [
1463 AC_DEFINE(HAVE_UINTXX_T)
1464 AC_MSG_RESULT(yes)
1465 ],
1466 [ AC_MSG_RESULT(no) ]
1467 )
1468fi
1469
Damien Milleredb82922000-06-20 13:25:52 +10001470if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001471 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001472then
1473 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1474 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001475 [
1476#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001477 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001478 [
Damien Miller70494d12000-04-03 15:57:06 +10001479 int8_t a; int16_t b; int32_t c;
1480 u_int8_t e; u_int16_t f; u_int32_t g;
1481 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001482 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001483 [
1484 AC_DEFINE(HAVE_U_INTXX_T)
1485 AC_DEFINE(HAVE_INTXX_T)
1486 AC_MSG_RESULT(yes)
1487 ],
1488 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001489 )
Damien Millerb29ea912000-01-15 14:12:03 +11001490fi
1491
Damien Miller58be7382001-09-15 21:31:54 +10001492
1493AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1494 AC_TRY_COMPILE(
1495 [
1496#include <sys/types.h>
1497 ],
1498 [ u_char foo; foo = 125; ],
1499 [ ac_cv_have_u_char="yes" ],
1500 [ ac_cv_have_u_char="no" ]
1501 )
1502])
1503if test "x$ac_cv_have_u_char" = "xyes" ; then
1504 AC_DEFINE(HAVE_U_CHAR)
1505fi
1506
Tim Rice13aae5e2001-10-21 17:53:58 -07001507TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001508
Tim Rice200a5c02002-02-26 22:12:34 -08001509AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001510
Damien Miller61e50f12000-05-08 20:49:37 +10001511AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1512 AC_TRY_COMPILE(
1513 [
1514#include <sys/types.h>
1515 ],
1516 [ size_t foo; foo = 1235; ],
1517 [ ac_cv_have_size_t="yes" ],
1518 [ ac_cv_have_size_t="no" ]
1519 )
1520])
1521if test "x$ac_cv_have_size_t" = "xyes" ; then
1522 AC_DEFINE(HAVE_SIZE_T)
1523fi
Damien Miller95058511999-12-29 10:36:45 +11001524
Damien Miller615f9392000-05-17 22:53:33 +10001525AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1526 AC_TRY_COMPILE(
1527 [
1528#include <sys/types.h>
1529 ],
1530 [ ssize_t foo; foo = 1235; ],
1531 [ ac_cv_have_ssize_t="yes" ],
1532 [ ac_cv_have_ssize_t="no" ]
1533 )
1534])
1535if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1536 AC_DEFINE(HAVE_SSIZE_T)
1537fi
1538
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001539AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1540 AC_TRY_COMPILE(
1541 [
1542#include <time.h>
1543 ],
1544 [ clock_t foo; foo = 1235; ],
1545 [ ac_cv_have_clock_t="yes" ],
1546 [ ac_cv_have_clock_t="no" ]
1547 )
1548])
1549if test "x$ac_cv_have_clock_t" = "xyes" ; then
1550 AC_DEFINE(HAVE_CLOCK_T)
1551fi
1552
Damien Millerb54b40e2000-06-23 08:23:34 +10001553AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1554 AC_TRY_COMPILE(
1555 [
1556#include <sys/types.h>
1557#include <sys/socket.h>
1558 ],
1559 [ sa_family_t foo; foo = 1235; ],
1560 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001561 [ AC_TRY_COMPILE(
1562 [
1563#include <sys/types.h>
1564#include <sys/socket.h>
1565#include <netinet/in.h>
1566 ],
1567 [ sa_family_t foo; foo = 1235; ],
1568 [ ac_cv_have_sa_family_t="yes" ],
1569
Damien Millerb54b40e2000-06-23 08:23:34 +10001570 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001571 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001572 )
1573])
1574if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1575 AC_DEFINE(HAVE_SA_FAMILY_T)
1576fi
1577
Damien Miller0f91b4e2000-06-18 15:43:25 +10001578AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1579 AC_TRY_COMPILE(
1580 [
1581#include <sys/types.h>
1582 ],
1583 [ pid_t foo; foo = 1235; ],
1584 [ ac_cv_have_pid_t="yes" ],
1585 [ ac_cv_have_pid_t="no" ]
1586 )
1587])
1588if test "x$ac_cv_have_pid_t" = "xyes" ; then
1589 AC_DEFINE(HAVE_PID_T)
1590fi
1591
1592AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1593 AC_TRY_COMPILE(
1594 [
1595#include <sys/types.h>
1596 ],
1597 [ mode_t foo; foo = 1235; ],
1598 [ ac_cv_have_mode_t="yes" ],
1599 [ ac_cv_have_mode_t="no" ]
1600 )
1601])
1602if test "x$ac_cv_have_mode_t" = "xyes" ; then
1603 AC_DEFINE(HAVE_MODE_T)
1604fi
1605
Damien Miller61e50f12000-05-08 20:49:37 +10001606
1607AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1608 AC_TRY_COMPILE(
1609 [
Damien Miller81171112000-04-23 11:14:01 +10001610#include <sys/types.h>
1611#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001612 ],
1613 [ struct sockaddr_storage s; ],
1614 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1615 [ ac_cv_have_struct_sockaddr_storage="no" ]
1616 )
1617])
1618if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1619 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1620fi
Damien Miller34132e52000-01-14 15:45:46 +11001621
Damien Miller61e50f12000-05-08 20:49:37 +10001622AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1623 AC_TRY_COMPILE(
1624 [
Damien Miller7b22d652000-06-18 14:07:04 +10001625#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001626#include <netinet/in.h>
1627 ],
1628 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1629 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1630 [ ac_cv_have_struct_sockaddr_in6="no" ]
1631 )
1632])
1633if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1634 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1635fi
Damien Miller34132e52000-01-14 15:45:46 +11001636
Damien Miller61e50f12000-05-08 20:49:37 +10001637AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1638 AC_TRY_COMPILE(
1639 [
Damien Miller7b22d652000-06-18 14:07:04 +10001640#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001641#include <netinet/in.h>
1642 ],
1643 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1644 [ ac_cv_have_struct_in6_addr="yes" ],
1645 [ ac_cv_have_struct_in6_addr="no" ]
1646 )
1647])
1648if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1649 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1650fi
Damien Miller34132e52000-01-14 15:45:46 +11001651
Damien Miller61e50f12000-05-08 20:49:37 +10001652AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1653 AC_TRY_COMPILE(
1654 [
Damien Miller81171112000-04-23 11:14:01 +10001655#include <sys/types.h>
1656#include <sys/socket.h>
1657#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001658 ],
1659 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1660 [ ac_cv_have_struct_addrinfo="yes" ],
1661 [ ac_cv_have_struct_addrinfo="no" ]
1662 )
1663])
1664if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1665 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1666fi
1667
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001668AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1669 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001670 [ #include <sys/time.h> ],
1671 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001672 [ ac_cv_have_struct_timeval="yes" ],
1673 [ ac_cv_have_struct_timeval="no" ]
1674 )
1675])
1676if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1677 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1678 have_struct_timeval=1
1679fi
1680
Tim Rice4e4dc562003-03-18 10:21:40 -08001681AC_CHECK_TYPES(struct timespec)
1682
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001683# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001684if test "x$ac_cv_have_int64_t" = "xno" -a \
1685 "x$ac_cv_sizeof_long_int" != "x8" -a \
1686 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001687 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1688 echo "an alternative compiler (I.E., GCC) before continuing."
1689 echo ""
1690 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001691else
1692dnl test snprintf (broken on SCO w/gcc)
1693 AC_TRY_RUN(
1694 [
1695#include <stdio.h>
1696#include <string.h>
1697#ifdef HAVE_SNPRINTF
1698main()
1699{
1700 char buf[50];
1701 char expected_out[50];
1702 int mazsize = 50 ;
1703#if (SIZEOF_LONG_INT == 8)
1704 long int num = 0x7fffffffffffffff;
1705#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001706 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001707#endif
1708 strcpy(expected_out, "9223372036854775807");
1709 snprintf(buf, mazsize, "%lld", num);
1710 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001711 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001712 exit(0);
1713}
1714#else
1715main() { exit(0); }
1716#endif
1717 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1718 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001719fi
1720
Damien Miller78315eb2000-09-29 23:01:36 +11001721dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001722OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1723OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1724OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1725OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1726OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001727OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001728OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1729OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001730OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001731OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1732OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1733OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1734OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001735OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1736OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1737OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1738OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001739
1740AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001741
Damien Miller61e50f12000-05-08 20:49:37 +10001742AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1743 ac_cv_have_ss_family_in_struct_ss, [
1744 AC_TRY_COMPILE(
1745 [
Damien Miller81171112000-04-23 11:14:01 +10001746#include <sys/types.h>
1747#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001748 ],
1749 [ struct sockaddr_storage s; s.ss_family = 1; ],
1750 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1751 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1752 )
1753])
1754if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1755 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1756fi
1757
Damien Miller61e50f12000-05-08 20:49:37 +10001758AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1759 ac_cv_have___ss_family_in_struct_ss, [
1760 AC_TRY_COMPILE(
1761 [
Damien Miller81171112000-04-23 11:14:01 +10001762#include <sys/types.h>
1763#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001764 ],
1765 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1766 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1767 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1768 )
1769])
1770if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1771 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1772fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001773
Damien Millerad833b32000-08-23 10:46:23 +10001774AC_CACHE_CHECK([for pw_class field in struct passwd],
1775 ac_cv_have_pw_class_in_struct_passwd, [
1776 AC_TRY_COMPILE(
1777 [
Damien Millerad833b32000-08-23 10:46:23 +10001778#include <pwd.h>
1779 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001780 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001781 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1782 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1783 )
1784])
1785if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1786 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1787fi
1788
Kevin Steves82456952001-06-22 21:14:18 +00001789AC_CACHE_CHECK([for pw_expire field in struct passwd],
1790 ac_cv_have_pw_expire_in_struct_passwd, [
1791 AC_TRY_COMPILE(
1792 [
1793#include <pwd.h>
1794 ],
1795 [ struct passwd p; p.pw_expire = 0; ],
1796 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1797 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1798 )
1799])
1800if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1801 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1802fi
1803
1804AC_CACHE_CHECK([for pw_change field in struct passwd],
1805 ac_cv_have_pw_change_in_struct_passwd, [
1806 AC_TRY_COMPILE(
1807 [
1808#include <pwd.h>
1809 ],
1810 [ struct passwd p; p.pw_change = 0; ],
1811 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1812 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1813 )
1814])
1815if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1816 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1817fi
Damien Miller61e50f12000-05-08 20:49:37 +10001818
Tim Rice28bbb0c2002-05-27 17:37:32 -07001819dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001820AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1821 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001822 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001823 [
Tim Riceae49fe62002-04-12 10:26:21 -07001824#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001825#include <sys/socket.h>
1826#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001827int main() {
1828#ifdef msg_accrights
1829exit(1);
1830#endif
1831struct msghdr m;
1832m.msg_accrights = 0;
1833exit(0);
1834}
Kevin Steves939c9db2002-03-22 17:23:25 +00001835 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001836 [ ac_cv_have_accrights_in_msghdr="yes" ],
1837 [ ac_cv_have_accrights_in_msghdr="no" ]
1838 )
1839])
1840if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1841 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1842fi
1843
Kevin Stevesa44e0352002-04-07 16:18:03 +00001844AC_CACHE_CHECK([for msg_control field in struct msghdr],
1845 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001846 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001847 [
Tim Riceae49fe62002-04-12 10:26:21 -07001848#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001849#include <sys/socket.h>
1850#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001851int main() {
1852#ifdef msg_control
1853exit(1);
1854#endif
1855struct msghdr m;
1856m.msg_control = 0;
1857exit(0);
1858}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001859 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001860 [ ac_cv_have_control_in_msghdr="yes" ],
1861 [ ac_cv_have_control_in_msghdr="no" ]
1862 )
1863])
1864if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1865 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1866fi
1867
Damien Miller61e50f12000-05-08 20:49:37 +10001868AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11001869 AC_TRY_LINK([],
1870 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10001871 [ ac_cv_libc_defines___progname="yes" ],
1872 [ ac_cv_libc_defines___progname="no" ]
1873 )
1874])
1875if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1876 AC_DEFINE(HAVE___PROGNAME)
1877fi
1878
Kevin Steves4846f4a2002-03-22 18:19:53 +00001879AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1880 AC_TRY_LINK([
1881#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001882],
1883 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00001884 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1885 [ ac_cv_cc_implements___FUNCTION__="no" ]
1886 )
1887])
1888if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1889 AC_DEFINE(HAVE___FUNCTION__)
1890fi
1891
1892AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1893 AC_TRY_LINK([
1894#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001895],
1896 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00001897 [ ac_cv_cc_implements___func__="yes" ],
1898 [ ac_cv_cc_implements___func__="no" ]
1899 )
1900])
1901if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1902 AC_DEFINE(HAVE___func__)
1903fi
1904
Damien Miller4f8e6692001-07-14 13:22:53 +10001905AC_CACHE_CHECK([whether getopt has optreset support],
1906 ac_cv_have_getopt_optreset, [
1907 AC_TRY_LINK(
1908 [
1909#include <getopt.h>
1910 ],
1911 [ extern int optreset; optreset = 0; ],
1912 [ ac_cv_have_getopt_optreset="yes" ],
1913 [ ac_cv_have_getopt_optreset="no" ]
1914 )
1915])
1916if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1917 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1918fi
Damien Millera22ba012000-03-02 23:09:20 +11001919
Damien Millerecbb26d2000-07-15 14:59:14 +10001920AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11001921 AC_TRY_LINK([],
1922 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10001923 [ ac_cv_libc_defines_sys_errlist="yes" ],
1924 [ ac_cv_libc_defines_sys_errlist="no" ]
1925 )
1926])
1927if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1928 AC_DEFINE(HAVE_SYS_ERRLIST)
1929fi
1930
1931
Damien Miller11fa2cc2000-08-16 10:35:58 +10001932AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11001933 AC_TRY_LINK([],
1934 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10001935 [ ac_cv_libc_defines_sys_nerr="yes" ],
1936 [ ac_cv_libc_defines_sys_nerr="no" ]
1937 )
1938])
1939if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1940 AC_DEFINE(HAVE_SYS_NERR)
1941fi
1942
Damien Millera8e06ce2003-11-21 23:48:55 +11001943SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001944# Check whether user wants sectok support
1945AC_ARG_WITH(sectok,
1946 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001947 [
1948 if test "x$withval" != "xno" ; then
1949 if test "x$withval" != "xyes" ; then
1950 CPPFLAGS="$CPPFLAGS -I${withval}"
1951 LDFLAGS="$LDFLAGS -L${withval}"
1952 if test ! -z "$need_dash_r" ; then
1953 LDFLAGS="$LDFLAGS -R${withval}"
1954 fi
1955 if test ! -z "$blibpath" ; then
1956 blibpath="$blibpath:${withval}"
1957 fi
1958 fi
1959 AC_CHECK_HEADERS(sectok.h)
1960 if test "$ac_cv_header_sectok_h" != yes; then
1961 AC_MSG_ERROR(Can't find sectok.h)
1962 fi
1963 AC_CHECK_LIB(sectok, sectok_open)
1964 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1965 AC_MSG_ERROR(Can't find libsectok)
1966 fi
1967 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001968 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11001969 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001970 fi
1971 ]
1972)
1973
1974# Check whether user wants OpenSC support
1975AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001976 AC_HELP_STRING([--with-opensc=PFX],
1977 [Enable smartcard support using OpenSC]),
1978 opensc_config_prefix="$withval", opensc_config_prefix="")
1979if test x$opensc_config_prefix != x ; then
1980 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1981 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1982 if test "$OPENSC_CONFIG" != "no"; then
1983 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1984 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1985 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1986 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1987 AC_DEFINE(SMARTCARD)
1988 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11001989 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10001990 fi
1991fi
Damien Miller85de5802001-09-18 14:01:11 +10001992
Darren Tucker5f88d342003-10-15 16:57:57 +10001993# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11001994AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10001995 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10001996 [
Darren Tucker5f88d342003-10-15 16:57:57 +10001997 # Needed by our getrrsetbyname()
1998 AC_SEARCH_LIBS(res_query, resolv)
1999 AC_SEARCH_LIBS(dn_expand, resolv)
2000 AC_CHECK_FUNCS(_getshort _getlong)
2001 AC_CHECK_MEMBER(HEADER.ad,
2002 [AC_DEFINE(HAVE_HEADER_AD)],,
2003 [#include <arpa/nameser.h>])
2004 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002005
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002006# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002007KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002008AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002009 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2010 [
2011 if test "x$withval" != "xno" ; then
2012 if test "x$withval" = "xyes" ; then
2013 KRB5ROOT="/usr/local"
2014 else
2015 KRB5ROOT=${withval}
2016 fi
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002017 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002018 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2019 AC_DEFINE(KRB5)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002020 KRB5_MSG="yes"
Damien Millera8e06ce2003-11-21 23:48:55 +11002021 AC_MSG_CHECKING(whether we are using Heimdal)
2022 AC_TRY_COMPILE([ #include <krb5.h> ],
2023 [ char *tmp = heimdal_version; ],
2024 [ AC_MSG_RESULT(yes)
2025 AC_DEFINE(HEIMDAL)
2026 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2027 ],
2028 [ AC_MSG_RESULT(no)
2029 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2030 ]
2031 )
2032 if test ! -z "$need_dash_r" ; then
2033 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2034 fi
2035 if test ! -z "$blibpath" ; then
2036 blibpath="$blibpath:${KRB5ROOT}/lib"
2037 fi
Damien Miller200d0a72003-06-30 19:21:36 +10002038 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002039
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002040 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2041 [ AC_DEFINE(GSSAPI)
2042 K5LIBS="-lgssapi $K5LIBS" ],
2043 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2044 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002045 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002046 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2047 $K5LIBS)
2048 ],
2049 $K5LIBS)
2050
2051 AC_CHECK_HEADER(gssapi.h, ,
2052 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002053 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002054 AC_CHECK_HEADERS(gssapi.h, ,
2055 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002056 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002057 ]
2058 )
2059
2060 oldCPP="$CPPFLAGS"
2061 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2062 AC_CHECK_HEADER(gssapi_krb5.h, ,
2063 [ CPPFLAGS="$oldCPP" ])
2064
Damien Millera8e06ce2003-11-21 23:48:55 +11002065 KRB5=yes
2066 fi
2067 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002068)
Darren Tucker6aaa58c2003-08-02 22:24:49 +10002069LIBS="$LIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10002070
Damien Millera22ba012000-03-02 23:09:20 +11002071# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002072
Damien Millerf58c6722002-05-13 13:15:42 +10002073PRIVSEP_PATH=/var/empty
2074AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002075 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002076 [
2077 if test "x$withval" != "$no" ; then
2078 PRIVSEP_PATH=$withval
2079 fi
2080 ]
2081)
2082AC_SUBST(PRIVSEP_PATH)
2083
Damien Millera22ba012000-03-02 23:09:20 +11002084AC_ARG_WITH(xauth,
2085 [ --with-xauth=PATH Specify path to xauth program ],
2086 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002087 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002088 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002089 fi
2090 ],
2091 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002092 TestPath="$PATH"
2093 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2094 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2095 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2096 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2097 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002098 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002099 xauth_path="/usr/openwin/bin/xauth"
2100 fi
2101 ]
2102)
2103
Damien Miller7d901272003-01-13 16:55:22 +11002104STRIP_OPT=-s
2105AC_ARG_ENABLE(strip,
2106 [ --disable-strip Disable calling strip(1) on install],
2107 [
2108 if test "x$enableval" = "xno" ; then
2109 STRIP_OPT=
2110 fi
2111 ]
2112)
2113AC_SUBST(STRIP_OPT)
2114
Damien Millera19cf472000-11-29 13:28:50 +11002115if test -z "$xauth_path" ; then
2116 XAUTH_PATH="undefined"
2117 AC_SUBST(XAUTH_PATH)
2118else
Damien Millera22ba012000-03-02 23:09:20 +11002119 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002120 XAUTH_PATH=$xauth_path
2121 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002122fi
Damien Millera22ba012000-03-02 23:09:20 +11002123
2124# Check for mail directory (last resort if we cannot get it from headers)
2125if test ! -z "$MAIL" ; then
2126 maildir=`dirname $MAIL`
2127 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2128fi
2129
Damien Millera22ba012000-03-02 23:09:20 +11002130if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002131 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002132 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002133 [
2134 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2135 have_dev_ptmx=1
2136 ]
2137 )
2138 fi
Damien Millera22ba012000-03-02 23:09:20 +11002139fi
Damien Millera8e06ce2003-11-21 23:48:55 +11002140AC_CHECK_FILE("/dev/ptc",
Damien Miller204ad072000-03-02 23:56:12 +11002141 [
2142 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2143 have_dev_ptc=1
2144 ]
2145)
2146
Damien Millera22ba012000-03-02 23:09:20 +11002147# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002148AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002149 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002150 [
Damien Miller897741e2001-04-16 10:41:46 +10002151 case "$withval" in
2152 man|cat|doc)
2153 MANTYPE=$withval
2154 ;;
2155 *)
2156 AC_MSG_ERROR(invalid man type: $withval)
2157 ;;
2158 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002159 ]
2160)
Ben Lindstrombc709922001-04-18 18:04:21 +00002161if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002162 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2163 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002164 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2165 MANTYPE=doc
2166 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2167 MANTYPE=man
2168 else
2169 MANTYPE=cat
2170 fi
2171fi
Damien Miller670a4b82000-01-22 13:53:11 +11002172AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002173if test "$MANTYPE" = "doc"; then
2174 mansubdir=man;
2175else
2176 mansubdir=$MANTYPE;
2177fi
2178AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002179
Damien Millera22ba012000-03-02 23:09:20 +11002180# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002181MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002182AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002183 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002184 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002185 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002186 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002187 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002188 fi
2189 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002190)
2191
Damien Millera22ba012000-03-02 23:09:20 +11002192# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002193AC_ARG_WITH(shadow,
2194 [ --without-shadow Disable shadow password support],
2195 [
2196 if test "x$withval" = "xno" ; then
2197 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002198 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002199 fi
2200 ]
2201)
2202
Damien Miller1f335fb2000-06-26 11:31:33 +10002203if test -z "$disable_shadow" ; then
2204 AC_MSG_CHECKING([if the systems has expire shadow information])
2205 AC_TRY_COMPILE(
2206 [
2207#include <sys/types.h>
2208#include <shadow.h>
2209 struct spwd sp;
2210 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2211 [ sp_expire_available=yes ], []
2212 )
2213
2214 if test "x$sp_expire_available" = "xyes" ; then
2215 AC_MSG_RESULT(yes)
2216 AC_DEFINE(HAS_SHADOW_EXPIRE)
2217 else
2218 AC_MSG_RESULT(no)
2219 fi
2220fi
2221
Damien Millera22ba012000-03-02 23:09:20 +11002222# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002223if test ! -z "$IPADDR_IN_DISPLAY" ; then
2224 DISPLAY_HACK_MSG="yes"
2225 AC_DEFINE(IPADDR_IN_DISPLAY)
2226else
Damien Millera8e06ce2003-11-21 23:48:55 +11002227 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002228 AC_ARG_WITH(ipaddr-display,
2229 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2230 [
2231 if test "x$withval" != "xno" ; then
2232 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002233 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002234 fi
2235 ]
2236 )
2237fi
Damien Miller76112de1999-12-21 11:18:08 +11002238
Darren Tuckere1a790d2003-09-16 11:52:19 +10002239# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002240AC_ARG_ENABLE(etc-default-login,
2241 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2242[
Darren Tuckere1a790d2003-09-16 11:52:19 +10002243AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2244
2245if test "x$external_path_file" = "x/etc/default/login"; then
2246 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2247fi
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002248])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002249
Tim Rice43a1c132002-04-17 21:19:14 -07002250dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2251if test $ac_cv_func_login_getcapbool = "yes" -a \
2252 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002253 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002254fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002255
Damien Millera22ba012000-03-02 23:09:20 +11002256# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002257SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002258AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002259 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002260 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002261 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002262 AC_MSG_WARN([
2263--with-default-path=PATH has no effect on this system.
2264Edit /etc/login.conf instead.])
2265 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002266 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002267 AC_MSG_WARN([
2268--with-default-path=PATH will only be used if PATH is not defined in
2269$external_path_file .])
2270 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002271 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002272 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002273 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002274 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002275 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2276 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002277 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002278 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002279 AC_MSG_WARN([
2280If PATH is defined in $external_path_file, ensure the path to scp is included,
2281otherwise scp will not work.])
2282 fi
2283 AC_TRY_RUN(
2284 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002285/* find out what STDPATH is */
2286#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002287#ifdef HAVE_PATHS_H
2288# include <paths.h>
2289#endif
2290#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002291# ifdef _PATH_USERPATH /* Irix */
2292# define _PATH_STDPATH _PATH_USERPATH
2293# else
2294# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2295# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002296#endif
2297#include <sys/types.h>
2298#include <sys/stat.h>
2299#include <fcntl.h>
2300#define DATA "conftest.stdpath"
2301
2302main()
2303{
2304 FILE *fd;
2305 int rc;
2306
2307 fd = fopen(DATA,"w");
2308 if(fd == NULL)
2309 exit(1);
2310
2311 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2312 exit(1);
2313
2314 exit(0);
2315}
2316 ], [ user_path=`cat conftest.stdpath` ],
2317 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2318 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2319 )
2320# make sure $bindir is in USER_PATH so scp will work
2321 t_bindir=`eval echo ${bindir}`
2322 case $t_bindir in
2323 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2324 esac
2325 case $t_bindir in
2326 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2327 esac
2328 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2329 if test $? -ne 0 ; then
2330 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2331 if test $? -ne 0 ; then
2332 user_path=$user_path:$t_bindir
2333 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2334 fi
2335 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002336 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002337)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002338if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002339 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2340 AC_SUBST(user_path)
2341fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002342
Damien Millera18bbd32002-05-13 10:48:57 +10002343# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002344AC_ARG_WITH(superuser-path,
2345 [ --with-superuser-path= Specify different path for super-user],
2346 [
2347 if test "x$withval" != "xno" ; then
2348 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2349 superuser_path=$withval
2350 fi
2351 ]
2352)
2353
2354
Damien Miller61e50f12000-05-08 20:49:37 +10002355AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002356IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002357AC_ARG_WITH(4in6,
2358 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2359 [
2360 if test "x$withval" != "xno" ; then
2361 AC_MSG_RESULT(yes)
2362 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002363 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002364 else
2365 AC_MSG_RESULT(no)
2366 fi
2367 ],[
2368 if test "x$inet6_default_4in6" = "xyes"; then
2369 AC_MSG_RESULT([yes (default)])
2370 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002371 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002372 else
2373 AC_MSG_RESULT([no (default)])
2374 fi
2375 ]
2376)
2377
Damien Miller60396b02001-02-18 17:01:00 +11002378# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002379BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002380AC_ARG_WITH(bsd-auth,
2381 [ --with-bsd-auth Enable BSD auth support],
2382 [
2383 if test "x$withval" != "xno" ; then
2384 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002385 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002386 fi
2387 ]
2388)
2389
Damien Millera22ba012000-03-02 23:09:20 +11002390# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002391piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002392# make sure the directory exists
2393if test ! -d $piddir ; then
2394 piddir=`eval echo ${sysconfdir}`
2395 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002396 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002397 esac
2398fi
2399
Tim Rice88f2ab52002-03-17 12:17:34 -08002400AC_ARG_WITH(pid-dir,
2401 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2402 [
2403 if test "x$withval" != "xno" ; then
2404 piddir=$withval
2405 if test ! -d $piddir ; then
2406 AC_MSG_WARN([** no $piddir directory on this system **])
2407 fi
2408 fi
2409 ]
2410)
2411
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002412AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002413AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002414
andre2ff7b5d2000-06-03 14:57:40 +00002415dnl allow user to disable some login recording features
2416AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002417 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002418 [
2419 if test "x$enableval" = "xno" ; then
2420 AC_DEFINE(DISABLE_LASTLOG)
2421 fi
2422 ]
andre2ff7b5d2000-06-03 14:57:40 +00002423)
2424AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002425 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002426 [
2427 if test "x$enableval" = "xno" ; then
2428 AC_DEFINE(DISABLE_UTMP)
2429 fi
2430 ]
andre2ff7b5d2000-06-03 14:57:40 +00002431)
2432AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002433 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002434 [
2435 if test "x$enableval" = "xno" ; then
2436 AC_DEFINE(DISABLE_UTMPX)
2437 fi
2438 ]
andre2ff7b5d2000-06-03 14:57:40 +00002439)
2440AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002441 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002442 [
2443 if test "x$enableval" = "xno" ; then
2444 AC_DEFINE(DISABLE_WTMP)
2445 fi
2446 ]
andre2ff7b5d2000-06-03 14:57:40 +00002447)
2448AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002449 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002450 [
2451 if test "x$enableval" = "xno" ; then
2452 AC_DEFINE(DISABLE_WTMPX)
2453 fi
2454 ]
andre2ff7b5d2000-06-03 14:57:40 +00002455)
2456AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002457 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002458 [
2459 if test "x$enableval" = "xno" ; then
2460 AC_DEFINE(DISABLE_LOGIN)
2461 fi
2462 ]
andre2ff7b5d2000-06-03 14:57:40 +00002463)
2464AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002465 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002466 [
2467 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002468 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002469 fi
2470 ]
andre2ff7b5d2000-06-03 14:57:40 +00002471)
2472AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002473 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002474 [
2475 if test "x$enableval" = "xno" ; then
2476 AC_DEFINE(DISABLE_PUTUTXLINE)
2477 fi
2478 ]
andre2ff7b5d2000-06-03 14:57:40 +00002479)
2480AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002481 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002482 [
2483 if test "x$withval" = "xno" ; then
2484 AC_DEFINE(DISABLE_LASTLOG)
2485 else
2486 conf_lastlog_location=$withval
2487 fi
2488 ]
2489)
andre2ff7b5d2000-06-03 14:57:40 +00002490
2491dnl lastlog, [uw]tmpx? detection
2492dnl NOTE: set the paths in the platform section to avoid the
2493dnl need for command-line parameters
2494dnl lastlog and [uw]tmp are subject to a file search if all else fails
2495
2496dnl lastlog detection
2497dnl NOTE: the code itself will detect if lastlog is a directory
2498AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2499AC_TRY_COMPILE([
2500#include <sys/types.h>
2501#include <utmp.h>
2502#ifdef HAVE_LASTLOG_H
2503# include <lastlog.h>
2504#endif
Damien Miller2994e082000-06-04 15:51:47 +10002505#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002506# include <paths.h>
2507#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002508#ifdef HAVE_LOGIN_H
2509# include <login.h>
2510#endif
andre2ff7b5d2000-06-03 14:57:40 +00002511 ],
2512 [ char *lastlog = LASTLOG_FILE; ],
2513 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002514 [
2515 AC_MSG_RESULT(no)
2516 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2517 AC_TRY_COMPILE([
2518#include <sys/types.h>
2519#include <utmp.h>
2520#ifdef HAVE_LASTLOG_H
2521# include <lastlog.h>
2522#endif
2523#ifdef HAVE_PATHS_H
2524# include <paths.h>
2525#endif
2526 ],
2527 [ char *lastlog = _PATH_LASTLOG; ],
2528 [ AC_MSG_RESULT(yes) ],
2529 [
andree441aa32000-06-12 22:34:38 +00002530 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002531 system_lastlog_path=no
2532 ])
2533 ]
andre2ff7b5d2000-06-03 14:57:40 +00002534)
Damien Miller2994e082000-06-04 15:51:47 +10002535
andre2ff7b5d2000-06-03 14:57:40 +00002536if test -z "$conf_lastlog_location"; then
2537 if test x"$system_lastlog_path" = x"no" ; then
2538 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002539 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002540 conf_lastlog_location=$f
2541 fi
2542 done
2543 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002544 AC_MSG_WARN([** Cannot find lastlog **])
2545 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002546 fi
2547 fi
2548fi
2549
2550if test -n "$conf_lastlog_location"; then
2551 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2552fi
2553
2554dnl utmp detection
2555AC_MSG_CHECKING([if your system defines UTMP_FILE])
2556AC_TRY_COMPILE([
2557#include <sys/types.h>
2558#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002559#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002560# include <paths.h>
2561#endif
2562 ],
2563 [ char *utmp = UTMP_FILE; ],
2564 [ AC_MSG_RESULT(yes) ],
2565 [ AC_MSG_RESULT(no)
2566 system_utmp_path=no ]
2567)
2568if test -z "$conf_utmp_location"; then
2569 if test x"$system_utmp_path" = x"no" ; then
2570 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2571 if test -f $f ; then
2572 conf_utmp_location=$f
2573 fi
2574 done
2575 if test -z "$conf_utmp_location"; then
2576 AC_DEFINE(DISABLE_UTMP)
2577 fi
2578 fi
2579fi
2580if test -n "$conf_utmp_location"; then
2581 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2582fi
2583
2584dnl wtmp detection
2585AC_MSG_CHECKING([if your system defines WTMP_FILE])
2586AC_TRY_COMPILE([
2587#include <sys/types.h>
2588#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002589#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002590# include <paths.h>
2591#endif
2592 ],
2593 [ char *wtmp = WTMP_FILE; ],
2594 [ AC_MSG_RESULT(yes) ],
2595 [ AC_MSG_RESULT(no)
2596 system_wtmp_path=no ]
2597)
2598if test -z "$conf_wtmp_location"; then
2599 if test x"$system_wtmp_path" = x"no" ; then
2600 for f in /usr/adm/wtmp /var/log/wtmp; do
2601 if test -f $f ; then
2602 conf_wtmp_location=$f
2603 fi
2604 done
2605 if test -z "$conf_wtmp_location"; then
2606 AC_DEFINE(DISABLE_WTMP)
2607 fi
2608 fi
2609fi
2610if test -n "$conf_wtmp_location"; then
2611 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2612fi
2613
2614
2615dnl utmpx detection - I don't know any system so perverse as to require
2616dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2617dnl there, though.
2618AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2619AC_TRY_COMPILE([
2620#include <sys/types.h>
2621#include <utmp.h>
2622#ifdef HAVE_UTMPX_H
2623#include <utmpx.h>
2624#endif
Damien Miller2994e082000-06-04 15:51:47 +10002625#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002626# include <paths.h>
2627#endif
2628 ],
2629 [ char *utmpx = UTMPX_FILE; ],
2630 [ AC_MSG_RESULT(yes) ],
2631 [ AC_MSG_RESULT(no)
2632 system_utmpx_path=no ]
2633)
2634if test -z "$conf_utmpx_location"; then
2635 if test x"$system_utmpx_path" = x"no" ; then
2636 AC_DEFINE(DISABLE_UTMPX)
2637 fi
2638else
2639 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2640fi
2641
2642dnl wtmpx detection
2643AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2644AC_TRY_COMPILE([
2645#include <sys/types.h>
2646#include <utmp.h>
2647#ifdef HAVE_UTMPX_H
2648#include <utmpx.h>
2649#endif
Damien Miller2994e082000-06-04 15:51:47 +10002650#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002651# include <paths.h>
2652#endif
2653 ],
2654 [ char *wtmpx = WTMPX_FILE; ],
2655 [ AC_MSG_RESULT(yes) ],
2656 [ AC_MSG_RESULT(no)
2657 system_wtmpx_path=no ]
2658)
2659if test -z "$conf_wtmpx_location"; then
2660 if test x"$system_wtmpx_path" = x"no" ; then
2661 AC_DEFINE(DISABLE_WTMPX)
2662 fi
2663else
2664 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2665fi
2666
Damien Miller4018c192000-04-30 09:30:44 +10002667
Damien Miller29ea30d2000-03-17 10:54:15 +11002668if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002669 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2670 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002671fi
2672
Tim Rice4cec93f2002-02-26 08:40:48 -08002673dnl remove pam and dl because they are in $LIBPAM
2674if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002675 LIBS=`echo $LIBS | sed 's/-lpam //'`
2676fi
2677if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2678 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002679fi
2680
Damien Millerbac2d8a2000-09-05 16:13:06 +11002681AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002682AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2683AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002684
Damien Miller7b22d652000-06-18 14:07:04 +10002685# Print summary of options
2686
Damien Miller7b22d652000-06-18 14:07:04 +10002687# Someone please show me a better way :)
2688A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2689B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2690C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2691D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002692E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002693F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002694G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002695H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2696I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2697J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002698
2699echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002700echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002701echo " User binaries: $B"
2702echo " System binaries: $C"
2703echo " Configuration files: $D"
2704echo " Askpass program: $E"
2705echo " Manual pages: $F"
2706echo " PID file: $G"
2707echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002708if test "x$external_path_file" = "x/etc/login.conf" ; then
2709echo " At runtime, sshd will use the path defined in $external_path_file"
2710echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002711else
Damien Millerf58c6722002-05-13 13:15:42 +10002712echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002713 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002714echo " (If PATH is set in $external_path_file it will be used instead. If"
2715echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2716 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002717fi
Damien Millera18bbd32002-05-13 10:48:57 +10002718if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002719echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002720fi
Damien Millerf58c6722002-05-13 13:15:42 +10002721echo " Manpage format: $MANTYPE"
Damien Miller9d2be482003-05-15 11:12:19 +10002722echo " DNS support: $DNS_MSG"
Damien Miller7abe09b2003-05-15 10:53:49 +10002723echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002724echo " KerberosV support: $KRB5_MSG"
2725echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002726echo " S/KEY support: $SKEY_MSG"
2727echo " TCP Wrappers support: $TCPW_MSG"
2728echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002729echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002730echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2731echo " BSD Auth support: $BSD_AUTH_MSG"
2732echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002733if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002734echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002735fi
2736
Damien Miller7b22d652000-06-18 14:07:04 +10002737echo ""
2738
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002739echo " Host: ${host}"
2740echo " Compiler: ${CC}"
2741echo " Compiler flags: ${CFLAGS}"
2742echo "Preprocessor flags: ${CPPFLAGS}"
2743echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002744echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002745
2746echo ""
2747
Damien Miller82cf0ce2000-12-20 13:34:48 +11002748if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002749 echo "PAM is enabled. You may need to install a PAM control file "
2750 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11002751 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11002752 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002753 echo ""
2754fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002755
Damien Miller6c21c512002-01-22 21:57:53 +11002756if test ! -z "$RAND_HELPER_CMDHASH" ; then
2757 echo "WARNING: you are using the builtin random number collection "
2758 echo "service. Please read WARNING.RNG and request that your OS "
2759 echo "vendor includes kernel-based random number collection in "
2760 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002761 echo ""
2762fi
Damien Miller60396b02001-02-18 17:01:00 +11002763