blob: 5d1f85012310eb8fd11a7ddde9d23b57294d4362 [file] [log] [blame]
Darren Tuckered9eb022003-09-22 11:18:47 +10001# $Id: configure.ac,v 1.158 2003/09/22 01:18:47 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 Tuckere41bba52003-08-25 11:51:19 +1000406 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000407 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000408
409*-*-nto-qnx)
410 AC_DEFINE(USE_PIPES)
411 AC_DEFINE(NO_X11_UNIX_SOCKETS)
412 AC_DEFINE(MISSING_NFDBITS)
413 AC_DEFINE(MISSING_HOWMANY)
414 AC_DEFINE(MISSING_FD_MASK)
415 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100416esac
417
Damien Millere37bfc12000-06-05 09:37:43 +1000418# Allow user to specify flags
419AC_ARG_WITH(cflags,
420 [ --with-cflags Specify additional flags to pass to compiler],
421 [
422 if test "x$withval" != "xno" ; then
423 CFLAGS="$CFLAGS $withval"
424 fi
425 ]
426)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000427AC_ARG_WITH(cppflags,
428 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
429 [
430 if test "x$withval" != "xno"; then
431 CPPFLAGS="$CPPFLAGS $withval"
432 fi
433 ]
434)
Damien Millere37bfc12000-06-05 09:37:43 +1000435AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000436 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000437 [
438 if test "x$withval" != "xno" ; then
439 LDFLAGS="$LDFLAGS $withval"
440 fi
441 ]
442)
443AC_ARG_WITH(libs,
444 [ --with-libs Specify additional libraries to link with],
445 [
446 if test "x$withval" != "xno" ; then
447 LIBS="$LIBS $withval"
448 fi
449 ]
450)
451
Darren Tucker6eb93042003-06-29 21:30:41 +1000452AC_MSG_CHECKING(compiler and flags for sanity)
453AC_TRY_RUN([
454#include <stdio.h>
455int main(){exit(0);}
456 ],
457 [ AC_MSG_RESULT(yes) ],
458 [
459 AC_MSG_RESULT(no)
460 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
461 ]
462)
463
Tim Rice4cec93f2002-02-26 08:40:48 -0800464# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000465AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000466 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800467 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000468 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000469 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000470 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
471 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
Ben Lindstrom4b0f1ad2003-02-01 04:43:34 +0000472 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
Tim Rice81ed5182002-09-25 17:38:46 -0700473 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800474 util.h utime.h utmp.h utmpx.h)
475
Damien Millera22ba012000-03-02 23:09:20 +1100476# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700477AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
478AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000479
Damien Millerdf288022001-02-18 13:07:07 +1100480dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700481if test "x$with_tcp_wrappers" != "xno" ; then
482 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
483 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
484 fi
485fi
Damien Millerdf288022001-02-18 13:07:07 +1100486
Tim Rice1e1ef642003-09-11 22:19:31 -0700487dnl IRIX and Solaris 2.5.1 have dirname() in libgen
488AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
489 AC_CHECK_LIB(gen, dirname,[
490 AC_CACHE_CHECK([for broken dirname],
491 ac_cv_have_broken_dirname, [
492 save_LIBS="$LIBS"
493 LIBS="$LIBS -lgen"
494 AC_TRY_RUN(
495 [
496#include <libgen.h>
497#include <string.h>
498
499int main(int argc, char **argv) {
500 char *s, buf[32];
501
502 strncpy(buf,"/etc", 32);
503 s = dirname(buf);
504 if (!s || strncmp(s, "/", 32) != 0) {
505 exit(1);
506 } else {
507 exit(0);
508 }
509}
510 ],
511 [ ac_cv_have_broken_dirname="no" ],
512 [ ac_cv_have_broken_dirname="yes" ]
513 )
514 LIBS="$save_LIBS"
515 ])
516 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
517 LIBS="$LIBS -lgen"
518 AC_DEFINE(HAVE_DIRNAME)
519 AC_CHECK_HEADERS(libgen.h)
520 fi
521 ])
522])
523
524AC_CHECK_FUNC(getspnam, ,
525 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
526AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
527
Damien Miller150c8b52002-02-13 23:06:56 +1100528AC_ARG_WITH(rpath,
529 [ --without-rpath Disable auto-added -R linker paths],
530 [
531 if test "x$withval" = "xno" ; then
532 need_dash_r=""
533 fi
534 if test "x$withval" = "xyes" ; then
535 need_dash_r=1
536 fi
537 ]
538)
539
Tim Rice13aae5e2001-10-21 17:53:58 -0700540dnl zlib is required
541AC_ARG_WITH(zlib,
542 [ --with-zlib=PATH Use zlib in PATH],
543 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000544 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100545 AC_MSG_ERROR([*** zlib is required ***])
546 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700547 if test -d "$withval/lib"; then
548 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700549 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700550 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700551 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700552 fi
553 else
554 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700555 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700556 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700557 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700558 fi
559 fi
560 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700561 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700562 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700563 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700564 fi
565 ]
566)
567
Tim Rice17b93e52001-10-23 22:36:54 -0700568AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100569
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000570dnl UnixWare 2.x
571AC_CHECK_FUNC(strcasecmp,
572 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
573)
574AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700575 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
576 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000577)
Damien Millerab18c411999-11-11 10:40:23 +1100578
Tim Ricee589a292001-11-03 11:09:32 -0800579dnl Checks for libutil functions
580AC_CHECK_HEADERS(libutil.h)
581AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
582AC_CHECK_FUNCS(logout updwtmp logwtmp)
583
Ben Lindstrom8697e082001-02-24 21:41:10 +0000584AC_FUNC_STRFTIME
585
Damien Miller3c027682001-03-14 11:39:45 +1100586# Check for ALTDIRFUNC glob() extension
587AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
588AC_EGREP_CPP(FOUNDIT,
589 [
590 #include <glob.h>
591 #ifdef GLOB_ALTDIRFUNC
592 FOUNDIT
593 #endif
594 ],
595 [
596 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
597 AC_MSG_RESULT(yes)
598 ],
599 [
600 AC_MSG_RESULT(no)
601 ]
602)
Damien Millerab18c411999-11-11 10:40:23 +1100603
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000604# Check for g.gl_matchc glob() extension
605AC_MSG_CHECKING(for gl_matchc field in glob_t)
606AC_EGREP_CPP(FOUNDIT,
607 [
608 #include <glob.h>
609 int main(void){glob_t g; g.gl_matchc = 1;}
610 ],
611 [
612 AC_DEFINE(GLOB_HAS_GL_MATCHC)
613 AC_MSG_RESULT(yes)
614 ],
615 [
616 AC_MSG_RESULT(no)
617 ]
618)
619
Damien Miller18bb4732001-03-28 14:35:30 +1000620AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
621AC_TRY_RUN(
622 [
623#include <sys/types.h>
624#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700625int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000626 ],
627 [AC_MSG_RESULT(yes)],
628 [
629 AC_MSG_RESULT(no)
630 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
631 ]
632)
633
Damien Millerc547bf12001-02-16 10:18:12 +1100634# Check whether user wants S/Key support
635SKEY_MSG="no"
636AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700637 [ --with-skey[[=PATH]] Enable S/Key support
638 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100639 [
640 if test "x$withval" != "xno" ; then
641
642 if test "x$withval" != "xyes" ; then
643 CPPFLAGS="$CPPFLAGS -I${withval}/include"
644 LDFLAGS="$LDFLAGS -L${withval}/lib"
645 fi
646
647 AC_DEFINE(SKEY)
648 LIBS="-lskey $LIBS"
649 SKEY_MSG="yes"
650
Tim Rice4cec93f2002-02-26 08:40:48 -0800651 AC_MSG_CHECKING([for s/key support])
652 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100653 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800654#include <stdio.h>
655#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700656int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800657 ],
658 [AC_MSG_RESULT(yes)],
659 [
660 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100661 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
662 ])
663 fi
664 ]
665)
666
667# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700668TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100669AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700670 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
671 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100672 [
673 if test "x$withval" != "xno" ; then
674 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700675 saved_LDFLAGS="$LDFLAGS"
676 saved_CPPFLAGS="$CPPFLAGS"
677 if test -n "${withval}" -a "${withval}" != "yes"; then
678 if test -d "${withval}/lib"; then
679 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700680 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700681 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700682 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700683 fi
684 else
685 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700686 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700687 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700688 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700689 fi
690 fi
691 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700692 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700693 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700694 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700695 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700696 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800697 LIBWRAP="-lwrap"
698 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100699 AC_MSG_CHECKING(for libwrap)
700 AC_TRY_LINK(
701 [
702#include <tcpd.h>
703 int deny_severity = 0, allow_severity = 0;
704 ],
705 [hosts_access(0);],
706 [
707 AC_MSG_RESULT(yes)
708 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800709 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700710 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100711 ],
712 [
713 AC_MSG_ERROR([*** libwrap missing])
714 ]
715 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800716 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100717 fi
718 ]
719)
720
Damien Millerfe1f1432003-02-24 15:45:42 +1100721dnl Checks for library functions. Please keep in alphabetical order
722AC_CHECK_FUNCS(\
Damien Millerf09ad862003-09-19 16:41:01 +1000723 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
Damien Miller5fe46a42003-06-05 09:53:31 +1000724 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Damien Millerfe1f1432003-02-24 15:45:42 +1100725 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000726 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100727 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000728 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
729 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
730 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Damien Miller5fe46a42003-06-05 09:53:31 +1000731 setproctitle setregid setresgid setresuid setreuid setrlimit \
732 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tuckerb2427c82003-09-10 15:22:44 +1000733 strlcat strlcpy strmode strnvis sysconf tcgetpgrp \
Darren Tuckerf38ea772003-08-13 20:48:07 +1000734 truncate utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100735)
Tim Rice13aae5e2001-10-21 17:53:58 -0700736
Damien Millercd6853c2003-01-28 11:33:42 +1100737AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
738
Darren Tuckerf1159b52003-07-07 19:44:01 +1000739dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000740AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000741AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000742
Darren Tuckerb2427c82003-09-10 15:22:44 +1000743dnl tcsendbreak might be a macro
744AC_CHECK_DECL(tcsendbreak,
745 [AC_DEFINE(HAVE_TCSENDBREAK)],
746 [AC_CHECK_FUNCS(tcsendbreak)],
747 [#include <termios.h>]
748)
749
Damien Millerad833b32000-08-23 10:46:23 +1000750dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000751AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000752dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000753AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000754AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000755dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000756AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000757AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100758
Damien Miller04f80141999-11-19 15:32:34 +1100759AC_CHECK_FUNC(daemon,
760 [AC_DEFINE(HAVE_DAEMON)],
761 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
762)
763
Damien Miller9fb07e42000-03-05 16:22:59 +1100764AC_CHECK_FUNC(getpagesize,
765 [AC_DEFINE(HAVE_GETPAGESIZE)],
766 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
767)
768
Damien Millercb170cb2000-07-01 16:52:55 +1000769# Check for broken snprintf
770if test "x$ac_cv_func_snprintf" = "xyes" ; then
771 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
772 AC_TRY_RUN(
773 [
774#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700775int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000776 ],
777 [AC_MSG_RESULT(yes)],
778 [
779 AC_MSG_RESULT(no)
780 AC_DEFINE(BROKEN_SNPRINTF)
781 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
782 ]
783 )
784fi
785
Damien Millere8328192003-01-07 15:18:32 +1100786dnl see whether mkstemp() requires XXXXXX
787if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
788AC_MSG_CHECKING([for (overly) strict mkstemp])
789AC_TRY_RUN(
790 [
791#include <stdlib.h>
792main() { char template[]="conftest.mkstemp-test";
793if (mkstemp(template) == -1)
794 exit(1);
795unlink(template); exit(0);
796}
797 ],
798 [
799 AC_MSG_RESULT(no)
800 ],
801 [
802 AC_MSG_RESULT(yes)
803 AC_DEFINE(HAVE_STRICT_MKSTEMP)
804 ],
805 [
806 AC_MSG_RESULT(yes)
807 AC_DEFINE(HAVE_STRICT_MKSTEMP)
808 ]
809)
810fi
811
Darren Tucker70a3d552003-08-21 17:58:29 +1000812dnl make sure that openpty does not reacquire controlling terminal
813if test ! -z "$check_for_openpty_ctty_bug"; then
814 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
815 AC_TRY_RUN(
816 [
817#include <stdio.h>
818#include <sys/fcntl.h>
819#include <sys/types.h>
820#include <sys/wait.h>
821
822int
823main()
824{
825 pid_t pid;
826 int fd, ptyfd, ttyfd, status;
827
828 pid = fork();
829 if (pid < 0) { /* failed */
830 exit(1);
831 } else if (pid > 0) { /* parent */
832 waitpid(pid, &status, 0);
833 if (WIFEXITED(status))
834 exit(WEXITSTATUS(status));
835 else
836 exit(2);
837 } else { /* child */
838 close(0); close(1); close(2);
839 setsid();
840 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
841 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
842 if (fd >= 0)
843 exit(3); /* Acquired ctty: broken */
844 else
845 exit(0); /* Did not acquire ctty: OK */
846 }
847}
848 ],
849 [
850 AC_MSG_RESULT(yes)
851 ],
852 [
853 AC_MSG_RESULT(no)
854 AC_DEFINE(SSHD_ACQUIRES_CTTY)
855 ]
856 )
857fi
858
Damien Miller606f8802000-09-16 15:39:56 +1100859AC_FUNC_GETPGRP
860
Damien Millera64b57a2001-01-17 10:44:13 +1100861# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000862PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100863AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100864 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100865 [
Damien Millera64b57a2001-01-17 10:44:13 +1100866 if test "x$withval" != "xno" ; then
867 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
868 AC_MSG_ERROR([PAM headers not found])
869 fi
870
871 AC_CHECK_LIB(dl, dlopen, , )
872 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
873 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000874 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +1100875
876 disable_shadow=yes
877 PAM_MSG="yes"
878
879 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800880 if test $ac_cv_lib_dl_dlopen = yes; then
881 LIBPAM="-lpam -ldl"
882 else
883 LIBPAM="-lpam"
884 fi
885 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100886 fi
887 ]
888)
Damien Millera22ba012000-03-02 23:09:20 +1100889
Damien Millera64b57a2001-01-17 10:44:13 +1100890# Check for older PAM
891if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100892 # Check PAM strerror arguments (old PAM)
893 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
894 AC_TRY_COMPILE(
895 [
Damien Miller81171112000-04-23 11:14:01 +1000896#include <stdlib.h>
897#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100898 ],
899 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
900 [AC_MSG_RESULT(no)],
901 [
902 AC_DEFINE(HAVE_OLD_PAM)
903 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000904 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100905 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100906 )
Damien Millera22ba012000-03-02 23:09:20 +1100907fi
908
Damien Millerfc93d4b2002-09-04 23:26:29 +1000909# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
910# because the system crypt() is more featureful.
911if test "x$check_for_libcrypt_before" = "x1"; then
912 AC_CHECK_LIB(crypt, crypt)
913fi
914
Tim Riceaef73712002-05-11 13:17:42 -0700915# Search for OpenSSL
916saved_CPPFLAGS="$CPPFLAGS"
917saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100918AC_ARG_WITH(ssl-dir,
919 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
920 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000921 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700922 if test -d "$withval/lib"; then
923 if test -n "${need_dash_r}"; then
924 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
925 else
926 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
927 fi
928 else
929 if test -n "${need_dash_r}"; then
930 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
931 else
932 LDFLAGS="-L${withval} ${LDFLAGS}"
933 fi
934 fi
935 if test -d "$withval/include"; then
936 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
937 else
938 CPPFLAGS="-I${withval} ${CPPFLAGS}"
939 fi
Damien Millera22ba012000-03-02 23:09:20 +1100940 fi
941 ]
942)
Tim Riceaef73712002-05-11 13:17:42 -0700943LIBS="$LIBS -lcrypto"
944AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000945 [
Tim Riceaef73712002-05-11 13:17:42 -0700946 dnl Check default openssl install dir
947 if test -n "${need_dash_r}"; then
948 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000949 else
Tim Riceaef73712002-05-11 13:17:42 -0700950 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000951 fi
Tim Riceaef73712002-05-11 13:17:42 -0700952 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
953 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
954 [
955 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
956 ]
957 )
958 ]
959)
960
Tim Riced730b782002-08-13 18:52:10 -0700961# Determine OpenSSL header version
962AC_MSG_CHECKING([OpenSSL header version])
963AC_TRY_RUN(
964 [
965#include <stdio.h>
966#include <string.h>
967#include <openssl/opensslv.h>
968#define DATA "conftest.sslincver"
969int main(void) {
970 FILE *fd;
971 int rc;
972
973 fd = fopen(DATA,"w");
974 if(fd == NULL)
975 exit(1);
976
977 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
978 exit(1);
979
980 exit(0);
981}
982 ],
983 [
984 ssl_header_ver=`cat conftest.sslincver`
985 AC_MSG_RESULT($ssl_header_ver)
986 ],
987 [
988 AC_MSG_RESULT(not found)
989 AC_MSG_ERROR(OpenSSL version header not found.)
990 ]
991)
992
993# Determine OpenSSL library version
994AC_MSG_CHECKING([OpenSSL library version])
995AC_TRY_RUN(
996 [
997#include <stdio.h>
998#include <string.h>
999#include <openssl/opensslv.h>
1000#include <openssl/crypto.h>
1001#define DATA "conftest.ssllibver"
1002int main(void) {
1003 FILE *fd;
1004 int rc;
1005
1006 fd = fopen(DATA,"w");
1007 if(fd == NULL)
1008 exit(1);
1009
1010 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1011 exit(1);
1012
1013 exit(0);
1014}
1015 ],
1016 [
1017 ssl_library_ver=`cat conftest.ssllibver`
1018 AC_MSG_RESULT($ssl_library_ver)
1019 ],
1020 [
1021 AC_MSG_RESULT(not found)
1022 AC_MSG_ERROR(OpenSSL library not found.)
1023 ]
1024)
Damien Millera22ba012000-03-02 23:09:20 +11001025
Damien Millerec932372002-01-22 22:16:03 +11001026# Sanity check OpenSSL headers
1027AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1028AC_TRY_RUN(
1029 [
1030#include <string.h>
1031#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001032int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001033 ],
1034 [
1035 AC_MSG_RESULT(yes)
1036 ],
1037 [
1038 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001039 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1040Check config.log for details.
1041Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001042 ]
1043)
1044
Damien Millera64b57a2001-01-17 10:44:13 +11001045# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1046# version in OpenSSL. Skip this for PAM
Damien Miller4f9f42a2003-05-10 19:28:02 +10001047if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001048 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001049fi
1050
Damien Miller6c21c512002-01-22 21:57:53 +11001051
1052### Configure cryptographic random number support
1053
1054# Check wheter OpenSSL seeds itself
1055AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1056AC_TRY_RUN(
1057 [
1058#include <string.h>
1059#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001060int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001061 ],
1062 [
1063 OPENSSL_SEEDS_ITSELF=yes
1064 AC_MSG_RESULT(yes)
1065 ],
1066 [
1067 AC_MSG_RESULT(no)
1068 # Default to use of the rand helper if OpenSSL doesn't
1069 # seed itself
1070 USE_RAND_HELPER=yes
1071 ]
1072)
1073
1074
1075# Do we want to force the use of the rand helper?
1076AC_ARG_WITH(rand-helper,
1077 [ --with-rand-helper Use subprocess to gather strong randomness ],
1078 [
1079 if test "x$withval" = "xno" ; then
1080 # Force use of OpenSSL's internal RNG, even if
1081 # the previous test showed it to be unseeded.
1082 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1083 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1084 OPENSSL_SEEDS_ITSELF=yes
1085 USE_RAND_HELPER=""
1086 fi
1087 else
1088 USE_RAND_HELPER=yes
1089 fi
1090 ],
1091)
1092
1093# Which randomness source do we use?
1094if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1095 # OpenSSL only
1096 AC_DEFINE(OPENSSL_PRNG_ONLY)
1097 RAND_MSG="OpenSSL internal ONLY"
1098 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001099elif test ! -z "$USE_RAND_HELPER" ; then
1100 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001101 RAND_MSG="ssh-rand-helper"
1102 INSTALL_SSH_RAND_HELPER="yes"
1103fi
1104AC_SUBST(INSTALL_SSH_RAND_HELPER)
1105
1106### Configuration of ssh-rand-helper
1107
1108# PRNGD TCP socket
1109AC_ARG_WITH(prngd-port,
1110 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1111 [
Damien Millere996d722002-01-23 11:20:59 +11001112 case "$withval" in
1113 no)
1114 withval=""
1115 ;;
1116 [[0-9]]*)
1117 ;;
1118 *)
1119 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1120 ;;
1121 esac
1122 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001123 PRNGD_PORT="$withval"
1124 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1125 fi
1126 ]
1127)
1128
1129# PRNGD Unix domain socket
1130AC_ARG_WITH(prngd-socket,
1131 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1132 [
Damien Millere996d722002-01-23 11:20:59 +11001133 case "$withval" in
1134 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001135 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001136 ;;
1137 no)
1138 withval=""
1139 ;;
1140 /*)
1141 ;;
1142 *)
1143 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1144 ;;
1145 esac
1146
1147 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001148 if test ! -z "$PRNGD_PORT" ; then
1149 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1150 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001151 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001152 AC_MSG_WARN(Entropy socket is not readable)
1153 fi
1154 PRNGD_SOCKET="$withval"
1155 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1156 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001157 ],
1158 [
1159 # Check for existing socket only if we don't have a random device already
1160 if test "$USE_RAND_HELPER" = yes ; then
1161 AC_MSG_CHECKING(for PRNGD/EGD socket)
1162 # Insert other locations here
1163 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1164 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1165 PRNGD_SOCKET="$sock"
1166 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1167 break;
1168 fi
1169 done
1170 if test ! -z "$PRNGD_SOCKET" ; then
1171 AC_MSG_RESULT($PRNGD_SOCKET)
1172 else
1173 AC_MSG_RESULT(not found)
1174 fi
1175 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001176 ]
1177)
1178
1179# Change default command timeout for hashing entropy source
1180entropy_timeout=200
1181AC_ARG_WITH(entropy-timeout,
1182 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1183 [
1184 if test "x$withval" != "xno" ; then
1185 entropy_timeout=$withval
1186 fi
1187 ]
1188)
Damien Miller6c21c512002-01-22 21:57:53 +11001189AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1190
Damien Millerd3f6ad22002-06-25 10:24:47 +10001191SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001192AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001193 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001194 [
1195 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001196 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001197 fi
1198 ]
1199)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001200AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1201AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001202
Tim Rice88f2ab52002-03-17 12:17:34 -08001203# We do this little dance with the search path to insure
1204# that programs that we select for use by installed programs
1205# (which may be run by the super-user) come from trusted
1206# locations before they come from the user's private area.
1207# This should help avoid accidentally configuring some
1208# random version of a program in someone's personal bin.
1209
1210OPATH=$PATH
1211PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001212test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001213test -d /sbin && PATH=$PATH:/sbin
1214test -d /usr/sbin && PATH=$PATH:/usr/sbin
1215PATH=$PATH:/etc:$OPATH
1216
Damien Miller6c21c512002-01-22 21:57:53 +11001217# These programs are used by the command hashing source to gather entropy
1218OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1219OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1220OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1221OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1222OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1223OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1224OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1225OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1226OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1227OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1228OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1229OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1230OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1231OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1232OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1233OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001234# restore PATH
1235PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001236
1237# Where does ssh-rand-helper get its randomness from?
1238INSTALL_SSH_PRNG_CMDS=""
1239if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1240 if test ! -z "$PRNGD_PORT" ; then
1241 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1242 elif test ! -z "$PRNGD_SOCKET" ; then
1243 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1244 else
1245 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1246 RAND_HELPER_CMDHASH=yes
1247 INSTALL_SSH_PRNG_CMDS="yes"
1248 fi
1249fi
1250AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1251
1252
Ben Lindstromb5628642000-10-18 00:02:25 +00001253# Cheap hack to ensure NEWS-OS libraries are arranged right.
1254if test ! -z "$SONY" ; then
1255 LIBS="$LIBS -liberty";
1256fi
1257
Damien Millera22ba012000-03-02 23:09:20 +11001258# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001259AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001260AC_CHECK_SIZEOF(short int, 2)
1261AC_CHECK_SIZEOF(int, 4)
1262AC_CHECK_SIZEOF(long int, 4)
1263AC_CHECK_SIZEOF(long long int, 8)
1264
Damien Millerfa2bb692002-04-23 23:22:25 +10001265# Sanity check long long for some platforms (AIX)
1266if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1267 ac_cv_sizeof_long_long_int=0
1268fi
1269
Damien Millera22ba012000-03-02 23:09:20 +11001270# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001271AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1272 AC_TRY_COMPILE(
1273 [ #include <sys/types.h> ],
1274 [ u_int a; a = 1;],
1275 [ ac_cv_have_u_int="yes" ],
1276 [ ac_cv_have_u_int="no" ]
1277 )
1278])
1279if test "x$ac_cv_have_u_int" = "xyes" ; then
1280 AC_DEFINE(HAVE_U_INT)
1281 have_u_int=1
1282fi
1283
Damien Miller61e50f12000-05-08 20:49:37 +10001284AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1285 AC_TRY_COMPILE(
1286 [ #include <sys/types.h> ],
1287 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1288 [ ac_cv_have_intxx_t="yes" ],
1289 [ ac_cv_have_intxx_t="no" ]
1290 )
1291])
1292if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1293 AC_DEFINE(HAVE_INTXX_T)
1294 have_intxx_t=1
1295fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001296
1297if (test -z "$have_intxx_t" && \
1298 test "x$ac_cv_header_stdint_h" = "xyes")
1299then
1300 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1301 AC_TRY_COMPILE(
1302 [ #include <stdint.h> ],
1303 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1304 [
1305 AC_DEFINE(HAVE_INTXX_T)
1306 AC_MSG_RESULT(yes)
1307 ],
1308 [ AC_MSG_RESULT(no) ]
1309 )
1310fi
1311
Damien Miller578783e2000-09-23 14:12:24 +11001312AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1313 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001314 [
1315#include <sys/types.h>
1316#ifdef HAVE_STDINT_H
1317# include <stdint.h>
1318#endif
1319#include <sys/socket.h>
1320#ifdef HAVE_SYS_BITYPES_H
1321# include <sys/bitypes.h>
1322#endif
1323 ],
Damien Miller578783e2000-09-23 14:12:24 +11001324 [ int64_t a; a = 1;],
1325 [ ac_cv_have_int64_t="yes" ],
1326 [ ac_cv_have_int64_t="no" ]
1327 )
1328])
1329if test "x$ac_cv_have_int64_t" = "xyes" ; then
1330 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001331fi
1332
Damien Miller61e50f12000-05-08 20:49:37 +10001333AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1334 AC_TRY_COMPILE(
1335 [ #include <sys/types.h> ],
1336 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1337 [ ac_cv_have_u_intxx_t="yes" ],
1338 [ ac_cv_have_u_intxx_t="no" ]
1339 )
1340])
1341if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1342 AC_DEFINE(HAVE_U_INTXX_T)
1343 have_u_intxx_t=1
1344fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001345
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001346if test -z "$have_u_intxx_t" ; then
1347 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1348 AC_TRY_COMPILE(
1349 [ #include <sys/socket.h> ],
1350 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1351 [
1352 AC_DEFINE(HAVE_U_INTXX_T)
1353 AC_MSG_RESULT(yes)
1354 ],
1355 [ AC_MSG_RESULT(no) ]
1356 )
1357fi
1358
Damien Miller578783e2000-09-23 14:12:24 +11001359AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1360 AC_TRY_COMPILE(
1361 [ #include <sys/types.h> ],
1362 [ u_int64_t a; a = 1;],
1363 [ ac_cv_have_u_int64_t="yes" ],
1364 [ ac_cv_have_u_int64_t="no" ]
1365 )
1366])
1367if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1368 AC_DEFINE(HAVE_U_INT64_T)
1369 have_u_int64_t=1
1370fi
1371
Tim Rice4cec93f2002-02-26 08:40:48 -08001372if test -z "$have_u_int64_t" ; then
1373 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1374 AC_TRY_COMPILE(
1375 [ #include <sys/bitypes.h> ],
1376 [ u_int64_t a; a = 1],
1377 [
1378 AC_DEFINE(HAVE_U_INT64_T)
1379 AC_MSG_RESULT(yes)
1380 ],
1381 [ AC_MSG_RESULT(no) ]
1382 )
1383fi
1384
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001385if test -z "$have_u_intxx_t" ; then
1386 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1387 AC_TRY_COMPILE(
1388 [
1389#include <sys/types.h>
1390 ],
1391 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1392 [ ac_cv_have_uintxx_t="yes" ],
1393 [ ac_cv_have_uintxx_t="no" ]
1394 )
1395 ])
1396 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1397 AC_DEFINE(HAVE_UINTXX_T)
1398 fi
1399fi
1400
1401if test -z "$have_uintxx_t" ; then
1402 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1403 AC_TRY_COMPILE(
1404 [ #include <stdint.h> ],
1405 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1406 [
1407 AC_DEFINE(HAVE_UINTXX_T)
1408 AC_MSG_RESULT(yes)
1409 ],
1410 [ AC_MSG_RESULT(no) ]
1411 )
1412fi
1413
Damien Milleredb82922000-06-20 13:25:52 +10001414if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1415 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001416then
1417 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1418 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001419 [
1420#include <sys/bitypes.h>
1421 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001422 [
Damien Miller70494d12000-04-03 15:57:06 +10001423 int8_t a; int16_t b; int32_t c;
1424 u_int8_t e; u_int16_t f; u_int32_t g;
1425 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001426 ],
1427 [
1428 AC_DEFINE(HAVE_U_INTXX_T)
1429 AC_DEFINE(HAVE_INTXX_T)
1430 AC_MSG_RESULT(yes)
1431 ],
1432 [AC_MSG_RESULT(no)]
1433 )
1434fi
1435
Damien Miller58be7382001-09-15 21:31:54 +10001436
1437AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1438 AC_TRY_COMPILE(
1439 [
1440#include <sys/types.h>
1441 ],
1442 [ u_char foo; foo = 125; ],
1443 [ ac_cv_have_u_char="yes" ],
1444 [ ac_cv_have_u_char="no" ]
1445 )
1446])
1447if test "x$ac_cv_have_u_char" = "xyes" ; then
1448 AC_DEFINE(HAVE_U_CHAR)
1449fi
1450
Tim Rice13aae5e2001-10-21 17:53:58 -07001451TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001452
Tim Rice200a5c02002-02-26 22:12:34 -08001453AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001454
Damien Miller61e50f12000-05-08 20:49:37 +10001455AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1456 AC_TRY_COMPILE(
1457 [
1458#include <sys/types.h>
1459 ],
1460 [ size_t foo; foo = 1235; ],
1461 [ ac_cv_have_size_t="yes" ],
1462 [ ac_cv_have_size_t="no" ]
1463 )
1464])
1465if test "x$ac_cv_have_size_t" = "xyes" ; then
1466 AC_DEFINE(HAVE_SIZE_T)
1467fi
Damien Miller95058511999-12-29 10:36:45 +11001468
Damien Miller615f9392000-05-17 22:53:33 +10001469AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1470 AC_TRY_COMPILE(
1471 [
1472#include <sys/types.h>
1473 ],
1474 [ ssize_t foo; foo = 1235; ],
1475 [ ac_cv_have_ssize_t="yes" ],
1476 [ ac_cv_have_ssize_t="no" ]
1477 )
1478])
1479if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1480 AC_DEFINE(HAVE_SSIZE_T)
1481fi
1482
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001483AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1484 AC_TRY_COMPILE(
1485 [
1486#include <time.h>
1487 ],
1488 [ clock_t foo; foo = 1235; ],
1489 [ ac_cv_have_clock_t="yes" ],
1490 [ ac_cv_have_clock_t="no" ]
1491 )
1492])
1493if test "x$ac_cv_have_clock_t" = "xyes" ; then
1494 AC_DEFINE(HAVE_CLOCK_T)
1495fi
1496
Damien Millerb54b40e2000-06-23 08:23:34 +10001497AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1498 AC_TRY_COMPILE(
1499 [
1500#include <sys/types.h>
1501#include <sys/socket.h>
1502 ],
1503 [ sa_family_t foo; foo = 1235; ],
1504 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001505 [ AC_TRY_COMPILE(
1506 [
1507#include <sys/types.h>
1508#include <sys/socket.h>
1509#include <netinet/in.h>
1510 ],
1511 [ sa_family_t foo; foo = 1235; ],
1512 [ ac_cv_have_sa_family_t="yes" ],
1513
Damien Millerb54b40e2000-06-23 08:23:34 +10001514 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001515 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001516 )
1517])
1518if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1519 AC_DEFINE(HAVE_SA_FAMILY_T)
1520fi
1521
Damien Miller0f91b4e2000-06-18 15:43:25 +10001522AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1523 AC_TRY_COMPILE(
1524 [
1525#include <sys/types.h>
1526 ],
1527 [ pid_t foo; foo = 1235; ],
1528 [ ac_cv_have_pid_t="yes" ],
1529 [ ac_cv_have_pid_t="no" ]
1530 )
1531])
1532if test "x$ac_cv_have_pid_t" = "xyes" ; then
1533 AC_DEFINE(HAVE_PID_T)
1534fi
1535
1536AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1537 AC_TRY_COMPILE(
1538 [
1539#include <sys/types.h>
1540 ],
1541 [ mode_t foo; foo = 1235; ],
1542 [ ac_cv_have_mode_t="yes" ],
1543 [ ac_cv_have_mode_t="no" ]
1544 )
1545])
1546if test "x$ac_cv_have_mode_t" = "xyes" ; then
1547 AC_DEFINE(HAVE_MODE_T)
1548fi
1549
Damien Miller61e50f12000-05-08 20:49:37 +10001550
1551AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1552 AC_TRY_COMPILE(
1553 [
Damien Miller81171112000-04-23 11:14:01 +10001554#include <sys/types.h>
1555#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001556 ],
1557 [ struct sockaddr_storage s; ],
1558 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1559 [ ac_cv_have_struct_sockaddr_storage="no" ]
1560 )
1561])
1562if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1563 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1564fi
Damien Miller34132e52000-01-14 15:45:46 +11001565
Damien Miller61e50f12000-05-08 20:49:37 +10001566AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1567 AC_TRY_COMPILE(
1568 [
Damien Miller7b22d652000-06-18 14:07:04 +10001569#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001570#include <netinet/in.h>
1571 ],
1572 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1573 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1574 [ ac_cv_have_struct_sockaddr_in6="no" ]
1575 )
1576])
1577if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1578 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1579fi
Damien Miller34132e52000-01-14 15:45:46 +11001580
Damien Miller61e50f12000-05-08 20:49:37 +10001581AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1582 AC_TRY_COMPILE(
1583 [
Damien Miller7b22d652000-06-18 14:07:04 +10001584#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001585#include <netinet/in.h>
1586 ],
1587 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1588 [ ac_cv_have_struct_in6_addr="yes" ],
1589 [ ac_cv_have_struct_in6_addr="no" ]
1590 )
1591])
1592if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1593 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1594fi
Damien Miller34132e52000-01-14 15:45:46 +11001595
Damien Miller61e50f12000-05-08 20:49:37 +10001596AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1597 AC_TRY_COMPILE(
1598 [
Damien Miller81171112000-04-23 11:14:01 +10001599#include <sys/types.h>
1600#include <sys/socket.h>
1601#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001602 ],
1603 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1604 [ ac_cv_have_struct_addrinfo="yes" ],
1605 [ ac_cv_have_struct_addrinfo="no" ]
1606 )
1607])
1608if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1609 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1610fi
1611
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001612AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1613 AC_TRY_COMPILE(
1614 [ #include <sys/time.h> ],
1615 [ struct timeval tv; tv.tv_sec = 1;],
1616 [ ac_cv_have_struct_timeval="yes" ],
1617 [ ac_cv_have_struct_timeval="no" ]
1618 )
1619])
1620if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1621 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1622 have_struct_timeval=1
1623fi
1624
Tim Rice4e4dc562003-03-18 10:21:40 -08001625AC_CHECK_TYPES(struct timespec)
1626
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001627# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001628if test "x$ac_cv_have_int64_t" = "xno" -a \
1629 "x$ac_cv_sizeof_long_int" != "x8" -a \
1630 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001631 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1632 echo "an alternative compiler (I.E., GCC) before continuing."
1633 echo ""
1634 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001635else
1636dnl test snprintf (broken on SCO w/gcc)
1637 AC_TRY_RUN(
1638 [
1639#include <stdio.h>
1640#include <string.h>
1641#ifdef HAVE_SNPRINTF
1642main()
1643{
1644 char buf[50];
1645 char expected_out[50];
1646 int mazsize = 50 ;
1647#if (SIZEOF_LONG_INT == 8)
1648 long int num = 0x7fffffffffffffff;
1649#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001650 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001651#endif
1652 strcpy(expected_out, "9223372036854775807");
1653 snprintf(buf, mazsize, "%lld", num);
1654 if(strcmp(buf, expected_out) != 0)
1655 exit(1);
1656 exit(0);
1657}
1658#else
1659main() { exit(0); }
1660#endif
1661 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1662 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001663fi
1664
Damien Miller78315eb2000-09-29 23:01:36 +11001665dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001666OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1667OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1668OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1669OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1670OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001671OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001672OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1673OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001674OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001675OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1676OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1677OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1678OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001679OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1680OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1681OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1682OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001683
1684AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001685
Damien Miller61e50f12000-05-08 20:49:37 +10001686AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1687 ac_cv_have_ss_family_in_struct_ss, [
1688 AC_TRY_COMPILE(
1689 [
Damien Miller81171112000-04-23 11:14:01 +10001690#include <sys/types.h>
1691#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001692 ],
1693 [ struct sockaddr_storage s; s.ss_family = 1; ],
1694 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1695 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1696 )
1697])
1698if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1699 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1700fi
1701
Damien Miller61e50f12000-05-08 20:49:37 +10001702AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1703 ac_cv_have___ss_family_in_struct_ss, [
1704 AC_TRY_COMPILE(
1705 [
Damien Miller81171112000-04-23 11:14:01 +10001706#include <sys/types.h>
1707#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001708 ],
1709 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1710 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1711 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1712 )
1713])
1714if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1715 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1716fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001717
Damien Millerad833b32000-08-23 10:46:23 +10001718AC_CACHE_CHECK([for pw_class field in struct passwd],
1719 ac_cv_have_pw_class_in_struct_passwd, [
1720 AC_TRY_COMPILE(
1721 [
Damien Millerad833b32000-08-23 10:46:23 +10001722#include <pwd.h>
1723 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001724 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001725 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1726 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1727 )
1728])
1729if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1730 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1731fi
1732
Kevin Steves82456952001-06-22 21:14:18 +00001733AC_CACHE_CHECK([for pw_expire field in struct passwd],
1734 ac_cv_have_pw_expire_in_struct_passwd, [
1735 AC_TRY_COMPILE(
1736 [
1737#include <pwd.h>
1738 ],
1739 [ struct passwd p; p.pw_expire = 0; ],
1740 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1741 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1742 )
1743])
1744if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1745 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1746fi
1747
1748AC_CACHE_CHECK([for pw_change field in struct passwd],
1749 ac_cv_have_pw_change_in_struct_passwd, [
1750 AC_TRY_COMPILE(
1751 [
1752#include <pwd.h>
1753 ],
1754 [ struct passwd p; p.pw_change = 0; ],
1755 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1756 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1757 )
1758])
1759if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1760 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1761fi
Damien Miller61e50f12000-05-08 20:49:37 +10001762
Tim Rice28bbb0c2002-05-27 17:37:32 -07001763dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001764AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1765 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001766 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001767 [
Tim Riceae49fe62002-04-12 10:26:21 -07001768#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001769#include <sys/socket.h>
1770#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001771int main() {
1772#ifdef msg_accrights
1773exit(1);
1774#endif
1775struct msghdr m;
1776m.msg_accrights = 0;
1777exit(0);
1778}
Kevin Steves939c9db2002-03-22 17:23:25 +00001779 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001780 [ ac_cv_have_accrights_in_msghdr="yes" ],
1781 [ ac_cv_have_accrights_in_msghdr="no" ]
1782 )
1783])
1784if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1785 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1786fi
1787
Kevin Stevesa44e0352002-04-07 16:18:03 +00001788AC_CACHE_CHECK([for msg_control field in struct msghdr],
1789 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001790 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001791 [
Tim Riceae49fe62002-04-12 10:26:21 -07001792#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001793#include <sys/socket.h>
1794#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001795int main() {
1796#ifdef msg_control
1797exit(1);
1798#endif
1799struct msghdr m;
1800m.msg_control = 0;
1801exit(0);
1802}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001803 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001804 [ ac_cv_have_control_in_msghdr="yes" ],
1805 [ ac_cv_have_control_in_msghdr="no" ]
1806 )
1807])
1808if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1809 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1810fi
1811
Damien Miller61e50f12000-05-08 20:49:37 +10001812AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1813 AC_TRY_LINK([],
1814 [ extern char *__progname; printf("%s", __progname); ],
1815 [ ac_cv_libc_defines___progname="yes" ],
1816 [ ac_cv_libc_defines___progname="no" ]
1817 )
1818])
1819if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1820 AC_DEFINE(HAVE___PROGNAME)
1821fi
1822
Kevin Steves4846f4a2002-03-22 18:19:53 +00001823AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1824 AC_TRY_LINK([
1825#include <stdio.h>
1826],
1827 [ printf("%s", __FUNCTION__); ],
1828 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1829 [ ac_cv_cc_implements___FUNCTION__="no" ]
1830 )
1831])
1832if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1833 AC_DEFINE(HAVE___FUNCTION__)
1834fi
1835
1836AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1837 AC_TRY_LINK([
1838#include <stdio.h>
1839],
1840 [ printf("%s", __func__); ],
1841 [ ac_cv_cc_implements___func__="yes" ],
1842 [ ac_cv_cc_implements___func__="no" ]
1843 )
1844])
1845if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1846 AC_DEFINE(HAVE___func__)
1847fi
1848
Damien Miller4f8e6692001-07-14 13:22:53 +10001849AC_CACHE_CHECK([whether getopt has optreset support],
1850 ac_cv_have_getopt_optreset, [
1851 AC_TRY_LINK(
1852 [
1853#include <getopt.h>
1854 ],
1855 [ extern int optreset; optreset = 0; ],
1856 [ ac_cv_have_getopt_optreset="yes" ],
1857 [ ac_cv_have_getopt_optreset="no" ]
1858 )
1859])
1860if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1861 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1862fi
Damien Millera22ba012000-03-02 23:09:20 +11001863
Damien Millerecbb26d2000-07-15 14:59:14 +10001864AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1865 AC_TRY_LINK([],
1866 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1867 [ ac_cv_libc_defines_sys_errlist="yes" ],
1868 [ ac_cv_libc_defines_sys_errlist="no" ]
1869 )
1870])
1871if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1872 AC_DEFINE(HAVE_SYS_ERRLIST)
1873fi
1874
1875
Damien Miller11fa2cc2000-08-16 10:35:58 +10001876AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1877 AC_TRY_LINK([],
1878 [ extern int sys_nerr; printf("%i", sys_nerr);],
1879 [ ac_cv_libc_defines_sys_nerr="yes" ],
1880 [ ac_cv_libc_defines_sys_nerr="no" ]
1881 )
1882])
1883if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1884 AC_DEFINE(HAVE_SYS_NERR)
1885fi
1886
Damien Miller85de5802001-09-18 14:01:11 +10001887SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001888# Check whether user wants sectok support
1889AC_ARG_WITH(sectok,
1890 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001891 [
1892 if test "x$withval" != "xno" ; then
1893 if test "x$withval" != "xyes" ; then
1894 CPPFLAGS="$CPPFLAGS -I${withval}"
1895 LDFLAGS="$LDFLAGS -L${withval}"
1896 if test ! -z "$need_dash_r" ; then
1897 LDFLAGS="$LDFLAGS -R${withval}"
1898 fi
1899 if test ! -z "$blibpath" ; then
1900 blibpath="$blibpath:${withval}"
1901 fi
1902 fi
1903 AC_CHECK_HEADERS(sectok.h)
1904 if test "$ac_cv_header_sectok_h" != yes; then
1905 AC_MSG_ERROR(Can't find sectok.h)
1906 fi
1907 AC_CHECK_LIB(sectok, sectok_open)
1908 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1909 AC_MSG_ERROR(Can't find libsectok)
1910 fi
1911 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001912 AC_DEFINE(USE_SECTOK)
1913 SCARD_MSG="yes, using sectok"
1914 fi
1915 ]
1916)
1917
1918# Check whether user wants OpenSC support
1919AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001920 AC_HELP_STRING([--with-opensc=PFX],
1921 [Enable smartcard support using OpenSC]),
1922 opensc_config_prefix="$withval", opensc_config_prefix="")
1923if test x$opensc_config_prefix != x ; then
1924 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1925 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1926 if test "$OPENSC_CONFIG" != "no"; then
1927 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1928 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1929 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1930 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1931 AC_DEFINE(SMARTCARD)
1932 AC_DEFINE(USE_OPENSC)
1933 SCARD_MSG="yes, using OpenSC"
1934 fi
1935fi
Damien Miller85de5802001-09-18 14:01:11 +10001936
Damien Miller7abe09b2003-05-15 10:53:49 +10001937# Check whether user wants DNS support
1938DNS_MSG="no"
1939AC_ARG_WITH(dns,
1940 [ --with-dns Support for fetching keys from DNS (experimental)],
1941 [
1942 if test "x$withval" != "xno" ; then
Damien Millerd9ec3702003-05-15 12:27:08 +10001943 DNS_MSG="yes"
1944 AC_DEFINE(DNS)
1945 AC_SEARCH_LIBS(getrrsetbyname, resolv,
Damien Miller200d0a72003-06-30 19:21:36 +10001946 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1947 [
1948 # Needed by our getrrsetbyname()
1949 AC_SEARCH_LIBS(res_query, resolv)
1950 AC_SEARCH_LIBS(dn_expand, resolv)
Tim Rice0ac16a42003-09-08 06:33:33 -07001951 AC_CHECK_FUNCS(_getshort _getlong)
Tim Riceb284e162003-09-08 14:35:16 -07001952 AC_CHECK_MEMBER(HEADER.ad,
1953 [AC_DEFINE(HAVE_HEADER_AD)],,
1954 [#include <arpa/nameser.h>])
Damien Miller200d0a72003-06-30 19:21:36 +10001955 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10001956 fi
1957 ]
1958)
1959
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001960# Check whether user wants Kerberos 5 support
1961KRB5_MSG="no"
1962AC_ARG_WITH(kerberos5,
1963 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1964 [
1965 if test "x$withval" != "xno" ; then
1966 if test "x$withval" = "xyes" ; then
1967 KRB5ROOT="/usr/local"
1968 else
1969 KRB5ROOT=${withval}
1970 fi
1971 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1972 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1973 AC_DEFINE(KRB5)
1974 KRB5_MSG="yes"
1975 AC_MSG_CHECKING(whether we are using Heimdal)
1976 AC_TRY_COMPILE([ #include <krb5.h> ],
1977 [ char *tmp = heimdal_version; ],
1978 [ AC_MSG_RESULT(yes)
1979 AC_DEFINE(HEIMDAL)
1980 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1981 ],
1982 [ AC_MSG_RESULT(no)
1983 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1984 ]
1985 )
1986 if test ! -z "$need_dash_r" ; then
1987 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1988 fi
1989 if test ! -z "$blibpath" ; then
1990 blibpath="$blibpath:${KRB5ROOT}/lib"
1991 fi
Damien Miller200d0a72003-06-30 19:21:36 +10001992 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001993
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001994 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1995 [ AC_DEFINE(GSSAPI)
1996 K5LIBS="-lgssapi $K5LIBS" ],
1997 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1998 [ AC_DEFINE(GSSAPI)
1999 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2000 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2001 $K5LIBS)
2002 ],
2003 $K5LIBS)
2004
2005 AC_CHECK_HEADER(gssapi.h, ,
2006 [ unset ac_cv_header_gssapi_h
2007 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2008 AC_CHECK_HEADERS(gssapi.h, ,
2009 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2010 )
2011 ]
2012 )
2013
2014 oldCPP="$CPPFLAGS"
2015 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2016 AC_CHECK_HEADER(gssapi_krb5.h, ,
2017 [ CPPFLAGS="$oldCPP" ])
2018
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002019 KRB5=yes
2020 fi
2021 ]
2022)
Darren Tucker6aaa58c2003-08-02 22:24:49 +10002023LIBS="$LIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10002024
Damien Millera22ba012000-03-02 23:09:20 +11002025# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002026
Damien Millerf58c6722002-05-13 13:15:42 +10002027PRIVSEP_PATH=/var/empty
2028AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002029 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002030 [
2031 if test "x$withval" != "$no" ; then
2032 PRIVSEP_PATH=$withval
2033 fi
2034 ]
2035)
2036AC_SUBST(PRIVSEP_PATH)
2037
Damien Millera22ba012000-03-02 23:09:20 +11002038AC_ARG_WITH(xauth,
2039 [ --with-xauth=PATH Specify path to xauth program ],
2040 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002041 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002042 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002043 fi
2044 ],
2045 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002046 TestPath="$PATH"
2047 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2048 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2049 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2050 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2051 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002052 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002053 xauth_path="/usr/openwin/bin/xauth"
2054 fi
2055 ]
2056)
2057
Damien Miller7d901272003-01-13 16:55:22 +11002058STRIP_OPT=-s
2059AC_ARG_ENABLE(strip,
2060 [ --disable-strip Disable calling strip(1) on install],
2061 [
2062 if test "x$enableval" = "xno" ; then
2063 STRIP_OPT=
2064 fi
2065 ]
2066)
2067AC_SUBST(STRIP_OPT)
2068
Damien Millera19cf472000-11-29 13:28:50 +11002069if test -z "$xauth_path" ; then
2070 XAUTH_PATH="undefined"
2071 AC_SUBST(XAUTH_PATH)
2072else
Damien Millera22ba012000-03-02 23:09:20 +11002073 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002074 XAUTH_PATH=$xauth_path
2075 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002076fi
Damien Millera22ba012000-03-02 23:09:20 +11002077
2078# Check for mail directory (last resort if we cannot get it from headers)
2079if test ! -z "$MAIL" ; then
2080 maildir=`dirname $MAIL`
2081 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2082fi
2083
Damien Millera22ba012000-03-02 23:09:20 +11002084if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002085 if test "x$disable_ptmx_check" != "xyes" ; then
2086 AC_CHECK_FILE("/dev/ptmx",
2087 [
2088 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2089 have_dev_ptmx=1
2090 ]
2091 )
2092 fi
Damien Millera22ba012000-03-02 23:09:20 +11002093fi
Damien Miller204ad072000-03-02 23:56:12 +11002094AC_CHECK_FILE("/dev/ptc",
2095 [
2096 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2097 have_dev_ptc=1
2098 ]
2099)
2100
Damien Millera22ba012000-03-02 23:09:20 +11002101# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002102AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002103 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002104 [
Damien Miller897741e2001-04-16 10:41:46 +10002105 case "$withval" in
2106 man|cat|doc)
2107 MANTYPE=$withval
2108 ;;
2109 *)
2110 AC_MSG_ERROR(invalid man type: $withval)
2111 ;;
2112 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002113 ]
2114)
Ben Lindstrombc709922001-04-18 18:04:21 +00002115if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002116 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2117 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002118 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2119 MANTYPE=doc
2120 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2121 MANTYPE=man
2122 else
2123 MANTYPE=cat
2124 fi
2125fi
Damien Miller670a4b82000-01-22 13:53:11 +11002126AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002127if test "$MANTYPE" = "doc"; then
2128 mansubdir=man;
2129else
2130 mansubdir=$MANTYPE;
2131fi
2132AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002133
Damien Millera22ba012000-03-02 23:09:20 +11002134# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10002135MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002136AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002137 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002138 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002139 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002140 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10002141 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002142 fi
2143 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002144)
2145
Damien Millera22ba012000-03-02 23:09:20 +11002146# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002147AC_ARG_WITH(shadow,
2148 [ --without-shadow Disable shadow password support],
2149 [
2150 if test "x$withval" = "xno" ; then
2151 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002152 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002153 fi
2154 ]
2155)
2156
Damien Miller1f335fb2000-06-26 11:31:33 +10002157if test -z "$disable_shadow" ; then
2158 AC_MSG_CHECKING([if the systems has expire shadow information])
2159 AC_TRY_COMPILE(
2160 [
2161#include <sys/types.h>
2162#include <shadow.h>
2163 struct spwd sp;
2164 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2165 [ sp_expire_available=yes ], []
2166 )
2167
2168 if test "x$sp_expire_available" = "xyes" ; then
2169 AC_MSG_RESULT(yes)
2170 AC_DEFINE(HAS_SHADOW_EXPIRE)
2171 else
2172 AC_MSG_RESULT(no)
2173 fi
2174fi
2175
Damien Millera22ba012000-03-02 23:09:20 +11002176# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002177if test ! -z "$IPADDR_IN_DISPLAY" ; then
2178 DISPLAY_HACK_MSG="yes"
2179 AC_DEFINE(IPADDR_IN_DISPLAY)
2180else
2181 DISPLAY_HACK_MSG="no"
2182 AC_ARG_WITH(ipaddr-display,
2183 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2184 [
2185 if test "x$withval" != "xno" ; then
2186 AC_DEFINE(IPADDR_IN_DISPLAY)
2187 DISPLAY_HACK_MSG="yes"
2188 fi
2189 ]
2190 )
2191fi
Damien Miller76112de1999-12-21 11:18:08 +11002192
Darren Tuckere1a790d2003-09-16 11:52:19 +10002193# check for /etc/default/login and use it if present.
2194AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2195
2196if test "x$external_path_file" = "x/etc/default/login"; then
2197 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2198fi
2199
Tim Rice43a1c132002-04-17 21:19:14 -07002200dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2201if test $ac_cv_func_login_getcapbool = "yes" -a \
2202 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002203 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002204fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002205
Damien Millera22ba012000-03-02 23:09:20 +11002206# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002207SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002208AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002209 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002210 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002211 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002212 AC_MSG_WARN([
2213--with-default-path=PATH has no effect on this system.
2214Edit /etc/login.conf instead.])
2215 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002216 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002217 AC_MSG_WARN([
2218--with-default-path=PATH will only be used if PATH is not defined in
2219$external_path_file .])
2220 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002221 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002222 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002223 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002224 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002225 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2226 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002227 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002228 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002229 AC_MSG_WARN([
2230If PATH is defined in $external_path_file, ensure the path to scp is included,
2231otherwise scp will not work.])
2232 fi
2233 AC_TRY_RUN(
2234 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002235/* find out what STDPATH is */
2236#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002237#ifdef HAVE_PATHS_H
2238# include <paths.h>
2239#endif
2240#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002241# ifdef _PATH_USERPATH /* Irix */
2242# define _PATH_STDPATH _PATH_USERPATH
2243# else
2244# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2245# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002246#endif
2247#include <sys/types.h>
2248#include <sys/stat.h>
2249#include <fcntl.h>
2250#define DATA "conftest.stdpath"
2251
2252main()
2253{
2254 FILE *fd;
2255 int rc;
2256
2257 fd = fopen(DATA,"w");
2258 if(fd == NULL)
2259 exit(1);
2260
2261 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2262 exit(1);
2263
2264 exit(0);
2265}
2266 ], [ user_path=`cat conftest.stdpath` ],
2267 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2268 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2269 )
2270# make sure $bindir is in USER_PATH so scp will work
2271 t_bindir=`eval echo ${bindir}`
2272 case $t_bindir in
2273 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2274 esac
2275 case $t_bindir in
2276 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2277 esac
2278 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2279 if test $? -ne 0 ; then
2280 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2281 if test $? -ne 0 ; then
2282 user_path=$user_path:$t_bindir
2283 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2284 fi
2285 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002286 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002287)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002288if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002289 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2290 AC_SUBST(user_path)
2291fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002292
Damien Millera18bbd32002-05-13 10:48:57 +10002293# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002294AC_ARG_WITH(superuser-path,
2295 [ --with-superuser-path= Specify different path for super-user],
2296 [
2297 if test "x$withval" != "xno" ; then
2298 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2299 superuser_path=$withval
2300 fi
2301 ]
2302)
2303
2304
Damien Miller61e50f12000-05-08 20:49:37 +10002305AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002306IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002307AC_ARG_WITH(4in6,
2308 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2309 [
2310 if test "x$withval" != "xno" ; then
2311 AC_MSG_RESULT(yes)
2312 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002313 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002314 else
2315 AC_MSG_RESULT(no)
2316 fi
2317 ],[
2318 if test "x$inet6_default_4in6" = "xyes"; then
2319 AC_MSG_RESULT([yes (default)])
2320 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002321 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002322 else
2323 AC_MSG_RESULT([no (default)])
2324 fi
2325 ]
2326)
2327
Damien Miller60396b02001-02-18 17:01:00 +11002328# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002329BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002330AC_ARG_WITH(bsd-auth,
2331 [ --with-bsd-auth Enable BSD auth support],
2332 [
2333 if test "x$withval" != "xno" ; then
2334 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002335 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002336 fi
2337 ]
2338)
2339
Damien Millera22ba012000-03-02 23:09:20 +11002340# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002341piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002342# make sure the directory exists
2343if test ! -d $piddir ; then
2344 piddir=`eval echo ${sysconfdir}`
2345 case $piddir in
2346 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2347 esac
2348fi
2349
Tim Rice88f2ab52002-03-17 12:17:34 -08002350AC_ARG_WITH(pid-dir,
2351 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2352 [
2353 if test "x$withval" != "xno" ; then
2354 piddir=$withval
2355 if test ! -d $piddir ; then
2356 AC_MSG_WARN([** no $piddir directory on this system **])
2357 fi
2358 fi
2359 ]
2360)
2361
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002362AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002363AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002364
andre2ff7b5d2000-06-03 14:57:40 +00002365dnl allow user to disable some login recording features
2366AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002367 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002368 [
2369 if test "x$enableval" = "xno" ; then
2370 AC_DEFINE(DISABLE_LASTLOG)
2371 fi
2372 ]
andre2ff7b5d2000-06-03 14:57:40 +00002373)
2374AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002375 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002376 [
2377 if test "x$enableval" = "xno" ; then
2378 AC_DEFINE(DISABLE_UTMP)
2379 fi
2380 ]
andre2ff7b5d2000-06-03 14:57:40 +00002381)
2382AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002383 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002384 [
2385 if test "x$enableval" = "xno" ; then
2386 AC_DEFINE(DISABLE_UTMPX)
2387 fi
2388 ]
andre2ff7b5d2000-06-03 14:57:40 +00002389)
2390AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002391 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002392 [
2393 if test "x$enableval" = "xno" ; then
2394 AC_DEFINE(DISABLE_WTMP)
2395 fi
2396 ]
andre2ff7b5d2000-06-03 14:57:40 +00002397)
2398AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002399 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002400 [
2401 if test "x$enableval" = "xno" ; then
2402 AC_DEFINE(DISABLE_WTMPX)
2403 fi
2404 ]
andre2ff7b5d2000-06-03 14:57:40 +00002405)
2406AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002407 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002408 [
2409 if test "x$enableval" = "xno" ; then
2410 AC_DEFINE(DISABLE_LOGIN)
2411 fi
2412 ]
andre2ff7b5d2000-06-03 14:57:40 +00002413)
2414AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002415 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002416 [
2417 if test "x$enableval" = "xno" ; then
2418 AC_DEFINE(DISABLE_PUTUTLINE)
2419 fi
2420 ]
andre2ff7b5d2000-06-03 14:57:40 +00002421)
2422AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002423 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002424 [
2425 if test "x$enableval" = "xno" ; then
2426 AC_DEFINE(DISABLE_PUTUTXLINE)
2427 fi
2428 ]
andre2ff7b5d2000-06-03 14:57:40 +00002429)
2430AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002431 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002432 [
2433 if test "x$withval" = "xno" ; then
2434 AC_DEFINE(DISABLE_LASTLOG)
2435 else
2436 conf_lastlog_location=$withval
2437 fi
2438 ]
2439)
andre2ff7b5d2000-06-03 14:57:40 +00002440
2441dnl lastlog, [uw]tmpx? detection
2442dnl NOTE: set the paths in the platform section to avoid the
2443dnl need for command-line parameters
2444dnl lastlog and [uw]tmp are subject to a file search if all else fails
2445
2446dnl lastlog detection
2447dnl NOTE: the code itself will detect if lastlog is a directory
2448AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2449AC_TRY_COMPILE([
2450#include <sys/types.h>
2451#include <utmp.h>
2452#ifdef HAVE_LASTLOG_H
2453# include <lastlog.h>
2454#endif
Damien Miller2994e082000-06-04 15:51:47 +10002455#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002456# include <paths.h>
2457#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002458#ifdef HAVE_LOGIN_H
2459# include <login.h>
2460#endif
andre2ff7b5d2000-06-03 14:57:40 +00002461 ],
2462 [ char *lastlog = LASTLOG_FILE; ],
2463 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002464 [
2465 AC_MSG_RESULT(no)
2466 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2467 AC_TRY_COMPILE([
2468#include <sys/types.h>
2469#include <utmp.h>
2470#ifdef HAVE_LASTLOG_H
2471# include <lastlog.h>
2472#endif
2473#ifdef HAVE_PATHS_H
2474# include <paths.h>
2475#endif
2476 ],
2477 [ char *lastlog = _PATH_LASTLOG; ],
2478 [ AC_MSG_RESULT(yes) ],
2479 [
andree441aa32000-06-12 22:34:38 +00002480 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002481 system_lastlog_path=no
2482 ])
2483 ]
andre2ff7b5d2000-06-03 14:57:40 +00002484)
Damien Miller2994e082000-06-04 15:51:47 +10002485
andre2ff7b5d2000-06-03 14:57:40 +00002486if test -z "$conf_lastlog_location"; then
2487 if test x"$system_lastlog_path" = x"no" ; then
2488 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002489 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002490 conf_lastlog_location=$f
2491 fi
2492 done
2493 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002494 AC_MSG_WARN([** Cannot find lastlog **])
2495 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002496 fi
2497 fi
2498fi
2499
2500if test -n "$conf_lastlog_location"; then
2501 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2502fi
2503
2504dnl utmp detection
2505AC_MSG_CHECKING([if your system defines UTMP_FILE])
2506AC_TRY_COMPILE([
2507#include <sys/types.h>
2508#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002509#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002510# include <paths.h>
2511#endif
2512 ],
2513 [ char *utmp = UTMP_FILE; ],
2514 [ AC_MSG_RESULT(yes) ],
2515 [ AC_MSG_RESULT(no)
2516 system_utmp_path=no ]
2517)
2518if test -z "$conf_utmp_location"; then
2519 if test x"$system_utmp_path" = x"no" ; then
2520 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2521 if test -f $f ; then
2522 conf_utmp_location=$f
2523 fi
2524 done
2525 if test -z "$conf_utmp_location"; then
2526 AC_DEFINE(DISABLE_UTMP)
2527 fi
2528 fi
2529fi
2530if test -n "$conf_utmp_location"; then
2531 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2532fi
2533
2534dnl wtmp detection
2535AC_MSG_CHECKING([if your system defines WTMP_FILE])
2536AC_TRY_COMPILE([
2537#include <sys/types.h>
2538#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002539#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002540# include <paths.h>
2541#endif
2542 ],
2543 [ char *wtmp = WTMP_FILE; ],
2544 [ AC_MSG_RESULT(yes) ],
2545 [ AC_MSG_RESULT(no)
2546 system_wtmp_path=no ]
2547)
2548if test -z "$conf_wtmp_location"; then
2549 if test x"$system_wtmp_path" = x"no" ; then
2550 for f in /usr/adm/wtmp /var/log/wtmp; do
2551 if test -f $f ; then
2552 conf_wtmp_location=$f
2553 fi
2554 done
2555 if test -z "$conf_wtmp_location"; then
2556 AC_DEFINE(DISABLE_WTMP)
2557 fi
2558 fi
2559fi
2560if test -n "$conf_wtmp_location"; then
2561 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2562fi
2563
2564
2565dnl utmpx detection - I don't know any system so perverse as to require
2566dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2567dnl there, though.
2568AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2569AC_TRY_COMPILE([
2570#include <sys/types.h>
2571#include <utmp.h>
2572#ifdef HAVE_UTMPX_H
2573#include <utmpx.h>
2574#endif
Damien Miller2994e082000-06-04 15:51:47 +10002575#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002576# include <paths.h>
2577#endif
2578 ],
2579 [ char *utmpx = UTMPX_FILE; ],
2580 [ AC_MSG_RESULT(yes) ],
2581 [ AC_MSG_RESULT(no)
2582 system_utmpx_path=no ]
2583)
2584if test -z "$conf_utmpx_location"; then
2585 if test x"$system_utmpx_path" = x"no" ; then
2586 AC_DEFINE(DISABLE_UTMPX)
2587 fi
2588else
2589 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2590fi
2591
2592dnl wtmpx detection
2593AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2594AC_TRY_COMPILE([
2595#include <sys/types.h>
2596#include <utmp.h>
2597#ifdef HAVE_UTMPX_H
2598#include <utmpx.h>
2599#endif
Damien Miller2994e082000-06-04 15:51:47 +10002600#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002601# include <paths.h>
2602#endif
2603 ],
2604 [ char *wtmpx = WTMPX_FILE; ],
2605 [ AC_MSG_RESULT(yes) ],
2606 [ AC_MSG_RESULT(no)
2607 system_wtmpx_path=no ]
2608)
2609if test -z "$conf_wtmpx_location"; then
2610 if test x"$system_wtmpx_path" = x"no" ; then
2611 AC_DEFINE(DISABLE_WTMPX)
2612 fi
2613else
2614 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2615fi
2616
Damien Miller4018c192000-04-30 09:30:44 +10002617
Damien Miller29ea30d2000-03-17 10:54:15 +11002618if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002619 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2620 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002621fi
2622
Tim Rice4cec93f2002-02-26 08:40:48 -08002623dnl remove pam and dl because they are in $LIBPAM
2624if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002625 LIBS=`echo $LIBS | sed 's/-lpam //'`
2626fi
2627if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2628 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002629fi
2630
Damien Millerbac2d8a2000-09-05 16:13:06 +11002631AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002632AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2633AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002634
Damien Miller7b22d652000-06-18 14:07:04 +10002635# Print summary of options
2636
Damien Miller7b22d652000-06-18 14:07:04 +10002637# Someone please show me a better way :)
2638A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2639B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2640C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2641D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002642E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002643F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002644G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002645H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2646I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2647J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002648
2649echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002650echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002651echo " User binaries: $B"
2652echo " System binaries: $C"
2653echo " Configuration files: $D"
2654echo " Askpass program: $E"
2655echo " Manual pages: $F"
2656echo " PID file: $G"
2657echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002658if test "x$external_path_file" = "x/etc/login.conf" ; then
2659echo " At runtime, sshd will use the path defined in $external_path_file"
2660echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002661else
Damien Millerf58c6722002-05-13 13:15:42 +10002662echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002663 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002664echo " (If PATH is set in $external_path_file it will be used instead. If"
2665echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2666 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002667fi
Damien Millera18bbd32002-05-13 10:48:57 +10002668if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002669echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002670fi
Damien Millerf58c6722002-05-13 13:15:42 +10002671echo " Manpage format: $MANTYPE"
Damien Miller9d2be482003-05-15 11:12:19 +10002672echo " DNS support: $DNS_MSG"
Damien Miller7abe09b2003-05-15 10:53:49 +10002673echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002674echo " KerberosV support: $KRB5_MSG"
2675echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002676echo " S/KEY support: $SKEY_MSG"
2677echo " TCP Wrappers support: $TCPW_MSG"
2678echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002679echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002680echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2681echo " BSD Auth support: $BSD_AUTH_MSG"
2682echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002683if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002684echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002685fi
2686
Damien Miller7b22d652000-06-18 14:07:04 +10002687echo ""
2688
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002689echo " Host: ${host}"
2690echo " Compiler: ${CC}"
2691echo " Compiler flags: ${CFLAGS}"
2692echo "Preprocessor flags: ${CPPFLAGS}"
2693echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002694echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002695
2696echo ""
2697
Damien Miller82cf0ce2000-12-20 13:34:48 +11002698if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002699 echo "PAM is enabled. You may need to install a PAM control file "
2700 echo "for sshd, otherwise password authentication may fail. "
2701 echo "Example PAM control files can be found in the contrib/ "
2702 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002703 echo ""
2704fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002705
Damien Miller6c21c512002-01-22 21:57:53 +11002706if test ! -z "$RAND_HELPER_CMDHASH" ; then
2707 echo "WARNING: you are using the builtin random number collection "
2708 echo "service. Please read WARNING.RNG and request that your OS "
2709 echo "vendor includes kernel-based random number collection in "
2710 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002711 echo ""
2712fi
Damien Miller60396b02001-02-18 17:01:00 +11002713