blob: 3a503d99499e0117753f3c60b14529b873a9402b [file] [log] [blame]
Darren Tucker00130112003-09-22 11:40:24 +10001# $Id: configure.ac,v 1.160 2003/09/22 01:40:25 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 Miller649d9992001-06-27 23:35:51 +100051if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
52 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110053fi
54
Damien Millera22ba012000-03-02 23:09:20 +110055# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110056case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110057*-*-aix*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000058 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110059 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millereab4bae2003-04-29 23:22:40 +100060 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
61 if (test -z "$blibpath"); then
62 blibpath="/usr/lib:/lib:/usr/local/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +110063 fi
Damien Millereab4bae2003-04-29 23:22:40 +100064 saved_LDFLAGS="$LDFLAGS"
65 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
66 if (test -z "$blibflags"); then
67 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
68 AC_TRY_LINK([], [], [blibflags=$tryflags])
69 fi
70 done
71 if (test -z "$blibflags"); then
72 AC_MSG_RESULT(not found)
73 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
74 else
75 AC_MSG_RESULT($blibflags)
76 fi
77 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +100078 dnl Check for authenticate. Might be in libs.a on older AIXes
79 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -070080 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +100081 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -070082 LIBS="$LIBS -ls"
83 ])
84 ])
Darren Tucker5c6a91a2003-07-14 16:21:44 +100085 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
86 AC_CHECK_DECL(loginfailed,
87 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
88 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +100089 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +100090 [(void)loginfailed("user","host","tty",0);],
91 [AC_MSG_RESULT(yes)
92 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +100093 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +100094 )],
95 [],
96 [#include <usersec.h>]
97 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +100098 AC_CHECK_FUNCS(setauthdb)
Damien Millereca71f82000-01-20 22:38:27 +110099 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +1000100 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000101 AC_DEFINE(SETEUID_BREAKS_SETUID)
102 AC_DEFINE(BROKEN_SETREUID)
103 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000104 dnl AIX handles lastlog as part of its login message
105 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000106 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000107 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100108 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100109*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100110 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800111 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100112 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000113 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100114 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100115 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000116 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000117 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700118 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +0000119 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100120 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000121*-*-dgux*)
122 AC_DEFINE(IP_TOS_IS_BROKEN)
123 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000124*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000125 AC_MSG_CHECKING(if we have working getaddrinfo)
126 AC_TRY_RUN([#include <mach-o/dyld.h>
127main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
128 exit(0);
129 else
130 exit(1);
131}], [AC_MSG_RESULT(working)],
132 [AC_MSG_RESULT(buggy)
133 AC_DEFINE(BROKEN_GETADDRINFO)],
Darren Tucker20379a32003-09-22 11:07:40 +1000134 AC_DEFINE(SETEUID_BREAKS_SETUID)
135 AC_DEFINE(BROKEN_SETREUID)
136 AC_DEFINE(BROKEN_SETREGID)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000137 [AC_MSG_RESULT(assume it is working)])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000138 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000139*-*-hpux10.26)
140 if test -z "$GCC"; then
141 CFLAGS="$CFLAGS -Ae"
142 fi
143 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
144 IPADDR_IN_DISPLAY=yes
145 AC_DEFINE(HAVE_SECUREWARE)
146 AC_DEFINE(USE_PIPES)
147 AC_DEFINE(LOGIN_NO_ENDOPT)
148 AC_DEFINE(LOGIN_NEEDS_UTMPX)
149 AC_DEFINE(DISABLE_SHADOW)
150 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000151 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000152 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700153 LIBS="$LIBS -lsec -lsecpw"
154 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000155 disable_ptmx_check=yes
156 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100157*-*-hpux10*)
158 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000159 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100160 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000161 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100162 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000163 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000164 AC_DEFINE(LOGIN_NO_ENDOPT)
165 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100166 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100167 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000168 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000169 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700170 LIBS="$LIBS -lsec"
171 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100172 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000173*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000174 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100175 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100176 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100177 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000178 AC_DEFINE(LOGIN_NO_ENDOPT)
179 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100180 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100181 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000182 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000183 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700184 LIBS="$LIBS -lsec"
185 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000186 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100187*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000188 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000189 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100190 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000191 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000192 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000193 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100194 ;;
195*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000196 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000197 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100198 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000199 AC_DEFINE(WITH_IRIX_ARRAY)
200 AC_DEFINE(WITH_IRIX_PROJECT)
201 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000202 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000203 AC_DEFINE(BROKEN_INET_NTOA)
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 Millerbeb4ba51999-12-28 15:09:35 +1100206 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100207*-*-linux*)
208 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100209 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000210 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100211 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000212 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000213 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
Damien Miller35276252003-06-03 10:14:28 +1000214 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller7bcb0892000-03-11 20:45:40 +1100215 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000216 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000217 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000218 AC_DEFINE(BROKEN_CMSG_TYPE)
219 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000220 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100221 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000222mips-sony-bsd|mips-sony-newsos4)
223 AC_DEFINE(HAVE_NEWS4)
224 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000225 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100226*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000227 check_for_libcrypt_before=1
Damien Millera22ba012000-03-02 23:09:20 +1100228 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100229 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100230*-*-freebsd*)
231 check_for_libcrypt_later=1
232 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000233*-*-bsdi*)
234 AC_DEFINE(SETEUID_BREAKS_SETUID)
235 AC_DEFINE(BROKEN_SETREUID)
236 AC_DEFINE(BROKEN_SETREGID)
237 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000238*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000239 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100240 conf_utmp_location=/etc/utmp
241 conf_wtmp_location=/usr/adm/wtmp
242 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000243 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000244 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000245 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100246 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000247 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000248 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000249 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100250*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000251 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000252 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100253 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100254 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000255 AC_DEFINE(LOGIN_NEEDS_UTMPX)
256 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000257 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000258 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000259 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
260 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000261 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000262 # hardwire lastlog location (can't detect it on some versions)
263 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000264 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
265 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
266 if test "$sol2ver" -ge 8; then
267 AC_MSG_RESULT(yes)
268 AC_DEFINE(DISABLE_UTMP)
269 AC_DEFINE(DISABLE_WTMP)
270 else
271 AC_MSG_RESULT(no)
272 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100273 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000274*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000275 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000276 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100277 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000278 conf_utmp_location=/etc/utmp
279 conf_wtmp_location=/var/adm/wtmp
280 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000281 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000282 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000283*-ncr-sysv*)
284 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
285 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700286 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000287 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000288 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000289 AC_DEFINE(SETEUID_BREAKS_SETUID)
290 AC_DEFINE(BROKEN_SETREUID)
291 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000292 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000293*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000294 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700295 # /usr/ucblib MUST NOT be searched on ReliantUNIX
296 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100297 IPADDR_IN_DISPLAY=yes
298 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000299 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000300 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000301 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700302 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
303 # Attention: always take care to bind libsocket and libnsl before libc,
304 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000305 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100306*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000307 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100308 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100309 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700310 AC_DEFINE(SETEUID_BREAKS_SETUID)
311 AC_DEFINE(BROKEN_SETREUID)
312 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100313 ;;
314*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000315 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100316 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100317 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700318 AC_DEFINE(SETEUID_BREAKS_SETUID)
319 AC_DEFINE(BROKEN_SETREUID)
320 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100321 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100322*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000323 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100324 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100325 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100326*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000327 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100328 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700329 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100330 RANLIB=true
331 no_dev_ptmx=1
332 AC_DEFINE(BROKEN_SYS_TERMIO_H)
333 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000334 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000335 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100336 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Riceae477e92003-09-12 18:15:15 -0700337 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100338 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700339 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700340 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100341 ;;
342*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800343 if test -z "$GCC"; then
344 CFLAGS="$CFLAGS -belf"
345 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000346 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000347 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100348 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000349 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100350 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000351 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000352 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700353 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700354 AC_DEFINE(SETEUID_BREAKS_SETUID)
355 AC_DEFINE(BROKEN_SETREUID)
356 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700357 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100358 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700359 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000360 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000361*-*-unicosmk*)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000362 AC_DEFINE(USE_PIPES)
363 AC_DEFINE(DISABLE_FD_PASSING)
364 LDFLAGS="$LDFLAGS"
365 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
366 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000367 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000368*-*-unicosmp*)
369 AC_DEFINE(WITH_ABBREV_NO_TTY)
370 AC_DEFINE(USE_PIPES)
371 AC_DEFINE(DISABLE_FD_PASSING)
372 LDFLAGS="$LDFLAGS"
373 LIBS="$LIBS -lgen -lacid"
374 MANTYPE=cat
375 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000376*-*-unicos*)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000377 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700378 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700379 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000380 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
381 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
382 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700383 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000384*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000385 AC_MSG_CHECKING(for Digital Unix SIA)
386 no_osfsia=""
387 AC_ARG_WITH(osfsia,
388 [ --with-osfsia Enable Digital Unix SIA],
389 [
390 if test "x$withval" = "xno" ; then
391 AC_MSG_RESULT(disabled)
392 no_osfsia=1
393 fi
394 ],
395 )
396 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000397 if test -f /etc/sia/matrix.conf; then
398 AC_MSG_RESULT(yes)
399 AC_DEFINE(HAVE_OSF_SIA)
400 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000401 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000402 LIBS="$LIBS -lsecurity -ldb -lm -laud"
403 else
404 AC_MSG_RESULT(no)
405 fi
406 fi
Ben Lindstromdc3c7572002-10-04 23:54:54 +0000407 AC_DEFINE(DISABLE_FD_PASSING)
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000408 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tuckered92b212003-09-22 11:26:16 +1000409 AC_DEFINE(SETEIUD_BREAKS_SETUID)
410 AC_DEFINE(BROKEN_SETREUID)
411 AC_DEFINE(BROKEN_SETREGID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000412 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000413 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000414
415*-*-nto-qnx)
416 AC_DEFINE(USE_PIPES)
417 AC_DEFINE(NO_X11_UNIX_SOCKETS)
418 AC_DEFINE(MISSING_NFDBITS)
419 AC_DEFINE(MISSING_HOWMANY)
420 AC_DEFINE(MISSING_FD_MASK)
421 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100422esac
423
Damien Millere37bfc12000-06-05 09:37:43 +1000424# Allow user to specify flags
425AC_ARG_WITH(cflags,
426 [ --with-cflags Specify additional flags to pass to compiler],
427 [
428 if test "x$withval" != "xno" ; then
429 CFLAGS="$CFLAGS $withval"
430 fi
431 ]
432)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000433AC_ARG_WITH(cppflags,
434 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
435 [
436 if test "x$withval" != "xno"; then
437 CPPFLAGS="$CPPFLAGS $withval"
438 fi
439 ]
440)
Damien Millere37bfc12000-06-05 09:37:43 +1000441AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000442 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000443 [
444 if test "x$withval" != "xno" ; then
445 LDFLAGS="$LDFLAGS $withval"
446 fi
447 ]
448)
449AC_ARG_WITH(libs,
450 [ --with-libs Specify additional libraries to link with],
451 [
452 if test "x$withval" != "xno" ; then
453 LIBS="$LIBS $withval"
454 fi
455 ]
456)
457
Darren Tucker6eb93042003-06-29 21:30:41 +1000458AC_MSG_CHECKING(compiler and flags for sanity)
459AC_TRY_RUN([
460#include <stdio.h>
461int main(){exit(0);}
462 ],
463 [ AC_MSG_RESULT(yes) ],
464 [
465 AC_MSG_RESULT(no)
466 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
467 ]
468)
469
Tim Rice4cec93f2002-02-26 08:40:48 -0800470# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000471AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000472 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800473 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000474 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000475 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000476 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
477 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
Ben Lindstrom4b0f1ad2003-02-01 04:43:34 +0000478 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
Tim Rice81ed5182002-09-25 17:38:46 -0700479 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800480 util.h utime.h utmp.h utmpx.h)
481
Damien Millera22ba012000-03-02 23:09:20 +1100482# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700483AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
484AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000485
Damien Millerdf288022001-02-18 13:07:07 +1100486dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700487if test "x$with_tcp_wrappers" != "xno" ; then
488 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
489 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
490 fi
491fi
Damien Millerdf288022001-02-18 13:07:07 +1100492
Tim Rice1e1ef642003-09-11 22:19:31 -0700493dnl IRIX and Solaris 2.5.1 have dirname() in libgen
494AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
495 AC_CHECK_LIB(gen, dirname,[
496 AC_CACHE_CHECK([for broken dirname],
497 ac_cv_have_broken_dirname, [
498 save_LIBS="$LIBS"
499 LIBS="$LIBS -lgen"
500 AC_TRY_RUN(
501 [
502#include <libgen.h>
503#include <string.h>
504
505int main(int argc, char **argv) {
506 char *s, buf[32];
507
508 strncpy(buf,"/etc", 32);
509 s = dirname(buf);
510 if (!s || strncmp(s, "/", 32) != 0) {
511 exit(1);
512 } else {
513 exit(0);
514 }
515}
516 ],
517 [ ac_cv_have_broken_dirname="no" ],
518 [ ac_cv_have_broken_dirname="yes" ]
519 )
520 LIBS="$save_LIBS"
521 ])
522 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
523 LIBS="$LIBS -lgen"
524 AC_DEFINE(HAVE_DIRNAME)
525 AC_CHECK_HEADERS(libgen.h)
526 fi
527 ])
528])
529
530AC_CHECK_FUNC(getspnam, ,
531 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
532AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
533
Damien Miller150c8b52002-02-13 23:06:56 +1100534AC_ARG_WITH(rpath,
535 [ --without-rpath Disable auto-added -R linker paths],
536 [
537 if test "x$withval" = "xno" ; then
538 need_dash_r=""
539 fi
540 if test "x$withval" = "xyes" ; then
541 need_dash_r=1
542 fi
543 ]
544)
545
Tim Rice13aae5e2001-10-21 17:53:58 -0700546dnl zlib is required
547AC_ARG_WITH(zlib,
548 [ --with-zlib=PATH Use zlib in PATH],
549 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000550 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100551 AC_MSG_ERROR([*** zlib is required ***])
552 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700553 if test -d "$withval/lib"; then
554 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700555 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700556 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700557 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700558 fi
559 else
560 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700561 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700562 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700563 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700564 fi
565 fi
566 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700567 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700568 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700569 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700570 fi
571 ]
572)
573
Tim Rice17b93e52001-10-23 22:36:54 -0700574AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100575
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000576dnl UnixWare 2.x
577AC_CHECK_FUNC(strcasecmp,
578 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
579)
580AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700581 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
582 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000583)
Damien Millerab18c411999-11-11 10:40:23 +1100584
Tim Ricee589a292001-11-03 11:09:32 -0800585dnl Checks for libutil functions
586AC_CHECK_HEADERS(libutil.h)
587AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
588AC_CHECK_FUNCS(logout updwtmp logwtmp)
589
Ben Lindstrom8697e082001-02-24 21:41:10 +0000590AC_FUNC_STRFTIME
591
Damien Miller3c027682001-03-14 11:39:45 +1100592# Check for ALTDIRFUNC glob() extension
593AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
594AC_EGREP_CPP(FOUNDIT,
595 [
596 #include <glob.h>
597 #ifdef GLOB_ALTDIRFUNC
598 FOUNDIT
599 #endif
600 ],
601 [
602 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
603 AC_MSG_RESULT(yes)
604 ],
605 [
606 AC_MSG_RESULT(no)
607 ]
608)
Damien Millerab18c411999-11-11 10:40:23 +1100609
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000610# Check for g.gl_matchc glob() extension
611AC_MSG_CHECKING(for gl_matchc field in glob_t)
612AC_EGREP_CPP(FOUNDIT,
613 [
614 #include <glob.h>
615 int main(void){glob_t g; g.gl_matchc = 1;}
616 ],
617 [
618 AC_DEFINE(GLOB_HAS_GL_MATCHC)
619 AC_MSG_RESULT(yes)
620 ],
621 [
622 AC_MSG_RESULT(no)
623 ]
624)
625
Damien Miller18bb4732001-03-28 14:35:30 +1000626AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
627AC_TRY_RUN(
628 [
629#include <sys/types.h>
630#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700631int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000632 ],
633 [AC_MSG_RESULT(yes)],
634 [
635 AC_MSG_RESULT(no)
636 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
637 ]
638)
639
Damien Millerc547bf12001-02-16 10:18:12 +1100640# Check whether user wants S/Key support
641SKEY_MSG="no"
642AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700643 [ --with-skey[[=PATH]] Enable S/Key support
644 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100645 [
646 if test "x$withval" != "xno" ; then
647
648 if test "x$withval" != "xyes" ; then
649 CPPFLAGS="$CPPFLAGS -I${withval}/include"
650 LDFLAGS="$LDFLAGS -L${withval}/lib"
651 fi
652
653 AC_DEFINE(SKEY)
654 LIBS="-lskey $LIBS"
655 SKEY_MSG="yes"
656
Tim Rice4cec93f2002-02-26 08:40:48 -0800657 AC_MSG_CHECKING([for s/key support])
658 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100659 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800660#include <stdio.h>
661#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700662int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800663 ],
664 [AC_MSG_RESULT(yes)],
665 [
666 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100667 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
668 ])
669 fi
670 ]
671)
672
673# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700674TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100675AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700676 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
677 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100678 [
679 if test "x$withval" != "xno" ; then
680 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700681 saved_LDFLAGS="$LDFLAGS"
682 saved_CPPFLAGS="$CPPFLAGS"
683 if test -n "${withval}" -a "${withval}" != "yes"; then
684 if test -d "${withval}/lib"; then
685 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700686 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700687 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700688 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700689 fi
690 else
691 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700692 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700693 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700694 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700695 fi
696 fi
697 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700698 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700699 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700700 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700701 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700702 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800703 LIBWRAP="-lwrap"
704 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100705 AC_MSG_CHECKING(for libwrap)
706 AC_TRY_LINK(
707 [
708#include <tcpd.h>
709 int deny_severity = 0, allow_severity = 0;
710 ],
711 [hosts_access(0);],
712 [
713 AC_MSG_RESULT(yes)
714 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800715 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700716 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100717 ],
718 [
719 AC_MSG_ERROR([*** libwrap missing])
720 ]
721 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800722 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100723 fi
724 ]
725)
726
Damien Millerfe1f1432003-02-24 15:45:42 +1100727dnl Checks for library functions. Please keep in alphabetical order
728AC_CHECK_FUNCS(\
Damien Millerf09ad862003-09-19 16:41:01 +1000729 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
Damien Miller5fe46a42003-06-05 09:53:31 +1000730 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Damien Millerfe1f1432003-02-24 15:45:42 +1100731 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000732 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100733 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000734 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
735 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
736 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Damien Miller5fe46a42003-06-05 09:53:31 +1000737 setproctitle setregid setresgid setresuid setreuid setrlimit \
738 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tuckerb2427c82003-09-10 15:22:44 +1000739 strlcat strlcpy strmode strnvis sysconf tcgetpgrp \
Darren Tuckerf38ea772003-08-13 20:48:07 +1000740 truncate utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100741)
Tim Rice13aae5e2001-10-21 17:53:58 -0700742
Damien Millercd6853c2003-01-28 11:33:42 +1100743AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
744
Darren Tuckerf1159b52003-07-07 19:44:01 +1000745dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000746AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000747AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000748
Darren Tuckerb2427c82003-09-10 15:22:44 +1000749dnl tcsendbreak might be a macro
750AC_CHECK_DECL(tcsendbreak,
751 [AC_DEFINE(HAVE_TCSENDBREAK)],
752 [AC_CHECK_FUNCS(tcsendbreak)],
753 [#include <termios.h>]
754)
755
Damien Millerad833b32000-08-23 10:46:23 +1000756dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000757AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000758dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000759AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000760AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000761dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000762AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000763AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100764
Damien Miller04f80141999-11-19 15:32:34 +1100765AC_CHECK_FUNC(daemon,
766 [AC_DEFINE(HAVE_DAEMON)],
767 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
768)
769
Damien Miller9fb07e42000-03-05 16:22:59 +1100770AC_CHECK_FUNC(getpagesize,
771 [AC_DEFINE(HAVE_GETPAGESIZE)],
772 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
773)
774
Damien Millercb170cb2000-07-01 16:52:55 +1000775# Check for broken snprintf
776if test "x$ac_cv_func_snprintf" = "xyes" ; then
777 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
778 AC_TRY_RUN(
779 [
780#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700781int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000782 ],
783 [AC_MSG_RESULT(yes)],
784 [
785 AC_MSG_RESULT(no)
786 AC_DEFINE(BROKEN_SNPRINTF)
787 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
788 ]
789 )
790fi
791
Damien Millere8328192003-01-07 15:18:32 +1100792dnl see whether mkstemp() requires XXXXXX
793if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
794AC_MSG_CHECKING([for (overly) strict mkstemp])
795AC_TRY_RUN(
796 [
797#include <stdlib.h>
798main() { char template[]="conftest.mkstemp-test";
799if (mkstemp(template) == -1)
800 exit(1);
801unlink(template); exit(0);
802}
803 ],
804 [
805 AC_MSG_RESULT(no)
806 ],
807 [
808 AC_MSG_RESULT(yes)
809 AC_DEFINE(HAVE_STRICT_MKSTEMP)
810 ],
811 [
812 AC_MSG_RESULT(yes)
813 AC_DEFINE(HAVE_STRICT_MKSTEMP)
814 ]
815)
816fi
817
Darren Tucker70a3d552003-08-21 17:58:29 +1000818dnl make sure that openpty does not reacquire controlling terminal
819if test ! -z "$check_for_openpty_ctty_bug"; then
820 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
821 AC_TRY_RUN(
822 [
823#include <stdio.h>
824#include <sys/fcntl.h>
825#include <sys/types.h>
826#include <sys/wait.h>
827
828int
829main()
830{
831 pid_t pid;
832 int fd, ptyfd, ttyfd, status;
833
834 pid = fork();
835 if (pid < 0) { /* failed */
836 exit(1);
837 } else if (pid > 0) { /* parent */
838 waitpid(pid, &status, 0);
839 if (WIFEXITED(status))
840 exit(WEXITSTATUS(status));
841 else
842 exit(2);
843 } else { /* child */
844 close(0); close(1); close(2);
845 setsid();
846 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
847 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
848 if (fd >= 0)
849 exit(3); /* Acquired ctty: broken */
850 else
851 exit(0); /* Did not acquire ctty: OK */
852 }
853}
854 ],
855 [
856 AC_MSG_RESULT(yes)
857 ],
858 [
859 AC_MSG_RESULT(no)
860 AC_DEFINE(SSHD_ACQUIRES_CTTY)
861 ]
862 )
863fi
864
Damien Miller606f8802000-09-16 15:39:56 +1100865AC_FUNC_GETPGRP
866
Damien Millera64b57a2001-01-17 10:44:13 +1100867# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000868PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100869AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100870 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100871 [
Damien Millera64b57a2001-01-17 10:44:13 +1100872 if test "x$withval" != "xno" ; then
873 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
874 AC_MSG_ERROR([PAM headers not found])
875 fi
876
877 AC_CHECK_LIB(dl, dlopen, , )
878 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
879 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000880 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +1100881
882 disable_shadow=yes
883 PAM_MSG="yes"
884
885 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800886 if test $ac_cv_lib_dl_dlopen = yes; then
887 LIBPAM="-lpam -ldl"
888 else
889 LIBPAM="-lpam"
890 fi
891 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100892 fi
893 ]
894)
Damien Millera22ba012000-03-02 23:09:20 +1100895
Damien Millera64b57a2001-01-17 10:44:13 +1100896# Check for older PAM
897if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100898 # Check PAM strerror arguments (old PAM)
899 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
900 AC_TRY_COMPILE(
901 [
Damien Miller81171112000-04-23 11:14:01 +1000902#include <stdlib.h>
903#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100904 ],
905 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
906 [AC_MSG_RESULT(no)],
907 [
908 AC_DEFINE(HAVE_OLD_PAM)
909 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000910 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100911 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100912 )
Damien Millera22ba012000-03-02 23:09:20 +1100913fi
914
Damien Millerfc93d4b2002-09-04 23:26:29 +1000915# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
916# because the system crypt() is more featureful.
917if test "x$check_for_libcrypt_before" = "x1"; then
918 AC_CHECK_LIB(crypt, crypt)
919fi
920
Tim Riceaef73712002-05-11 13:17:42 -0700921# Search for OpenSSL
922saved_CPPFLAGS="$CPPFLAGS"
923saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100924AC_ARG_WITH(ssl-dir,
925 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
926 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000927 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700928 if test -d "$withval/lib"; then
929 if test -n "${need_dash_r}"; then
930 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
931 else
932 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
933 fi
934 else
935 if test -n "${need_dash_r}"; then
936 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
937 else
938 LDFLAGS="-L${withval} ${LDFLAGS}"
939 fi
940 fi
941 if test -d "$withval/include"; then
942 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
943 else
944 CPPFLAGS="-I${withval} ${CPPFLAGS}"
945 fi
Damien Millera22ba012000-03-02 23:09:20 +1100946 fi
947 ]
948)
Tim Riceaef73712002-05-11 13:17:42 -0700949LIBS="$LIBS -lcrypto"
950AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000951 [
Tim Riceaef73712002-05-11 13:17:42 -0700952 dnl Check default openssl install dir
953 if test -n "${need_dash_r}"; then
954 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000955 else
Tim Riceaef73712002-05-11 13:17:42 -0700956 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000957 fi
Tim Riceaef73712002-05-11 13:17:42 -0700958 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
959 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
960 [
961 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
962 ]
963 )
964 ]
965)
966
Tim Riced730b782002-08-13 18:52:10 -0700967# Determine OpenSSL header version
968AC_MSG_CHECKING([OpenSSL header version])
969AC_TRY_RUN(
970 [
971#include <stdio.h>
972#include <string.h>
973#include <openssl/opensslv.h>
974#define DATA "conftest.sslincver"
975int main(void) {
976 FILE *fd;
977 int rc;
978
979 fd = fopen(DATA,"w");
980 if(fd == NULL)
981 exit(1);
982
983 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
984 exit(1);
985
986 exit(0);
987}
988 ],
989 [
990 ssl_header_ver=`cat conftest.sslincver`
991 AC_MSG_RESULT($ssl_header_ver)
992 ],
993 [
994 AC_MSG_RESULT(not found)
995 AC_MSG_ERROR(OpenSSL version header not found.)
996 ]
997)
998
999# Determine OpenSSL library version
1000AC_MSG_CHECKING([OpenSSL library version])
1001AC_TRY_RUN(
1002 [
1003#include <stdio.h>
1004#include <string.h>
1005#include <openssl/opensslv.h>
1006#include <openssl/crypto.h>
1007#define DATA "conftest.ssllibver"
1008int main(void) {
1009 FILE *fd;
1010 int rc;
1011
1012 fd = fopen(DATA,"w");
1013 if(fd == NULL)
1014 exit(1);
1015
1016 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1017 exit(1);
1018
1019 exit(0);
1020}
1021 ],
1022 [
1023 ssl_library_ver=`cat conftest.ssllibver`
1024 AC_MSG_RESULT($ssl_library_ver)
1025 ],
1026 [
1027 AC_MSG_RESULT(not found)
1028 AC_MSG_ERROR(OpenSSL library not found.)
1029 ]
1030)
Damien Millera22ba012000-03-02 23:09:20 +11001031
Damien Millerec932372002-01-22 22:16:03 +11001032# Sanity check OpenSSL headers
1033AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1034AC_TRY_RUN(
1035 [
1036#include <string.h>
1037#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001038int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001039 ],
1040 [
1041 AC_MSG_RESULT(yes)
1042 ],
1043 [
1044 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001045 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1046Check config.log for details.
1047Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001048 ]
1049)
1050
Damien Millera64b57a2001-01-17 10:44:13 +11001051# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1052# version in OpenSSL. Skip this for PAM
Damien Miller4f9f42a2003-05-10 19:28:02 +10001053if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001054 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001055fi
1056
Damien Miller6c21c512002-01-22 21:57:53 +11001057
1058### Configure cryptographic random number support
1059
1060# Check wheter OpenSSL seeds itself
1061AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1062AC_TRY_RUN(
1063 [
1064#include <string.h>
1065#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001066int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001067 ],
1068 [
1069 OPENSSL_SEEDS_ITSELF=yes
1070 AC_MSG_RESULT(yes)
1071 ],
1072 [
1073 AC_MSG_RESULT(no)
1074 # Default to use of the rand helper if OpenSSL doesn't
1075 # seed itself
1076 USE_RAND_HELPER=yes
1077 ]
1078)
1079
1080
1081# Do we want to force the use of the rand helper?
1082AC_ARG_WITH(rand-helper,
1083 [ --with-rand-helper Use subprocess to gather strong randomness ],
1084 [
1085 if test "x$withval" = "xno" ; then
1086 # Force use of OpenSSL's internal RNG, even if
1087 # the previous test showed it to be unseeded.
1088 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1089 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1090 OPENSSL_SEEDS_ITSELF=yes
1091 USE_RAND_HELPER=""
1092 fi
1093 else
1094 USE_RAND_HELPER=yes
1095 fi
1096 ],
1097)
1098
1099# Which randomness source do we use?
1100if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1101 # OpenSSL only
1102 AC_DEFINE(OPENSSL_PRNG_ONLY)
1103 RAND_MSG="OpenSSL internal ONLY"
1104 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001105elif test ! -z "$USE_RAND_HELPER" ; then
1106 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001107 RAND_MSG="ssh-rand-helper"
1108 INSTALL_SSH_RAND_HELPER="yes"
1109fi
1110AC_SUBST(INSTALL_SSH_RAND_HELPER)
1111
1112### Configuration of ssh-rand-helper
1113
1114# PRNGD TCP socket
1115AC_ARG_WITH(prngd-port,
1116 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1117 [
Damien Millere996d722002-01-23 11:20:59 +11001118 case "$withval" in
1119 no)
1120 withval=""
1121 ;;
1122 [[0-9]]*)
1123 ;;
1124 *)
1125 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1126 ;;
1127 esac
1128 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001129 PRNGD_PORT="$withval"
1130 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1131 fi
1132 ]
1133)
1134
1135# PRNGD Unix domain socket
1136AC_ARG_WITH(prngd-socket,
1137 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1138 [
Damien Millere996d722002-01-23 11:20:59 +11001139 case "$withval" in
1140 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001141 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001142 ;;
1143 no)
1144 withval=""
1145 ;;
1146 /*)
1147 ;;
1148 *)
1149 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1150 ;;
1151 esac
1152
1153 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001154 if test ! -z "$PRNGD_PORT" ; then
1155 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1156 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001157 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001158 AC_MSG_WARN(Entropy socket is not readable)
1159 fi
1160 PRNGD_SOCKET="$withval"
1161 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1162 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001163 ],
1164 [
1165 # Check for existing socket only if we don't have a random device already
1166 if test "$USE_RAND_HELPER" = yes ; then
1167 AC_MSG_CHECKING(for PRNGD/EGD socket)
1168 # Insert other locations here
1169 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1170 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1171 PRNGD_SOCKET="$sock"
1172 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1173 break;
1174 fi
1175 done
1176 if test ! -z "$PRNGD_SOCKET" ; then
1177 AC_MSG_RESULT($PRNGD_SOCKET)
1178 else
1179 AC_MSG_RESULT(not found)
1180 fi
1181 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001182 ]
1183)
1184
1185# Change default command timeout for hashing entropy source
1186entropy_timeout=200
1187AC_ARG_WITH(entropy-timeout,
1188 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1189 [
1190 if test "x$withval" != "xno" ; then
1191 entropy_timeout=$withval
1192 fi
1193 ]
1194)
Damien Miller6c21c512002-01-22 21:57:53 +11001195AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1196
Damien Millerd3f6ad22002-06-25 10:24:47 +10001197SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001198AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001199 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001200 [
1201 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001202 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001203 fi
1204 ]
1205)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001206AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1207AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001208
Tim Rice88f2ab52002-03-17 12:17:34 -08001209# We do this little dance with the search path to insure
1210# that programs that we select for use by installed programs
1211# (which may be run by the super-user) come from trusted
1212# locations before they come from the user's private area.
1213# This should help avoid accidentally configuring some
1214# random version of a program in someone's personal bin.
1215
1216OPATH=$PATH
1217PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001218test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001219test -d /sbin && PATH=$PATH:/sbin
1220test -d /usr/sbin && PATH=$PATH:/usr/sbin
1221PATH=$PATH:/etc:$OPATH
1222
Damien Miller6c21c512002-01-22 21:57:53 +11001223# These programs are used by the command hashing source to gather entropy
1224OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1225OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1226OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1227OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1228OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1229OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1230OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1231OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1232OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1233OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1234OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1235OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1236OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1237OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1238OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1239OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001240# restore PATH
1241PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001242
1243# Where does ssh-rand-helper get its randomness from?
1244INSTALL_SSH_PRNG_CMDS=""
1245if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1246 if test ! -z "$PRNGD_PORT" ; then
1247 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1248 elif test ! -z "$PRNGD_SOCKET" ; then
1249 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1250 else
1251 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1252 RAND_HELPER_CMDHASH=yes
1253 INSTALL_SSH_PRNG_CMDS="yes"
1254 fi
1255fi
1256AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1257
1258
Ben Lindstromb5628642000-10-18 00:02:25 +00001259# Cheap hack to ensure NEWS-OS libraries are arranged right.
1260if test ! -z "$SONY" ; then
1261 LIBS="$LIBS -liberty";
1262fi
1263
Damien Millera22ba012000-03-02 23:09:20 +11001264# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001265AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001266AC_CHECK_SIZEOF(short int, 2)
1267AC_CHECK_SIZEOF(int, 4)
1268AC_CHECK_SIZEOF(long int, 4)
1269AC_CHECK_SIZEOF(long long int, 8)
1270
Damien Millerfa2bb692002-04-23 23:22:25 +10001271# Sanity check long long for some platforms (AIX)
1272if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1273 ac_cv_sizeof_long_long_int=0
1274fi
1275
Damien Millera22ba012000-03-02 23:09:20 +11001276# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001277AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1278 AC_TRY_COMPILE(
1279 [ #include <sys/types.h> ],
1280 [ u_int a; a = 1;],
1281 [ ac_cv_have_u_int="yes" ],
1282 [ ac_cv_have_u_int="no" ]
1283 )
1284])
1285if test "x$ac_cv_have_u_int" = "xyes" ; then
1286 AC_DEFINE(HAVE_U_INT)
1287 have_u_int=1
1288fi
1289
Damien Miller61e50f12000-05-08 20:49:37 +10001290AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1291 AC_TRY_COMPILE(
1292 [ #include <sys/types.h> ],
1293 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1294 [ ac_cv_have_intxx_t="yes" ],
1295 [ ac_cv_have_intxx_t="no" ]
1296 )
1297])
1298if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1299 AC_DEFINE(HAVE_INTXX_T)
1300 have_intxx_t=1
1301fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001302
1303if (test -z "$have_intxx_t" && \
1304 test "x$ac_cv_header_stdint_h" = "xyes")
1305then
1306 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1307 AC_TRY_COMPILE(
1308 [ #include <stdint.h> ],
1309 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1310 [
1311 AC_DEFINE(HAVE_INTXX_T)
1312 AC_MSG_RESULT(yes)
1313 ],
1314 [ AC_MSG_RESULT(no) ]
1315 )
1316fi
1317
Damien Miller578783e2000-09-23 14:12:24 +11001318AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1319 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001320 [
1321#include <sys/types.h>
1322#ifdef HAVE_STDINT_H
1323# include <stdint.h>
1324#endif
1325#include <sys/socket.h>
1326#ifdef HAVE_SYS_BITYPES_H
1327# include <sys/bitypes.h>
1328#endif
1329 ],
Damien Miller578783e2000-09-23 14:12:24 +11001330 [ int64_t a; a = 1;],
1331 [ ac_cv_have_int64_t="yes" ],
1332 [ ac_cv_have_int64_t="no" ]
1333 )
1334])
1335if test "x$ac_cv_have_int64_t" = "xyes" ; then
1336 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001337fi
1338
Damien Miller61e50f12000-05-08 20:49:37 +10001339AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1340 AC_TRY_COMPILE(
1341 [ #include <sys/types.h> ],
1342 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1343 [ ac_cv_have_u_intxx_t="yes" ],
1344 [ ac_cv_have_u_intxx_t="no" ]
1345 )
1346])
1347if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1348 AC_DEFINE(HAVE_U_INTXX_T)
1349 have_u_intxx_t=1
1350fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001351
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001352if test -z "$have_u_intxx_t" ; then
1353 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1354 AC_TRY_COMPILE(
1355 [ #include <sys/socket.h> ],
1356 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1357 [
1358 AC_DEFINE(HAVE_U_INTXX_T)
1359 AC_MSG_RESULT(yes)
1360 ],
1361 [ AC_MSG_RESULT(no) ]
1362 )
1363fi
1364
Damien Miller578783e2000-09-23 14:12:24 +11001365AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1366 AC_TRY_COMPILE(
1367 [ #include <sys/types.h> ],
1368 [ u_int64_t a; a = 1;],
1369 [ ac_cv_have_u_int64_t="yes" ],
1370 [ ac_cv_have_u_int64_t="no" ]
1371 )
1372])
1373if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1374 AC_DEFINE(HAVE_U_INT64_T)
1375 have_u_int64_t=1
1376fi
1377
Tim Rice4cec93f2002-02-26 08:40:48 -08001378if test -z "$have_u_int64_t" ; then
1379 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1380 AC_TRY_COMPILE(
1381 [ #include <sys/bitypes.h> ],
1382 [ u_int64_t a; a = 1],
1383 [
1384 AC_DEFINE(HAVE_U_INT64_T)
1385 AC_MSG_RESULT(yes)
1386 ],
1387 [ AC_MSG_RESULT(no) ]
1388 )
1389fi
1390
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001391if test -z "$have_u_intxx_t" ; then
1392 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1393 AC_TRY_COMPILE(
1394 [
1395#include <sys/types.h>
1396 ],
1397 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1398 [ ac_cv_have_uintxx_t="yes" ],
1399 [ ac_cv_have_uintxx_t="no" ]
1400 )
1401 ])
1402 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1403 AC_DEFINE(HAVE_UINTXX_T)
1404 fi
1405fi
1406
1407if test -z "$have_uintxx_t" ; then
1408 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1409 AC_TRY_COMPILE(
1410 [ #include <stdint.h> ],
1411 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1412 [
1413 AC_DEFINE(HAVE_UINTXX_T)
1414 AC_MSG_RESULT(yes)
1415 ],
1416 [ AC_MSG_RESULT(no) ]
1417 )
1418fi
1419
Damien Milleredb82922000-06-20 13:25:52 +10001420if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1421 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001422then
1423 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1424 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001425 [
1426#include <sys/bitypes.h>
1427 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001428 [
Damien Miller70494d12000-04-03 15:57:06 +10001429 int8_t a; int16_t b; int32_t c;
1430 u_int8_t e; u_int16_t f; u_int32_t g;
1431 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001432 ],
1433 [
1434 AC_DEFINE(HAVE_U_INTXX_T)
1435 AC_DEFINE(HAVE_INTXX_T)
1436 AC_MSG_RESULT(yes)
1437 ],
1438 [AC_MSG_RESULT(no)]
1439 )
1440fi
1441
Damien Miller58be7382001-09-15 21:31:54 +10001442
1443AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1444 AC_TRY_COMPILE(
1445 [
1446#include <sys/types.h>
1447 ],
1448 [ u_char foo; foo = 125; ],
1449 [ ac_cv_have_u_char="yes" ],
1450 [ ac_cv_have_u_char="no" ]
1451 )
1452])
1453if test "x$ac_cv_have_u_char" = "xyes" ; then
1454 AC_DEFINE(HAVE_U_CHAR)
1455fi
1456
Tim Rice13aae5e2001-10-21 17:53:58 -07001457TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001458
Tim Rice200a5c02002-02-26 22:12:34 -08001459AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001460
Damien Miller61e50f12000-05-08 20:49:37 +10001461AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1462 AC_TRY_COMPILE(
1463 [
1464#include <sys/types.h>
1465 ],
1466 [ size_t foo; foo = 1235; ],
1467 [ ac_cv_have_size_t="yes" ],
1468 [ ac_cv_have_size_t="no" ]
1469 )
1470])
1471if test "x$ac_cv_have_size_t" = "xyes" ; then
1472 AC_DEFINE(HAVE_SIZE_T)
1473fi
Damien Miller95058511999-12-29 10:36:45 +11001474
Damien Miller615f9392000-05-17 22:53:33 +10001475AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1476 AC_TRY_COMPILE(
1477 [
1478#include <sys/types.h>
1479 ],
1480 [ ssize_t foo; foo = 1235; ],
1481 [ ac_cv_have_ssize_t="yes" ],
1482 [ ac_cv_have_ssize_t="no" ]
1483 )
1484])
1485if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1486 AC_DEFINE(HAVE_SSIZE_T)
1487fi
1488
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001489AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1490 AC_TRY_COMPILE(
1491 [
1492#include <time.h>
1493 ],
1494 [ clock_t foo; foo = 1235; ],
1495 [ ac_cv_have_clock_t="yes" ],
1496 [ ac_cv_have_clock_t="no" ]
1497 )
1498])
1499if test "x$ac_cv_have_clock_t" = "xyes" ; then
1500 AC_DEFINE(HAVE_CLOCK_T)
1501fi
1502
Damien Millerb54b40e2000-06-23 08:23:34 +10001503AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1504 AC_TRY_COMPILE(
1505 [
1506#include <sys/types.h>
1507#include <sys/socket.h>
1508 ],
1509 [ sa_family_t foo; foo = 1235; ],
1510 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001511 [ AC_TRY_COMPILE(
1512 [
1513#include <sys/types.h>
1514#include <sys/socket.h>
1515#include <netinet/in.h>
1516 ],
1517 [ sa_family_t foo; foo = 1235; ],
1518 [ ac_cv_have_sa_family_t="yes" ],
1519
Damien Millerb54b40e2000-06-23 08:23:34 +10001520 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001521 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001522 )
1523])
1524if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1525 AC_DEFINE(HAVE_SA_FAMILY_T)
1526fi
1527
Damien Miller0f91b4e2000-06-18 15:43:25 +10001528AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1529 AC_TRY_COMPILE(
1530 [
1531#include <sys/types.h>
1532 ],
1533 [ pid_t foo; foo = 1235; ],
1534 [ ac_cv_have_pid_t="yes" ],
1535 [ ac_cv_have_pid_t="no" ]
1536 )
1537])
1538if test "x$ac_cv_have_pid_t" = "xyes" ; then
1539 AC_DEFINE(HAVE_PID_T)
1540fi
1541
1542AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1543 AC_TRY_COMPILE(
1544 [
1545#include <sys/types.h>
1546 ],
1547 [ mode_t foo; foo = 1235; ],
1548 [ ac_cv_have_mode_t="yes" ],
1549 [ ac_cv_have_mode_t="no" ]
1550 )
1551])
1552if test "x$ac_cv_have_mode_t" = "xyes" ; then
1553 AC_DEFINE(HAVE_MODE_T)
1554fi
1555
Damien Miller61e50f12000-05-08 20:49:37 +10001556
1557AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1558 AC_TRY_COMPILE(
1559 [
Damien Miller81171112000-04-23 11:14:01 +10001560#include <sys/types.h>
1561#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001562 ],
1563 [ struct sockaddr_storage s; ],
1564 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1565 [ ac_cv_have_struct_sockaddr_storage="no" ]
1566 )
1567])
1568if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1569 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1570fi
Damien Miller34132e52000-01-14 15:45:46 +11001571
Damien Miller61e50f12000-05-08 20:49:37 +10001572AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1573 AC_TRY_COMPILE(
1574 [
Damien Miller7b22d652000-06-18 14:07:04 +10001575#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001576#include <netinet/in.h>
1577 ],
1578 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1579 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1580 [ ac_cv_have_struct_sockaddr_in6="no" ]
1581 )
1582])
1583if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1584 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1585fi
Damien Miller34132e52000-01-14 15:45:46 +11001586
Damien Miller61e50f12000-05-08 20:49:37 +10001587AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1588 AC_TRY_COMPILE(
1589 [
Damien Miller7b22d652000-06-18 14:07:04 +10001590#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001591#include <netinet/in.h>
1592 ],
1593 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1594 [ ac_cv_have_struct_in6_addr="yes" ],
1595 [ ac_cv_have_struct_in6_addr="no" ]
1596 )
1597])
1598if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1599 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1600fi
Damien Miller34132e52000-01-14 15:45:46 +11001601
Damien Miller61e50f12000-05-08 20:49:37 +10001602AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1603 AC_TRY_COMPILE(
1604 [
Damien Miller81171112000-04-23 11:14:01 +10001605#include <sys/types.h>
1606#include <sys/socket.h>
1607#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001608 ],
1609 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1610 [ ac_cv_have_struct_addrinfo="yes" ],
1611 [ ac_cv_have_struct_addrinfo="no" ]
1612 )
1613])
1614if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1615 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1616fi
1617
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001618AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1619 AC_TRY_COMPILE(
1620 [ #include <sys/time.h> ],
1621 [ struct timeval tv; tv.tv_sec = 1;],
1622 [ ac_cv_have_struct_timeval="yes" ],
1623 [ ac_cv_have_struct_timeval="no" ]
1624 )
1625])
1626if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1627 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1628 have_struct_timeval=1
1629fi
1630
Tim Rice4e4dc562003-03-18 10:21:40 -08001631AC_CHECK_TYPES(struct timespec)
1632
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001633# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001634if test "x$ac_cv_have_int64_t" = "xno" -a \
1635 "x$ac_cv_sizeof_long_int" != "x8" -a \
1636 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001637 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1638 echo "an alternative compiler (I.E., GCC) before continuing."
1639 echo ""
1640 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001641else
1642dnl test snprintf (broken on SCO w/gcc)
1643 AC_TRY_RUN(
1644 [
1645#include <stdio.h>
1646#include <string.h>
1647#ifdef HAVE_SNPRINTF
1648main()
1649{
1650 char buf[50];
1651 char expected_out[50];
1652 int mazsize = 50 ;
1653#if (SIZEOF_LONG_INT == 8)
1654 long int num = 0x7fffffffffffffff;
1655#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001656 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001657#endif
1658 strcpy(expected_out, "9223372036854775807");
1659 snprintf(buf, mazsize, "%lld", num);
1660 if(strcmp(buf, expected_out) != 0)
1661 exit(1);
1662 exit(0);
1663}
1664#else
1665main() { exit(0); }
1666#endif
1667 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1668 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001669fi
1670
Damien Miller78315eb2000-09-29 23:01:36 +11001671dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001672OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1673OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1674OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1675OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1676OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001677OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001678OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1679OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001680OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001681OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1682OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1683OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1684OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001685OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1686OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1687OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1688OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001689
1690AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001691
Damien Miller61e50f12000-05-08 20:49:37 +10001692AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1693 ac_cv_have_ss_family_in_struct_ss, [
1694 AC_TRY_COMPILE(
1695 [
Damien Miller81171112000-04-23 11:14:01 +10001696#include <sys/types.h>
1697#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001698 ],
1699 [ struct sockaddr_storage s; s.ss_family = 1; ],
1700 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1701 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1702 )
1703])
1704if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1705 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1706fi
1707
Damien Miller61e50f12000-05-08 20:49:37 +10001708AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1709 ac_cv_have___ss_family_in_struct_ss, [
1710 AC_TRY_COMPILE(
1711 [
Damien Miller81171112000-04-23 11:14:01 +10001712#include <sys/types.h>
1713#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001714 ],
1715 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1716 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1717 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1718 )
1719])
1720if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1721 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1722fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001723
Damien Millerad833b32000-08-23 10:46:23 +10001724AC_CACHE_CHECK([for pw_class field in struct passwd],
1725 ac_cv_have_pw_class_in_struct_passwd, [
1726 AC_TRY_COMPILE(
1727 [
Damien Millerad833b32000-08-23 10:46:23 +10001728#include <pwd.h>
1729 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001730 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001731 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1732 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1733 )
1734])
1735if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1736 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1737fi
1738
Kevin Steves82456952001-06-22 21:14:18 +00001739AC_CACHE_CHECK([for pw_expire field in struct passwd],
1740 ac_cv_have_pw_expire_in_struct_passwd, [
1741 AC_TRY_COMPILE(
1742 [
1743#include <pwd.h>
1744 ],
1745 [ struct passwd p; p.pw_expire = 0; ],
1746 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1747 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1748 )
1749])
1750if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1751 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1752fi
1753
1754AC_CACHE_CHECK([for pw_change field in struct passwd],
1755 ac_cv_have_pw_change_in_struct_passwd, [
1756 AC_TRY_COMPILE(
1757 [
1758#include <pwd.h>
1759 ],
1760 [ struct passwd p; p.pw_change = 0; ],
1761 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1762 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1763 )
1764])
1765if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1766 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1767fi
Damien Miller61e50f12000-05-08 20:49:37 +10001768
Tim Rice28bbb0c2002-05-27 17:37:32 -07001769dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001770AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1771 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001772 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001773 [
Tim Riceae49fe62002-04-12 10:26:21 -07001774#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001775#include <sys/socket.h>
1776#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001777int main() {
1778#ifdef msg_accrights
1779exit(1);
1780#endif
1781struct msghdr m;
1782m.msg_accrights = 0;
1783exit(0);
1784}
Kevin Steves939c9db2002-03-22 17:23:25 +00001785 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001786 [ ac_cv_have_accrights_in_msghdr="yes" ],
1787 [ ac_cv_have_accrights_in_msghdr="no" ]
1788 )
1789])
1790if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1791 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1792fi
1793
Kevin Stevesa44e0352002-04-07 16:18:03 +00001794AC_CACHE_CHECK([for msg_control field in struct msghdr],
1795 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001796 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001797 [
Tim Riceae49fe62002-04-12 10:26:21 -07001798#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001799#include <sys/socket.h>
1800#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001801int main() {
1802#ifdef msg_control
1803exit(1);
1804#endif
1805struct msghdr m;
1806m.msg_control = 0;
1807exit(0);
1808}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001809 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001810 [ ac_cv_have_control_in_msghdr="yes" ],
1811 [ ac_cv_have_control_in_msghdr="no" ]
1812 )
1813])
1814if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1815 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1816fi
1817
Damien Miller61e50f12000-05-08 20:49:37 +10001818AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1819 AC_TRY_LINK([],
1820 [ extern char *__progname; printf("%s", __progname); ],
1821 [ ac_cv_libc_defines___progname="yes" ],
1822 [ ac_cv_libc_defines___progname="no" ]
1823 )
1824])
1825if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1826 AC_DEFINE(HAVE___PROGNAME)
1827fi
1828
Kevin Steves4846f4a2002-03-22 18:19:53 +00001829AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1830 AC_TRY_LINK([
1831#include <stdio.h>
1832],
1833 [ printf("%s", __FUNCTION__); ],
1834 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1835 [ ac_cv_cc_implements___FUNCTION__="no" ]
1836 )
1837])
1838if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1839 AC_DEFINE(HAVE___FUNCTION__)
1840fi
1841
1842AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1843 AC_TRY_LINK([
1844#include <stdio.h>
1845],
1846 [ printf("%s", __func__); ],
1847 [ ac_cv_cc_implements___func__="yes" ],
1848 [ ac_cv_cc_implements___func__="no" ]
1849 )
1850])
1851if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1852 AC_DEFINE(HAVE___func__)
1853fi
1854
Damien Miller4f8e6692001-07-14 13:22:53 +10001855AC_CACHE_CHECK([whether getopt has optreset support],
1856 ac_cv_have_getopt_optreset, [
1857 AC_TRY_LINK(
1858 [
1859#include <getopt.h>
1860 ],
1861 [ extern int optreset; optreset = 0; ],
1862 [ ac_cv_have_getopt_optreset="yes" ],
1863 [ ac_cv_have_getopt_optreset="no" ]
1864 )
1865])
1866if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1867 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1868fi
Damien Millera22ba012000-03-02 23:09:20 +11001869
Damien Millerecbb26d2000-07-15 14:59:14 +10001870AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1871 AC_TRY_LINK([],
1872 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1873 [ ac_cv_libc_defines_sys_errlist="yes" ],
1874 [ ac_cv_libc_defines_sys_errlist="no" ]
1875 )
1876])
1877if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1878 AC_DEFINE(HAVE_SYS_ERRLIST)
1879fi
1880
1881
Damien Miller11fa2cc2000-08-16 10:35:58 +10001882AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1883 AC_TRY_LINK([],
1884 [ extern int sys_nerr; printf("%i", sys_nerr);],
1885 [ ac_cv_libc_defines_sys_nerr="yes" ],
1886 [ ac_cv_libc_defines_sys_nerr="no" ]
1887 )
1888])
1889if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1890 AC_DEFINE(HAVE_SYS_NERR)
1891fi
1892
Damien Miller85de5802001-09-18 14:01:11 +10001893SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001894# Check whether user wants sectok support
1895AC_ARG_WITH(sectok,
1896 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001897 [
1898 if test "x$withval" != "xno" ; then
1899 if test "x$withval" != "xyes" ; then
1900 CPPFLAGS="$CPPFLAGS -I${withval}"
1901 LDFLAGS="$LDFLAGS -L${withval}"
1902 if test ! -z "$need_dash_r" ; then
1903 LDFLAGS="$LDFLAGS -R${withval}"
1904 fi
1905 if test ! -z "$blibpath" ; then
1906 blibpath="$blibpath:${withval}"
1907 fi
1908 fi
1909 AC_CHECK_HEADERS(sectok.h)
1910 if test "$ac_cv_header_sectok_h" != yes; then
1911 AC_MSG_ERROR(Can't find sectok.h)
1912 fi
1913 AC_CHECK_LIB(sectok, sectok_open)
1914 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1915 AC_MSG_ERROR(Can't find libsectok)
1916 fi
1917 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001918 AC_DEFINE(USE_SECTOK)
1919 SCARD_MSG="yes, using sectok"
1920 fi
1921 ]
1922)
1923
1924# Check whether user wants OpenSC support
1925AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001926 AC_HELP_STRING([--with-opensc=PFX],
1927 [Enable smartcard support using OpenSC]),
1928 opensc_config_prefix="$withval", opensc_config_prefix="")
1929if test x$opensc_config_prefix != x ; then
1930 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1931 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1932 if test "$OPENSC_CONFIG" != "no"; then
1933 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1934 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1935 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1936 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1937 AC_DEFINE(SMARTCARD)
1938 AC_DEFINE(USE_OPENSC)
1939 SCARD_MSG="yes, using OpenSC"
1940 fi
1941fi
Damien Miller85de5802001-09-18 14:01:11 +10001942
Damien Miller7abe09b2003-05-15 10:53:49 +10001943# Check whether user wants DNS support
1944DNS_MSG="no"
1945AC_ARG_WITH(dns,
1946 [ --with-dns Support for fetching keys from DNS (experimental)],
1947 [
1948 if test "x$withval" != "xno" ; then
Damien Millerd9ec3702003-05-15 12:27:08 +10001949 DNS_MSG="yes"
1950 AC_DEFINE(DNS)
1951 AC_SEARCH_LIBS(getrrsetbyname, resolv,
Damien Miller200d0a72003-06-30 19:21:36 +10001952 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1953 [
1954 # Needed by our getrrsetbyname()
1955 AC_SEARCH_LIBS(res_query, resolv)
1956 AC_SEARCH_LIBS(dn_expand, resolv)
Tim Rice0ac16a42003-09-08 06:33:33 -07001957 AC_CHECK_FUNCS(_getshort _getlong)
Tim Riceb284e162003-09-08 14:35:16 -07001958 AC_CHECK_MEMBER(HEADER.ad,
1959 [AC_DEFINE(HAVE_HEADER_AD)],,
1960 [#include <arpa/nameser.h>])
Damien Miller200d0a72003-06-30 19:21:36 +10001961 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10001962 fi
1963 ]
1964)
1965
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001966# Check whether user wants Kerberos 5 support
1967KRB5_MSG="no"
1968AC_ARG_WITH(kerberos5,
1969 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1970 [
1971 if test "x$withval" != "xno" ; then
1972 if test "x$withval" = "xyes" ; then
1973 KRB5ROOT="/usr/local"
1974 else
1975 KRB5ROOT=${withval}
1976 fi
1977 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1978 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1979 AC_DEFINE(KRB5)
1980 KRB5_MSG="yes"
1981 AC_MSG_CHECKING(whether we are using Heimdal)
1982 AC_TRY_COMPILE([ #include <krb5.h> ],
1983 [ char *tmp = heimdal_version; ],
1984 [ AC_MSG_RESULT(yes)
1985 AC_DEFINE(HEIMDAL)
1986 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1987 ],
1988 [ AC_MSG_RESULT(no)
1989 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1990 ]
1991 )
1992 if test ! -z "$need_dash_r" ; then
1993 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1994 fi
1995 if test ! -z "$blibpath" ; then
1996 blibpath="$blibpath:${KRB5ROOT}/lib"
1997 fi
Damien Miller200d0a72003-06-30 19:21:36 +10001998 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001999
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002000 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2001 [ AC_DEFINE(GSSAPI)
2002 K5LIBS="-lgssapi $K5LIBS" ],
2003 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2004 [ AC_DEFINE(GSSAPI)
2005 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2006 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2007 $K5LIBS)
2008 ],
2009 $K5LIBS)
2010
2011 AC_CHECK_HEADER(gssapi.h, ,
2012 [ unset ac_cv_header_gssapi_h
2013 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2014 AC_CHECK_HEADERS(gssapi.h, ,
2015 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2016 )
2017 ]
2018 )
2019
2020 oldCPP="$CPPFLAGS"
2021 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2022 AC_CHECK_HEADER(gssapi_krb5.h, ,
2023 [ CPPFLAGS="$oldCPP" ])
2024
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002025 KRB5=yes
2026 fi
2027 ]
2028)
Darren Tucker6aaa58c2003-08-02 22:24:49 +10002029LIBS="$LIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10002030
Damien Millera22ba012000-03-02 23:09:20 +11002031# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002032
Damien Millerf58c6722002-05-13 13:15:42 +10002033PRIVSEP_PATH=/var/empty
2034AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002035 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002036 [
2037 if test "x$withval" != "$no" ; then
2038 PRIVSEP_PATH=$withval
2039 fi
2040 ]
2041)
2042AC_SUBST(PRIVSEP_PATH)
2043
Damien Millera22ba012000-03-02 23:09:20 +11002044AC_ARG_WITH(xauth,
2045 [ --with-xauth=PATH Specify path to xauth program ],
2046 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002047 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002048 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002049 fi
2050 ],
2051 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002052 TestPath="$PATH"
2053 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2054 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2055 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2056 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2057 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002058 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002059 xauth_path="/usr/openwin/bin/xauth"
2060 fi
2061 ]
2062)
2063
Damien Miller7d901272003-01-13 16:55:22 +11002064STRIP_OPT=-s
2065AC_ARG_ENABLE(strip,
2066 [ --disable-strip Disable calling strip(1) on install],
2067 [
2068 if test "x$enableval" = "xno" ; then
2069 STRIP_OPT=
2070 fi
2071 ]
2072)
2073AC_SUBST(STRIP_OPT)
2074
Damien Millera19cf472000-11-29 13:28:50 +11002075if test -z "$xauth_path" ; then
2076 XAUTH_PATH="undefined"
2077 AC_SUBST(XAUTH_PATH)
2078else
Damien Millera22ba012000-03-02 23:09:20 +11002079 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002080 XAUTH_PATH=$xauth_path
2081 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002082fi
Damien Millera22ba012000-03-02 23:09:20 +11002083
2084# Check for mail directory (last resort if we cannot get it from headers)
2085if test ! -z "$MAIL" ; then
2086 maildir=`dirname $MAIL`
2087 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2088fi
2089
Damien Millera22ba012000-03-02 23:09:20 +11002090if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002091 if test "x$disable_ptmx_check" != "xyes" ; then
2092 AC_CHECK_FILE("/dev/ptmx",
2093 [
2094 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2095 have_dev_ptmx=1
2096 ]
2097 )
2098 fi
Damien Millera22ba012000-03-02 23:09:20 +11002099fi
Damien Miller204ad072000-03-02 23:56:12 +11002100AC_CHECK_FILE("/dev/ptc",
2101 [
2102 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2103 have_dev_ptc=1
2104 ]
2105)
2106
Damien Millera22ba012000-03-02 23:09:20 +11002107# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002108AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002109 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002110 [
Damien Miller897741e2001-04-16 10:41:46 +10002111 case "$withval" in
2112 man|cat|doc)
2113 MANTYPE=$withval
2114 ;;
2115 *)
2116 AC_MSG_ERROR(invalid man type: $withval)
2117 ;;
2118 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002119 ]
2120)
Ben Lindstrombc709922001-04-18 18:04:21 +00002121if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002122 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2123 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002124 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2125 MANTYPE=doc
2126 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2127 MANTYPE=man
2128 else
2129 MANTYPE=cat
2130 fi
2131fi
Damien Miller670a4b82000-01-22 13:53:11 +11002132AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002133if test "$MANTYPE" = "doc"; then
2134 mansubdir=man;
2135else
2136 mansubdir=$MANTYPE;
2137fi
2138AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002139
Damien Millera22ba012000-03-02 23:09:20 +11002140# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10002141MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002142AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002143 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002144 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002145 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002146 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10002147 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002148 fi
2149 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002150)
2151
Damien Millera22ba012000-03-02 23:09:20 +11002152# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002153AC_ARG_WITH(shadow,
2154 [ --without-shadow Disable shadow password support],
2155 [
2156 if test "x$withval" = "xno" ; then
2157 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002158 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002159 fi
2160 ]
2161)
2162
Damien Miller1f335fb2000-06-26 11:31:33 +10002163if test -z "$disable_shadow" ; then
2164 AC_MSG_CHECKING([if the systems has expire shadow information])
2165 AC_TRY_COMPILE(
2166 [
2167#include <sys/types.h>
2168#include <shadow.h>
2169 struct spwd sp;
2170 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2171 [ sp_expire_available=yes ], []
2172 )
2173
2174 if test "x$sp_expire_available" = "xyes" ; then
2175 AC_MSG_RESULT(yes)
2176 AC_DEFINE(HAS_SHADOW_EXPIRE)
2177 else
2178 AC_MSG_RESULT(no)
2179 fi
2180fi
2181
Damien Millera22ba012000-03-02 23:09:20 +11002182# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002183if test ! -z "$IPADDR_IN_DISPLAY" ; then
2184 DISPLAY_HACK_MSG="yes"
2185 AC_DEFINE(IPADDR_IN_DISPLAY)
2186else
2187 DISPLAY_HACK_MSG="no"
2188 AC_ARG_WITH(ipaddr-display,
2189 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2190 [
2191 if test "x$withval" != "xno" ; then
2192 AC_DEFINE(IPADDR_IN_DISPLAY)
2193 DISPLAY_HACK_MSG="yes"
2194 fi
2195 ]
2196 )
2197fi
Damien Miller76112de1999-12-21 11:18:08 +11002198
Darren Tuckere1a790d2003-09-16 11:52:19 +10002199# check for /etc/default/login and use it if present.
2200AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2201
2202if test "x$external_path_file" = "x/etc/default/login"; then
2203 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2204fi
2205
Tim Rice43a1c132002-04-17 21:19:14 -07002206dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2207if test $ac_cv_func_login_getcapbool = "yes" -a \
2208 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002209 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002210fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002211
Damien Millera22ba012000-03-02 23:09:20 +11002212# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002213SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002214AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002215 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002216 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002217 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002218 AC_MSG_WARN([
2219--with-default-path=PATH has no effect on this system.
2220Edit /etc/login.conf instead.])
2221 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002222 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002223 AC_MSG_WARN([
2224--with-default-path=PATH will only be used if PATH is not defined in
2225$external_path_file .])
2226 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002227 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002228 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002229 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002230 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002231 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2232 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002233 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002234 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002235 AC_MSG_WARN([
2236If PATH is defined in $external_path_file, ensure the path to scp is included,
2237otherwise scp will not work.])
2238 fi
2239 AC_TRY_RUN(
2240 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002241/* find out what STDPATH is */
2242#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002243#ifdef HAVE_PATHS_H
2244# include <paths.h>
2245#endif
2246#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002247# ifdef _PATH_USERPATH /* Irix */
2248# define _PATH_STDPATH _PATH_USERPATH
2249# else
2250# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2251# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002252#endif
2253#include <sys/types.h>
2254#include <sys/stat.h>
2255#include <fcntl.h>
2256#define DATA "conftest.stdpath"
2257
2258main()
2259{
2260 FILE *fd;
2261 int rc;
2262
2263 fd = fopen(DATA,"w");
2264 if(fd == NULL)
2265 exit(1);
2266
2267 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2268 exit(1);
2269
2270 exit(0);
2271}
2272 ], [ user_path=`cat conftest.stdpath` ],
2273 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2274 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2275 )
2276# make sure $bindir is in USER_PATH so scp will work
2277 t_bindir=`eval echo ${bindir}`
2278 case $t_bindir in
2279 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2280 esac
2281 case $t_bindir in
2282 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2283 esac
2284 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2285 if test $? -ne 0 ; then
2286 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2287 if test $? -ne 0 ; then
2288 user_path=$user_path:$t_bindir
2289 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2290 fi
2291 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002292 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002293)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002294if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002295 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2296 AC_SUBST(user_path)
2297fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002298
Damien Millera18bbd32002-05-13 10:48:57 +10002299# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002300AC_ARG_WITH(superuser-path,
2301 [ --with-superuser-path= Specify different path for super-user],
2302 [
2303 if test "x$withval" != "xno" ; then
2304 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2305 superuser_path=$withval
2306 fi
2307 ]
2308)
2309
2310
Damien Miller61e50f12000-05-08 20:49:37 +10002311AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002312IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002313AC_ARG_WITH(4in6,
2314 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2315 [
2316 if test "x$withval" != "xno" ; then
2317 AC_MSG_RESULT(yes)
2318 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002319 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002320 else
2321 AC_MSG_RESULT(no)
2322 fi
2323 ],[
2324 if test "x$inet6_default_4in6" = "xyes"; then
2325 AC_MSG_RESULT([yes (default)])
2326 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002327 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002328 else
2329 AC_MSG_RESULT([no (default)])
2330 fi
2331 ]
2332)
2333
Damien Miller60396b02001-02-18 17:01:00 +11002334# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002335BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002336AC_ARG_WITH(bsd-auth,
2337 [ --with-bsd-auth Enable BSD auth support],
2338 [
2339 if test "x$withval" != "xno" ; then
2340 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002341 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002342 fi
2343 ]
2344)
2345
Damien Millera22ba012000-03-02 23:09:20 +11002346# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002347piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002348# make sure the directory exists
2349if test ! -d $piddir ; then
2350 piddir=`eval echo ${sysconfdir}`
2351 case $piddir in
2352 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2353 esac
2354fi
2355
Tim Rice88f2ab52002-03-17 12:17:34 -08002356AC_ARG_WITH(pid-dir,
2357 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2358 [
2359 if test "x$withval" != "xno" ; then
2360 piddir=$withval
2361 if test ! -d $piddir ; then
2362 AC_MSG_WARN([** no $piddir directory on this system **])
2363 fi
2364 fi
2365 ]
2366)
2367
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002368AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002369AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002370
andre2ff7b5d2000-06-03 14:57:40 +00002371dnl allow user to disable some login recording features
2372AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002373 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002374 [
2375 if test "x$enableval" = "xno" ; then
2376 AC_DEFINE(DISABLE_LASTLOG)
2377 fi
2378 ]
andre2ff7b5d2000-06-03 14:57:40 +00002379)
2380AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002381 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002382 [
2383 if test "x$enableval" = "xno" ; then
2384 AC_DEFINE(DISABLE_UTMP)
2385 fi
2386 ]
andre2ff7b5d2000-06-03 14:57:40 +00002387)
2388AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002389 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002390 [
2391 if test "x$enableval" = "xno" ; then
2392 AC_DEFINE(DISABLE_UTMPX)
2393 fi
2394 ]
andre2ff7b5d2000-06-03 14:57:40 +00002395)
2396AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002397 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002398 [
2399 if test "x$enableval" = "xno" ; then
2400 AC_DEFINE(DISABLE_WTMP)
2401 fi
2402 ]
andre2ff7b5d2000-06-03 14:57:40 +00002403)
2404AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002405 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002406 [
2407 if test "x$enableval" = "xno" ; then
2408 AC_DEFINE(DISABLE_WTMPX)
2409 fi
2410 ]
andre2ff7b5d2000-06-03 14:57:40 +00002411)
2412AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002413 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002414 [
2415 if test "x$enableval" = "xno" ; then
2416 AC_DEFINE(DISABLE_LOGIN)
2417 fi
2418 ]
andre2ff7b5d2000-06-03 14:57:40 +00002419)
2420AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002421 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002422 [
2423 if test "x$enableval" = "xno" ; then
2424 AC_DEFINE(DISABLE_PUTUTLINE)
2425 fi
2426 ]
andre2ff7b5d2000-06-03 14:57:40 +00002427)
2428AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002429 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002430 [
2431 if test "x$enableval" = "xno" ; then
2432 AC_DEFINE(DISABLE_PUTUTXLINE)
2433 fi
2434 ]
andre2ff7b5d2000-06-03 14:57:40 +00002435)
2436AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002437 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002438 [
2439 if test "x$withval" = "xno" ; then
2440 AC_DEFINE(DISABLE_LASTLOG)
2441 else
2442 conf_lastlog_location=$withval
2443 fi
2444 ]
2445)
andre2ff7b5d2000-06-03 14:57:40 +00002446
2447dnl lastlog, [uw]tmpx? detection
2448dnl NOTE: set the paths in the platform section to avoid the
2449dnl need for command-line parameters
2450dnl lastlog and [uw]tmp are subject to a file search if all else fails
2451
2452dnl lastlog detection
2453dnl NOTE: the code itself will detect if lastlog is a directory
2454AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2455AC_TRY_COMPILE([
2456#include <sys/types.h>
2457#include <utmp.h>
2458#ifdef HAVE_LASTLOG_H
2459# include <lastlog.h>
2460#endif
Damien Miller2994e082000-06-04 15:51:47 +10002461#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002462# include <paths.h>
2463#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002464#ifdef HAVE_LOGIN_H
2465# include <login.h>
2466#endif
andre2ff7b5d2000-06-03 14:57:40 +00002467 ],
2468 [ char *lastlog = LASTLOG_FILE; ],
2469 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002470 [
2471 AC_MSG_RESULT(no)
2472 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2473 AC_TRY_COMPILE([
2474#include <sys/types.h>
2475#include <utmp.h>
2476#ifdef HAVE_LASTLOG_H
2477# include <lastlog.h>
2478#endif
2479#ifdef HAVE_PATHS_H
2480# include <paths.h>
2481#endif
2482 ],
2483 [ char *lastlog = _PATH_LASTLOG; ],
2484 [ AC_MSG_RESULT(yes) ],
2485 [
andree441aa32000-06-12 22:34:38 +00002486 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002487 system_lastlog_path=no
2488 ])
2489 ]
andre2ff7b5d2000-06-03 14:57:40 +00002490)
Damien Miller2994e082000-06-04 15:51:47 +10002491
andre2ff7b5d2000-06-03 14:57:40 +00002492if test -z "$conf_lastlog_location"; then
2493 if test x"$system_lastlog_path" = x"no" ; then
2494 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002495 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002496 conf_lastlog_location=$f
2497 fi
2498 done
2499 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002500 AC_MSG_WARN([** Cannot find lastlog **])
2501 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002502 fi
2503 fi
2504fi
2505
2506if test -n "$conf_lastlog_location"; then
2507 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2508fi
2509
2510dnl utmp detection
2511AC_MSG_CHECKING([if your system defines UTMP_FILE])
2512AC_TRY_COMPILE([
2513#include <sys/types.h>
2514#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002515#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002516# include <paths.h>
2517#endif
2518 ],
2519 [ char *utmp = UTMP_FILE; ],
2520 [ AC_MSG_RESULT(yes) ],
2521 [ AC_MSG_RESULT(no)
2522 system_utmp_path=no ]
2523)
2524if test -z "$conf_utmp_location"; then
2525 if test x"$system_utmp_path" = x"no" ; then
2526 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2527 if test -f $f ; then
2528 conf_utmp_location=$f
2529 fi
2530 done
2531 if test -z "$conf_utmp_location"; then
2532 AC_DEFINE(DISABLE_UTMP)
2533 fi
2534 fi
2535fi
2536if test -n "$conf_utmp_location"; then
2537 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2538fi
2539
2540dnl wtmp detection
2541AC_MSG_CHECKING([if your system defines WTMP_FILE])
2542AC_TRY_COMPILE([
2543#include <sys/types.h>
2544#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002545#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002546# include <paths.h>
2547#endif
2548 ],
2549 [ char *wtmp = WTMP_FILE; ],
2550 [ AC_MSG_RESULT(yes) ],
2551 [ AC_MSG_RESULT(no)
2552 system_wtmp_path=no ]
2553)
2554if test -z "$conf_wtmp_location"; then
2555 if test x"$system_wtmp_path" = x"no" ; then
2556 for f in /usr/adm/wtmp /var/log/wtmp; do
2557 if test -f $f ; then
2558 conf_wtmp_location=$f
2559 fi
2560 done
2561 if test -z "$conf_wtmp_location"; then
2562 AC_DEFINE(DISABLE_WTMP)
2563 fi
2564 fi
2565fi
2566if test -n "$conf_wtmp_location"; then
2567 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2568fi
2569
2570
2571dnl utmpx detection - I don't know any system so perverse as to require
2572dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2573dnl there, though.
2574AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2575AC_TRY_COMPILE([
2576#include <sys/types.h>
2577#include <utmp.h>
2578#ifdef HAVE_UTMPX_H
2579#include <utmpx.h>
2580#endif
Damien Miller2994e082000-06-04 15:51:47 +10002581#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002582# include <paths.h>
2583#endif
2584 ],
2585 [ char *utmpx = UTMPX_FILE; ],
2586 [ AC_MSG_RESULT(yes) ],
2587 [ AC_MSG_RESULT(no)
2588 system_utmpx_path=no ]
2589)
2590if test -z "$conf_utmpx_location"; then
2591 if test x"$system_utmpx_path" = x"no" ; then
2592 AC_DEFINE(DISABLE_UTMPX)
2593 fi
2594else
2595 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2596fi
2597
2598dnl wtmpx detection
2599AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2600AC_TRY_COMPILE([
2601#include <sys/types.h>
2602#include <utmp.h>
2603#ifdef HAVE_UTMPX_H
2604#include <utmpx.h>
2605#endif
Damien Miller2994e082000-06-04 15:51:47 +10002606#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002607# include <paths.h>
2608#endif
2609 ],
2610 [ char *wtmpx = WTMPX_FILE; ],
2611 [ AC_MSG_RESULT(yes) ],
2612 [ AC_MSG_RESULT(no)
2613 system_wtmpx_path=no ]
2614)
2615if test -z "$conf_wtmpx_location"; then
2616 if test x"$system_wtmpx_path" = x"no" ; then
2617 AC_DEFINE(DISABLE_WTMPX)
2618 fi
2619else
2620 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2621fi
2622
Damien Miller4018c192000-04-30 09:30:44 +10002623
Damien Miller29ea30d2000-03-17 10:54:15 +11002624if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002625 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2626 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002627fi
2628
Tim Rice4cec93f2002-02-26 08:40:48 -08002629dnl remove pam and dl because they are in $LIBPAM
2630if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002631 LIBS=`echo $LIBS | sed 's/-lpam //'`
2632fi
2633if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2634 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002635fi
2636
Damien Millerbac2d8a2000-09-05 16:13:06 +11002637AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002638AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2639AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002640
Damien Miller7b22d652000-06-18 14:07:04 +10002641# Print summary of options
2642
Damien Miller7b22d652000-06-18 14:07:04 +10002643# Someone please show me a better way :)
2644A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2645B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2646C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2647D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002648E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002649F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002650G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002651H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2652I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2653J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002654
2655echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002656echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002657echo " User binaries: $B"
2658echo " System binaries: $C"
2659echo " Configuration files: $D"
2660echo " Askpass program: $E"
2661echo " Manual pages: $F"
2662echo " PID file: $G"
2663echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002664if test "x$external_path_file" = "x/etc/login.conf" ; then
2665echo " At runtime, sshd will use the path defined in $external_path_file"
2666echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002667else
Damien Millerf58c6722002-05-13 13:15:42 +10002668echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002669 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002670echo " (If PATH is set in $external_path_file it will be used instead. If"
2671echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2672 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002673fi
Damien Millera18bbd32002-05-13 10:48:57 +10002674if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002675echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002676fi
Damien Millerf58c6722002-05-13 13:15:42 +10002677echo " Manpage format: $MANTYPE"
Damien Miller9d2be482003-05-15 11:12:19 +10002678echo " DNS support: $DNS_MSG"
Damien Miller7abe09b2003-05-15 10:53:49 +10002679echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002680echo " KerberosV support: $KRB5_MSG"
2681echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002682echo " S/KEY support: $SKEY_MSG"
2683echo " TCP Wrappers support: $TCPW_MSG"
2684echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002685echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002686echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2687echo " BSD Auth support: $BSD_AUTH_MSG"
2688echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002689if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002690echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002691fi
2692
Damien Miller7b22d652000-06-18 14:07:04 +10002693echo ""
2694
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002695echo " Host: ${host}"
2696echo " Compiler: ${CC}"
2697echo " Compiler flags: ${CFLAGS}"
2698echo "Preprocessor flags: ${CPPFLAGS}"
2699echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002700echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002701
2702echo ""
2703
Damien Miller82cf0ce2000-12-20 13:34:48 +11002704if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002705 echo "PAM is enabled. You may need to install a PAM control file "
2706 echo "for sshd, otherwise password authentication may fail. "
2707 echo "Example PAM control files can be found in the contrib/ "
2708 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002709 echo ""
2710fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002711
Damien Miller6c21c512002-01-22 21:57:53 +11002712if test ! -z "$RAND_HELPER_CMDHASH" ; then
2713 echo "WARNING: you are using the builtin random number collection "
2714 echo "service. Please read WARNING.RNG and request that your OS "
2715 echo "vendor includes kernel-based random number collection in "
2716 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002717 echo ""
2718fi
Damien Miller60396b02001-02-18 17:01:00 +11002719