blob: 538ecd2d94d3b3ef613a0fce2d2434bffc63ec14 [file] [log] [blame]
Darren Tucker20379a32003-09-22 11:07:40 +10001# $Id: configure.ac,v 1.157 2003/09/22 01:07:40 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 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000233*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000234 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100235 conf_utmp_location=/etc/utmp
236 conf_wtmp_location=/usr/adm/wtmp
237 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000238 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000239 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000240 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100241 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000242 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000243 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000244 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100245*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000246 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000247 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100248 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100249 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000250 AC_DEFINE(LOGIN_NEEDS_UTMPX)
251 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000252 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000253 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000254 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
255 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000256 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000257 # hardwire lastlog location (can't detect it on some versions)
258 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000259 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
260 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
261 if test "$sol2ver" -ge 8; then
262 AC_MSG_RESULT(yes)
263 AC_DEFINE(DISABLE_UTMP)
264 AC_DEFINE(DISABLE_WTMP)
265 else
266 AC_MSG_RESULT(no)
267 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100268 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000269*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000270 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000271 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100272 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000273 conf_utmp_location=/etc/utmp
274 conf_wtmp_location=/var/adm/wtmp
275 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000276 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000277 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000278*-ncr-sysv*)
279 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
280 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700281 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000282 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000283 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000284 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000285*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000286 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700287 # /usr/ucblib MUST NOT be searched on ReliantUNIX
288 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100289 IPADDR_IN_DISPLAY=yes
290 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000291 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000292 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000293 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700294 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
295 # Attention: always take care to bind libsocket and libnsl before libc,
296 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000297 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100298*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000299 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100300 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100301 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700302 AC_DEFINE(SETEUID_BREAKS_SETUID)
303 AC_DEFINE(BROKEN_SETREUID)
304 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100305 ;;
306*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000307 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100308 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100309 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700310 AC_DEFINE(SETEUID_BREAKS_SETUID)
311 AC_DEFINE(BROKEN_SETREUID)
312 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100313 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100314*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000315 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100316 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100317 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100318*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000319 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100320 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700321 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100322 RANLIB=true
323 no_dev_ptmx=1
324 AC_DEFINE(BROKEN_SYS_TERMIO_H)
325 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000326 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000327 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100328 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Riceae477e92003-09-12 18:15:15 -0700329 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100330 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700331 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700332 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100333 ;;
334*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800335 if test -z "$GCC"; then
336 CFLAGS="$CFLAGS -belf"
337 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000338 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000339 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100340 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000341 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100342 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000343 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000344 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700345 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700346 AC_DEFINE(SETEUID_BREAKS_SETUID)
347 AC_DEFINE(BROKEN_SETREUID)
348 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700349 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100350 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700351 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000352 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000353*-*-unicosmk*)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000354 AC_DEFINE(USE_PIPES)
355 AC_DEFINE(DISABLE_FD_PASSING)
356 LDFLAGS="$LDFLAGS"
357 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
358 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000359 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000360*-*-unicosmp*)
361 AC_DEFINE(WITH_ABBREV_NO_TTY)
362 AC_DEFINE(USE_PIPES)
363 AC_DEFINE(DISABLE_FD_PASSING)
364 LDFLAGS="$LDFLAGS"
365 LIBS="$LIBS -lgen -lacid"
366 MANTYPE=cat
367 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000368*-*-unicos*)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000369 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700370 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700371 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000372 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
373 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
374 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700375 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000376*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000377 AC_MSG_CHECKING(for Digital Unix SIA)
378 no_osfsia=""
379 AC_ARG_WITH(osfsia,
380 [ --with-osfsia Enable Digital Unix SIA],
381 [
382 if test "x$withval" = "xno" ; then
383 AC_MSG_RESULT(disabled)
384 no_osfsia=1
385 fi
386 ],
387 )
388 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000389 if test -f /etc/sia/matrix.conf; then
390 AC_MSG_RESULT(yes)
391 AC_DEFINE(HAVE_OSF_SIA)
392 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000393 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000394 LIBS="$LIBS -lsecurity -ldb -lm -laud"
395 else
396 AC_MSG_RESULT(no)
397 fi
398 fi
Ben Lindstromdc3c7572002-10-04 23:54:54 +0000399 AC_DEFINE(DISABLE_FD_PASSING)
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000400 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tuckere41bba52003-08-25 11:51:19 +1000401 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000402 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000403
404*-*-nto-qnx)
405 AC_DEFINE(USE_PIPES)
406 AC_DEFINE(NO_X11_UNIX_SOCKETS)
407 AC_DEFINE(MISSING_NFDBITS)
408 AC_DEFINE(MISSING_HOWMANY)
409 AC_DEFINE(MISSING_FD_MASK)
410 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100411esac
412
Damien Millere37bfc12000-06-05 09:37:43 +1000413# Allow user to specify flags
414AC_ARG_WITH(cflags,
415 [ --with-cflags Specify additional flags to pass to compiler],
416 [
417 if test "x$withval" != "xno" ; then
418 CFLAGS="$CFLAGS $withval"
419 fi
420 ]
421)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000422AC_ARG_WITH(cppflags,
423 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
424 [
425 if test "x$withval" != "xno"; then
426 CPPFLAGS="$CPPFLAGS $withval"
427 fi
428 ]
429)
Damien Millere37bfc12000-06-05 09:37:43 +1000430AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000431 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000432 [
433 if test "x$withval" != "xno" ; then
434 LDFLAGS="$LDFLAGS $withval"
435 fi
436 ]
437)
438AC_ARG_WITH(libs,
439 [ --with-libs Specify additional libraries to link with],
440 [
441 if test "x$withval" != "xno" ; then
442 LIBS="$LIBS $withval"
443 fi
444 ]
445)
446
Darren Tucker6eb93042003-06-29 21:30:41 +1000447AC_MSG_CHECKING(compiler and flags for sanity)
448AC_TRY_RUN([
449#include <stdio.h>
450int main(){exit(0);}
451 ],
452 [ AC_MSG_RESULT(yes) ],
453 [
454 AC_MSG_RESULT(no)
455 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
456 ]
457)
458
Tim Rice4cec93f2002-02-26 08:40:48 -0800459# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000460AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000461 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800462 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000463 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000464 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000465 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
466 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
Ben Lindstrom4b0f1ad2003-02-01 04:43:34 +0000467 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
Tim Rice81ed5182002-09-25 17:38:46 -0700468 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800469 util.h utime.h utmp.h utmpx.h)
470
Damien Millera22ba012000-03-02 23:09:20 +1100471# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700472AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
473AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000474
Damien Millerdf288022001-02-18 13:07:07 +1100475dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700476if test "x$with_tcp_wrappers" != "xno" ; then
477 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
478 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
479 fi
480fi
Damien Millerdf288022001-02-18 13:07:07 +1100481
Tim Rice1e1ef642003-09-11 22:19:31 -0700482dnl IRIX and Solaris 2.5.1 have dirname() in libgen
483AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
484 AC_CHECK_LIB(gen, dirname,[
485 AC_CACHE_CHECK([for broken dirname],
486 ac_cv_have_broken_dirname, [
487 save_LIBS="$LIBS"
488 LIBS="$LIBS -lgen"
489 AC_TRY_RUN(
490 [
491#include <libgen.h>
492#include <string.h>
493
494int main(int argc, char **argv) {
495 char *s, buf[32];
496
497 strncpy(buf,"/etc", 32);
498 s = dirname(buf);
499 if (!s || strncmp(s, "/", 32) != 0) {
500 exit(1);
501 } else {
502 exit(0);
503 }
504}
505 ],
506 [ ac_cv_have_broken_dirname="no" ],
507 [ ac_cv_have_broken_dirname="yes" ]
508 )
509 LIBS="$save_LIBS"
510 ])
511 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
512 LIBS="$LIBS -lgen"
513 AC_DEFINE(HAVE_DIRNAME)
514 AC_CHECK_HEADERS(libgen.h)
515 fi
516 ])
517])
518
519AC_CHECK_FUNC(getspnam, ,
520 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
521AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
522
Damien Miller150c8b52002-02-13 23:06:56 +1100523AC_ARG_WITH(rpath,
524 [ --without-rpath Disable auto-added -R linker paths],
525 [
526 if test "x$withval" = "xno" ; then
527 need_dash_r=""
528 fi
529 if test "x$withval" = "xyes" ; then
530 need_dash_r=1
531 fi
532 ]
533)
534
Tim Rice13aae5e2001-10-21 17:53:58 -0700535dnl zlib is required
536AC_ARG_WITH(zlib,
537 [ --with-zlib=PATH Use zlib in PATH],
538 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000539 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100540 AC_MSG_ERROR([*** zlib is required ***])
541 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700542 if test -d "$withval/lib"; then
543 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700544 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700545 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700546 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700547 fi
548 else
549 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700550 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700551 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700552 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700553 fi
554 fi
555 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700556 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700557 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700558 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700559 fi
560 ]
561)
562
Tim Rice17b93e52001-10-23 22:36:54 -0700563AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100564
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000565dnl UnixWare 2.x
566AC_CHECK_FUNC(strcasecmp,
567 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
568)
569AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700570 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
571 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000572)
Damien Millerab18c411999-11-11 10:40:23 +1100573
Tim Ricee589a292001-11-03 11:09:32 -0800574dnl Checks for libutil functions
575AC_CHECK_HEADERS(libutil.h)
576AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
577AC_CHECK_FUNCS(logout updwtmp logwtmp)
578
Ben Lindstrom8697e082001-02-24 21:41:10 +0000579AC_FUNC_STRFTIME
580
Damien Miller3c027682001-03-14 11:39:45 +1100581# Check for ALTDIRFUNC glob() extension
582AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
583AC_EGREP_CPP(FOUNDIT,
584 [
585 #include <glob.h>
586 #ifdef GLOB_ALTDIRFUNC
587 FOUNDIT
588 #endif
589 ],
590 [
591 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
592 AC_MSG_RESULT(yes)
593 ],
594 [
595 AC_MSG_RESULT(no)
596 ]
597)
Damien Millerab18c411999-11-11 10:40:23 +1100598
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000599# Check for g.gl_matchc glob() extension
600AC_MSG_CHECKING(for gl_matchc field in glob_t)
601AC_EGREP_CPP(FOUNDIT,
602 [
603 #include <glob.h>
604 int main(void){glob_t g; g.gl_matchc = 1;}
605 ],
606 [
607 AC_DEFINE(GLOB_HAS_GL_MATCHC)
608 AC_MSG_RESULT(yes)
609 ],
610 [
611 AC_MSG_RESULT(no)
612 ]
613)
614
Damien Miller18bb4732001-03-28 14:35:30 +1000615AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
616AC_TRY_RUN(
617 [
618#include <sys/types.h>
619#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700620int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000621 ],
622 [AC_MSG_RESULT(yes)],
623 [
624 AC_MSG_RESULT(no)
625 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
626 ]
627)
628
Damien Millerc547bf12001-02-16 10:18:12 +1100629# Check whether user wants S/Key support
630SKEY_MSG="no"
631AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700632 [ --with-skey[[=PATH]] Enable S/Key support
633 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100634 [
635 if test "x$withval" != "xno" ; then
636
637 if test "x$withval" != "xyes" ; then
638 CPPFLAGS="$CPPFLAGS -I${withval}/include"
639 LDFLAGS="$LDFLAGS -L${withval}/lib"
640 fi
641
642 AC_DEFINE(SKEY)
643 LIBS="-lskey $LIBS"
644 SKEY_MSG="yes"
645
Tim Rice4cec93f2002-02-26 08:40:48 -0800646 AC_MSG_CHECKING([for s/key support])
647 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100648 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800649#include <stdio.h>
650#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700651int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800652 ],
653 [AC_MSG_RESULT(yes)],
654 [
655 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100656 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
657 ])
658 fi
659 ]
660)
661
662# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700663TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100664AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700665 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
666 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100667 [
668 if test "x$withval" != "xno" ; then
669 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700670 saved_LDFLAGS="$LDFLAGS"
671 saved_CPPFLAGS="$CPPFLAGS"
672 if test -n "${withval}" -a "${withval}" != "yes"; then
673 if test -d "${withval}/lib"; then
674 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700675 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700676 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700677 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700678 fi
679 else
680 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700681 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700682 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700683 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700684 fi
685 fi
686 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700687 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700688 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700689 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700690 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700691 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800692 LIBWRAP="-lwrap"
693 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100694 AC_MSG_CHECKING(for libwrap)
695 AC_TRY_LINK(
696 [
697#include <tcpd.h>
698 int deny_severity = 0, allow_severity = 0;
699 ],
700 [hosts_access(0);],
701 [
702 AC_MSG_RESULT(yes)
703 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800704 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700705 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100706 ],
707 [
708 AC_MSG_ERROR([*** libwrap missing])
709 ]
710 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800711 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100712 fi
713 ]
714)
715
Damien Millerfe1f1432003-02-24 15:45:42 +1100716dnl Checks for library functions. Please keep in alphabetical order
717AC_CHECK_FUNCS(\
Damien Millerf09ad862003-09-19 16:41:01 +1000718 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
Damien Miller5fe46a42003-06-05 09:53:31 +1000719 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Damien Millerfe1f1432003-02-24 15:45:42 +1100720 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000721 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100722 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000723 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
724 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
725 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Damien Miller5fe46a42003-06-05 09:53:31 +1000726 setproctitle setregid setresgid setresuid setreuid setrlimit \
727 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tuckerb2427c82003-09-10 15:22:44 +1000728 strlcat strlcpy strmode strnvis sysconf tcgetpgrp \
Darren Tuckerf38ea772003-08-13 20:48:07 +1000729 truncate utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100730)
Tim Rice13aae5e2001-10-21 17:53:58 -0700731
Damien Millercd6853c2003-01-28 11:33:42 +1100732AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
733
Darren Tuckerf1159b52003-07-07 19:44:01 +1000734dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000735AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000736AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000737
Darren Tuckerb2427c82003-09-10 15:22:44 +1000738dnl tcsendbreak might be a macro
739AC_CHECK_DECL(tcsendbreak,
740 [AC_DEFINE(HAVE_TCSENDBREAK)],
741 [AC_CHECK_FUNCS(tcsendbreak)],
742 [#include <termios.h>]
743)
744
Damien Millerad833b32000-08-23 10:46:23 +1000745dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000746AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000747dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000748AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000749AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000750dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000751AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000752AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100753
Damien Miller04f80141999-11-19 15:32:34 +1100754AC_CHECK_FUNC(daemon,
755 [AC_DEFINE(HAVE_DAEMON)],
756 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
757)
758
Damien Miller9fb07e42000-03-05 16:22:59 +1100759AC_CHECK_FUNC(getpagesize,
760 [AC_DEFINE(HAVE_GETPAGESIZE)],
761 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
762)
763
Damien Millercb170cb2000-07-01 16:52:55 +1000764# Check for broken snprintf
765if test "x$ac_cv_func_snprintf" = "xyes" ; then
766 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
767 AC_TRY_RUN(
768 [
769#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700770int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000771 ],
772 [AC_MSG_RESULT(yes)],
773 [
774 AC_MSG_RESULT(no)
775 AC_DEFINE(BROKEN_SNPRINTF)
776 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
777 ]
778 )
779fi
780
Damien Millere8328192003-01-07 15:18:32 +1100781dnl see whether mkstemp() requires XXXXXX
782if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
783AC_MSG_CHECKING([for (overly) strict mkstemp])
784AC_TRY_RUN(
785 [
786#include <stdlib.h>
787main() { char template[]="conftest.mkstemp-test";
788if (mkstemp(template) == -1)
789 exit(1);
790unlink(template); exit(0);
791}
792 ],
793 [
794 AC_MSG_RESULT(no)
795 ],
796 [
797 AC_MSG_RESULT(yes)
798 AC_DEFINE(HAVE_STRICT_MKSTEMP)
799 ],
800 [
801 AC_MSG_RESULT(yes)
802 AC_DEFINE(HAVE_STRICT_MKSTEMP)
803 ]
804)
805fi
806
Darren Tucker70a3d552003-08-21 17:58:29 +1000807dnl make sure that openpty does not reacquire controlling terminal
808if test ! -z "$check_for_openpty_ctty_bug"; then
809 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
810 AC_TRY_RUN(
811 [
812#include <stdio.h>
813#include <sys/fcntl.h>
814#include <sys/types.h>
815#include <sys/wait.h>
816
817int
818main()
819{
820 pid_t pid;
821 int fd, ptyfd, ttyfd, status;
822
823 pid = fork();
824 if (pid < 0) { /* failed */
825 exit(1);
826 } else if (pid > 0) { /* parent */
827 waitpid(pid, &status, 0);
828 if (WIFEXITED(status))
829 exit(WEXITSTATUS(status));
830 else
831 exit(2);
832 } else { /* child */
833 close(0); close(1); close(2);
834 setsid();
835 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
836 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
837 if (fd >= 0)
838 exit(3); /* Acquired ctty: broken */
839 else
840 exit(0); /* Did not acquire ctty: OK */
841 }
842}
843 ],
844 [
845 AC_MSG_RESULT(yes)
846 ],
847 [
848 AC_MSG_RESULT(no)
849 AC_DEFINE(SSHD_ACQUIRES_CTTY)
850 ]
851 )
852fi
853
Damien Miller606f8802000-09-16 15:39:56 +1100854AC_FUNC_GETPGRP
855
Damien Millera64b57a2001-01-17 10:44:13 +1100856# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000857PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100858AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100859 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100860 [
Damien Millera64b57a2001-01-17 10:44:13 +1100861 if test "x$withval" != "xno" ; then
862 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
863 AC_MSG_ERROR([PAM headers not found])
864 fi
865
866 AC_CHECK_LIB(dl, dlopen, , )
867 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
868 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000869 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +1100870
871 disable_shadow=yes
872 PAM_MSG="yes"
873
874 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800875 if test $ac_cv_lib_dl_dlopen = yes; then
876 LIBPAM="-lpam -ldl"
877 else
878 LIBPAM="-lpam"
879 fi
880 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100881 fi
882 ]
883)
Damien Millera22ba012000-03-02 23:09:20 +1100884
Damien Millera64b57a2001-01-17 10:44:13 +1100885# Check for older PAM
886if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100887 # Check PAM strerror arguments (old PAM)
888 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
889 AC_TRY_COMPILE(
890 [
Damien Miller81171112000-04-23 11:14:01 +1000891#include <stdlib.h>
892#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100893 ],
894 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
895 [AC_MSG_RESULT(no)],
896 [
897 AC_DEFINE(HAVE_OLD_PAM)
898 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000899 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100900 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100901 )
Damien Millera22ba012000-03-02 23:09:20 +1100902fi
903
Damien Millerfc93d4b2002-09-04 23:26:29 +1000904# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
905# because the system crypt() is more featureful.
906if test "x$check_for_libcrypt_before" = "x1"; then
907 AC_CHECK_LIB(crypt, crypt)
908fi
909
Tim Riceaef73712002-05-11 13:17:42 -0700910# Search for OpenSSL
911saved_CPPFLAGS="$CPPFLAGS"
912saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100913AC_ARG_WITH(ssl-dir,
914 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
915 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000916 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700917 if test -d "$withval/lib"; then
918 if test -n "${need_dash_r}"; then
919 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
920 else
921 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
922 fi
923 else
924 if test -n "${need_dash_r}"; then
925 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
926 else
927 LDFLAGS="-L${withval} ${LDFLAGS}"
928 fi
929 fi
930 if test -d "$withval/include"; then
931 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
932 else
933 CPPFLAGS="-I${withval} ${CPPFLAGS}"
934 fi
Damien Millera22ba012000-03-02 23:09:20 +1100935 fi
936 ]
937)
Tim Riceaef73712002-05-11 13:17:42 -0700938LIBS="$LIBS -lcrypto"
939AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000940 [
Tim Riceaef73712002-05-11 13:17:42 -0700941 dnl Check default openssl install dir
942 if test -n "${need_dash_r}"; then
943 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000944 else
Tim Riceaef73712002-05-11 13:17:42 -0700945 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000946 fi
Tim Riceaef73712002-05-11 13:17:42 -0700947 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
948 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
949 [
950 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
951 ]
952 )
953 ]
954)
955
Tim Riced730b782002-08-13 18:52:10 -0700956# Determine OpenSSL header version
957AC_MSG_CHECKING([OpenSSL header version])
958AC_TRY_RUN(
959 [
960#include <stdio.h>
961#include <string.h>
962#include <openssl/opensslv.h>
963#define DATA "conftest.sslincver"
964int main(void) {
965 FILE *fd;
966 int rc;
967
968 fd = fopen(DATA,"w");
969 if(fd == NULL)
970 exit(1);
971
972 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
973 exit(1);
974
975 exit(0);
976}
977 ],
978 [
979 ssl_header_ver=`cat conftest.sslincver`
980 AC_MSG_RESULT($ssl_header_ver)
981 ],
982 [
983 AC_MSG_RESULT(not found)
984 AC_MSG_ERROR(OpenSSL version header not found.)
985 ]
986)
987
988# Determine OpenSSL library version
989AC_MSG_CHECKING([OpenSSL library version])
990AC_TRY_RUN(
991 [
992#include <stdio.h>
993#include <string.h>
994#include <openssl/opensslv.h>
995#include <openssl/crypto.h>
996#define DATA "conftest.ssllibver"
997int main(void) {
998 FILE *fd;
999 int rc;
1000
1001 fd = fopen(DATA,"w");
1002 if(fd == NULL)
1003 exit(1);
1004
1005 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1006 exit(1);
1007
1008 exit(0);
1009}
1010 ],
1011 [
1012 ssl_library_ver=`cat conftest.ssllibver`
1013 AC_MSG_RESULT($ssl_library_ver)
1014 ],
1015 [
1016 AC_MSG_RESULT(not found)
1017 AC_MSG_ERROR(OpenSSL library not found.)
1018 ]
1019)
Damien Millera22ba012000-03-02 23:09:20 +11001020
Damien Millerec932372002-01-22 22:16:03 +11001021# Sanity check OpenSSL headers
1022AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1023AC_TRY_RUN(
1024 [
1025#include <string.h>
1026#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001027int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001028 ],
1029 [
1030 AC_MSG_RESULT(yes)
1031 ],
1032 [
1033 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001034 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1035Check config.log for details.
1036Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001037 ]
1038)
1039
Damien Millera64b57a2001-01-17 10:44:13 +11001040# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1041# version in OpenSSL. Skip this for PAM
Damien Miller4f9f42a2003-05-10 19:28:02 +10001042if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001043 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001044fi
1045
Damien Miller6c21c512002-01-22 21:57:53 +11001046
1047### Configure cryptographic random number support
1048
1049# Check wheter OpenSSL seeds itself
1050AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1051AC_TRY_RUN(
1052 [
1053#include <string.h>
1054#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001055int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001056 ],
1057 [
1058 OPENSSL_SEEDS_ITSELF=yes
1059 AC_MSG_RESULT(yes)
1060 ],
1061 [
1062 AC_MSG_RESULT(no)
1063 # Default to use of the rand helper if OpenSSL doesn't
1064 # seed itself
1065 USE_RAND_HELPER=yes
1066 ]
1067)
1068
1069
1070# Do we want to force the use of the rand helper?
1071AC_ARG_WITH(rand-helper,
1072 [ --with-rand-helper Use subprocess to gather strong randomness ],
1073 [
1074 if test "x$withval" = "xno" ; then
1075 # Force use of OpenSSL's internal RNG, even if
1076 # the previous test showed it to be unseeded.
1077 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1078 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1079 OPENSSL_SEEDS_ITSELF=yes
1080 USE_RAND_HELPER=""
1081 fi
1082 else
1083 USE_RAND_HELPER=yes
1084 fi
1085 ],
1086)
1087
1088# Which randomness source do we use?
1089if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1090 # OpenSSL only
1091 AC_DEFINE(OPENSSL_PRNG_ONLY)
1092 RAND_MSG="OpenSSL internal ONLY"
1093 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001094elif test ! -z "$USE_RAND_HELPER" ; then
1095 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001096 RAND_MSG="ssh-rand-helper"
1097 INSTALL_SSH_RAND_HELPER="yes"
1098fi
1099AC_SUBST(INSTALL_SSH_RAND_HELPER)
1100
1101### Configuration of ssh-rand-helper
1102
1103# PRNGD TCP socket
1104AC_ARG_WITH(prngd-port,
1105 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1106 [
Damien Millere996d722002-01-23 11:20:59 +11001107 case "$withval" in
1108 no)
1109 withval=""
1110 ;;
1111 [[0-9]]*)
1112 ;;
1113 *)
1114 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1115 ;;
1116 esac
1117 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001118 PRNGD_PORT="$withval"
1119 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1120 fi
1121 ]
1122)
1123
1124# PRNGD Unix domain socket
1125AC_ARG_WITH(prngd-socket,
1126 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1127 [
Damien Millere996d722002-01-23 11:20:59 +11001128 case "$withval" in
1129 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001130 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001131 ;;
1132 no)
1133 withval=""
1134 ;;
1135 /*)
1136 ;;
1137 *)
1138 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1139 ;;
1140 esac
1141
1142 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001143 if test ! -z "$PRNGD_PORT" ; then
1144 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1145 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001146 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001147 AC_MSG_WARN(Entropy socket is not readable)
1148 fi
1149 PRNGD_SOCKET="$withval"
1150 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1151 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001152 ],
1153 [
1154 # Check for existing socket only if we don't have a random device already
1155 if test "$USE_RAND_HELPER" = yes ; then
1156 AC_MSG_CHECKING(for PRNGD/EGD socket)
1157 # Insert other locations here
1158 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1159 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1160 PRNGD_SOCKET="$sock"
1161 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1162 break;
1163 fi
1164 done
1165 if test ! -z "$PRNGD_SOCKET" ; then
1166 AC_MSG_RESULT($PRNGD_SOCKET)
1167 else
1168 AC_MSG_RESULT(not found)
1169 fi
1170 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001171 ]
1172)
1173
1174# Change default command timeout for hashing entropy source
1175entropy_timeout=200
1176AC_ARG_WITH(entropy-timeout,
1177 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1178 [
1179 if test "x$withval" != "xno" ; then
1180 entropy_timeout=$withval
1181 fi
1182 ]
1183)
Damien Miller6c21c512002-01-22 21:57:53 +11001184AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1185
Damien Millerd3f6ad22002-06-25 10:24:47 +10001186SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001187AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001188 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001189 [
1190 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001191 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001192 fi
1193 ]
1194)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001195AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1196AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001197
Tim Rice88f2ab52002-03-17 12:17:34 -08001198# We do this little dance with the search path to insure
1199# that programs that we select for use by installed programs
1200# (which may be run by the super-user) come from trusted
1201# locations before they come from the user's private area.
1202# This should help avoid accidentally configuring some
1203# random version of a program in someone's personal bin.
1204
1205OPATH=$PATH
1206PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001207test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001208test -d /sbin && PATH=$PATH:/sbin
1209test -d /usr/sbin && PATH=$PATH:/usr/sbin
1210PATH=$PATH:/etc:$OPATH
1211
Damien Miller6c21c512002-01-22 21:57:53 +11001212# These programs are used by the command hashing source to gather entropy
1213OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1214OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1215OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1216OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1217OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1218OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1219OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1220OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1221OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1222OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1223OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1224OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1225OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1226OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1227OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1228OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001229# restore PATH
1230PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001231
1232# Where does ssh-rand-helper get its randomness from?
1233INSTALL_SSH_PRNG_CMDS=""
1234if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1235 if test ! -z "$PRNGD_PORT" ; then
1236 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1237 elif test ! -z "$PRNGD_SOCKET" ; then
1238 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1239 else
1240 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1241 RAND_HELPER_CMDHASH=yes
1242 INSTALL_SSH_PRNG_CMDS="yes"
1243 fi
1244fi
1245AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1246
1247
Ben Lindstromb5628642000-10-18 00:02:25 +00001248# Cheap hack to ensure NEWS-OS libraries are arranged right.
1249if test ! -z "$SONY" ; then
1250 LIBS="$LIBS -liberty";
1251fi
1252
Damien Millera22ba012000-03-02 23:09:20 +11001253# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001254AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001255AC_CHECK_SIZEOF(short int, 2)
1256AC_CHECK_SIZEOF(int, 4)
1257AC_CHECK_SIZEOF(long int, 4)
1258AC_CHECK_SIZEOF(long long int, 8)
1259
Damien Millerfa2bb692002-04-23 23:22:25 +10001260# Sanity check long long for some platforms (AIX)
1261if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1262 ac_cv_sizeof_long_long_int=0
1263fi
1264
Damien Millera22ba012000-03-02 23:09:20 +11001265# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001266AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1267 AC_TRY_COMPILE(
1268 [ #include <sys/types.h> ],
1269 [ u_int a; a = 1;],
1270 [ ac_cv_have_u_int="yes" ],
1271 [ ac_cv_have_u_int="no" ]
1272 )
1273])
1274if test "x$ac_cv_have_u_int" = "xyes" ; then
1275 AC_DEFINE(HAVE_U_INT)
1276 have_u_int=1
1277fi
1278
Damien Miller61e50f12000-05-08 20:49:37 +10001279AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1280 AC_TRY_COMPILE(
1281 [ #include <sys/types.h> ],
1282 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1283 [ ac_cv_have_intxx_t="yes" ],
1284 [ ac_cv_have_intxx_t="no" ]
1285 )
1286])
1287if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1288 AC_DEFINE(HAVE_INTXX_T)
1289 have_intxx_t=1
1290fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001291
1292if (test -z "$have_intxx_t" && \
1293 test "x$ac_cv_header_stdint_h" = "xyes")
1294then
1295 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1296 AC_TRY_COMPILE(
1297 [ #include <stdint.h> ],
1298 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1299 [
1300 AC_DEFINE(HAVE_INTXX_T)
1301 AC_MSG_RESULT(yes)
1302 ],
1303 [ AC_MSG_RESULT(no) ]
1304 )
1305fi
1306
Damien Miller578783e2000-09-23 14:12:24 +11001307AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1308 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001309 [
1310#include <sys/types.h>
1311#ifdef HAVE_STDINT_H
1312# include <stdint.h>
1313#endif
1314#include <sys/socket.h>
1315#ifdef HAVE_SYS_BITYPES_H
1316# include <sys/bitypes.h>
1317#endif
1318 ],
Damien Miller578783e2000-09-23 14:12:24 +11001319 [ int64_t a; a = 1;],
1320 [ ac_cv_have_int64_t="yes" ],
1321 [ ac_cv_have_int64_t="no" ]
1322 )
1323])
1324if test "x$ac_cv_have_int64_t" = "xyes" ; then
1325 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001326fi
1327
Damien Miller61e50f12000-05-08 20:49:37 +10001328AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1329 AC_TRY_COMPILE(
1330 [ #include <sys/types.h> ],
1331 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1332 [ ac_cv_have_u_intxx_t="yes" ],
1333 [ ac_cv_have_u_intxx_t="no" ]
1334 )
1335])
1336if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1337 AC_DEFINE(HAVE_U_INTXX_T)
1338 have_u_intxx_t=1
1339fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001340
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001341if test -z "$have_u_intxx_t" ; then
1342 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1343 AC_TRY_COMPILE(
1344 [ #include <sys/socket.h> ],
1345 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1346 [
1347 AC_DEFINE(HAVE_U_INTXX_T)
1348 AC_MSG_RESULT(yes)
1349 ],
1350 [ AC_MSG_RESULT(no) ]
1351 )
1352fi
1353
Damien Miller578783e2000-09-23 14:12:24 +11001354AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1355 AC_TRY_COMPILE(
1356 [ #include <sys/types.h> ],
1357 [ u_int64_t a; a = 1;],
1358 [ ac_cv_have_u_int64_t="yes" ],
1359 [ ac_cv_have_u_int64_t="no" ]
1360 )
1361])
1362if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1363 AC_DEFINE(HAVE_U_INT64_T)
1364 have_u_int64_t=1
1365fi
1366
Tim Rice4cec93f2002-02-26 08:40:48 -08001367if test -z "$have_u_int64_t" ; then
1368 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1369 AC_TRY_COMPILE(
1370 [ #include <sys/bitypes.h> ],
1371 [ u_int64_t a; a = 1],
1372 [
1373 AC_DEFINE(HAVE_U_INT64_T)
1374 AC_MSG_RESULT(yes)
1375 ],
1376 [ AC_MSG_RESULT(no) ]
1377 )
1378fi
1379
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001380if test -z "$have_u_intxx_t" ; then
1381 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1382 AC_TRY_COMPILE(
1383 [
1384#include <sys/types.h>
1385 ],
1386 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1387 [ ac_cv_have_uintxx_t="yes" ],
1388 [ ac_cv_have_uintxx_t="no" ]
1389 )
1390 ])
1391 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1392 AC_DEFINE(HAVE_UINTXX_T)
1393 fi
1394fi
1395
1396if test -z "$have_uintxx_t" ; then
1397 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1398 AC_TRY_COMPILE(
1399 [ #include <stdint.h> ],
1400 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1401 [
1402 AC_DEFINE(HAVE_UINTXX_T)
1403 AC_MSG_RESULT(yes)
1404 ],
1405 [ AC_MSG_RESULT(no) ]
1406 )
1407fi
1408
Damien Milleredb82922000-06-20 13:25:52 +10001409if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1410 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001411then
1412 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1413 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001414 [
1415#include <sys/bitypes.h>
1416 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001417 [
Damien Miller70494d12000-04-03 15:57:06 +10001418 int8_t a; int16_t b; int32_t c;
1419 u_int8_t e; u_int16_t f; u_int32_t g;
1420 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001421 ],
1422 [
1423 AC_DEFINE(HAVE_U_INTXX_T)
1424 AC_DEFINE(HAVE_INTXX_T)
1425 AC_MSG_RESULT(yes)
1426 ],
1427 [AC_MSG_RESULT(no)]
1428 )
1429fi
1430
Damien Miller58be7382001-09-15 21:31:54 +10001431
1432AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1433 AC_TRY_COMPILE(
1434 [
1435#include <sys/types.h>
1436 ],
1437 [ u_char foo; foo = 125; ],
1438 [ ac_cv_have_u_char="yes" ],
1439 [ ac_cv_have_u_char="no" ]
1440 )
1441])
1442if test "x$ac_cv_have_u_char" = "xyes" ; then
1443 AC_DEFINE(HAVE_U_CHAR)
1444fi
1445
Tim Rice13aae5e2001-10-21 17:53:58 -07001446TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001447
Tim Rice200a5c02002-02-26 22:12:34 -08001448AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001449
Damien Miller61e50f12000-05-08 20:49:37 +10001450AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1451 AC_TRY_COMPILE(
1452 [
1453#include <sys/types.h>
1454 ],
1455 [ size_t foo; foo = 1235; ],
1456 [ ac_cv_have_size_t="yes" ],
1457 [ ac_cv_have_size_t="no" ]
1458 )
1459])
1460if test "x$ac_cv_have_size_t" = "xyes" ; then
1461 AC_DEFINE(HAVE_SIZE_T)
1462fi
Damien Miller95058511999-12-29 10:36:45 +11001463
Damien Miller615f9392000-05-17 22:53:33 +10001464AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1465 AC_TRY_COMPILE(
1466 [
1467#include <sys/types.h>
1468 ],
1469 [ ssize_t foo; foo = 1235; ],
1470 [ ac_cv_have_ssize_t="yes" ],
1471 [ ac_cv_have_ssize_t="no" ]
1472 )
1473])
1474if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1475 AC_DEFINE(HAVE_SSIZE_T)
1476fi
1477
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001478AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1479 AC_TRY_COMPILE(
1480 [
1481#include <time.h>
1482 ],
1483 [ clock_t foo; foo = 1235; ],
1484 [ ac_cv_have_clock_t="yes" ],
1485 [ ac_cv_have_clock_t="no" ]
1486 )
1487])
1488if test "x$ac_cv_have_clock_t" = "xyes" ; then
1489 AC_DEFINE(HAVE_CLOCK_T)
1490fi
1491
Damien Millerb54b40e2000-06-23 08:23:34 +10001492AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1493 AC_TRY_COMPILE(
1494 [
1495#include <sys/types.h>
1496#include <sys/socket.h>
1497 ],
1498 [ sa_family_t foo; foo = 1235; ],
1499 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001500 [ AC_TRY_COMPILE(
1501 [
1502#include <sys/types.h>
1503#include <sys/socket.h>
1504#include <netinet/in.h>
1505 ],
1506 [ sa_family_t foo; foo = 1235; ],
1507 [ ac_cv_have_sa_family_t="yes" ],
1508
Damien Millerb54b40e2000-06-23 08:23:34 +10001509 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001510 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001511 )
1512])
1513if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1514 AC_DEFINE(HAVE_SA_FAMILY_T)
1515fi
1516
Damien Miller0f91b4e2000-06-18 15:43:25 +10001517AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1518 AC_TRY_COMPILE(
1519 [
1520#include <sys/types.h>
1521 ],
1522 [ pid_t foo; foo = 1235; ],
1523 [ ac_cv_have_pid_t="yes" ],
1524 [ ac_cv_have_pid_t="no" ]
1525 )
1526])
1527if test "x$ac_cv_have_pid_t" = "xyes" ; then
1528 AC_DEFINE(HAVE_PID_T)
1529fi
1530
1531AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1532 AC_TRY_COMPILE(
1533 [
1534#include <sys/types.h>
1535 ],
1536 [ mode_t foo; foo = 1235; ],
1537 [ ac_cv_have_mode_t="yes" ],
1538 [ ac_cv_have_mode_t="no" ]
1539 )
1540])
1541if test "x$ac_cv_have_mode_t" = "xyes" ; then
1542 AC_DEFINE(HAVE_MODE_T)
1543fi
1544
Damien Miller61e50f12000-05-08 20:49:37 +10001545
1546AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1547 AC_TRY_COMPILE(
1548 [
Damien Miller81171112000-04-23 11:14:01 +10001549#include <sys/types.h>
1550#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001551 ],
1552 [ struct sockaddr_storage s; ],
1553 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1554 [ ac_cv_have_struct_sockaddr_storage="no" ]
1555 )
1556])
1557if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1558 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1559fi
Damien Miller34132e52000-01-14 15:45:46 +11001560
Damien Miller61e50f12000-05-08 20:49:37 +10001561AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1562 AC_TRY_COMPILE(
1563 [
Damien Miller7b22d652000-06-18 14:07:04 +10001564#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001565#include <netinet/in.h>
1566 ],
1567 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1568 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1569 [ ac_cv_have_struct_sockaddr_in6="no" ]
1570 )
1571])
1572if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1573 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1574fi
Damien Miller34132e52000-01-14 15:45:46 +11001575
Damien Miller61e50f12000-05-08 20:49:37 +10001576AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1577 AC_TRY_COMPILE(
1578 [
Damien Miller7b22d652000-06-18 14:07:04 +10001579#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001580#include <netinet/in.h>
1581 ],
1582 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1583 [ ac_cv_have_struct_in6_addr="yes" ],
1584 [ ac_cv_have_struct_in6_addr="no" ]
1585 )
1586])
1587if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1588 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1589fi
Damien Miller34132e52000-01-14 15:45:46 +11001590
Damien Miller61e50f12000-05-08 20:49:37 +10001591AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1592 AC_TRY_COMPILE(
1593 [
Damien Miller81171112000-04-23 11:14:01 +10001594#include <sys/types.h>
1595#include <sys/socket.h>
1596#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001597 ],
1598 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1599 [ ac_cv_have_struct_addrinfo="yes" ],
1600 [ ac_cv_have_struct_addrinfo="no" ]
1601 )
1602])
1603if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1604 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1605fi
1606
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001607AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1608 AC_TRY_COMPILE(
1609 [ #include <sys/time.h> ],
1610 [ struct timeval tv; tv.tv_sec = 1;],
1611 [ ac_cv_have_struct_timeval="yes" ],
1612 [ ac_cv_have_struct_timeval="no" ]
1613 )
1614])
1615if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1616 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1617 have_struct_timeval=1
1618fi
1619
Tim Rice4e4dc562003-03-18 10:21:40 -08001620AC_CHECK_TYPES(struct timespec)
1621
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001622# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001623if test "x$ac_cv_have_int64_t" = "xno" -a \
1624 "x$ac_cv_sizeof_long_int" != "x8" -a \
1625 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001626 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1627 echo "an alternative compiler (I.E., GCC) before continuing."
1628 echo ""
1629 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001630else
1631dnl test snprintf (broken on SCO w/gcc)
1632 AC_TRY_RUN(
1633 [
1634#include <stdio.h>
1635#include <string.h>
1636#ifdef HAVE_SNPRINTF
1637main()
1638{
1639 char buf[50];
1640 char expected_out[50];
1641 int mazsize = 50 ;
1642#if (SIZEOF_LONG_INT == 8)
1643 long int num = 0x7fffffffffffffff;
1644#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001645 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001646#endif
1647 strcpy(expected_out, "9223372036854775807");
1648 snprintf(buf, mazsize, "%lld", num);
1649 if(strcmp(buf, expected_out) != 0)
1650 exit(1);
1651 exit(0);
1652}
1653#else
1654main() { exit(0); }
1655#endif
1656 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1657 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001658fi
1659
Damien Miller78315eb2000-09-29 23:01:36 +11001660dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001661OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1662OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1663OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1664OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1665OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001666OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001667OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1668OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001669OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001670OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1671OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1672OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1673OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001674OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1675OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1676OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1677OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001678
1679AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001680
Damien Miller61e50f12000-05-08 20:49:37 +10001681AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1682 ac_cv_have_ss_family_in_struct_ss, [
1683 AC_TRY_COMPILE(
1684 [
Damien Miller81171112000-04-23 11:14:01 +10001685#include <sys/types.h>
1686#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001687 ],
1688 [ struct sockaddr_storage s; s.ss_family = 1; ],
1689 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1690 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1691 )
1692])
1693if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1694 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1695fi
1696
Damien Miller61e50f12000-05-08 20:49:37 +10001697AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1698 ac_cv_have___ss_family_in_struct_ss, [
1699 AC_TRY_COMPILE(
1700 [
Damien Miller81171112000-04-23 11:14:01 +10001701#include <sys/types.h>
1702#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001703 ],
1704 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1705 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1706 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1707 )
1708])
1709if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1710 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1711fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001712
Damien Millerad833b32000-08-23 10:46:23 +10001713AC_CACHE_CHECK([for pw_class field in struct passwd],
1714 ac_cv_have_pw_class_in_struct_passwd, [
1715 AC_TRY_COMPILE(
1716 [
Damien Millerad833b32000-08-23 10:46:23 +10001717#include <pwd.h>
1718 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001719 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001720 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1721 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1722 )
1723])
1724if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1725 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1726fi
1727
Kevin Steves82456952001-06-22 21:14:18 +00001728AC_CACHE_CHECK([for pw_expire field in struct passwd],
1729 ac_cv_have_pw_expire_in_struct_passwd, [
1730 AC_TRY_COMPILE(
1731 [
1732#include <pwd.h>
1733 ],
1734 [ struct passwd p; p.pw_expire = 0; ],
1735 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1736 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1737 )
1738])
1739if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1740 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1741fi
1742
1743AC_CACHE_CHECK([for pw_change field in struct passwd],
1744 ac_cv_have_pw_change_in_struct_passwd, [
1745 AC_TRY_COMPILE(
1746 [
1747#include <pwd.h>
1748 ],
1749 [ struct passwd p; p.pw_change = 0; ],
1750 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1751 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1752 )
1753])
1754if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1755 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1756fi
Damien Miller61e50f12000-05-08 20:49:37 +10001757
Tim Rice28bbb0c2002-05-27 17:37:32 -07001758dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001759AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1760 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001761 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001762 [
Tim Riceae49fe62002-04-12 10:26:21 -07001763#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001764#include <sys/socket.h>
1765#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001766int main() {
1767#ifdef msg_accrights
1768exit(1);
1769#endif
1770struct msghdr m;
1771m.msg_accrights = 0;
1772exit(0);
1773}
Kevin Steves939c9db2002-03-22 17:23:25 +00001774 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001775 [ ac_cv_have_accrights_in_msghdr="yes" ],
1776 [ ac_cv_have_accrights_in_msghdr="no" ]
1777 )
1778])
1779if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1780 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1781fi
1782
Kevin Stevesa44e0352002-04-07 16:18:03 +00001783AC_CACHE_CHECK([for msg_control field in struct msghdr],
1784 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001785 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001786 [
Tim Riceae49fe62002-04-12 10:26:21 -07001787#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001788#include <sys/socket.h>
1789#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001790int main() {
1791#ifdef msg_control
1792exit(1);
1793#endif
1794struct msghdr m;
1795m.msg_control = 0;
1796exit(0);
1797}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001798 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001799 [ ac_cv_have_control_in_msghdr="yes" ],
1800 [ ac_cv_have_control_in_msghdr="no" ]
1801 )
1802])
1803if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1804 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1805fi
1806
Damien Miller61e50f12000-05-08 20:49:37 +10001807AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1808 AC_TRY_LINK([],
1809 [ extern char *__progname; printf("%s", __progname); ],
1810 [ ac_cv_libc_defines___progname="yes" ],
1811 [ ac_cv_libc_defines___progname="no" ]
1812 )
1813])
1814if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1815 AC_DEFINE(HAVE___PROGNAME)
1816fi
1817
Kevin Steves4846f4a2002-03-22 18:19:53 +00001818AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1819 AC_TRY_LINK([
1820#include <stdio.h>
1821],
1822 [ printf("%s", __FUNCTION__); ],
1823 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1824 [ ac_cv_cc_implements___FUNCTION__="no" ]
1825 )
1826])
1827if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1828 AC_DEFINE(HAVE___FUNCTION__)
1829fi
1830
1831AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1832 AC_TRY_LINK([
1833#include <stdio.h>
1834],
1835 [ printf("%s", __func__); ],
1836 [ ac_cv_cc_implements___func__="yes" ],
1837 [ ac_cv_cc_implements___func__="no" ]
1838 )
1839])
1840if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1841 AC_DEFINE(HAVE___func__)
1842fi
1843
Damien Miller4f8e6692001-07-14 13:22:53 +10001844AC_CACHE_CHECK([whether getopt has optreset support],
1845 ac_cv_have_getopt_optreset, [
1846 AC_TRY_LINK(
1847 [
1848#include <getopt.h>
1849 ],
1850 [ extern int optreset; optreset = 0; ],
1851 [ ac_cv_have_getopt_optreset="yes" ],
1852 [ ac_cv_have_getopt_optreset="no" ]
1853 )
1854])
1855if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1856 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1857fi
Damien Millera22ba012000-03-02 23:09:20 +11001858
Damien Millerecbb26d2000-07-15 14:59:14 +10001859AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1860 AC_TRY_LINK([],
1861 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1862 [ ac_cv_libc_defines_sys_errlist="yes" ],
1863 [ ac_cv_libc_defines_sys_errlist="no" ]
1864 )
1865])
1866if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1867 AC_DEFINE(HAVE_SYS_ERRLIST)
1868fi
1869
1870
Damien Miller11fa2cc2000-08-16 10:35:58 +10001871AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1872 AC_TRY_LINK([],
1873 [ extern int sys_nerr; printf("%i", sys_nerr);],
1874 [ ac_cv_libc_defines_sys_nerr="yes" ],
1875 [ ac_cv_libc_defines_sys_nerr="no" ]
1876 )
1877])
1878if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1879 AC_DEFINE(HAVE_SYS_NERR)
1880fi
1881
Damien Miller85de5802001-09-18 14:01:11 +10001882SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001883# Check whether user wants sectok support
1884AC_ARG_WITH(sectok,
1885 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001886 [
1887 if test "x$withval" != "xno" ; then
1888 if test "x$withval" != "xyes" ; then
1889 CPPFLAGS="$CPPFLAGS -I${withval}"
1890 LDFLAGS="$LDFLAGS -L${withval}"
1891 if test ! -z "$need_dash_r" ; then
1892 LDFLAGS="$LDFLAGS -R${withval}"
1893 fi
1894 if test ! -z "$blibpath" ; then
1895 blibpath="$blibpath:${withval}"
1896 fi
1897 fi
1898 AC_CHECK_HEADERS(sectok.h)
1899 if test "$ac_cv_header_sectok_h" != yes; then
1900 AC_MSG_ERROR(Can't find sectok.h)
1901 fi
1902 AC_CHECK_LIB(sectok, sectok_open)
1903 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1904 AC_MSG_ERROR(Can't find libsectok)
1905 fi
1906 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001907 AC_DEFINE(USE_SECTOK)
1908 SCARD_MSG="yes, using sectok"
1909 fi
1910 ]
1911)
1912
1913# Check whether user wants OpenSC support
1914AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001915 AC_HELP_STRING([--with-opensc=PFX],
1916 [Enable smartcard support using OpenSC]),
1917 opensc_config_prefix="$withval", opensc_config_prefix="")
1918if test x$opensc_config_prefix != x ; then
1919 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1920 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1921 if test "$OPENSC_CONFIG" != "no"; then
1922 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1923 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1924 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1925 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1926 AC_DEFINE(SMARTCARD)
1927 AC_DEFINE(USE_OPENSC)
1928 SCARD_MSG="yes, using OpenSC"
1929 fi
1930fi
Damien Miller85de5802001-09-18 14:01:11 +10001931
Damien Miller7abe09b2003-05-15 10:53:49 +10001932# Check whether user wants DNS support
1933DNS_MSG="no"
1934AC_ARG_WITH(dns,
1935 [ --with-dns Support for fetching keys from DNS (experimental)],
1936 [
1937 if test "x$withval" != "xno" ; then
Damien Millerd9ec3702003-05-15 12:27:08 +10001938 DNS_MSG="yes"
1939 AC_DEFINE(DNS)
1940 AC_SEARCH_LIBS(getrrsetbyname, resolv,
Damien Miller200d0a72003-06-30 19:21:36 +10001941 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1942 [
1943 # Needed by our getrrsetbyname()
1944 AC_SEARCH_LIBS(res_query, resolv)
1945 AC_SEARCH_LIBS(dn_expand, resolv)
Tim Rice0ac16a42003-09-08 06:33:33 -07001946 AC_CHECK_FUNCS(_getshort _getlong)
Tim Riceb284e162003-09-08 14:35:16 -07001947 AC_CHECK_MEMBER(HEADER.ad,
1948 [AC_DEFINE(HAVE_HEADER_AD)],,
1949 [#include <arpa/nameser.h>])
Damien Miller200d0a72003-06-30 19:21:36 +10001950 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10001951 fi
1952 ]
1953)
1954
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001955# Check whether user wants Kerberos 5 support
1956KRB5_MSG="no"
1957AC_ARG_WITH(kerberos5,
1958 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1959 [
1960 if test "x$withval" != "xno" ; then
1961 if test "x$withval" = "xyes" ; then
1962 KRB5ROOT="/usr/local"
1963 else
1964 KRB5ROOT=${withval}
1965 fi
1966 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1967 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1968 AC_DEFINE(KRB5)
1969 KRB5_MSG="yes"
1970 AC_MSG_CHECKING(whether we are using Heimdal)
1971 AC_TRY_COMPILE([ #include <krb5.h> ],
1972 [ char *tmp = heimdal_version; ],
1973 [ AC_MSG_RESULT(yes)
1974 AC_DEFINE(HEIMDAL)
1975 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1976 ],
1977 [ AC_MSG_RESULT(no)
1978 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1979 ]
1980 )
1981 if test ! -z "$need_dash_r" ; then
1982 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1983 fi
1984 if test ! -z "$blibpath" ; then
1985 blibpath="$blibpath:${KRB5ROOT}/lib"
1986 fi
Damien Miller200d0a72003-06-30 19:21:36 +10001987 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001988
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001989 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1990 [ AC_DEFINE(GSSAPI)
1991 K5LIBS="-lgssapi $K5LIBS" ],
1992 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1993 [ AC_DEFINE(GSSAPI)
1994 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
1995 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
1996 $K5LIBS)
1997 ],
1998 $K5LIBS)
1999
2000 AC_CHECK_HEADER(gssapi.h, ,
2001 [ unset ac_cv_header_gssapi_h
2002 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2003 AC_CHECK_HEADERS(gssapi.h, ,
2004 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2005 )
2006 ]
2007 )
2008
2009 oldCPP="$CPPFLAGS"
2010 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2011 AC_CHECK_HEADER(gssapi_krb5.h, ,
2012 [ CPPFLAGS="$oldCPP" ])
2013
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002014 KRB5=yes
2015 fi
2016 ]
2017)
Darren Tucker6aaa58c2003-08-02 22:24:49 +10002018LIBS="$LIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10002019
Damien Millera22ba012000-03-02 23:09:20 +11002020# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002021
Damien Millerf58c6722002-05-13 13:15:42 +10002022PRIVSEP_PATH=/var/empty
2023AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002024 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002025 [
2026 if test "x$withval" != "$no" ; then
2027 PRIVSEP_PATH=$withval
2028 fi
2029 ]
2030)
2031AC_SUBST(PRIVSEP_PATH)
2032
Damien Millera22ba012000-03-02 23:09:20 +11002033AC_ARG_WITH(xauth,
2034 [ --with-xauth=PATH Specify path to xauth program ],
2035 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002036 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002037 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002038 fi
2039 ],
2040 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002041 TestPath="$PATH"
2042 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2043 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2044 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2045 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2046 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002047 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002048 xauth_path="/usr/openwin/bin/xauth"
2049 fi
2050 ]
2051)
2052
Damien Miller7d901272003-01-13 16:55:22 +11002053STRIP_OPT=-s
2054AC_ARG_ENABLE(strip,
2055 [ --disable-strip Disable calling strip(1) on install],
2056 [
2057 if test "x$enableval" = "xno" ; then
2058 STRIP_OPT=
2059 fi
2060 ]
2061)
2062AC_SUBST(STRIP_OPT)
2063
Damien Millera19cf472000-11-29 13:28:50 +11002064if test -z "$xauth_path" ; then
2065 XAUTH_PATH="undefined"
2066 AC_SUBST(XAUTH_PATH)
2067else
Damien Millera22ba012000-03-02 23:09:20 +11002068 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002069 XAUTH_PATH=$xauth_path
2070 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002071fi
Damien Millera22ba012000-03-02 23:09:20 +11002072
2073# Check for mail directory (last resort if we cannot get it from headers)
2074if test ! -z "$MAIL" ; then
2075 maildir=`dirname $MAIL`
2076 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2077fi
2078
Damien Millera22ba012000-03-02 23:09:20 +11002079if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002080 if test "x$disable_ptmx_check" != "xyes" ; then
2081 AC_CHECK_FILE("/dev/ptmx",
2082 [
2083 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2084 have_dev_ptmx=1
2085 ]
2086 )
2087 fi
Damien Millera22ba012000-03-02 23:09:20 +11002088fi
Damien Miller204ad072000-03-02 23:56:12 +11002089AC_CHECK_FILE("/dev/ptc",
2090 [
2091 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2092 have_dev_ptc=1
2093 ]
2094)
2095
Damien Millera22ba012000-03-02 23:09:20 +11002096# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002097AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002098 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002099 [
Damien Miller897741e2001-04-16 10:41:46 +10002100 case "$withval" in
2101 man|cat|doc)
2102 MANTYPE=$withval
2103 ;;
2104 *)
2105 AC_MSG_ERROR(invalid man type: $withval)
2106 ;;
2107 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002108 ]
2109)
Ben Lindstrombc709922001-04-18 18:04:21 +00002110if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002111 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2112 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002113 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2114 MANTYPE=doc
2115 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2116 MANTYPE=man
2117 else
2118 MANTYPE=cat
2119 fi
2120fi
Damien Miller670a4b82000-01-22 13:53:11 +11002121AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002122if test "$MANTYPE" = "doc"; then
2123 mansubdir=man;
2124else
2125 mansubdir=$MANTYPE;
2126fi
2127AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002128
Damien Millera22ba012000-03-02 23:09:20 +11002129# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10002130MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002131AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002132 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002133 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002134 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002135 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10002136 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002137 fi
2138 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002139)
2140
Damien Millera22ba012000-03-02 23:09:20 +11002141# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002142AC_ARG_WITH(shadow,
2143 [ --without-shadow Disable shadow password support],
2144 [
2145 if test "x$withval" = "xno" ; then
2146 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002147 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002148 fi
2149 ]
2150)
2151
Damien Miller1f335fb2000-06-26 11:31:33 +10002152if test -z "$disable_shadow" ; then
2153 AC_MSG_CHECKING([if the systems has expire shadow information])
2154 AC_TRY_COMPILE(
2155 [
2156#include <sys/types.h>
2157#include <shadow.h>
2158 struct spwd sp;
2159 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2160 [ sp_expire_available=yes ], []
2161 )
2162
2163 if test "x$sp_expire_available" = "xyes" ; then
2164 AC_MSG_RESULT(yes)
2165 AC_DEFINE(HAS_SHADOW_EXPIRE)
2166 else
2167 AC_MSG_RESULT(no)
2168 fi
2169fi
2170
Damien Millera22ba012000-03-02 23:09:20 +11002171# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002172if test ! -z "$IPADDR_IN_DISPLAY" ; then
2173 DISPLAY_HACK_MSG="yes"
2174 AC_DEFINE(IPADDR_IN_DISPLAY)
2175else
2176 DISPLAY_HACK_MSG="no"
2177 AC_ARG_WITH(ipaddr-display,
2178 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2179 [
2180 if test "x$withval" != "xno" ; then
2181 AC_DEFINE(IPADDR_IN_DISPLAY)
2182 DISPLAY_HACK_MSG="yes"
2183 fi
2184 ]
2185 )
2186fi
Damien Miller76112de1999-12-21 11:18:08 +11002187
Darren Tuckere1a790d2003-09-16 11:52:19 +10002188# check for /etc/default/login and use it if present.
2189AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2190
2191if test "x$external_path_file" = "x/etc/default/login"; then
2192 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2193fi
2194
Tim Rice43a1c132002-04-17 21:19:14 -07002195dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2196if test $ac_cv_func_login_getcapbool = "yes" -a \
2197 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002198 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002199fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002200
Damien Millera22ba012000-03-02 23:09:20 +11002201# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002202SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002203AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002204 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002205 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002206 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002207 AC_MSG_WARN([
2208--with-default-path=PATH has no effect on this system.
2209Edit /etc/login.conf instead.])
2210 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002211 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002212 AC_MSG_WARN([
2213--with-default-path=PATH will only be used if PATH is not defined in
2214$external_path_file .])
2215 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002216 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002217 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002218 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002219 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002220 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2221 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002222 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002223 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002224 AC_MSG_WARN([
2225If PATH is defined in $external_path_file, ensure the path to scp is included,
2226otherwise scp will not work.])
2227 fi
2228 AC_TRY_RUN(
2229 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002230/* find out what STDPATH is */
2231#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002232#ifdef HAVE_PATHS_H
2233# include <paths.h>
2234#endif
2235#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002236# ifdef _PATH_USERPATH /* Irix */
2237# define _PATH_STDPATH _PATH_USERPATH
2238# else
2239# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2240# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002241#endif
2242#include <sys/types.h>
2243#include <sys/stat.h>
2244#include <fcntl.h>
2245#define DATA "conftest.stdpath"
2246
2247main()
2248{
2249 FILE *fd;
2250 int rc;
2251
2252 fd = fopen(DATA,"w");
2253 if(fd == NULL)
2254 exit(1);
2255
2256 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2257 exit(1);
2258
2259 exit(0);
2260}
2261 ], [ user_path=`cat conftest.stdpath` ],
2262 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2263 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2264 )
2265# make sure $bindir is in USER_PATH so scp will work
2266 t_bindir=`eval echo ${bindir}`
2267 case $t_bindir in
2268 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2269 esac
2270 case $t_bindir in
2271 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2272 esac
2273 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2274 if test $? -ne 0 ; then
2275 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2276 if test $? -ne 0 ; then
2277 user_path=$user_path:$t_bindir
2278 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2279 fi
2280 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002281 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002282)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002283if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002284 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2285 AC_SUBST(user_path)
2286fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002287
Damien Millera18bbd32002-05-13 10:48:57 +10002288# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002289AC_ARG_WITH(superuser-path,
2290 [ --with-superuser-path= Specify different path for super-user],
2291 [
2292 if test "x$withval" != "xno" ; then
2293 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2294 superuser_path=$withval
2295 fi
2296 ]
2297)
2298
2299
Damien Miller61e50f12000-05-08 20:49:37 +10002300AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002301IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002302AC_ARG_WITH(4in6,
2303 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2304 [
2305 if test "x$withval" != "xno" ; then
2306 AC_MSG_RESULT(yes)
2307 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002308 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002309 else
2310 AC_MSG_RESULT(no)
2311 fi
2312 ],[
2313 if test "x$inet6_default_4in6" = "xyes"; then
2314 AC_MSG_RESULT([yes (default)])
2315 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002316 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002317 else
2318 AC_MSG_RESULT([no (default)])
2319 fi
2320 ]
2321)
2322
Damien Miller60396b02001-02-18 17:01:00 +11002323# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002324BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002325AC_ARG_WITH(bsd-auth,
2326 [ --with-bsd-auth Enable BSD auth support],
2327 [
2328 if test "x$withval" != "xno" ; then
2329 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002330 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002331 fi
2332 ]
2333)
2334
Damien Millera22ba012000-03-02 23:09:20 +11002335# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002336piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002337# make sure the directory exists
2338if test ! -d $piddir ; then
2339 piddir=`eval echo ${sysconfdir}`
2340 case $piddir in
2341 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2342 esac
2343fi
2344
Tim Rice88f2ab52002-03-17 12:17:34 -08002345AC_ARG_WITH(pid-dir,
2346 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2347 [
2348 if test "x$withval" != "xno" ; then
2349 piddir=$withval
2350 if test ! -d $piddir ; then
2351 AC_MSG_WARN([** no $piddir directory on this system **])
2352 fi
2353 fi
2354 ]
2355)
2356
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002357AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002358AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002359
andre2ff7b5d2000-06-03 14:57:40 +00002360dnl allow user to disable some login recording features
2361AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002362 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002363 [
2364 if test "x$enableval" = "xno" ; then
2365 AC_DEFINE(DISABLE_LASTLOG)
2366 fi
2367 ]
andre2ff7b5d2000-06-03 14:57:40 +00002368)
2369AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002370 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002371 [
2372 if test "x$enableval" = "xno" ; then
2373 AC_DEFINE(DISABLE_UTMP)
2374 fi
2375 ]
andre2ff7b5d2000-06-03 14:57:40 +00002376)
2377AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002378 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002379 [
2380 if test "x$enableval" = "xno" ; then
2381 AC_DEFINE(DISABLE_UTMPX)
2382 fi
2383 ]
andre2ff7b5d2000-06-03 14:57:40 +00002384)
2385AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002386 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002387 [
2388 if test "x$enableval" = "xno" ; then
2389 AC_DEFINE(DISABLE_WTMP)
2390 fi
2391 ]
andre2ff7b5d2000-06-03 14:57:40 +00002392)
2393AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002394 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002395 [
2396 if test "x$enableval" = "xno" ; then
2397 AC_DEFINE(DISABLE_WTMPX)
2398 fi
2399 ]
andre2ff7b5d2000-06-03 14:57:40 +00002400)
2401AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002402 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002403 [
2404 if test "x$enableval" = "xno" ; then
2405 AC_DEFINE(DISABLE_LOGIN)
2406 fi
2407 ]
andre2ff7b5d2000-06-03 14:57:40 +00002408)
2409AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002410 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002411 [
2412 if test "x$enableval" = "xno" ; then
2413 AC_DEFINE(DISABLE_PUTUTLINE)
2414 fi
2415 ]
andre2ff7b5d2000-06-03 14:57:40 +00002416)
2417AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002418 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002419 [
2420 if test "x$enableval" = "xno" ; then
2421 AC_DEFINE(DISABLE_PUTUTXLINE)
2422 fi
2423 ]
andre2ff7b5d2000-06-03 14:57:40 +00002424)
2425AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002426 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002427 [
2428 if test "x$withval" = "xno" ; then
2429 AC_DEFINE(DISABLE_LASTLOG)
2430 else
2431 conf_lastlog_location=$withval
2432 fi
2433 ]
2434)
andre2ff7b5d2000-06-03 14:57:40 +00002435
2436dnl lastlog, [uw]tmpx? detection
2437dnl NOTE: set the paths in the platform section to avoid the
2438dnl need for command-line parameters
2439dnl lastlog and [uw]tmp are subject to a file search if all else fails
2440
2441dnl lastlog detection
2442dnl NOTE: the code itself will detect if lastlog is a directory
2443AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2444AC_TRY_COMPILE([
2445#include <sys/types.h>
2446#include <utmp.h>
2447#ifdef HAVE_LASTLOG_H
2448# include <lastlog.h>
2449#endif
Damien Miller2994e082000-06-04 15:51:47 +10002450#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002451# include <paths.h>
2452#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002453#ifdef HAVE_LOGIN_H
2454# include <login.h>
2455#endif
andre2ff7b5d2000-06-03 14:57:40 +00002456 ],
2457 [ char *lastlog = LASTLOG_FILE; ],
2458 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002459 [
2460 AC_MSG_RESULT(no)
2461 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2462 AC_TRY_COMPILE([
2463#include <sys/types.h>
2464#include <utmp.h>
2465#ifdef HAVE_LASTLOG_H
2466# include <lastlog.h>
2467#endif
2468#ifdef HAVE_PATHS_H
2469# include <paths.h>
2470#endif
2471 ],
2472 [ char *lastlog = _PATH_LASTLOG; ],
2473 [ AC_MSG_RESULT(yes) ],
2474 [
andree441aa32000-06-12 22:34:38 +00002475 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002476 system_lastlog_path=no
2477 ])
2478 ]
andre2ff7b5d2000-06-03 14:57:40 +00002479)
Damien Miller2994e082000-06-04 15:51:47 +10002480
andre2ff7b5d2000-06-03 14:57:40 +00002481if test -z "$conf_lastlog_location"; then
2482 if test x"$system_lastlog_path" = x"no" ; then
2483 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002484 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002485 conf_lastlog_location=$f
2486 fi
2487 done
2488 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002489 AC_MSG_WARN([** Cannot find lastlog **])
2490 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002491 fi
2492 fi
2493fi
2494
2495if test -n "$conf_lastlog_location"; then
2496 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2497fi
2498
2499dnl utmp detection
2500AC_MSG_CHECKING([if your system defines UTMP_FILE])
2501AC_TRY_COMPILE([
2502#include <sys/types.h>
2503#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002504#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002505# include <paths.h>
2506#endif
2507 ],
2508 [ char *utmp = UTMP_FILE; ],
2509 [ AC_MSG_RESULT(yes) ],
2510 [ AC_MSG_RESULT(no)
2511 system_utmp_path=no ]
2512)
2513if test -z "$conf_utmp_location"; then
2514 if test x"$system_utmp_path" = x"no" ; then
2515 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2516 if test -f $f ; then
2517 conf_utmp_location=$f
2518 fi
2519 done
2520 if test -z "$conf_utmp_location"; then
2521 AC_DEFINE(DISABLE_UTMP)
2522 fi
2523 fi
2524fi
2525if test -n "$conf_utmp_location"; then
2526 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2527fi
2528
2529dnl wtmp detection
2530AC_MSG_CHECKING([if your system defines WTMP_FILE])
2531AC_TRY_COMPILE([
2532#include <sys/types.h>
2533#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002534#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002535# include <paths.h>
2536#endif
2537 ],
2538 [ char *wtmp = WTMP_FILE; ],
2539 [ AC_MSG_RESULT(yes) ],
2540 [ AC_MSG_RESULT(no)
2541 system_wtmp_path=no ]
2542)
2543if test -z "$conf_wtmp_location"; then
2544 if test x"$system_wtmp_path" = x"no" ; then
2545 for f in /usr/adm/wtmp /var/log/wtmp; do
2546 if test -f $f ; then
2547 conf_wtmp_location=$f
2548 fi
2549 done
2550 if test -z "$conf_wtmp_location"; then
2551 AC_DEFINE(DISABLE_WTMP)
2552 fi
2553 fi
2554fi
2555if test -n "$conf_wtmp_location"; then
2556 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2557fi
2558
2559
2560dnl utmpx detection - I don't know any system so perverse as to require
2561dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2562dnl there, though.
2563AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2564AC_TRY_COMPILE([
2565#include <sys/types.h>
2566#include <utmp.h>
2567#ifdef HAVE_UTMPX_H
2568#include <utmpx.h>
2569#endif
Damien Miller2994e082000-06-04 15:51:47 +10002570#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002571# include <paths.h>
2572#endif
2573 ],
2574 [ char *utmpx = UTMPX_FILE; ],
2575 [ AC_MSG_RESULT(yes) ],
2576 [ AC_MSG_RESULT(no)
2577 system_utmpx_path=no ]
2578)
2579if test -z "$conf_utmpx_location"; then
2580 if test x"$system_utmpx_path" = x"no" ; then
2581 AC_DEFINE(DISABLE_UTMPX)
2582 fi
2583else
2584 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2585fi
2586
2587dnl wtmpx detection
2588AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2589AC_TRY_COMPILE([
2590#include <sys/types.h>
2591#include <utmp.h>
2592#ifdef HAVE_UTMPX_H
2593#include <utmpx.h>
2594#endif
Damien Miller2994e082000-06-04 15:51:47 +10002595#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002596# include <paths.h>
2597#endif
2598 ],
2599 [ char *wtmpx = WTMPX_FILE; ],
2600 [ AC_MSG_RESULT(yes) ],
2601 [ AC_MSG_RESULT(no)
2602 system_wtmpx_path=no ]
2603)
2604if test -z "$conf_wtmpx_location"; then
2605 if test x"$system_wtmpx_path" = x"no" ; then
2606 AC_DEFINE(DISABLE_WTMPX)
2607 fi
2608else
2609 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2610fi
2611
Damien Miller4018c192000-04-30 09:30:44 +10002612
Damien Miller29ea30d2000-03-17 10:54:15 +11002613if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002614 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2615 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002616fi
2617
Tim Rice4cec93f2002-02-26 08:40:48 -08002618dnl remove pam and dl because they are in $LIBPAM
2619if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002620 LIBS=`echo $LIBS | sed 's/-lpam //'`
2621fi
2622if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2623 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002624fi
2625
Damien Millerbac2d8a2000-09-05 16:13:06 +11002626AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002627AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2628AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002629
Damien Miller7b22d652000-06-18 14:07:04 +10002630# Print summary of options
2631
Damien Miller7b22d652000-06-18 14:07:04 +10002632# Someone please show me a better way :)
2633A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2634B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2635C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2636D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002637E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002638F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002639G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002640H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2641I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2642J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002643
2644echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002645echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002646echo " User binaries: $B"
2647echo " System binaries: $C"
2648echo " Configuration files: $D"
2649echo " Askpass program: $E"
2650echo " Manual pages: $F"
2651echo " PID file: $G"
2652echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002653if test "x$external_path_file" = "x/etc/login.conf" ; then
2654echo " At runtime, sshd will use the path defined in $external_path_file"
2655echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002656else
Damien Millerf58c6722002-05-13 13:15:42 +10002657echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002658 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002659echo " (If PATH is set in $external_path_file it will be used instead. If"
2660echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2661 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002662fi
Damien Millera18bbd32002-05-13 10:48:57 +10002663if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002664echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002665fi
Damien Millerf58c6722002-05-13 13:15:42 +10002666echo " Manpage format: $MANTYPE"
Damien Miller9d2be482003-05-15 11:12:19 +10002667echo " DNS support: $DNS_MSG"
Damien Miller7abe09b2003-05-15 10:53:49 +10002668echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002669echo " KerberosV support: $KRB5_MSG"
2670echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002671echo " S/KEY support: $SKEY_MSG"
2672echo " TCP Wrappers support: $TCPW_MSG"
2673echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002674echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002675echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2676echo " BSD Auth support: $BSD_AUTH_MSG"
2677echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002678if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002679echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002680fi
2681
Damien Miller7b22d652000-06-18 14:07:04 +10002682echo ""
2683
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002684echo " Host: ${host}"
2685echo " Compiler: ${CC}"
2686echo " Compiler flags: ${CFLAGS}"
2687echo "Preprocessor flags: ${CPPFLAGS}"
2688echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002689echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002690
2691echo ""
2692
Damien Miller82cf0ce2000-12-20 13:34:48 +11002693if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002694 echo "PAM is enabled. You may need to install a PAM control file "
2695 echo "for sshd, otherwise password authentication may fail. "
2696 echo "Example PAM control files can be found in the contrib/ "
2697 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002698 echo ""
2699fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002700
Damien Miller6c21c512002-01-22 21:57:53 +11002701if test ! -z "$RAND_HELPER_CMDHASH" ; then
2702 echo "WARNING: you are using the builtin random number collection "
2703 echo "service. Please read WARNING.RNG and request that your OS "
2704 echo "vendor includes kernel-based random number collection in "
2705 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002706 echo ""
2707fi
Damien Miller60396b02001-02-18 17:01:00 +11002708