blob: 88aa481a710b2a98e3819a9742eeb2ba241b3db8 [file] [log] [blame]
Darren Tuckered92b212003-09-22 11:26:16 +10001# $Id: configure.ac,v 1.159 2003/09/22 01:26:16 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)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000289 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000290*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000291 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700292 # /usr/ucblib MUST NOT be searched on ReliantUNIX
293 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100294 IPADDR_IN_DISPLAY=yes
295 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000296 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000297 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000298 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700299 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
300 # Attention: always take care to bind libsocket and libnsl before libc,
301 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000302 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100303*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000304 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100305 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100306 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700307 AC_DEFINE(SETEUID_BREAKS_SETUID)
308 AC_DEFINE(BROKEN_SETREUID)
309 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100310 ;;
311*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000312 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100313 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100314 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700315 AC_DEFINE(SETEUID_BREAKS_SETUID)
316 AC_DEFINE(BROKEN_SETREUID)
317 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100318 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100319*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000320 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100321 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100322 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100323*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000324 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100325 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700326 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100327 RANLIB=true
328 no_dev_ptmx=1
329 AC_DEFINE(BROKEN_SYS_TERMIO_H)
330 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000331 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000332 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100333 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Riceae477e92003-09-12 18:15:15 -0700334 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100335 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700336 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700337 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100338 ;;
339*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800340 if test -z "$GCC"; then
341 CFLAGS="$CFLAGS -belf"
342 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000343 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000344 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100345 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000346 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100347 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000348 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000349 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700350 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700351 AC_DEFINE(SETEUID_BREAKS_SETUID)
352 AC_DEFINE(BROKEN_SETREUID)
353 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700354 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100355 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700356 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000357 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000358*-*-unicosmk*)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000359 AC_DEFINE(USE_PIPES)
360 AC_DEFINE(DISABLE_FD_PASSING)
361 LDFLAGS="$LDFLAGS"
362 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
363 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000364 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000365*-*-unicosmp*)
366 AC_DEFINE(WITH_ABBREV_NO_TTY)
367 AC_DEFINE(USE_PIPES)
368 AC_DEFINE(DISABLE_FD_PASSING)
369 LDFLAGS="$LDFLAGS"
370 LIBS="$LIBS -lgen -lacid"
371 MANTYPE=cat
372 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000373*-*-unicos*)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000374 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700375 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700376 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000377 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
378 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
379 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700380 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000381*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000382 AC_MSG_CHECKING(for Digital Unix SIA)
383 no_osfsia=""
384 AC_ARG_WITH(osfsia,
385 [ --with-osfsia Enable Digital Unix SIA],
386 [
387 if test "x$withval" = "xno" ; then
388 AC_MSG_RESULT(disabled)
389 no_osfsia=1
390 fi
391 ],
392 )
393 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000394 if test -f /etc/sia/matrix.conf; then
395 AC_MSG_RESULT(yes)
396 AC_DEFINE(HAVE_OSF_SIA)
397 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000398 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000399 LIBS="$LIBS -lsecurity -ldb -lm -laud"
400 else
401 AC_MSG_RESULT(no)
402 fi
403 fi
Ben Lindstromdc3c7572002-10-04 23:54:54 +0000404 AC_DEFINE(DISABLE_FD_PASSING)
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000405 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tuckered92b212003-09-22 11:26:16 +1000406 AC_DEFINE(SETEIUD_BREAKS_SETUID)
407 AC_DEFINE(BROKEN_SETREUID)
408 AC_DEFINE(BROKEN_SETREGID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000409 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000410 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000411
412*-*-nto-qnx)
413 AC_DEFINE(USE_PIPES)
414 AC_DEFINE(NO_X11_UNIX_SOCKETS)
415 AC_DEFINE(MISSING_NFDBITS)
416 AC_DEFINE(MISSING_HOWMANY)
417 AC_DEFINE(MISSING_FD_MASK)
418 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100419esac
420
Damien Millere37bfc12000-06-05 09:37:43 +1000421# Allow user to specify flags
422AC_ARG_WITH(cflags,
423 [ --with-cflags Specify additional flags to pass to compiler],
424 [
425 if test "x$withval" != "xno" ; then
426 CFLAGS="$CFLAGS $withval"
427 fi
428 ]
429)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000430AC_ARG_WITH(cppflags,
431 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
432 [
433 if test "x$withval" != "xno"; then
434 CPPFLAGS="$CPPFLAGS $withval"
435 fi
436 ]
437)
Damien Millere37bfc12000-06-05 09:37:43 +1000438AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000439 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000440 [
441 if test "x$withval" != "xno" ; then
442 LDFLAGS="$LDFLAGS $withval"
443 fi
444 ]
445)
446AC_ARG_WITH(libs,
447 [ --with-libs Specify additional libraries to link with],
448 [
449 if test "x$withval" != "xno" ; then
450 LIBS="$LIBS $withval"
451 fi
452 ]
453)
454
Darren Tucker6eb93042003-06-29 21:30:41 +1000455AC_MSG_CHECKING(compiler and flags for sanity)
456AC_TRY_RUN([
457#include <stdio.h>
458int main(){exit(0);}
459 ],
460 [ AC_MSG_RESULT(yes) ],
461 [
462 AC_MSG_RESULT(no)
463 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
464 ]
465)
466
Tim Rice4cec93f2002-02-26 08:40:48 -0800467# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000468AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000469 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800470 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000471 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000472 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000473 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
474 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
Ben Lindstrom4b0f1ad2003-02-01 04:43:34 +0000475 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
Tim Rice81ed5182002-09-25 17:38:46 -0700476 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800477 util.h utime.h utmp.h utmpx.h)
478
Damien Millera22ba012000-03-02 23:09:20 +1100479# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700480AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
481AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000482
Damien Millerdf288022001-02-18 13:07:07 +1100483dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700484if test "x$with_tcp_wrappers" != "xno" ; then
485 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
486 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
487 fi
488fi
Damien Millerdf288022001-02-18 13:07:07 +1100489
Tim Rice1e1ef642003-09-11 22:19:31 -0700490dnl IRIX and Solaris 2.5.1 have dirname() in libgen
491AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
492 AC_CHECK_LIB(gen, dirname,[
493 AC_CACHE_CHECK([for broken dirname],
494 ac_cv_have_broken_dirname, [
495 save_LIBS="$LIBS"
496 LIBS="$LIBS -lgen"
497 AC_TRY_RUN(
498 [
499#include <libgen.h>
500#include <string.h>
501
502int main(int argc, char **argv) {
503 char *s, buf[32];
504
505 strncpy(buf,"/etc", 32);
506 s = dirname(buf);
507 if (!s || strncmp(s, "/", 32) != 0) {
508 exit(1);
509 } else {
510 exit(0);
511 }
512}
513 ],
514 [ ac_cv_have_broken_dirname="no" ],
515 [ ac_cv_have_broken_dirname="yes" ]
516 )
517 LIBS="$save_LIBS"
518 ])
519 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
520 LIBS="$LIBS -lgen"
521 AC_DEFINE(HAVE_DIRNAME)
522 AC_CHECK_HEADERS(libgen.h)
523 fi
524 ])
525])
526
527AC_CHECK_FUNC(getspnam, ,
528 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
529AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
530
Damien Miller150c8b52002-02-13 23:06:56 +1100531AC_ARG_WITH(rpath,
532 [ --without-rpath Disable auto-added -R linker paths],
533 [
534 if test "x$withval" = "xno" ; then
535 need_dash_r=""
536 fi
537 if test "x$withval" = "xyes" ; then
538 need_dash_r=1
539 fi
540 ]
541)
542
Tim Rice13aae5e2001-10-21 17:53:58 -0700543dnl zlib is required
544AC_ARG_WITH(zlib,
545 [ --with-zlib=PATH Use zlib in PATH],
546 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000547 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100548 AC_MSG_ERROR([*** zlib is required ***])
549 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700550 if test -d "$withval/lib"; then
551 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700552 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700553 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700554 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700555 fi
556 else
557 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700558 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700559 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700560 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700561 fi
562 fi
563 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700564 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700565 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700566 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700567 fi
568 ]
569)
570
Tim Rice17b93e52001-10-23 22:36:54 -0700571AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100572
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000573dnl UnixWare 2.x
574AC_CHECK_FUNC(strcasecmp,
575 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
576)
577AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700578 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
579 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000580)
Damien Millerab18c411999-11-11 10:40:23 +1100581
Tim Ricee589a292001-11-03 11:09:32 -0800582dnl Checks for libutil functions
583AC_CHECK_HEADERS(libutil.h)
584AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
585AC_CHECK_FUNCS(logout updwtmp logwtmp)
586
Ben Lindstrom8697e082001-02-24 21:41:10 +0000587AC_FUNC_STRFTIME
588
Damien Miller3c027682001-03-14 11:39:45 +1100589# Check for ALTDIRFUNC glob() extension
590AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
591AC_EGREP_CPP(FOUNDIT,
592 [
593 #include <glob.h>
594 #ifdef GLOB_ALTDIRFUNC
595 FOUNDIT
596 #endif
597 ],
598 [
599 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
600 AC_MSG_RESULT(yes)
601 ],
602 [
603 AC_MSG_RESULT(no)
604 ]
605)
Damien Millerab18c411999-11-11 10:40:23 +1100606
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000607# Check for g.gl_matchc glob() extension
608AC_MSG_CHECKING(for gl_matchc field in glob_t)
609AC_EGREP_CPP(FOUNDIT,
610 [
611 #include <glob.h>
612 int main(void){glob_t g; g.gl_matchc = 1;}
613 ],
614 [
615 AC_DEFINE(GLOB_HAS_GL_MATCHC)
616 AC_MSG_RESULT(yes)
617 ],
618 [
619 AC_MSG_RESULT(no)
620 ]
621)
622
Damien Miller18bb4732001-03-28 14:35:30 +1000623AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
624AC_TRY_RUN(
625 [
626#include <sys/types.h>
627#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700628int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000629 ],
630 [AC_MSG_RESULT(yes)],
631 [
632 AC_MSG_RESULT(no)
633 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
634 ]
635)
636
Damien Millerc547bf12001-02-16 10:18:12 +1100637# Check whether user wants S/Key support
638SKEY_MSG="no"
639AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700640 [ --with-skey[[=PATH]] Enable S/Key support
641 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100642 [
643 if test "x$withval" != "xno" ; then
644
645 if test "x$withval" != "xyes" ; then
646 CPPFLAGS="$CPPFLAGS -I${withval}/include"
647 LDFLAGS="$LDFLAGS -L${withval}/lib"
648 fi
649
650 AC_DEFINE(SKEY)
651 LIBS="-lskey $LIBS"
652 SKEY_MSG="yes"
653
Tim Rice4cec93f2002-02-26 08:40:48 -0800654 AC_MSG_CHECKING([for s/key support])
655 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100656 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800657#include <stdio.h>
658#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700659int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800660 ],
661 [AC_MSG_RESULT(yes)],
662 [
663 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100664 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
665 ])
666 fi
667 ]
668)
669
670# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700671TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100672AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700673 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
674 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100675 [
676 if test "x$withval" != "xno" ; then
677 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700678 saved_LDFLAGS="$LDFLAGS"
679 saved_CPPFLAGS="$CPPFLAGS"
680 if test -n "${withval}" -a "${withval}" != "yes"; then
681 if test -d "${withval}/lib"; then
682 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700683 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700684 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700685 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700686 fi
687 else
688 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700689 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700690 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700691 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700692 fi
693 fi
694 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700695 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700696 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700697 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700698 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700699 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800700 LIBWRAP="-lwrap"
701 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100702 AC_MSG_CHECKING(for libwrap)
703 AC_TRY_LINK(
704 [
705#include <tcpd.h>
706 int deny_severity = 0, allow_severity = 0;
707 ],
708 [hosts_access(0);],
709 [
710 AC_MSG_RESULT(yes)
711 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800712 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700713 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100714 ],
715 [
716 AC_MSG_ERROR([*** libwrap missing])
717 ]
718 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800719 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100720 fi
721 ]
722)
723
Damien Millerfe1f1432003-02-24 15:45:42 +1100724dnl Checks for library functions. Please keep in alphabetical order
725AC_CHECK_FUNCS(\
Damien Millerf09ad862003-09-19 16:41:01 +1000726 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
Damien Miller5fe46a42003-06-05 09:53:31 +1000727 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Damien Millerfe1f1432003-02-24 15:45:42 +1100728 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000729 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100730 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000731 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
732 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
733 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Damien Miller5fe46a42003-06-05 09:53:31 +1000734 setproctitle setregid setresgid setresuid setreuid setrlimit \
735 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tuckerb2427c82003-09-10 15:22:44 +1000736 strlcat strlcpy strmode strnvis sysconf tcgetpgrp \
Darren Tuckerf38ea772003-08-13 20:48:07 +1000737 truncate utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100738)
Tim Rice13aae5e2001-10-21 17:53:58 -0700739
Damien Millercd6853c2003-01-28 11:33:42 +1100740AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
741
Darren Tuckerf1159b52003-07-07 19:44:01 +1000742dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000743AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000744AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000745
Darren Tuckerb2427c82003-09-10 15:22:44 +1000746dnl tcsendbreak might be a macro
747AC_CHECK_DECL(tcsendbreak,
748 [AC_DEFINE(HAVE_TCSENDBREAK)],
749 [AC_CHECK_FUNCS(tcsendbreak)],
750 [#include <termios.h>]
751)
752
Damien Millerad833b32000-08-23 10:46:23 +1000753dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000754AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000755dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000756AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000757AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000758dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000759AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000760AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100761
Damien Miller04f80141999-11-19 15:32:34 +1100762AC_CHECK_FUNC(daemon,
763 [AC_DEFINE(HAVE_DAEMON)],
764 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
765)
766
Damien Miller9fb07e42000-03-05 16:22:59 +1100767AC_CHECK_FUNC(getpagesize,
768 [AC_DEFINE(HAVE_GETPAGESIZE)],
769 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
770)
771
Damien Millercb170cb2000-07-01 16:52:55 +1000772# Check for broken snprintf
773if test "x$ac_cv_func_snprintf" = "xyes" ; then
774 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
775 AC_TRY_RUN(
776 [
777#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700778int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000779 ],
780 [AC_MSG_RESULT(yes)],
781 [
782 AC_MSG_RESULT(no)
783 AC_DEFINE(BROKEN_SNPRINTF)
784 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
785 ]
786 )
787fi
788
Damien Millere8328192003-01-07 15:18:32 +1100789dnl see whether mkstemp() requires XXXXXX
790if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
791AC_MSG_CHECKING([for (overly) strict mkstemp])
792AC_TRY_RUN(
793 [
794#include <stdlib.h>
795main() { char template[]="conftest.mkstemp-test";
796if (mkstemp(template) == -1)
797 exit(1);
798unlink(template); exit(0);
799}
800 ],
801 [
802 AC_MSG_RESULT(no)
803 ],
804 [
805 AC_MSG_RESULT(yes)
806 AC_DEFINE(HAVE_STRICT_MKSTEMP)
807 ],
808 [
809 AC_MSG_RESULT(yes)
810 AC_DEFINE(HAVE_STRICT_MKSTEMP)
811 ]
812)
813fi
814
Darren Tucker70a3d552003-08-21 17:58:29 +1000815dnl make sure that openpty does not reacquire controlling terminal
816if test ! -z "$check_for_openpty_ctty_bug"; then
817 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
818 AC_TRY_RUN(
819 [
820#include <stdio.h>
821#include <sys/fcntl.h>
822#include <sys/types.h>
823#include <sys/wait.h>
824
825int
826main()
827{
828 pid_t pid;
829 int fd, ptyfd, ttyfd, status;
830
831 pid = fork();
832 if (pid < 0) { /* failed */
833 exit(1);
834 } else if (pid > 0) { /* parent */
835 waitpid(pid, &status, 0);
836 if (WIFEXITED(status))
837 exit(WEXITSTATUS(status));
838 else
839 exit(2);
840 } else { /* child */
841 close(0); close(1); close(2);
842 setsid();
843 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
844 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
845 if (fd >= 0)
846 exit(3); /* Acquired ctty: broken */
847 else
848 exit(0); /* Did not acquire ctty: OK */
849 }
850}
851 ],
852 [
853 AC_MSG_RESULT(yes)
854 ],
855 [
856 AC_MSG_RESULT(no)
857 AC_DEFINE(SSHD_ACQUIRES_CTTY)
858 ]
859 )
860fi
861
Damien Miller606f8802000-09-16 15:39:56 +1100862AC_FUNC_GETPGRP
863
Damien Millera64b57a2001-01-17 10:44:13 +1100864# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000865PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100866AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100867 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100868 [
Damien Millera64b57a2001-01-17 10:44:13 +1100869 if test "x$withval" != "xno" ; then
870 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
871 AC_MSG_ERROR([PAM headers not found])
872 fi
873
874 AC_CHECK_LIB(dl, dlopen, , )
875 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
876 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000877 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +1100878
879 disable_shadow=yes
880 PAM_MSG="yes"
881
882 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800883 if test $ac_cv_lib_dl_dlopen = yes; then
884 LIBPAM="-lpam -ldl"
885 else
886 LIBPAM="-lpam"
887 fi
888 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100889 fi
890 ]
891)
Damien Millera22ba012000-03-02 23:09:20 +1100892
Damien Millera64b57a2001-01-17 10:44:13 +1100893# Check for older PAM
894if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100895 # Check PAM strerror arguments (old PAM)
896 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
897 AC_TRY_COMPILE(
898 [
Damien Miller81171112000-04-23 11:14:01 +1000899#include <stdlib.h>
900#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100901 ],
902 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
903 [AC_MSG_RESULT(no)],
904 [
905 AC_DEFINE(HAVE_OLD_PAM)
906 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000907 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100908 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100909 )
Damien Millera22ba012000-03-02 23:09:20 +1100910fi
911
Damien Millerfc93d4b2002-09-04 23:26:29 +1000912# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
913# because the system crypt() is more featureful.
914if test "x$check_for_libcrypt_before" = "x1"; then
915 AC_CHECK_LIB(crypt, crypt)
916fi
917
Tim Riceaef73712002-05-11 13:17:42 -0700918# Search for OpenSSL
919saved_CPPFLAGS="$CPPFLAGS"
920saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100921AC_ARG_WITH(ssl-dir,
922 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
923 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000924 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700925 if test -d "$withval/lib"; then
926 if test -n "${need_dash_r}"; then
927 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
928 else
929 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
930 fi
931 else
932 if test -n "${need_dash_r}"; then
933 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
934 else
935 LDFLAGS="-L${withval} ${LDFLAGS}"
936 fi
937 fi
938 if test -d "$withval/include"; then
939 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
940 else
941 CPPFLAGS="-I${withval} ${CPPFLAGS}"
942 fi
Damien Millera22ba012000-03-02 23:09:20 +1100943 fi
944 ]
945)
Tim Riceaef73712002-05-11 13:17:42 -0700946LIBS="$LIBS -lcrypto"
947AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000948 [
Tim Riceaef73712002-05-11 13:17:42 -0700949 dnl Check default openssl install dir
950 if test -n "${need_dash_r}"; then
951 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000952 else
Tim Riceaef73712002-05-11 13:17:42 -0700953 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000954 fi
Tim Riceaef73712002-05-11 13:17:42 -0700955 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
956 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
957 [
958 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
959 ]
960 )
961 ]
962)
963
Tim Riced730b782002-08-13 18:52:10 -0700964# Determine OpenSSL header version
965AC_MSG_CHECKING([OpenSSL header version])
966AC_TRY_RUN(
967 [
968#include <stdio.h>
969#include <string.h>
970#include <openssl/opensslv.h>
971#define DATA "conftest.sslincver"
972int main(void) {
973 FILE *fd;
974 int rc;
975
976 fd = fopen(DATA,"w");
977 if(fd == NULL)
978 exit(1);
979
980 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
981 exit(1);
982
983 exit(0);
984}
985 ],
986 [
987 ssl_header_ver=`cat conftest.sslincver`
988 AC_MSG_RESULT($ssl_header_ver)
989 ],
990 [
991 AC_MSG_RESULT(not found)
992 AC_MSG_ERROR(OpenSSL version header not found.)
993 ]
994)
995
996# Determine OpenSSL library version
997AC_MSG_CHECKING([OpenSSL library version])
998AC_TRY_RUN(
999 [
1000#include <stdio.h>
1001#include <string.h>
1002#include <openssl/opensslv.h>
1003#include <openssl/crypto.h>
1004#define DATA "conftest.ssllibver"
1005int main(void) {
1006 FILE *fd;
1007 int rc;
1008
1009 fd = fopen(DATA,"w");
1010 if(fd == NULL)
1011 exit(1);
1012
1013 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1014 exit(1);
1015
1016 exit(0);
1017}
1018 ],
1019 [
1020 ssl_library_ver=`cat conftest.ssllibver`
1021 AC_MSG_RESULT($ssl_library_ver)
1022 ],
1023 [
1024 AC_MSG_RESULT(not found)
1025 AC_MSG_ERROR(OpenSSL library not found.)
1026 ]
1027)
Damien Millera22ba012000-03-02 23:09:20 +11001028
Damien Millerec932372002-01-22 22:16:03 +11001029# Sanity check OpenSSL headers
1030AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1031AC_TRY_RUN(
1032 [
1033#include <string.h>
1034#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001035int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001036 ],
1037 [
1038 AC_MSG_RESULT(yes)
1039 ],
1040 [
1041 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001042 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1043Check config.log for details.
1044Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001045 ]
1046)
1047
Damien Millera64b57a2001-01-17 10:44:13 +11001048# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1049# version in OpenSSL. Skip this for PAM
Damien Miller4f9f42a2003-05-10 19:28:02 +10001050if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001051 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001052fi
1053
Damien Miller6c21c512002-01-22 21:57:53 +11001054
1055### Configure cryptographic random number support
1056
1057# Check wheter OpenSSL seeds itself
1058AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1059AC_TRY_RUN(
1060 [
1061#include <string.h>
1062#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001063int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001064 ],
1065 [
1066 OPENSSL_SEEDS_ITSELF=yes
1067 AC_MSG_RESULT(yes)
1068 ],
1069 [
1070 AC_MSG_RESULT(no)
1071 # Default to use of the rand helper if OpenSSL doesn't
1072 # seed itself
1073 USE_RAND_HELPER=yes
1074 ]
1075)
1076
1077
1078# Do we want to force the use of the rand helper?
1079AC_ARG_WITH(rand-helper,
1080 [ --with-rand-helper Use subprocess to gather strong randomness ],
1081 [
1082 if test "x$withval" = "xno" ; then
1083 # Force use of OpenSSL's internal RNG, even if
1084 # the previous test showed it to be unseeded.
1085 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1086 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1087 OPENSSL_SEEDS_ITSELF=yes
1088 USE_RAND_HELPER=""
1089 fi
1090 else
1091 USE_RAND_HELPER=yes
1092 fi
1093 ],
1094)
1095
1096# Which randomness source do we use?
1097if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1098 # OpenSSL only
1099 AC_DEFINE(OPENSSL_PRNG_ONLY)
1100 RAND_MSG="OpenSSL internal ONLY"
1101 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001102elif test ! -z "$USE_RAND_HELPER" ; then
1103 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001104 RAND_MSG="ssh-rand-helper"
1105 INSTALL_SSH_RAND_HELPER="yes"
1106fi
1107AC_SUBST(INSTALL_SSH_RAND_HELPER)
1108
1109### Configuration of ssh-rand-helper
1110
1111# PRNGD TCP socket
1112AC_ARG_WITH(prngd-port,
1113 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1114 [
Damien Millere996d722002-01-23 11:20:59 +11001115 case "$withval" in
1116 no)
1117 withval=""
1118 ;;
1119 [[0-9]]*)
1120 ;;
1121 *)
1122 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1123 ;;
1124 esac
1125 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001126 PRNGD_PORT="$withval"
1127 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1128 fi
1129 ]
1130)
1131
1132# PRNGD Unix domain socket
1133AC_ARG_WITH(prngd-socket,
1134 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1135 [
Damien Millere996d722002-01-23 11:20:59 +11001136 case "$withval" in
1137 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001138 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001139 ;;
1140 no)
1141 withval=""
1142 ;;
1143 /*)
1144 ;;
1145 *)
1146 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1147 ;;
1148 esac
1149
1150 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001151 if test ! -z "$PRNGD_PORT" ; then
1152 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1153 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001154 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001155 AC_MSG_WARN(Entropy socket is not readable)
1156 fi
1157 PRNGD_SOCKET="$withval"
1158 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1159 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001160 ],
1161 [
1162 # Check for existing socket only if we don't have a random device already
1163 if test "$USE_RAND_HELPER" = yes ; then
1164 AC_MSG_CHECKING(for PRNGD/EGD socket)
1165 # Insert other locations here
1166 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1167 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1168 PRNGD_SOCKET="$sock"
1169 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1170 break;
1171 fi
1172 done
1173 if test ! -z "$PRNGD_SOCKET" ; then
1174 AC_MSG_RESULT($PRNGD_SOCKET)
1175 else
1176 AC_MSG_RESULT(not found)
1177 fi
1178 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001179 ]
1180)
1181
1182# Change default command timeout for hashing entropy source
1183entropy_timeout=200
1184AC_ARG_WITH(entropy-timeout,
1185 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1186 [
1187 if test "x$withval" != "xno" ; then
1188 entropy_timeout=$withval
1189 fi
1190 ]
1191)
Damien Miller6c21c512002-01-22 21:57:53 +11001192AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1193
Damien Millerd3f6ad22002-06-25 10:24:47 +10001194SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001195AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001196 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001197 [
1198 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001199 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001200 fi
1201 ]
1202)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001203AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1204AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001205
Tim Rice88f2ab52002-03-17 12:17:34 -08001206# We do this little dance with the search path to insure
1207# that programs that we select for use by installed programs
1208# (which may be run by the super-user) come from trusted
1209# locations before they come from the user's private area.
1210# This should help avoid accidentally configuring some
1211# random version of a program in someone's personal bin.
1212
1213OPATH=$PATH
1214PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001215test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001216test -d /sbin && PATH=$PATH:/sbin
1217test -d /usr/sbin && PATH=$PATH:/usr/sbin
1218PATH=$PATH:/etc:$OPATH
1219
Damien Miller6c21c512002-01-22 21:57:53 +11001220# These programs are used by the command hashing source to gather entropy
1221OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1222OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1223OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1224OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1225OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1226OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1227OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1228OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1229OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1230OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1231OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1232OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1233OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1234OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1235OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1236OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001237# restore PATH
1238PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001239
1240# Where does ssh-rand-helper get its randomness from?
1241INSTALL_SSH_PRNG_CMDS=""
1242if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1243 if test ! -z "$PRNGD_PORT" ; then
1244 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1245 elif test ! -z "$PRNGD_SOCKET" ; then
1246 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1247 else
1248 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1249 RAND_HELPER_CMDHASH=yes
1250 INSTALL_SSH_PRNG_CMDS="yes"
1251 fi
1252fi
1253AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1254
1255
Ben Lindstromb5628642000-10-18 00:02:25 +00001256# Cheap hack to ensure NEWS-OS libraries are arranged right.
1257if test ! -z "$SONY" ; then
1258 LIBS="$LIBS -liberty";
1259fi
1260
Damien Millera22ba012000-03-02 23:09:20 +11001261# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001262AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001263AC_CHECK_SIZEOF(short int, 2)
1264AC_CHECK_SIZEOF(int, 4)
1265AC_CHECK_SIZEOF(long int, 4)
1266AC_CHECK_SIZEOF(long long int, 8)
1267
Damien Millerfa2bb692002-04-23 23:22:25 +10001268# Sanity check long long for some platforms (AIX)
1269if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1270 ac_cv_sizeof_long_long_int=0
1271fi
1272
Damien Millera22ba012000-03-02 23:09:20 +11001273# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001274AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1275 AC_TRY_COMPILE(
1276 [ #include <sys/types.h> ],
1277 [ u_int a; a = 1;],
1278 [ ac_cv_have_u_int="yes" ],
1279 [ ac_cv_have_u_int="no" ]
1280 )
1281])
1282if test "x$ac_cv_have_u_int" = "xyes" ; then
1283 AC_DEFINE(HAVE_U_INT)
1284 have_u_int=1
1285fi
1286
Damien Miller61e50f12000-05-08 20:49:37 +10001287AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1288 AC_TRY_COMPILE(
1289 [ #include <sys/types.h> ],
1290 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1291 [ ac_cv_have_intxx_t="yes" ],
1292 [ ac_cv_have_intxx_t="no" ]
1293 )
1294])
1295if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1296 AC_DEFINE(HAVE_INTXX_T)
1297 have_intxx_t=1
1298fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001299
1300if (test -z "$have_intxx_t" && \
1301 test "x$ac_cv_header_stdint_h" = "xyes")
1302then
1303 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1304 AC_TRY_COMPILE(
1305 [ #include <stdint.h> ],
1306 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1307 [
1308 AC_DEFINE(HAVE_INTXX_T)
1309 AC_MSG_RESULT(yes)
1310 ],
1311 [ AC_MSG_RESULT(no) ]
1312 )
1313fi
1314
Damien Miller578783e2000-09-23 14:12:24 +11001315AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1316 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001317 [
1318#include <sys/types.h>
1319#ifdef HAVE_STDINT_H
1320# include <stdint.h>
1321#endif
1322#include <sys/socket.h>
1323#ifdef HAVE_SYS_BITYPES_H
1324# include <sys/bitypes.h>
1325#endif
1326 ],
Damien Miller578783e2000-09-23 14:12:24 +11001327 [ int64_t a; a = 1;],
1328 [ ac_cv_have_int64_t="yes" ],
1329 [ ac_cv_have_int64_t="no" ]
1330 )
1331])
1332if test "x$ac_cv_have_int64_t" = "xyes" ; then
1333 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001334fi
1335
Damien Miller61e50f12000-05-08 20:49:37 +10001336AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1337 AC_TRY_COMPILE(
1338 [ #include <sys/types.h> ],
1339 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1340 [ ac_cv_have_u_intxx_t="yes" ],
1341 [ ac_cv_have_u_intxx_t="no" ]
1342 )
1343])
1344if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1345 AC_DEFINE(HAVE_U_INTXX_T)
1346 have_u_intxx_t=1
1347fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001348
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001349if test -z "$have_u_intxx_t" ; then
1350 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1351 AC_TRY_COMPILE(
1352 [ #include <sys/socket.h> ],
1353 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1354 [
1355 AC_DEFINE(HAVE_U_INTXX_T)
1356 AC_MSG_RESULT(yes)
1357 ],
1358 [ AC_MSG_RESULT(no) ]
1359 )
1360fi
1361
Damien Miller578783e2000-09-23 14:12:24 +11001362AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1363 AC_TRY_COMPILE(
1364 [ #include <sys/types.h> ],
1365 [ u_int64_t a; a = 1;],
1366 [ ac_cv_have_u_int64_t="yes" ],
1367 [ ac_cv_have_u_int64_t="no" ]
1368 )
1369])
1370if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1371 AC_DEFINE(HAVE_U_INT64_T)
1372 have_u_int64_t=1
1373fi
1374
Tim Rice4cec93f2002-02-26 08:40:48 -08001375if test -z "$have_u_int64_t" ; then
1376 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1377 AC_TRY_COMPILE(
1378 [ #include <sys/bitypes.h> ],
1379 [ u_int64_t a; a = 1],
1380 [
1381 AC_DEFINE(HAVE_U_INT64_T)
1382 AC_MSG_RESULT(yes)
1383 ],
1384 [ AC_MSG_RESULT(no) ]
1385 )
1386fi
1387
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001388if test -z "$have_u_intxx_t" ; then
1389 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1390 AC_TRY_COMPILE(
1391 [
1392#include <sys/types.h>
1393 ],
1394 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1395 [ ac_cv_have_uintxx_t="yes" ],
1396 [ ac_cv_have_uintxx_t="no" ]
1397 )
1398 ])
1399 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1400 AC_DEFINE(HAVE_UINTXX_T)
1401 fi
1402fi
1403
1404if test -z "$have_uintxx_t" ; then
1405 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1406 AC_TRY_COMPILE(
1407 [ #include <stdint.h> ],
1408 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1409 [
1410 AC_DEFINE(HAVE_UINTXX_T)
1411 AC_MSG_RESULT(yes)
1412 ],
1413 [ AC_MSG_RESULT(no) ]
1414 )
1415fi
1416
Damien Milleredb82922000-06-20 13:25:52 +10001417if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1418 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001419then
1420 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1421 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001422 [
1423#include <sys/bitypes.h>
1424 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001425 [
Damien Miller70494d12000-04-03 15:57:06 +10001426 int8_t a; int16_t b; int32_t c;
1427 u_int8_t e; u_int16_t f; u_int32_t g;
1428 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001429 ],
1430 [
1431 AC_DEFINE(HAVE_U_INTXX_T)
1432 AC_DEFINE(HAVE_INTXX_T)
1433 AC_MSG_RESULT(yes)
1434 ],
1435 [AC_MSG_RESULT(no)]
1436 )
1437fi
1438
Damien Miller58be7382001-09-15 21:31:54 +10001439
1440AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1441 AC_TRY_COMPILE(
1442 [
1443#include <sys/types.h>
1444 ],
1445 [ u_char foo; foo = 125; ],
1446 [ ac_cv_have_u_char="yes" ],
1447 [ ac_cv_have_u_char="no" ]
1448 )
1449])
1450if test "x$ac_cv_have_u_char" = "xyes" ; then
1451 AC_DEFINE(HAVE_U_CHAR)
1452fi
1453
Tim Rice13aae5e2001-10-21 17:53:58 -07001454TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001455
Tim Rice200a5c02002-02-26 22:12:34 -08001456AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001457
Damien Miller61e50f12000-05-08 20:49:37 +10001458AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1459 AC_TRY_COMPILE(
1460 [
1461#include <sys/types.h>
1462 ],
1463 [ size_t foo; foo = 1235; ],
1464 [ ac_cv_have_size_t="yes" ],
1465 [ ac_cv_have_size_t="no" ]
1466 )
1467])
1468if test "x$ac_cv_have_size_t" = "xyes" ; then
1469 AC_DEFINE(HAVE_SIZE_T)
1470fi
Damien Miller95058511999-12-29 10:36:45 +11001471
Damien Miller615f9392000-05-17 22:53:33 +10001472AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1473 AC_TRY_COMPILE(
1474 [
1475#include <sys/types.h>
1476 ],
1477 [ ssize_t foo; foo = 1235; ],
1478 [ ac_cv_have_ssize_t="yes" ],
1479 [ ac_cv_have_ssize_t="no" ]
1480 )
1481])
1482if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1483 AC_DEFINE(HAVE_SSIZE_T)
1484fi
1485
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001486AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1487 AC_TRY_COMPILE(
1488 [
1489#include <time.h>
1490 ],
1491 [ clock_t foo; foo = 1235; ],
1492 [ ac_cv_have_clock_t="yes" ],
1493 [ ac_cv_have_clock_t="no" ]
1494 )
1495])
1496if test "x$ac_cv_have_clock_t" = "xyes" ; then
1497 AC_DEFINE(HAVE_CLOCK_T)
1498fi
1499
Damien Millerb54b40e2000-06-23 08:23:34 +10001500AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1501 AC_TRY_COMPILE(
1502 [
1503#include <sys/types.h>
1504#include <sys/socket.h>
1505 ],
1506 [ sa_family_t foo; foo = 1235; ],
1507 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001508 [ AC_TRY_COMPILE(
1509 [
1510#include <sys/types.h>
1511#include <sys/socket.h>
1512#include <netinet/in.h>
1513 ],
1514 [ sa_family_t foo; foo = 1235; ],
1515 [ ac_cv_have_sa_family_t="yes" ],
1516
Damien Millerb54b40e2000-06-23 08:23:34 +10001517 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001518 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001519 )
1520])
1521if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1522 AC_DEFINE(HAVE_SA_FAMILY_T)
1523fi
1524
Damien Miller0f91b4e2000-06-18 15:43:25 +10001525AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1526 AC_TRY_COMPILE(
1527 [
1528#include <sys/types.h>
1529 ],
1530 [ pid_t foo; foo = 1235; ],
1531 [ ac_cv_have_pid_t="yes" ],
1532 [ ac_cv_have_pid_t="no" ]
1533 )
1534])
1535if test "x$ac_cv_have_pid_t" = "xyes" ; then
1536 AC_DEFINE(HAVE_PID_T)
1537fi
1538
1539AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1540 AC_TRY_COMPILE(
1541 [
1542#include <sys/types.h>
1543 ],
1544 [ mode_t foo; foo = 1235; ],
1545 [ ac_cv_have_mode_t="yes" ],
1546 [ ac_cv_have_mode_t="no" ]
1547 )
1548])
1549if test "x$ac_cv_have_mode_t" = "xyes" ; then
1550 AC_DEFINE(HAVE_MODE_T)
1551fi
1552
Damien Miller61e50f12000-05-08 20:49:37 +10001553
1554AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1555 AC_TRY_COMPILE(
1556 [
Damien Miller81171112000-04-23 11:14:01 +10001557#include <sys/types.h>
1558#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001559 ],
1560 [ struct sockaddr_storage s; ],
1561 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1562 [ ac_cv_have_struct_sockaddr_storage="no" ]
1563 )
1564])
1565if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1566 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1567fi
Damien Miller34132e52000-01-14 15:45:46 +11001568
Damien Miller61e50f12000-05-08 20:49:37 +10001569AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1570 AC_TRY_COMPILE(
1571 [
Damien Miller7b22d652000-06-18 14:07:04 +10001572#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001573#include <netinet/in.h>
1574 ],
1575 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1576 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1577 [ ac_cv_have_struct_sockaddr_in6="no" ]
1578 )
1579])
1580if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1581 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1582fi
Damien Miller34132e52000-01-14 15:45:46 +11001583
Damien Miller61e50f12000-05-08 20:49:37 +10001584AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1585 AC_TRY_COMPILE(
1586 [
Damien Miller7b22d652000-06-18 14:07:04 +10001587#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001588#include <netinet/in.h>
1589 ],
1590 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1591 [ ac_cv_have_struct_in6_addr="yes" ],
1592 [ ac_cv_have_struct_in6_addr="no" ]
1593 )
1594])
1595if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1596 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1597fi
Damien Miller34132e52000-01-14 15:45:46 +11001598
Damien Miller61e50f12000-05-08 20:49:37 +10001599AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1600 AC_TRY_COMPILE(
1601 [
Damien Miller81171112000-04-23 11:14:01 +10001602#include <sys/types.h>
1603#include <sys/socket.h>
1604#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001605 ],
1606 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1607 [ ac_cv_have_struct_addrinfo="yes" ],
1608 [ ac_cv_have_struct_addrinfo="no" ]
1609 )
1610])
1611if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1612 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1613fi
1614
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001615AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1616 AC_TRY_COMPILE(
1617 [ #include <sys/time.h> ],
1618 [ struct timeval tv; tv.tv_sec = 1;],
1619 [ ac_cv_have_struct_timeval="yes" ],
1620 [ ac_cv_have_struct_timeval="no" ]
1621 )
1622])
1623if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1624 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1625 have_struct_timeval=1
1626fi
1627
Tim Rice4e4dc562003-03-18 10:21:40 -08001628AC_CHECK_TYPES(struct timespec)
1629
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001630# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001631if test "x$ac_cv_have_int64_t" = "xno" -a \
1632 "x$ac_cv_sizeof_long_int" != "x8" -a \
1633 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001634 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1635 echo "an alternative compiler (I.E., GCC) before continuing."
1636 echo ""
1637 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001638else
1639dnl test snprintf (broken on SCO w/gcc)
1640 AC_TRY_RUN(
1641 [
1642#include <stdio.h>
1643#include <string.h>
1644#ifdef HAVE_SNPRINTF
1645main()
1646{
1647 char buf[50];
1648 char expected_out[50];
1649 int mazsize = 50 ;
1650#if (SIZEOF_LONG_INT == 8)
1651 long int num = 0x7fffffffffffffff;
1652#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001653 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001654#endif
1655 strcpy(expected_out, "9223372036854775807");
1656 snprintf(buf, mazsize, "%lld", num);
1657 if(strcmp(buf, expected_out) != 0)
1658 exit(1);
1659 exit(0);
1660}
1661#else
1662main() { exit(0); }
1663#endif
1664 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1665 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001666fi
1667
Damien Miller78315eb2000-09-29 23:01:36 +11001668dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001669OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1670OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1671OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1672OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1673OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001674OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001675OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1676OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001677OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001678OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1679OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1680OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1681OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001682OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1683OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1684OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1685OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001686
1687AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001688
Damien Miller61e50f12000-05-08 20:49:37 +10001689AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1690 ac_cv_have_ss_family_in_struct_ss, [
1691 AC_TRY_COMPILE(
1692 [
Damien Miller81171112000-04-23 11:14:01 +10001693#include <sys/types.h>
1694#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001695 ],
1696 [ struct sockaddr_storage s; s.ss_family = 1; ],
1697 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1698 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1699 )
1700])
1701if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1702 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1703fi
1704
Damien Miller61e50f12000-05-08 20:49:37 +10001705AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1706 ac_cv_have___ss_family_in_struct_ss, [
1707 AC_TRY_COMPILE(
1708 [
Damien Miller81171112000-04-23 11:14:01 +10001709#include <sys/types.h>
1710#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001711 ],
1712 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1713 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1714 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1715 )
1716])
1717if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1718 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1719fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001720
Damien Millerad833b32000-08-23 10:46:23 +10001721AC_CACHE_CHECK([for pw_class field in struct passwd],
1722 ac_cv_have_pw_class_in_struct_passwd, [
1723 AC_TRY_COMPILE(
1724 [
Damien Millerad833b32000-08-23 10:46:23 +10001725#include <pwd.h>
1726 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001727 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001728 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1729 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1730 )
1731])
1732if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1733 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1734fi
1735
Kevin Steves82456952001-06-22 21:14:18 +00001736AC_CACHE_CHECK([for pw_expire field in struct passwd],
1737 ac_cv_have_pw_expire_in_struct_passwd, [
1738 AC_TRY_COMPILE(
1739 [
1740#include <pwd.h>
1741 ],
1742 [ struct passwd p; p.pw_expire = 0; ],
1743 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1744 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1745 )
1746])
1747if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1748 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1749fi
1750
1751AC_CACHE_CHECK([for pw_change field in struct passwd],
1752 ac_cv_have_pw_change_in_struct_passwd, [
1753 AC_TRY_COMPILE(
1754 [
1755#include <pwd.h>
1756 ],
1757 [ struct passwd p; p.pw_change = 0; ],
1758 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1759 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1760 )
1761])
1762if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1763 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1764fi
Damien Miller61e50f12000-05-08 20:49:37 +10001765
Tim Rice28bbb0c2002-05-27 17:37:32 -07001766dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001767AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1768 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001769 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001770 [
Tim Riceae49fe62002-04-12 10:26:21 -07001771#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001772#include <sys/socket.h>
1773#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001774int main() {
1775#ifdef msg_accrights
1776exit(1);
1777#endif
1778struct msghdr m;
1779m.msg_accrights = 0;
1780exit(0);
1781}
Kevin Steves939c9db2002-03-22 17:23:25 +00001782 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001783 [ ac_cv_have_accrights_in_msghdr="yes" ],
1784 [ ac_cv_have_accrights_in_msghdr="no" ]
1785 )
1786])
1787if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1788 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1789fi
1790
Kevin Stevesa44e0352002-04-07 16:18:03 +00001791AC_CACHE_CHECK([for msg_control field in struct msghdr],
1792 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001793 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001794 [
Tim Riceae49fe62002-04-12 10:26:21 -07001795#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001796#include <sys/socket.h>
1797#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001798int main() {
1799#ifdef msg_control
1800exit(1);
1801#endif
1802struct msghdr m;
1803m.msg_control = 0;
1804exit(0);
1805}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001806 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001807 [ ac_cv_have_control_in_msghdr="yes" ],
1808 [ ac_cv_have_control_in_msghdr="no" ]
1809 )
1810])
1811if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1812 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1813fi
1814
Damien Miller61e50f12000-05-08 20:49:37 +10001815AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1816 AC_TRY_LINK([],
1817 [ extern char *__progname; printf("%s", __progname); ],
1818 [ ac_cv_libc_defines___progname="yes" ],
1819 [ ac_cv_libc_defines___progname="no" ]
1820 )
1821])
1822if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1823 AC_DEFINE(HAVE___PROGNAME)
1824fi
1825
Kevin Steves4846f4a2002-03-22 18:19:53 +00001826AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1827 AC_TRY_LINK([
1828#include <stdio.h>
1829],
1830 [ printf("%s", __FUNCTION__); ],
1831 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1832 [ ac_cv_cc_implements___FUNCTION__="no" ]
1833 )
1834])
1835if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1836 AC_DEFINE(HAVE___FUNCTION__)
1837fi
1838
1839AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1840 AC_TRY_LINK([
1841#include <stdio.h>
1842],
1843 [ printf("%s", __func__); ],
1844 [ ac_cv_cc_implements___func__="yes" ],
1845 [ ac_cv_cc_implements___func__="no" ]
1846 )
1847])
1848if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1849 AC_DEFINE(HAVE___func__)
1850fi
1851
Damien Miller4f8e6692001-07-14 13:22:53 +10001852AC_CACHE_CHECK([whether getopt has optreset support],
1853 ac_cv_have_getopt_optreset, [
1854 AC_TRY_LINK(
1855 [
1856#include <getopt.h>
1857 ],
1858 [ extern int optreset; optreset = 0; ],
1859 [ ac_cv_have_getopt_optreset="yes" ],
1860 [ ac_cv_have_getopt_optreset="no" ]
1861 )
1862])
1863if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1864 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1865fi
Damien Millera22ba012000-03-02 23:09:20 +11001866
Damien Millerecbb26d2000-07-15 14:59:14 +10001867AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1868 AC_TRY_LINK([],
1869 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1870 [ ac_cv_libc_defines_sys_errlist="yes" ],
1871 [ ac_cv_libc_defines_sys_errlist="no" ]
1872 )
1873])
1874if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1875 AC_DEFINE(HAVE_SYS_ERRLIST)
1876fi
1877
1878
Damien Miller11fa2cc2000-08-16 10:35:58 +10001879AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1880 AC_TRY_LINK([],
1881 [ extern int sys_nerr; printf("%i", sys_nerr);],
1882 [ ac_cv_libc_defines_sys_nerr="yes" ],
1883 [ ac_cv_libc_defines_sys_nerr="no" ]
1884 )
1885])
1886if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1887 AC_DEFINE(HAVE_SYS_NERR)
1888fi
1889
Damien Miller85de5802001-09-18 14:01:11 +10001890SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001891# Check whether user wants sectok support
1892AC_ARG_WITH(sectok,
1893 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001894 [
1895 if test "x$withval" != "xno" ; then
1896 if test "x$withval" != "xyes" ; then
1897 CPPFLAGS="$CPPFLAGS -I${withval}"
1898 LDFLAGS="$LDFLAGS -L${withval}"
1899 if test ! -z "$need_dash_r" ; then
1900 LDFLAGS="$LDFLAGS -R${withval}"
1901 fi
1902 if test ! -z "$blibpath" ; then
1903 blibpath="$blibpath:${withval}"
1904 fi
1905 fi
1906 AC_CHECK_HEADERS(sectok.h)
1907 if test "$ac_cv_header_sectok_h" != yes; then
1908 AC_MSG_ERROR(Can't find sectok.h)
1909 fi
1910 AC_CHECK_LIB(sectok, sectok_open)
1911 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1912 AC_MSG_ERROR(Can't find libsectok)
1913 fi
1914 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001915 AC_DEFINE(USE_SECTOK)
1916 SCARD_MSG="yes, using sectok"
1917 fi
1918 ]
1919)
1920
1921# Check whether user wants OpenSC support
1922AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001923 AC_HELP_STRING([--with-opensc=PFX],
1924 [Enable smartcard support using OpenSC]),
1925 opensc_config_prefix="$withval", opensc_config_prefix="")
1926if test x$opensc_config_prefix != x ; then
1927 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1928 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1929 if test "$OPENSC_CONFIG" != "no"; then
1930 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1931 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1932 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1933 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1934 AC_DEFINE(SMARTCARD)
1935 AC_DEFINE(USE_OPENSC)
1936 SCARD_MSG="yes, using OpenSC"
1937 fi
1938fi
Damien Miller85de5802001-09-18 14:01:11 +10001939
Damien Miller7abe09b2003-05-15 10:53:49 +10001940# Check whether user wants DNS support
1941DNS_MSG="no"
1942AC_ARG_WITH(dns,
1943 [ --with-dns Support for fetching keys from DNS (experimental)],
1944 [
1945 if test "x$withval" != "xno" ; then
Damien Millerd9ec3702003-05-15 12:27:08 +10001946 DNS_MSG="yes"
1947 AC_DEFINE(DNS)
1948 AC_SEARCH_LIBS(getrrsetbyname, resolv,
Damien Miller200d0a72003-06-30 19:21:36 +10001949 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1950 [
1951 # Needed by our getrrsetbyname()
1952 AC_SEARCH_LIBS(res_query, resolv)
1953 AC_SEARCH_LIBS(dn_expand, resolv)
Tim Rice0ac16a42003-09-08 06:33:33 -07001954 AC_CHECK_FUNCS(_getshort _getlong)
Tim Riceb284e162003-09-08 14:35:16 -07001955 AC_CHECK_MEMBER(HEADER.ad,
1956 [AC_DEFINE(HAVE_HEADER_AD)],,
1957 [#include <arpa/nameser.h>])
Damien Miller200d0a72003-06-30 19:21:36 +10001958 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10001959 fi
1960 ]
1961)
1962
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001963# Check whether user wants Kerberos 5 support
1964KRB5_MSG="no"
1965AC_ARG_WITH(kerberos5,
1966 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1967 [
1968 if test "x$withval" != "xno" ; then
1969 if test "x$withval" = "xyes" ; then
1970 KRB5ROOT="/usr/local"
1971 else
1972 KRB5ROOT=${withval}
1973 fi
1974 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1975 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1976 AC_DEFINE(KRB5)
1977 KRB5_MSG="yes"
1978 AC_MSG_CHECKING(whether we are using Heimdal)
1979 AC_TRY_COMPILE([ #include <krb5.h> ],
1980 [ char *tmp = heimdal_version; ],
1981 [ AC_MSG_RESULT(yes)
1982 AC_DEFINE(HEIMDAL)
1983 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1984 ],
1985 [ AC_MSG_RESULT(no)
1986 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1987 ]
1988 )
1989 if test ! -z "$need_dash_r" ; then
1990 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1991 fi
1992 if test ! -z "$blibpath" ; then
1993 blibpath="$blibpath:${KRB5ROOT}/lib"
1994 fi
Damien Miller200d0a72003-06-30 19:21:36 +10001995 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001996
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001997 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1998 [ AC_DEFINE(GSSAPI)
1999 K5LIBS="-lgssapi $K5LIBS" ],
2000 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2001 [ AC_DEFINE(GSSAPI)
2002 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2003 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2004 $K5LIBS)
2005 ],
2006 $K5LIBS)
2007
2008 AC_CHECK_HEADER(gssapi.h, ,
2009 [ unset ac_cv_header_gssapi_h
2010 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2011 AC_CHECK_HEADERS(gssapi.h, ,
2012 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2013 )
2014 ]
2015 )
2016
2017 oldCPP="$CPPFLAGS"
2018 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2019 AC_CHECK_HEADER(gssapi_krb5.h, ,
2020 [ CPPFLAGS="$oldCPP" ])
2021
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002022 KRB5=yes
2023 fi
2024 ]
2025)
Darren Tucker6aaa58c2003-08-02 22:24:49 +10002026LIBS="$LIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10002027
Damien Millera22ba012000-03-02 23:09:20 +11002028# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002029
Damien Millerf58c6722002-05-13 13:15:42 +10002030PRIVSEP_PATH=/var/empty
2031AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002032 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002033 [
2034 if test "x$withval" != "$no" ; then
2035 PRIVSEP_PATH=$withval
2036 fi
2037 ]
2038)
2039AC_SUBST(PRIVSEP_PATH)
2040
Damien Millera22ba012000-03-02 23:09:20 +11002041AC_ARG_WITH(xauth,
2042 [ --with-xauth=PATH Specify path to xauth program ],
2043 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002044 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002045 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002046 fi
2047 ],
2048 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002049 TestPath="$PATH"
2050 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2051 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2052 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2053 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2054 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002055 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002056 xauth_path="/usr/openwin/bin/xauth"
2057 fi
2058 ]
2059)
2060
Damien Miller7d901272003-01-13 16:55:22 +11002061STRIP_OPT=-s
2062AC_ARG_ENABLE(strip,
2063 [ --disable-strip Disable calling strip(1) on install],
2064 [
2065 if test "x$enableval" = "xno" ; then
2066 STRIP_OPT=
2067 fi
2068 ]
2069)
2070AC_SUBST(STRIP_OPT)
2071
Damien Millera19cf472000-11-29 13:28:50 +11002072if test -z "$xauth_path" ; then
2073 XAUTH_PATH="undefined"
2074 AC_SUBST(XAUTH_PATH)
2075else
Damien Millera22ba012000-03-02 23:09:20 +11002076 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002077 XAUTH_PATH=$xauth_path
2078 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002079fi
Damien Millera22ba012000-03-02 23:09:20 +11002080
2081# Check for mail directory (last resort if we cannot get it from headers)
2082if test ! -z "$MAIL" ; then
2083 maildir=`dirname $MAIL`
2084 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2085fi
2086
Damien Millera22ba012000-03-02 23:09:20 +11002087if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002088 if test "x$disable_ptmx_check" != "xyes" ; then
2089 AC_CHECK_FILE("/dev/ptmx",
2090 [
2091 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2092 have_dev_ptmx=1
2093 ]
2094 )
2095 fi
Damien Millera22ba012000-03-02 23:09:20 +11002096fi
Damien Miller204ad072000-03-02 23:56:12 +11002097AC_CHECK_FILE("/dev/ptc",
2098 [
2099 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2100 have_dev_ptc=1
2101 ]
2102)
2103
Damien Millera22ba012000-03-02 23:09:20 +11002104# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002105AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002106 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002107 [
Damien Miller897741e2001-04-16 10:41:46 +10002108 case "$withval" in
2109 man|cat|doc)
2110 MANTYPE=$withval
2111 ;;
2112 *)
2113 AC_MSG_ERROR(invalid man type: $withval)
2114 ;;
2115 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002116 ]
2117)
Ben Lindstrombc709922001-04-18 18:04:21 +00002118if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002119 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2120 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002121 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2122 MANTYPE=doc
2123 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2124 MANTYPE=man
2125 else
2126 MANTYPE=cat
2127 fi
2128fi
Damien Miller670a4b82000-01-22 13:53:11 +11002129AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002130if test "$MANTYPE" = "doc"; then
2131 mansubdir=man;
2132else
2133 mansubdir=$MANTYPE;
2134fi
2135AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002136
Damien Millera22ba012000-03-02 23:09:20 +11002137# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10002138MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002139AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002140 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002141 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002142 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002143 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10002144 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002145 fi
2146 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002147)
2148
Damien Millera22ba012000-03-02 23:09:20 +11002149# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002150AC_ARG_WITH(shadow,
2151 [ --without-shadow Disable shadow password support],
2152 [
2153 if test "x$withval" = "xno" ; then
2154 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002155 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002156 fi
2157 ]
2158)
2159
Damien Miller1f335fb2000-06-26 11:31:33 +10002160if test -z "$disable_shadow" ; then
2161 AC_MSG_CHECKING([if the systems has expire shadow information])
2162 AC_TRY_COMPILE(
2163 [
2164#include <sys/types.h>
2165#include <shadow.h>
2166 struct spwd sp;
2167 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2168 [ sp_expire_available=yes ], []
2169 )
2170
2171 if test "x$sp_expire_available" = "xyes" ; then
2172 AC_MSG_RESULT(yes)
2173 AC_DEFINE(HAS_SHADOW_EXPIRE)
2174 else
2175 AC_MSG_RESULT(no)
2176 fi
2177fi
2178
Damien Millera22ba012000-03-02 23:09:20 +11002179# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002180if test ! -z "$IPADDR_IN_DISPLAY" ; then
2181 DISPLAY_HACK_MSG="yes"
2182 AC_DEFINE(IPADDR_IN_DISPLAY)
2183else
2184 DISPLAY_HACK_MSG="no"
2185 AC_ARG_WITH(ipaddr-display,
2186 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2187 [
2188 if test "x$withval" != "xno" ; then
2189 AC_DEFINE(IPADDR_IN_DISPLAY)
2190 DISPLAY_HACK_MSG="yes"
2191 fi
2192 ]
2193 )
2194fi
Damien Miller76112de1999-12-21 11:18:08 +11002195
Darren Tuckere1a790d2003-09-16 11:52:19 +10002196# check for /etc/default/login and use it if present.
2197AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2198
2199if test "x$external_path_file" = "x/etc/default/login"; then
2200 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2201fi
2202
Tim Rice43a1c132002-04-17 21:19:14 -07002203dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2204if test $ac_cv_func_login_getcapbool = "yes" -a \
2205 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002206 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002207fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002208
Damien Millera22ba012000-03-02 23:09:20 +11002209# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002210SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002211AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002212 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002213 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002214 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002215 AC_MSG_WARN([
2216--with-default-path=PATH has no effect on this system.
2217Edit /etc/login.conf instead.])
2218 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002219 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002220 AC_MSG_WARN([
2221--with-default-path=PATH will only be used if PATH is not defined in
2222$external_path_file .])
2223 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002224 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002225 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002226 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002227 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002228 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2229 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002230 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002231 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002232 AC_MSG_WARN([
2233If PATH is defined in $external_path_file, ensure the path to scp is included,
2234otherwise scp will not work.])
2235 fi
2236 AC_TRY_RUN(
2237 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002238/* find out what STDPATH is */
2239#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002240#ifdef HAVE_PATHS_H
2241# include <paths.h>
2242#endif
2243#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002244# ifdef _PATH_USERPATH /* Irix */
2245# define _PATH_STDPATH _PATH_USERPATH
2246# else
2247# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2248# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002249#endif
2250#include <sys/types.h>
2251#include <sys/stat.h>
2252#include <fcntl.h>
2253#define DATA "conftest.stdpath"
2254
2255main()
2256{
2257 FILE *fd;
2258 int rc;
2259
2260 fd = fopen(DATA,"w");
2261 if(fd == NULL)
2262 exit(1);
2263
2264 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2265 exit(1);
2266
2267 exit(0);
2268}
2269 ], [ user_path=`cat conftest.stdpath` ],
2270 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2271 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2272 )
2273# make sure $bindir is in USER_PATH so scp will work
2274 t_bindir=`eval echo ${bindir}`
2275 case $t_bindir in
2276 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2277 esac
2278 case $t_bindir in
2279 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2280 esac
2281 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2282 if test $? -ne 0 ; then
2283 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2284 if test $? -ne 0 ; then
2285 user_path=$user_path:$t_bindir
2286 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2287 fi
2288 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002289 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002290)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002291if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002292 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2293 AC_SUBST(user_path)
2294fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002295
Damien Millera18bbd32002-05-13 10:48:57 +10002296# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002297AC_ARG_WITH(superuser-path,
2298 [ --with-superuser-path= Specify different path for super-user],
2299 [
2300 if test "x$withval" != "xno" ; then
2301 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2302 superuser_path=$withval
2303 fi
2304 ]
2305)
2306
2307
Damien Miller61e50f12000-05-08 20:49:37 +10002308AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002309IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002310AC_ARG_WITH(4in6,
2311 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2312 [
2313 if test "x$withval" != "xno" ; then
2314 AC_MSG_RESULT(yes)
2315 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002316 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002317 else
2318 AC_MSG_RESULT(no)
2319 fi
2320 ],[
2321 if test "x$inet6_default_4in6" = "xyes"; then
2322 AC_MSG_RESULT([yes (default)])
2323 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002324 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002325 else
2326 AC_MSG_RESULT([no (default)])
2327 fi
2328 ]
2329)
2330
Damien Miller60396b02001-02-18 17:01:00 +11002331# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002332BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002333AC_ARG_WITH(bsd-auth,
2334 [ --with-bsd-auth Enable BSD auth support],
2335 [
2336 if test "x$withval" != "xno" ; then
2337 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002338 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002339 fi
2340 ]
2341)
2342
Damien Millera22ba012000-03-02 23:09:20 +11002343# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002344piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002345# make sure the directory exists
2346if test ! -d $piddir ; then
2347 piddir=`eval echo ${sysconfdir}`
2348 case $piddir in
2349 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2350 esac
2351fi
2352
Tim Rice88f2ab52002-03-17 12:17:34 -08002353AC_ARG_WITH(pid-dir,
2354 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2355 [
2356 if test "x$withval" != "xno" ; then
2357 piddir=$withval
2358 if test ! -d $piddir ; then
2359 AC_MSG_WARN([** no $piddir directory on this system **])
2360 fi
2361 fi
2362 ]
2363)
2364
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002365AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002366AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002367
andre2ff7b5d2000-06-03 14:57:40 +00002368dnl allow user to disable some login recording features
2369AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002370 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002371 [
2372 if test "x$enableval" = "xno" ; then
2373 AC_DEFINE(DISABLE_LASTLOG)
2374 fi
2375 ]
andre2ff7b5d2000-06-03 14:57:40 +00002376)
2377AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002378 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002379 [
2380 if test "x$enableval" = "xno" ; then
2381 AC_DEFINE(DISABLE_UTMP)
2382 fi
2383 ]
andre2ff7b5d2000-06-03 14:57:40 +00002384)
2385AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002386 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002387 [
2388 if test "x$enableval" = "xno" ; then
2389 AC_DEFINE(DISABLE_UTMPX)
2390 fi
2391 ]
andre2ff7b5d2000-06-03 14:57:40 +00002392)
2393AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002394 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002395 [
2396 if test "x$enableval" = "xno" ; then
2397 AC_DEFINE(DISABLE_WTMP)
2398 fi
2399 ]
andre2ff7b5d2000-06-03 14:57:40 +00002400)
2401AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002402 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002403 [
2404 if test "x$enableval" = "xno" ; then
2405 AC_DEFINE(DISABLE_WTMPX)
2406 fi
2407 ]
andre2ff7b5d2000-06-03 14:57:40 +00002408)
2409AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002410 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002411 [
2412 if test "x$enableval" = "xno" ; then
2413 AC_DEFINE(DISABLE_LOGIN)
2414 fi
2415 ]
andre2ff7b5d2000-06-03 14:57:40 +00002416)
2417AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002418 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002419 [
2420 if test "x$enableval" = "xno" ; then
2421 AC_DEFINE(DISABLE_PUTUTLINE)
2422 fi
2423 ]
andre2ff7b5d2000-06-03 14:57:40 +00002424)
2425AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002426 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002427 [
2428 if test "x$enableval" = "xno" ; then
2429 AC_DEFINE(DISABLE_PUTUTXLINE)
2430 fi
2431 ]
andre2ff7b5d2000-06-03 14:57:40 +00002432)
2433AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002434 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002435 [
2436 if test "x$withval" = "xno" ; then
2437 AC_DEFINE(DISABLE_LASTLOG)
2438 else
2439 conf_lastlog_location=$withval
2440 fi
2441 ]
2442)
andre2ff7b5d2000-06-03 14:57:40 +00002443
2444dnl lastlog, [uw]tmpx? detection
2445dnl NOTE: set the paths in the platform section to avoid the
2446dnl need for command-line parameters
2447dnl lastlog and [uw]tmp are subject to a file search if all else fails
2448
2449dnl lastlog detection
2450dnl NOTE: the code itself will detect if lastlog is a directory
2451AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2452AC_TRY_COMPILE([
2453#include <sys/types.h>
2454#include <utmp.h>
2455#ifdef HAVE_LASTLOG_H
2456# include <lastlog.h>
2457#endif
Damien Miller2994e082000-06-04 15:51:47 +10002458#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002459# include <paths.h>
2460#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002461#ifdef HAVE_LOGIN_H
2462# include <login.h>
2463#endif
andre2ff7b5d2000-06-03 14:57:40 +00002464 ],
2465 [ char *lastlog = LASTLOG_FILE; ],
2466 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002467 [
2468 AC_MSG_RESULT(no)
2469 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2470 AC_TRY_COMPILE([
2471#include <sys/types.h>
2472#include <utmp.h>
2473#ifdef HAVE_LASTLOG_H
2474# include <lastlog.h>
2475#endif
2476#ifdef HAVE_PATHS_H
2477# include <paths.h>
2478#endif
2479 ],
2480 [ char *lastlog = _PATH_LASTLOG; ],
2481 [ AC_MSG_RESULT(yes) ],
2482 [
andree441aa32000-06-12 22:34:38 +00002483 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002484 system_lastlog_path=no
2485 ])
2486 ]
andre2ff7b5d2000-06-03 14:57:40 +00002487)
Damien Miller2994e082000-06-04 15:51:47 +10002488
andre2ff7b5d2000-06-03 14:57:40 +00002489if test -z "$conf_lastlog_location"; then
2490 if test x"$system_lastlog_path" = x"no" ; then
2491 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002492 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002493 conf_lastlog_location=$f
2494 fi
2495 done
2496 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002497 AC_MSG_WARN([** Cannot find lastlog **])
2498 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002499 fi
2500 fi
2501fi
2502
2503if test -n "$conf_lastlog_location"; then
2504 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2505fi
2506
2507dnl utmp detection
2508AC_MSG_CHECKING([if your system defines UTMP_FILE])
2509AC_TRY_COMPILE([
2510#include <sys/types.h>
2511#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002512#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002513# include <paths.h>
2514#endif
2515 ],
2516 [ char *utmp = UTMP_FILE; ],
2517 [ AC_MSG_RESULT(yes) ],
2518 [ AC_MSG_RESULT(no)
2519 system_utmp_path=no ]
2520)
2521if test -z "$conf_utmp_location"; then
2522 if test x"$system_utmp_path" = x"no" ; then
2523 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2524 if test -f $f ; then
2525 conf_utmp_location=$f
2526 fi
2527 done
2528 if test -z "$conf_utmp_location"; then
2529 AC_DEFINE(DISABLE_UTMP)
2530 fi
2531 fi
2532fi
2533if test -n "$conf_utmp_location"; then
2534 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2535fi
2536
2537dnl wtmp detection
2538AC_MSG_CHECKING([if your system defines WTMP_FILE])
2539AC_TRY_COMPILE([
2540#include <sys/types.h>
2541#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002542#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002543# include <paths.h>
2544#endif
2545 ],
2546 [ char *wtmp = WTMP_FILE; ],
2547 [ AC_MSG_RESULT(yes) ],
2548 [ AC_MSG_RESULT(no)
2549 system_wtmp_path=no ]
2550)
2551if test -z "$conf_wtmp_location"; then
2552 if test x"$system_wtmp_path" = x"no" ; then
2553 for f in /usr/adm/wtmp /var/log/wtmp; do
2554 if test -f $f ; then
2555 conf_wtmp_location=$f
2556 fi
2557 done
2558 if test -z "$conf_wtmp_location"; then
2559 AC_DEFINE(DISABLE_WTMP)
2560 fi
2561 fi
2562fi
2563if test -n "$conf_wtmp_location"; then
2564 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2565fi
2566
2567
2568dnl utmpx detection - I don't know any system so perverse as to require
2569dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2570dnl there, though.
2571AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2572AC_TRY_COMPILE([
2573#include <sys/types.h>
2574#include <utmp.h>
2575#ifdef HAVE_UTMPX_H
2576#include <utmpx.h>
2577#endif
Damien Miller2994e082000-06-04 15:51:47 +10002578#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002579# include <paths.h>
2580#endif
2581 ],
2582 [ char *utmpx = UTMPX_FILE; ],
2583 [ AC_MSG_RESULT(yes) ],
2584 [ AC_MSG_RESULT(no)
2585 system_utmpx_path=no ]
2586)
2587if test -z "$conf_utmpx_location"; then
2588 if test x"$system_utmpx_path" = x"no" ; then
2589 AC_DEFINE(DISABLE_UTMPX)
2590 fi
2591else
2592 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2593fi
2594
2595dnl wtmpx detection
2596AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2597AC_TRY_COMPILE([
2598#include <sys/types.h>
2599#include <utmp.h>
2600#ifdef HAVE_UTMPX_H
2601#include <utmpx.h>
2602#endif
Damien Miller2994e082000-06-04 15:51:47 +10002603#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002604# include <paths.h>
2605#endif
2606 ],
2607 [ char *wtmpx = WTMPX_FILE; ],
2608 [ AC_MSG_RESULT(yes) ],
2609 [ AC_MSG_RESULT(no)
2610 system_wtmpx_path=no ]
2611)
2612if test -z "$conf_wtmpx_location"; then
2613 if test x"$system_wtmpx_path" = x"no" ; then
2614 AC_DEFINE(DISABLE_WTMPX)
2615 fi
2616else
2617 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2618fi
2619
Damien Miller4018c192000-04-30 09:30:44 +10002620
Damien Miller29ea30d2000-03-17 10:54:15 +11002621if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002622 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2623 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002624fi
2625
Tim Rice4cec93f2002-02-26 08:40:48 -08002626dnl remove pam and dl because they are in $LIBPAM
2627if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002628 LIBS=`echo $LIBS | sed 's/-lpam //'`
2629fi
2630if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2631 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002632fi
2633
Damien Millerbac2d8a2000-09-05 16:13:06 +11002634AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002635AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2636AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002637
Damien Miller7b22d652000-06-18 14:07:04 +10002638# Print summary of options
2639
Damien Miller7b22d652000-06-18 14:07:04 +10002640# Someone please show me a better way :)
2641A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2642B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2643C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2644D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002645E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002646F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002647G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002648H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2649I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2650J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002651
2652echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002653echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002654echo " User binaries: $B"
2655echo " System binaries: $C"
2656echo " Configuration files: $D"
2657echo " Askpass program: $E"
2658echo " Manual pages: $F"
2659echo " PID file: $G"
2660echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002661if test "x$external_path_file" = "x/etc/login.conf" ; then
2662echo " At runtime, sshd will use the path defined in $external_path_file"
2663echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002664else
Damien Millerf58c6722002-05-13 13:15:42 +10002665echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002666 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002667echo " (If PATH is set in $external_path_file it will be used instead. If"
2668echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2669 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002670fi
Damien Millera18bbd32002-05-13 10:48:57 +10002671if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002672echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002673fi
Damien Millerf58c6722002-05-13 13:15:42 +10002674echo " Manpage format: $MANTYPE"
Damien Miller9d2be482003-05-15 11:12:19 +10002675echo " DNS support: $DNS_MSG"
Damien Miller7abe09b2003-05-15 10:53:49 +10002676echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002677echo " KerberosV support: $KRB5_MSG"
2678echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002679echo " S/KEY support: $SKEY_MSG"
2680echo " TCP Wrappers support: $TCPW_MSG"
2681echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002682echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002683echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2684echo " BSD Auth support: $BSD_AUTH_MSG"
2685echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002686if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002687echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002688fi
2689
Damien Miller7b22d652000-06-18 14:07:04 +10002690echo ""
2691
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002692echo " Host: ${host}"
2693echo " Compiler: ${CC}"
2694echo " Compiler flags: ${CFLAGS}"
2695echo "Preprocessor flags: ${CPPFLAGS}"
2696echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002697echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002698
2699echo ""
2700
Damien Miller82cf0ce2000-12-20 13:34:48 +11002701if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002702 echo "PAM is enabled. You may need to install a PAM control file "
2703 echo "for sshd, otherwise password authentication may fail. "
2704 echo "Example PAM control files can be found in the contrib/ "
2705 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002706 echo ""
2707fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002708
Damien Miller6c21c512002-01-22 21:57:53 +11002709if test ! -z "$RAND_HELPER_CMDHASH" ; then
2710 echo "WARNING: you are using the builtin random number collection "
2711 echo "service. Please read WARNING.RNG and request that your OS "
2712 echo "vendor includes kernel-based random number collection in "
2713 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002714 echo ""
2715fi
Damien Miller60396b02001-02-18 17:01:00 +11002716