blob: b602e915bf32aef4f438c6134946165eecd0f1b3 [file] [log] [blame]
Darren Tuckerbe79af12003-09-22 11:58:21 +10001# $Id: configure.ac,v 1.161 2003/09/22 01:58:21 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)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000204 AC_DEFINE(SETEUID_BREAKS_SETUID)
205 AC_DEFINE(BROKEN_SETREUID)
206 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000207 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000208 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100209 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100210*-*-linux*)
211 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100212 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000213 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100214 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000215 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000216 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
Damien Miller35276252003-06-03 10:14:28 +1000217 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller7bcb0892000-03-11 20:45:40 +1100218 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000219 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000220 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000221 AC_DEFINE(BROKEN_CMSG_TYPE)
222 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000223 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100224 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000225mips-sony-bsd|mips-sony-newsos4)
226 AC_DEFINE(HAVE_NEWS4)
227 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000228 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100229*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000230 check_for_libcrypt_before=1
Damien Millera22ba012000-03-02 23:09:20 +1100231 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100232 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100233*-*-freebsd*)
234 check_for_libcrypt_later=1
235 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000236*-*-bsdi*)
237 AC_DEFINE(SETEUID_BREAKS_SETUID)
238 AC_DEFINE(BROKEN_SETREUID)
239 AC_DEFINE(BROKEN_SETREGID)
240 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000241*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000242 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100243 conf_utmp_location=/etc/utmp
244 conf_wtmp_location=/usr/adm/wtmp
245 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000246 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000247 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000248 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100249 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000250 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000251 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000252 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100253*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000254 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000255 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100256 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100257 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000258 AC_DEFINE(LOGIN_NEEDS_UTMPX)
259 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000260 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000261 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000262 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
263 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000264 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000265 # hardwire lastlog location (can't detect it on some versions)
266 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000267 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
268 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
269 if test "$sol2ver" -ge 8; then
270 AC_MSG_RESULT(yes)
271 AC_DEFINE(DISABLE_UTMP)
272 AC_DEFINE(DISABLE_WTMP)
273 else
274 AC_MSG_RESULT(no)
275 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100276 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000277*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000278 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000279 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100280 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000281 conf_utmp_location=/etc/utmp
282 conf_wtmp_location=/var/adm/wtmp
283 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000284 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000285 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000286*-ncr-sysv*)
287 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
288 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700289 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000290 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000291 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000292 AC_DEFINE(SETEUID_BREAKS_SETUID)
293 AC_DEFINE(BROKEN_SETREUID)
294 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000295 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000296*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000297 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700298 # /usr/ucblib MUST NOT be searched on ReliantUNIX
299 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100300 IPADDR_IN_DISPLAY=yes
301 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000302 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000303 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000304 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700305 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
306 # Attention: always take care to bind libsocket and libnsl before libc,
307 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000308 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100309*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000310 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100311 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100312 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700313 AC_DEFINE(SETEUID_BREAKS_SETUID)
314 AC_DEFINE(BROKEN_SETREUID)
315 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100316 ;;
317*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000318 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100319 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100320 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700321 AC_DEFINE(SETEUID_BREAKS_SETUID)
322 AC_DEFINE(BROKEN_SETREUID)
323 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100324 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100325*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000326 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100327 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100328 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100329*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000330 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100331 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700332 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100333 RANLIB=true
334 no_dev_ptmx=1
335 AC_DEFINE(BROKEN_SYS_TERMIO_H)
336 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000337 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000338 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100339 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Riceae477e92003-09-12 18:15:15 -0700340 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100341 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700342 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700343 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100344 ;;
345*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800346 if test -z "$GCC"; then
347 CFLAGS="$CFLAGS -belf"
348 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000349 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000350 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100351 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000352 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100353 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000354 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000355 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700356 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700357 AC_DEFINE(SETEUID_BREAKS_SETUID)
358 AC_DEFINE(BROKEN_SETREUID)
359 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700360 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100361 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700362 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000363 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000364*-*-unicosmk*)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000365 AC_DEFINE(USE_PIPES)
366 AC_DEFINE(DISABLE_FD_PASSING)
367 LDFLAGS="$LDFLAGS"
368 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
369 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000370 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000371*-*-unicosmp*)
372 AC_DEFINE(WITH_ABBREV_NO_TTY)
373 AC_DEFINE(USE_PIPES)
374 AC_DEFINE(DISABLE_FD_PASSING)
375 LDFLAGS="$LDFLAGS"
376 LIBS="$LIBS -lgen -lacid"
377 MANTYPE=cat
378 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000379*-*-unicos*)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000380 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700381 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700382 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000383 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
384 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
385 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700386 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000387*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000388 AC_MSG_CHECKING(for Digital Unix SIA)
389 no_osfsia=""
390 AC_ARG_WITH(osfsia,
391 [ --with-osfsia Enable Digital Unix SIA],
392 [
393 if test "x$withval" = "xno" ; then
394 AC_MSG_RESULT(disabled)
395 no_osfsia=1
396 fi
397 ],
398 )
399 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000400 if test -f /etc/sia/matrix.conf; then
401 AC_MSG_RESULT(yes)
402 AC_DEFINE(HAVE_OSF_SIA)
403 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000404 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000405 LIBS="$LIBS -lsecurity -ldb -lm -laud"
406 else
407 AC_MSG_RESULT(no)
408 fi
409 fi
Ben Lindstromdc3c7572002-10-04 23:54:54 +0000410 AC_DEFINE(DISABLE_FD_PASSING)
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000411 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tuckered92b212003-09-22 11:26:16 +1000412 AC_DEFINE(SETEIUD_BREAKS_SETUID)
413 AC_DEFINE(BROKEN_SETREUID)
414 AC_DEFINE(BROKEN_SETREGID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000415 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000416 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000417
418*-*-nto-qnx)
419 AC_DEFINE(USE_PIPES)
420 AC_DEFINE(NO_X11_UNIX_SOCKETS)
421 AC_DEFINE(MISSING_NFDBITS)
422 AC_DEFINE(MISSING_HOWMANY)
423 AC_DEFINE(MISSING_FD_MASK)
424 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100425esac
426
Damien Millere37bfc12000-06-05 09:37:43 +1000427# Allow user to specify flags
428AC_ARG_WITH(cflags,
429 [ --with-cflags Specify additional flags to pass to compiler],
430 [
431 if test "x$withval" != "xno" ; then
432 CFLAGS="$CFLAGS $withval"
433 fi
434 ]
435)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000436AC_ARG_WITH(cppflags,
437 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
438 [
439 if test "x$withval" != "xno"; then
440 CPPFLAGS="$CPPFLAGS $withval"
441 fi
442 ]
443)
Damien Millere37bfc12000-06-05 09:37:43 +1000444AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000445 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000446 [
447 if test "x$withval" != "xno" ; then
448 LDFLAGS="$LDFLAGS $withval"
449 fi
450 ]
451)
452AC_ARG_WITH(libs,
453 [ --with-libs Specify additional libraries to link with],
454 [
455 if test "x$withval" != "xno" ; then
456 LIBS="$LIBS $withval"
457 fi
458 ]
459)
460
Darren Tucker6eb93042003-06-29 21:30:41 +1000461AC_MSG_CHECKING(compiler and flags for sanity)
462AC_TRY_RUN([
463#include <stdio.h>
464int main(){exit(0);}
465 ],
466 [ AC_MSG_RESULT(yes) ],
467 [
468 AC_MSG_RESULT(no)
469 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
470 ]
471)
472
Tim Rice4cec93f2002-02-26 08:40:48 -0800473# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000474AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000475 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800476 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000477 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000478 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000479 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
480 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
Ben Lindstrom4b0f1ad2003-02-01 04:43:34 +0000481 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
Tim Rice81ed5182002-09-25 17:38:46 -0700482 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800483 util.h utime.h utmp.h utmpx.h)
484
Damien Millera22ba012000-03-02 23:09:20 +1100485# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700486AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
487AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000488
Damien Millerdf288022001-02-18 13:07:07 +1100489dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700490if test "x$with_tcp_wrappers" != "xno" ; then
491 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
492 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
493 fi
494fi
Damien Millerdf288022001-02-18 13:07:07 +1100495
Tim Rice1e1ef642003-09-11 22:19:31 -0700496dnl IRIX and Solaris 2.5.1 have dirname() in libgen
497AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
498 AC_CHECK_LIB(gen, dirname,[
499 AC_CACHE_CHECK([for broken dirname],
500 ac_cv_have_broken_dirname, [
501 save_LIBS="$LIBS"
502 LIBS="$LIBS -lgen"
503 AC_TRY_RUN(
504 [
505#include <libgen.h>
506#include <string.h>
507
508int main(int argc, char **argv) {
509 char *s, buf[32];
510
511 strncpy(buf,"/etc", 32);
512 s = dirname(buf);
513 if (!s || strncmp(s, "/", 32) != 0) {
514 exit(1);
515 } else {
516 exit(0);
517 }
518}
519 ],
520 [ ac_cv_have_broken_dirname="no" ],
521 [ ac_cv_have_broken_dirname="yes" ]
522 )
523 LIBS="$save_LIBS"
524 ])
525 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
526 LIBS="$LIBS -lgen"
527 AC_DEFINE(HAVE_DIRNAME)
528 AC_CHECK_HEADERS(libgen.h)
529 fi
530 ])
531])
532
533AC_CHECK_FUNC(getspnam, ,
534 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
535AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
536
Damien Miller150c8b52002-02-13 23:06:56 +1100537AC_ARG_WITH(rpath,
538 [ --without-rpath Disable auto-added -R linker paths],
539 [
540 if test "x$withval" = "xno" ; then
541 need_dash_r=""
542 fi
543 if test "x$withval" = "xyes" ; then
544 need_dash_r=1
545 fi
546 ]
547)
548
Tim Rice13aae5e2001-10-21 17:53:58 -0700549dnl zlib is required
550AC_ARG_WITH(zlib,
551 [ --with-zlib=PATH Use zlib in PATH],
552 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000553 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100554 AC_MSG_ERROR([*** zlib is required ***])
555 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700556 if test -d "$withval/lib"; then
557 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700558 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700559 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700560 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700561 fi
562 else
563 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700564 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700565 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700566 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700567 fi
568 fi
569 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700570 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700571 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700572 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700573 fi
574 ]
575)
576
Tim Rice17b93e52001-10-23 22:36:54 -0700577AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100578
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000579dnl UnixWare 2.x
580AC_CHECK_FUNC(strcasecmp,
581 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
582)
583AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700584 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
585 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000586)
Damien Millerab18c411999-11-11 10:40:23 +1100587
Tim Ricee589a292001-11-03 11:09:32 -0800588dnl Checks for libutil functions
589AC_CHECK_HEADERS(libutil.h)
590AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
591AC_CHECK_FUNCS(logout updwtmp logwtmp)
592
Ben Lindstrom8697e082001-02-24 21:41:10 +0000593AC_FUNC_STRFTIME
594
Damien Miller3c027682001-03-14 11:39:45 +1100595# Check for ALTDIRFUNC glob() extension
596AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
597AC_EGREP_CPP(FOUNDIT,
598 [
599 #include <glob.h>
600 #ifdef GLOB_ALTDIRFUNC
601 FOUNDIT
602 #endif
603 ],
604 [
605 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
606 AC_MSG_RESULT(yes)
607 ],
608 [
609 AC_MSG_RESULT(no)
610 ]
611)
Damien Millerab18c411999-11-11 10:40:23 +1100612
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000613# Check for g.gl_matchc glob() extension
614AC_MSG_CHECKING(for gl_matchc field in glob_t)
615AC_EGREP_CPP(FOUNDIT,
616 [
617 #include <glob.h>
618 int main(void){glob_t g; g.gl_matchc = 1;}
619 ],
620 [
621 AC_DEFINE(GLOB_HAS_GL_MATCHC)
622 AC_MSG_RESULT(yes)
623 ],
624 [
625 AC_MSG_RESULT(no)
626 ]
627)
628
Damien Miller18bb4732001-03-28 14:35:30 +1000629AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
630AC_TRY_RUN(
631 [
632#include <sys/types.h>
633#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700634int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000635 ],
636 [AC_MSG_RESULT(yes)],
637 [
638 AC_MSG_RESULT(no)
639 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
640 ]
641)
642
Damien Millerc547bf12001-02-16 10:18:12 +1100643# Check whether user wants S/Key support
644SKEY_MSG="no"
645AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700646 [ --with-skey[[=PATH]] Enable S/Key support
647 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100648 [
649 if test "x$withval" != "xno" ; then
650
651 if test "x$withval" != "xyes" ; then
652 CPPFLAGS="$CPPFLAGS -I${withval}/include"
653 LDFLAGS="$LDFLAGS -L${withval}/lib"
654 fi
655
656 AC_DEFINE(SKEY)
657 LIBS="-lskey $LIBS"
658 SKEY_MSG="yes"
659
Tim Rice4cec93f2002-02-26 08:40:48 -0800660 AC_MSG_CHECKING([for s/key support])
661 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100662 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800663#include <stdio.h>
664#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700665int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800666 ],
667 [AC_MSG_RESULT(yes)],
668 [
669 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100670 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
671 ])
672 fi
673 ]
674)
675
676# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700677TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100678AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700679 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
680 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100681 [
682 if test "x$withval" != "xno" ; then
683 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700684 saved_LDFLAGS="$LDFLAGS"
685 saved_CPPFLAGS="$CPPFLAGS"
686 if test -n "${withval}" -a "${withval}" != "yes"; then
687 if test -d "${withval}/lib"; then
688 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700689 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700690 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700691 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700692 fi
693 else
694 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700695 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700696 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700697 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700698 fi
699 fi
700 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700701 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700702 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700703 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700704 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700705 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800706 LIBWRAP="-lwrap"
707 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100708 AC_MSG_CHECKING(for libwrap)
709 AC_TRY_LINK(
710 [
711#include <tcpd.h>
712 int deny_severity = 0, allow_severity = 0;
713 ],
714 [hosts_access(0);],
715 [
716 AC_MSG_RESULT(yes)
717 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800718 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700719 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100720 ],
721 [
722 AC_MSG_ERROR([*** libwrap missing])
723 ]
724 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800725 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100726 fi
727 ]
728)
729
Damien Millerfe1f1432003-02-24 15:45:42 +1100730dnl Checks for library functions. Please keep in alphabetical order
731AC_CHECK_FUNCS(\
Damien Millerf09ad862003-09-19 16:41:01 +1000732 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
Damien Miller5fe46a42003-06-05 09:53:31 +1000733 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Damien Millerfe1f1432003-02-24 15:45:42 +1100734 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000735 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100736 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000737 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
738 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
739 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Damien Miller5fe46a42003-06-05 09:53:31 +1000740 setproctitle setregid setresgid setresuid setreuid setrlimit \
741 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tuckerb2427c82003-09-10 15:22:44 +1000742 strlcat strlcpy strmode strnvis sysconf tcgetpgrp \
Darren Tuckerf38ea772003-08-13 20:48:07 +1000743 truncate utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100744)
Tim Rice13aae5e2001-10-21 17:53:58 -0700745
Damien Millercd6853c2003-01-28 11:33:42 +1100746AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
747
Darren Tuckerf1159b52003-07-07 19:44:01 +1000748dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000749AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000750AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000751
Darren Tuckerb2427c82003-09-10 15:22:44 +1000752dnl tcsendbreak might be a macro
753AC_CHECK_DECL(tcsendbreak,
754 [AC_DEFINE(HAVE_TCSENDBREAK)],
755 [AC_CHECK_FUNCS(tcsendbreak)],
756 [#include <termios.h>]
757)
758
Damien Millerad833b32000-08-23 10:46:23 +1000759dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000760AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000761dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000762AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000763AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000764dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000765AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000766AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100767
Damien Miller04f80141999-11-19 15:32:34 +1100768AC_CHECK_FUNC(daemon,
769 [AC_DEFINE(HAVE_DAEMON)],
770 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
771)
772
Damien Miller9fb07e42000-03-05 16:22:59 +1100773AC_CHECK_FUNC(getpagesize,
774 [AC_DEFINE(HAVE_GETPAGESIZE)],
775 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
776)
777
Damien Millercb170cb2000-07-01 16:52:55 +1000778# Check for broken snprintf
779if test "x$ac_cv_func_snprintf" = "xyes" ; then
780 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
781 AC_TRY_RUN(
782 [
783#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700784int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000785 ],
786 [AC_MSG_RESULT(yes)],
787 [
788 AC_MSG_RESULT(no)
789 AC_DEFINE(BROKEN_SNPRINTF)
790 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
791 ]
792 )
793fi
794
Damien Millere8328192003-01-07 15:18:32 +1100795dnl see whether mkstemp() requires XXXXXX
796if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
797AC_MSG_CHECKING([for (overly) strict mkstemp])
798AC_TRY_RUN(
799 [
800#include <stdlib.h>
801main() { char template[]="conftest.mkstemp-test";
802if (mkstemp(template) == -1)
803 exit(1);
804unlink(template); exit(0);
805}
806 ],
807 [
808 AC_MSG_RESULT(no)
809 ],
810 [
811 AC_MSG_RESULT(yes)
812 AC_DEFINE(HAVE_STRICT_MKSTEMP)
813 ],
814 [
815 AC_MSG_RESULT(yes)
816 AC_DEFINE(HAVE_STRICT_MKSTEMP)
817 ]
818)
819fi
820
Darren Tucker70a3d552003-08-21 17:58:29 +1000821dnl make sure that openpty does not reacquire controlling terminal
822if test ! -z "$check_for_openpty_ctty_bug"; then
823 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
824 AC_TRY_RUN(
825 [
826#include <stdio.h>
827#include <sys/fcntl.h>
828#include <sys/types.h>
829#include <sys/wait.h>
830
831int
832main()
833{
834 pid_t pid;
835 int fd, ptyfd, ttyfd, status;
836
837 pid = fork();
838 if (pid < 0) { /* failed */
839 exit(1);
840 } else if (pid > 0) { /* parent */
841 waitpid(pid, &status, 0);
842 if (WIFEXITED(status))
843 exit(WEXITSTATUS(status));
844 else
845 exit(2);
846 } else { /* child */
847 close(0); close(1); close(2);
848 setsid();
849 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
850 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
851 if (fd >= 0)
852 exit(3); /* Acquired ctty: broken */
853 else
854 exit(0); /* Did not acquire ctty: OK */
855 }
856}
857 ],
858 [
859 AC_MSG_RESULT(yes)
860 ],
861 [
862 AC_MSG_RESULT(no)
863 AC_DEFINE(SSHD_ACQUIRES_CTTY)
864 ]
865 )
866fi
867
Damien Miller606f8802000-09-16 15:39:56 +1100868AC_FUNC_GETPGRP
869
Damien Millera64b57a2001-01-17 10:44:13 +1100870# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000871PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100872AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100873 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100874 [
Damien Millera64b57a2001-01-17 10:44:13 +1100875 if test "x$withval" != "xno" ; then
876 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
877 AC_MSG_ERROR([PAM headers not found])
878 fi
879
880 AC_CHECK_LIB(dl, dlopen, , )
881 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
882 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000883 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +1100884
885 disable_shadow=yes
886 PAM_MSG="yes"
887
888 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800889 if test $ac_cv_lib_dl_dlopen = yes; then
890 LIBPAM="-lpam -ldl"
891 else
892 LIBPAM="-lpam"
893 fi
894 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100895 fi
896 ]
897)
Damien Millera22ba012000-03-02 23:09:20 +1100898
Damien Millera64b57a2001-01-17 10:44:13 +1100899# Check for older PAM
900if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100901 # Check PAM strerror arguments (old PAM)
902 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
903 AC_TRY_COMPILE(
904 [
Damien Miller81171112000-04-23 11:14:01 +1000905#include <stdlib.h>
906#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100907 ],
908 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
909 [AC_MSG_RESULT(no)],
910 [
911 AC_DEFINE(HAVE_OLD_PAM)
912 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000913 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100914 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100915 )
Damien Millera22ba012000-03-02 23:09:20 +1100916fi
917
Damien Millerfc93d4b2002-09-04 23:26:29 +1000918# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
919# because the system crypt() is more featureful.
920if test "x$check_for_libcrypt_before" = "x1"; then
921 AC_CHECK_LIB(crypt, crypt)
922fi
923
Tim Riceaef73712002-05-11 13:17:42 -0700924# Search for OpenSSL
925saved_CPPFLAGS="$CPPFLAGS"
926saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100927AC_ARG_WITH(ssl-dir,
928 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
929 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000930 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700931 if test -d "$withval/lib"; then
932 if test -n "${need_dash_r}"; then
933 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
934 else
935 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
936 fi
937 else
938 if test -n "${need_dash_r}"; then
939 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
940 else
941 LDFLAGS="-L${withval} ${LDFLAGS}"
942 fi
943 fi
944 if test -d "$withval/include"; then
945 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
946 else
947 CPPFLAGS="-I${withval} ${CPPFLAGS}"
948 fi
Damien Millera22ba012000-03-02 23:09:20 +1100949 fi
950 ]
951)
Tim Riceaef73712002-05-11 13:17:42 -0700952LIBS="$LIBS -lcrypto"
953AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000954 [
Tim Riceaef73712002-05-11 13:17:42 -0700955 dnl Check default openssl install dir
956 if test -n "${need_dash_r}"; then
957 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000958 else
Tim Riceaef73712002-05-11 13:17:42 -0700959 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000960 fi
Tim Riceaef73712002-05-11 13:17:42 -0700961 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
962 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
963 [
964 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
965 ]
966 )
967 ]
968)
969
Tim Riced730b782002-08-13 18:52:10 -0700970# Determine OpenSSL header version
971AC_MSG_CHECKING([OpenSSL header version])
972AC_TRY_RUN(
973 [
974#include <stdio.h>
975#include <string.h>
976#include <openssl/opensslv.h>
977#define DATA "conftest.sslincver"
978int main(void) {
979 FILE *fd;
980 int rc;
981
982 fd = fopen(DATA,"w");
983 if(fd == NULL)
984 exit(1);
985
986 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
987 exit(1);
988
989 exit(0);
990}
991 ],
992 [
993 ssl_header_ver=`cat conftest.sslincver`
994 AC_MSG_RESULT($ssl_header_ver)
995 ],
996 [
997 AC_MSG_RESULT(not found)
998 AC_MSG_ERROR(OpenSSL version header not found.)
999 ]
1000)
1001
1002# Determine OpenSSL library version
1003AC_MSG_CHECKING([OpenSSL library version])
1004AC_TRY_RUN(
1005 [
1006#include <stdio.h>
1007#include <string.h>
1008#include <openssl/opensslv.h>
1009#include <openssl/crypto.h>
1010#define DATA "conftest.ssllibver"
1011int main(void) {
1012 FILE *fd;
1013 int rc;
1014
1015 fd = fopen(DATA,"w");
1016 if(fd == NULL)
1017 exit(1);
1018
1019 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1020 exit(1);
1021
1022 exit(0);
1023}
1024 ],
1025 [
1026 ssl_library_ver=`cat conftest.ssllibver`
1027 AC_MSG_RESULT($ssl_library_ver)
1028 ],
1029 [
1030 AC_MSG_RESULT(not found)
1031 AC_MSG_ERROR(OpenSSL library not found.)
1032 ]
1033)
Damien Millera22ba012000-03-02 23:09:20 +11001034
Damien Millerec932372002-01-22 22:16:03 +11001035# Sanity check OpenSSL headers
1036AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1037AC_TRY_RUN(
1038 [
1039#include <string.h>
1040#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001041int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001042 ],
1043 [
1044 AC_MSG_RESULT(yes)
1045 ],
1046 [
1047 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001048 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1049Check config.log for details.
1050Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001051 ]
1052)
1053
Damien Millera64b57a2001-01-17 10:44:13 +11001054# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1055# version in OpenSSL. Skip this for PAM
Damien Miller4f9f42a2003-05-10 19:28:02 +10001056if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001057 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001058fi
1059
Damien Miller6c21c512002-01-22 21:57:53 +11001060
1061### Configure cryptographic random number support
1062
1063# Check wheter OpenSSL seeds itself
1064AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1065AC_TRY_RUN(
1066 [
1067#include <string.h>
1068#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001069int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001070 ],
1071 [
1072 OPENSSL_SEEDS_ITSELF=yes
1073 AC_MSG_RESULT(yes)
1074 ],
1075 [
1076 AC_MSG_RESULT(no)
1077 # Default to use of the rand helper if OpenSSL doesn't
1078 # seed itself
1079 USE_RAND_HELPER=yes
1080 ]
1081)
1082
1083
1084# Do we want to force the use of the rand helper?
1085AC_ARG_WITH(rand-helper,
1086 [ --with-rand-helper Use subprocess to gather strong randomness ],
1087 [
1088 if test "x$withval" = "xno" ; then
1089 # Force use of OpenSSL's internal RNG, even if
1090 # the previous test showed it to be unseeded.
1091 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1092 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1093 OPENSSL_SEEDS_ITSELF=yes
1094 USE_RAND_HELPER=""
1095 fi
1096 else
1097 USE_RAND_HELPER=yes
1098 fi
1099 ],
1100)
1101
1102# Which randomness source do we use?
1103if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1104 # OpenSSL only
1105 AC_DEFINE(OPENSSL_PRNG_ONLY)
1106 RAND_MSG="OpenSSL internal ONLY"
1107 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001108elif test ! -z "$USE_RAND_HELPER" ; then
1109 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001110 RAND_MSG="ssh-rand-helper"
1111 INSTALL_SSH_RAND_HELPER="yes"
1112fi
1113AC_SUBST(INSTALL_SSH_RAND_HELPER)
1114
1115### Configuration of ssh-rand-helper
1116
1117# PRNGD TCP socket
1118AC_ARG_WITH(prngd-port,
1119 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1120 [
Damien Millere996d722002-01-23 11:20:59 +11001121 case "$withval" in
1122 no)
1123 withval=""
1124 ;;
1125 [[0-9]]*)
1126 ;;
1127 *)
1128 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1129 ;;
1130 esac
1131 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001132 PRNGD_PORT="$withval"
1133 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1134 fi
1135 ]
1136)
1137
1138# PRNGD Unix domain socket
1139AC_ARG_WITH(prngd-socket,
1140 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1141 [
Damien Millere996d722002-01-23 11:20:59 +11001142 case "$withval" in
1143 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001144 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001145 ;;
1146 no)
1147 withval=""
1148 ;;
1149 /*)
1150 ;;
1151 *)
1152 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1153 ;;
1154 esac
1155
1156 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001157 if test ! -z "$PRNGD_PORT" ; then
1158 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1159 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001160 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001161 AC_MSG_WARN(Entropy socket is not readable)
1162 fi
1163 PRNGD_SOCKET="$withval"
1164 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1165 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001166 ],
1167 [
1168 # Check for existing socket only if we don't have a random device already
1169 if test "$USE_RAND_HELPER" = yes ; then
1170 AC_MSG_CHECKING(for PRNGD/EGD socket)
1171 # Insert other locations here
1172 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1173 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1174 PRNGD_SOCKET="$sock"
1175 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1176 break;
1177 fi
1178 done
1179 if test ! -z "$PRNGD_SOCKET" ; then
1180 AC_MSG_RESULT($PRNGD_SOCKET)
1181 else
1182 AC_MSG_RESULT(not found)
1183 fi
1184 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001185 ]
1186)
1187
1188# Change default command timeout for hashing entropy source
1189entropy_timeout=200
1190AC_ARG_WITH(entropy-timeout,
1191 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1192 [
1193 if test "x$withval" != "xno" ; then
1194 entropy_timeout=$withval
1195 fi
1196 ]
1197)
Damien Miller6c21c512002-01-22 21:57:53 +11001198AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1199
Damien Millerd3f6ad22002-06-25 10:24:47 +10001200SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001201AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001202 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001203 [
1204 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001205 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001206 fi
1207 ]
1208)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001209AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1210AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001211
Tim Rice88f2ab52002-03-17 12:17:34 -08001212# We do this little dance with the search path to insure
1213# that programs that we select for use by installed programs
1214# (which may be run by the super-user) come from trusted
1215# locations before they come from the user's private area.
1216# This should help avoid accidentally configuring some
1217# random version of a program in someone's personal bin.
1218
1219OPATH=$PATH
1220PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001221test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001222test -d /sbin && PATH=$PATH:/sbin
1223test -d /usr/sbin && PATH=$PATH:/usr/sbin
1224PATH=$PATH:/etc:$OPATH
1225
Damien Miller6c21c512002-01-22 21:57:53 +11001226# These programs are used by the command hashing source to gather entropy
1227OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1228OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1229OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1230OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1231OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1232OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1233OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1234OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1235OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1236OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1237OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1238OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1239OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1240OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1241OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1242OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001243# restore PATH
1244PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001245
1246# Where does ssh-rand-helper get its randomness from?
1247INSTALL_SSH_PRNG_CMDS=""
1248if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1249 if test ! -z "$PRNGD_PORT" ; then
1250 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1251 elif test ! -z "$PRNGD_SOCKET" ; then
1252 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1253 else
1254 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1255 RAND_HELPER_CMDHASH=yes
1256 INSTALL_SSH_PRNG_CMDS="yes"
1257 fi
1258fi
1259AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1260
1261
Ben Lindstromb5628642000-10-18 00:02:25 +00001262# Cheap hack to ensure NEWS-OS libraries are arranged right.
1263if test ! -z "$SONY" ; then
1264 LIBS="$LIBS -liberty";
1265fi
1266
Damien Millera22ba012000-03-02 23:09:20 +11001267# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001268AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001269AC_CHECK_SIZEOF(short int, 2)
1270AC_CHECK_SIZEOF(int, 4)
1271AC_CHECK_SIZEOF(long int, 4)
1272AC_CHECK_SIZEOF(long long int, 8)
1273
Damien Millerfa2bb692002-04-23 23:22:25 +10001274# Sanity check long long for some platforms (AIX)
1275if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1276 ac_cv_sizeof_long_long_int=0
1277fi
1278
Damien Millera22ba012000-03-02 23:09:20 +11001279# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001280AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1281 AC_TRY_COMPILE(
1282 [ #include <sys/types.h> ],
1283 [ u_int a; a = 1;],
1284 [ ac_cv_have_u_int="yes" ],
1285 [ ac_cv_have_u_int="no" ]
1286 )
1287])
1288if test "x$ac_cv_have_u_int" = "xyes" ; then
1289 AC_DEFINE(HAVE_U_INT)
1290 have_u_int=1
1291fi
1292
Damien Miller61e50f12000-05-08 20:49:37 +10001293AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1294 AC_TRY_COMPILE(
1295 [ #include <sys/types.h> ],
1296 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1297 [ ac_cv_have_intxx_t="yes" ],
1298 [ ac_cv_have_intxx_t="no" ]
1299 )
1300])
1301if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1302 AC_DEFINE(HAVE_INTXX_T)
1303 have_intxx_t=1
1304fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001305
1306if (test -z "$have_intxx_t" && \
1307 test "x$ac_cv_header_stdint_h" = "xyes")
1308then
1309 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1310 AC_TRY_COMPILE(
1311 [ #include <stdint.h> ],
1312 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1313 [
1314 AC_DEFINE(HAVE_INTXX_T)
1315 AC_MSG_RESULT(yes)
1316 ],
1317 [ AC_MSG_RESULT(no) ]
1318 )
1319fi
1320
Damien Miller578783e2000-09-23 14:12:24 +11001321AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1322 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001323 [
1324#include <sys/types.h>
1325#ifdef HAVE_STDINT_H
1326# include <stdint.h>
1327#endif
1328#include <sys/socket.h>
1329#ifdef HAVE_SYS_BITYPES_H
1330# include <sys/bitypes.h>
1331#endif
1332 ],
Damien Miller578783e2000-09-23 14:12:24 +11001333 [ int64_t a; a = 1;],
1334 [ ac_cv_have_int64_t="yes" ],
1335 [ ac_cv_have_int64_t="no" ]
1336 )
1337])
1338if test "x$ac_cv_have_int64_t" = "xyes" ; then
1339 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001340fi
1341
Damien Miller61e50f12000-05-08 20:49:37 +10001342AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1343 AC_TRY_COMPILE(
1344 [ #include <sys/types.h> ],
1345 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1346 [ ac_cv_have_u_intxx_t="yes" ],
1347 [ ac_cv_have_u_intxx_t="no" ]
1348 )
1349])
1350if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1351 AC_DEFINE(HAVE_U_INTXX_T)
1352 have_u_intxx_t=1
1353fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001354
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001355if test -z "$have_u_intxx_t" ; then
1356 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1357 AC_TRY_COMPILE(
1358 [ #include <sys/socket.h> ],
1359 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1360 [
1361 AC_DEFINE(HAVE_U_INTXX_T)
1362 AC_MSG_RESULT(yes)
1363 ],
1364 [ AC_MSG_RESULT(no) ]
1365 )
1366fi
1367
Damien Miller578783e2000-09-23 14:12:24 +11001368AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1369 AC_TRY_COMPILE(
1370 [ #include <sys/types.h> ],
1371 [ u_int64_t a; a = 1;],
1372 [ ac_cv_have_u_int64_t="yes" ],
1373 [ ac_cv_have_u_int64_t="no" ]
1374 )
1375])
1376if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1377 AC_DEFINE(HAVE_U_INT64_T)
1378 have_u_int64_t=1
1379fi
1380
Tim Rice4cec93f2002-02-26 08:40:48 -08001381if test -z "$have_u_int64_t" ; then
1382 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1383 AC_TRY_COMPILE(
1384 [ #include <sys/bitypes.h> ],
1385 [ u_int64_t a; a = 1],
1386 [
1387 AC_DEFINE(HAVE_U_INT64_T)
1388 AC_MSG_RESULT(yes)
1389 ],
1390 [ AC_MSG_RESULT(no) ]
1391 )
1392fi
1393
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001394if test -z "$have_u_intxx_t" ; then
1395 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1396 AC_TRY_COMPILE(
1397 [
1398#include <sys/types.h>
1399 ],
1400 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1401 [ ac_cv_have_uintxx_t="yes" ],
1402 [ ac_cv_have_uintxx_t="no" ]
1403 )
1404 ])
1405 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1406 AC_DEFINE(HAVE_UINTXX_T)
1407 fi
1408fi
1409
1410if test -z "$have_uintxx_t" ; then
1411 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1412 AC_TRY_COMPILE(
1413 [ #include <stdint.h> ],
1414 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1415 [
1416 AC_DEFINE(HAVE_UINTXX_T)
1417 AC_MSG_RESULT(yes)
1418 ],
1419 [ AC_MSG_RESULT(no) ]
1420 )
1421fi
1422
Damien Milleredb82922000-06-20 13:25:52 +10001423if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1424 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001425then
1426 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1427 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001428 [
1429#include <sys/bitypes.h>
1430 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001431 [
Damien Miller70494d12000-04-03 15:57:06 +10001432 int8_t a; int16_t b; int32_t c;
1433 u_int8_t e; u_int16_t f; u_int32_t g;
1434 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001435 ],
1436 [
1437 AC_DEFINE(HAVE_U_INTXX_T)
1438 AC_DEFINE(HAVE_INTXX_T)
1439 AC_MSG_RESULT(yes)
1440 ],
1441 [AC_MSG_RESULT(no)]
1442 )
1443fi
1444
Damien Miller58be7382001-09-15 21:31:54 +10001445
1446AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1447 AC_TRY_COMPILE(
1448 [
1449#include <sys/types.h>
1450 ],
1451 [ u_char foo; foo = 125; ],
1452 [ ac_cv_have_u_char="yes" ],
1453 [ ac_cv_have_u_char="no" ]
1454 )
1455])
1456if test "x$ac_cv_have_u_char" = "xyes" ; then
1457 AC_DEFINE(HAVE_U_CHAR)
1458fi
1459
Tim Rice13aae5e2001-10-21 17:53:58 -07001460TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001461
Tim Rice200a5c02002-02-26 22:12:34 -08001462AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001463
Damien Miller61e50f12000-05-08 20:49:37 +10001464AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1465 AC_TRY_COMPILE(
1466 [
1467#include <sys/types.h>
1468 ],
1469 [ size_t foo; foo = 1235; ],
1470 [ ac_cv_have_size_t="yes" ],
1471 [ ac_cv_have_size_t="no" ]
1472 )
1473])
1474if test "x$ac_cv_have_size_t" = "xyes" ; then
1475 AC_DEFINE(HAVE_SIZE_T)
1476fi
Damien Miller95058511999-12-29 10:36:45 +11001477
Damien Miller615f9392000-05-17 22:53:33 +10001478AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1479 AC_TRY_COMPILE(
1480 [
1481#include <sys/types.h>
1482 ],
1483 [ ssize_t foo; foo = 1235; ],
1484 [ ac_cv_have_ssize_t="yes" ],
1485 [ ac_cv_have_ssize_t="no" ]
1486 )
1487])
1488if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1489 AC_DEFINE(HAVE_SSIZE_T)
1490fi
1491
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001492AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1493 AC_TRY_COMPILE(
1494 [
1495#include <time.h>
1496 ],
1497 [ clock_t foo; foo = 1235; ],
1498 [ ac_cv_have_clock_t="yes" ],
1499 [ ac_cv_have_clock_t="no" ]
1500 )
1501])
1502if test "x$ac_cv_have_clock_t" = "xyes" ; then
1503 AC_DEFINE(HAVE_CLOCK_T)
1504fi
1505
Damien Millerb54b40e2000-06-23 08:23:34 +10001506AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1507 AC_TRY_COMPILE(
1508 [
1509#include <sys/types.h>
1510#include <sys/socket.h>
1511 ],
1512 [ sa_family_t foo; foo = 1235; ],
1513 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001514 [ AC_TRY_COMPILE(
1515 [
1516#include <sys/types.h>
1517#include <sys/socket.h>
1518#include <netinet/in.h>
1519 ],
1520 [ sa_family_t foo; foo = 1235; ],
1521 [ ac_cv_have_sa_family_t="yes" ],
1522
Damien Millerb54b40e2000-06-23 08:23:34 +10001523 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001524 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001525 )
1526])
1527if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1528 AC_DEFINE(HAVE_SA_FAMILY_T)
1529fi
1530
Damien Miller0f91b4e2000-06-18 15:43:25 +10001531AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1532 AC_TRY_COMPILE(
1533 [
1534#include <sys/types.h>
1535 ],
1536 [ pid_t foo; foo = 1235; ],
1537 [ ac_cv_have_pid_t="yes" ],
1538 [ ac_cv_have_pid_t="no" ]
1539 )
1540])
1541if test "x$ac_cv_have_pid_t" = "xyes" ; then
1542 AC_DEFINE(HAVE_PID_T)
1543fi
1544
1545AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1546 AC_TRY_COMPILE(
1547 [
1548#include <sys/types.h>
1549 ],
1550 [ mode_t foo; foo = 1235; ],
1551 [ ac_cv_have_mode_t="yes" ],
1552 [ ac_cv_have_mode_t="no" ]
1553 )
1554])
1555if test "x$ac_cv_have_mode_t" = "xyes" ; then
1556 AC_DEFINE(HAVE_MODE_T)
1557fi
1558
Damien Miller61e50f12000-05-08 20:49:37 +10001559
1560AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1561 AC_TRY_COMPILE(
1562 [
Damien Miller81171112000-04-23 11:14:01 +10001563#include <sys/types.h>
1564#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001565 ],
1566 [ struct sockaddr_storage s; ],
1567 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1568 [ ac_cv_have_struct_sockaddr_storage="no" ]
1569 )
1570])
1571if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1572 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1573fi
Damien Miller34132e52000-01-14 15:45:46 +11001574
Damien Miller61e50f12000-05-08 20:49:37 +10001575AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1576 AC_TRY_COMPILE(
1577 [
Damien Miller7b22d652000-06-18 14:07:04 +10001578#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001579#include <netinet/in.h>
1580 ],
1581 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1582 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1583 [ ac_cv_have_struct_sockaddr_in6="no" ]
1584 )
1585])
1586if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1587 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1588fi
Damien Miller34132e52000-01-14 15:45:46 +11001589
Damien Miller61e50f12000-05-08 20:49:37 +10001590AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1591 AC_TRY_COMPILE(
1592 [
Damien Miller7b22d652000-06-18 14:07:04 +10001593#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001594#include <netinet/in.h>
1595 ],
1596 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1597 [ ac_cv_have_struct_in6_addr="yes" ],
1598 [ ac_cv_have_struct_in6_addr="no" ]
1599 )
1600])
1601if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1602 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1603fi
Damien Miller34132e52000-01-14 15:45:46 +11001604
Damien Miller61e50f12000-05-08 20:49:37 +10001605AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1606 AC_TRY_COMPILE(
1607 [
Damien Miller81171112000-04-23 11:14:01 +10001608#include <sys/types.h>
1609#include <sys/socket.h>
1610#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001611 ],
1612 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1613 [ ac_cv_have_struct_addrinfo="yes" ],
1614 [ ac_cv_have_struct_addrinfo="no" ]
1615 )
1616])
1617if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1618 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1619fi
1620
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001621AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1622 AC_TRY_COMPILE(
1623 [ #include <sys/time.h> ],
1624 [ struct timeval tv; tv.tv_sec = 1;],
1625 [ ac_cv_have_struct_timeval="yes" ],
1626 [ ac_cv_have_struct_timeval="no" ]
1627 )
1628])
1629if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1630 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1631 have_struct_timeval=1
1632fi
1633
Tim Rice4e4dc562003-03-18 10:21:40 -08001634AC_CHECK_TYPES(struct timespec)
1635
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001636# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001637if test "x$ac_cv_have_int64_t" = "xno" -a \
1638 "x$ac_cv_sizeof_long_int" != "x8" -a \
1639 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001640 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1641 echo "an alternative compiler (I.E., GCC) before continuing."
1642 echo ""
1643 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001644else
1645dnl test snprintf (broken on SCO w/gcc)
1646 AC_TRY_RUN(
1647 [
1648#include <stdio.h>
1649#include <string.h>
1650#ifdef HAVE_SNPRINTF
1651main()
1652{
1653 char buf[50];
1654 char expected_out[50];
1655 int mazsize = 50 ;
1656#if (SIZEOF_LONG_INT == 8)
1657 long int num = 0x7fffffffffffffff;
1658#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001659 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001660#endif
1661 strcpy(expected_out, "9223372036854775807");
1662 snprintf(buf, mazsize, "%lld", num);
1663 if(strcmp(buf, expected_out) != 0)
1664 exit(1);
1665 exit(0);
1666}
1667#else
1668main() { exit(0); }
1669#endif
1670 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1671 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001672fi
1673
Damien Miller78315eb2000-09-29 23:01:36 +11001674dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001675OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1676OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1677OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1678OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1679OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001680OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001681OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1682OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001683OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001684OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1685OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1686OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1687OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001688OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1689OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1690OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1691OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001692
1693AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001694
Damien Miller61e50f12000-05-08 20:49:37 +10001695AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1696 ac_cv_have_ss_family_in_struct_ss, [
1697 AC_TRY_COMPILE(
1698 [
Damien Miller81171112000-04-23 11:14:01 +10001699#include <sys/types.h>
1700#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001701 ],
1702 [ struct sockaddr_storage s; s.ss_family = 1; ],
1703 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1704 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1705 )
1706])
1707if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1708 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1709fi
1710
Damien Miller61e50f12000-05-08 20:49:37 +10001711AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1712 ac_cv_have___ss_family_in_struct_ss, [
1713 AC_TRY_COMPILE(
1714 [
Damien Miller81171112000-04-23 11:14:01 +10001715#include <sys/types.h>
1716#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001717 ],
1718 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1719 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1720 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1721 )
1722])
1723if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1724 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1725fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001726
Damien Millerad833b32000-08-23 10:46:23 +10001727AC_CACHE_CHECK([for pw_class field in struct passwd],
1728 ac_cv_have_pw_class_in_struct_passwd, [
1729 AC_TRY_COMPILE(
1730 [
Damien Millerad833b32000-08-23 10:46:23 +10001731#include <pwd.h>
1732 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001733 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001734 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1735 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1736 )
1737])
1738if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1739 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1740fi
1741
Kevin Steves82456952001-06-22 21:14:18 +00001742AC_CACHE_CHECK([for pw_expire field in struct passwd],
1743 ac_cv_have_pw_expire_in_struct_passwd, [
1744 AC_TRY_COMPILE(
1745 [
1746#include <pwd.h>
1747 ],
1748 [ struct passwd p; p.pw_expire = 0; ],
1749 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1750 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1751 )
1752])
1753if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1754 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1755fi
1756
1757AC_CACHE_CHECK([for pw_change field in struct passwd],
1758 ac_cv_have_pw_change_in_struct_passwd, [
1759 AC_TRY_COMPILE(
1760 [
1761#include <pwd.h>
1762 ],
1763 [ struct passwd p; p.pw_change = 0; ],
1764 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1765 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1766 )
1767])
1768if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1769 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1770fi
Damien Miller61e50f12000-05-08 20:49:37 +10001771
Tim Rice28bbb0c2002-05-27 17:37:32 -07001772dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001773AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1774 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001775 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001776 [
Tim Riceae49fe62002-04-12 10:26:21 -07001777#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001778#include <sys/socket.h>
1779#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001780int main() {
1781#ifdef msg_accrights
1782exit(1);
1783#endif
1784struct msghdr m;
1785m.msg_accrights = 0;
1786exit(0);
1787}
Kevin Steves939c9db2002-03-22 17:23:25 +00001788 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001789 [ ac_cv_have_accrights_in_msghdr="yes" ],
1790 [ ac_cv_have_accrights_in_msghdr="no" ]
1791 )
1792])
1793if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1794 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1795fi
1796
Kevin Stevesa44e0352002-04-07 16:18:03 +00001797AC_CACHE_CHECK([for msg_control field in struct msghdr],
1798 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001799 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001800 [
Tim Riceae49fe62002-04-12 10:26:21 -07001801#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001802#include <sys/socket.h>
1803#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001804int main() {
1805#ifdef msg_control
1806exit(1);
1807#endif
1808struct msghdr m;
1809m.msg_control = 0;
1810exit(0);
1811}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001812 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001813 [ ac_cv_have_control_in_msghdr="yes" ],
1814 [ ac_cv_have_control_in_msghdr="no" ]
1815 )
1816])
1817if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1818 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1819fi
1820
Damien Miller61e50f12000-05-08 20:49:37 +10001821AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1822 AC_TRY_LINK([],
1823 [ extern char *__progname; printf("%s", __progname); ],
1824 [ ac_cv_libc_defines___progname="yes" ],
1825 [ ac_cv_libc_defines___progname="no" ]
1826 )
1827])
1828if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1829 AC_DEFINE(HAVE___PROGNAME)
1830fi
1831
Kevin Steves4846f4a2002-03-22 18:19:53 +00001832AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1833 AC_TRY_LINK([
1834#include <stdio.h>
1835],
1836 [ printf("%s", __FUNCTION__); ],
1837 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1838 [ ac_cv_cc_implements___FUNCTION__="no" ]
1839 )
1840])
1841if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1842 AC_DEFINE(HAVE___FUNCTION__)
1843fi
1844
1845AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1846 AC_TRY_LINK([
1847#include <stdio.h>
1848],
1849 [ printf("%s", __func__); ],
1850 [ ac_cv_cc_implements___func__="yes" ],
1851 [ ac_cv_cc_implements___func__="no" ]
1852 )
1853])
1854if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1855 AC_DEFINE(HAVE___func__)
1856fi
1857
Damien Miller4f8e6692001-07-14 13:22:53 +10001858AC_CACHE_CHECK([whether getopt has optreset support],
1859 ac_cv_have_getopt_optreset, [
1860 AC_TRY_LINK(
1861 [
1862#include <getopt.h>
1863 ],
1864 [ extern int optreset; optreset = 0; ],
1865 [ ac_cv_have_getopt_optreset="yes" ],
1866 [ ac_cv_have_getopt_optreset="no" ]
1867 )
1868])
1869if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1870 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1871fi
Damien Millera22ba012000-03-02 23:09:20 +11001872
Damien Millerecbb26d2000-07-15 14:59:14 +10001873AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1874 AC_TRY_LINK([],
1875 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1876 [ ac_cv_libc_defines_sys_errlist="yes" ],
1877 [ ac_cv_libc_defines_sys_errlist="no" ]
1878 )
1879])
1880if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1881 AC_DEFINE(HAVE_SYS_ERRLIST)
1882fi
1883
1884
Damien Miller11fa2cc2000-08-16 10:35:58 +10001885AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1886 AC_TRY_LINK([],
1887 [ extern int sys_nerr; printf("%i", sys_nerr);],
1888 [ ac_cv_libc_defines_sys_nerr="yes" ],
1889 [ ac_cv_libc_defines_sys_nerr="no" ]
1890 )
1891])
1892if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1893 AC_DEFINE(HAVE_SYS_NERR)
1894fi
1895
Damien Miller85de5802001-09-18 14:01:11 +10001896SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001897# Check whether user wants sectok support
1898AC_ARG_WITH(sectok,
1899 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001900 [
1901 if test "x$withval" != "xno" ; then
1902 if test "x$withval" != "xyes" ; then
1903 CPPFLAGS="$CPPFLAGS -I${withval}"
1904 LDFLAGS="$LDFLAGS -L${withval}"
1905 if test ! -z "$need_dash_r" ; then
1906 LDFLAGS="$LDFLAGS -R${withval}"
1907 fi
1908 if test ! -z "$blibpath" ; then
1909 blibpath="$blibpath:${withval}"
1910 fi
1911 fi
1912 AC_CHECK_HEADERS(sectok.h)
1913 if test "$ac_cv_header_sectok_h" != yes; then
1914 AC_MSG_ERROR(Can't find sectok.h)
1915 fi
1916 AC_CHECK_LIB(sectok, sectok_open)
1917 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1918 AC_MSG_ERROR(Can't find libsectok)
1919 fi
1920 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001921 AC_DEFINE(USE_SECTOK)
1922 SCARD_MSG="yes, using sectok"
1923 fi
1924 ]
1925)
1926
1927# Check whether user wants OpenSC support
1928AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001929 AC_HELP_STRING([--with-opensc=PFX],
1930 [Enable smartcard support using OpenSC]),
1931 opensc_config_prefix="$withval", opensc_config_prefix="")
1932if test x$opensc_config_prefix != x ; then
1933 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1934 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1935 if test "$OPENSC_CONFIG" != "no"; then
1936 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1937 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1938 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1939 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1940 AC_DEFINE(SMARTCARD)
1941 AC_DEFINE(USE_OPENSC)
1942 SCARD_MSG="yes, using OpenSC"
1943 fi
1944fi
Damien Miller85de5802001-09-18 14:01:11 +10001945
Damien Miller7abe09b2003-05-15 10:53:49 +10001946# Check whether user wants DNS support
1947DNS_MSG="no"
1948AC_ARG_WITH(dns,
1949 [ --with-dns Support for fetching keys from DNS (experimental)],
1950 [
1951 if test "x$withval" != "xno" ; then
Damien Millerd9ec3702003-05-15 12:27:08 +10001952 DNS_MSG="yes"
1953 AC_DEFINE(DNS)
1954 AC_SEARCH_LIBS(getrrsetbyname, resolv,
Damien Miller200d0a72003-06-30 19:21:36 +10001955 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1956 [
1957 # Needed by our getrrsetbyname()
1958 AC_SEARCH_LIBS(res_query, resolv)
1959 AC_SEARCH_LIBS(dn_expand, resolv)
Tim Rice0ac16a42003-09-08 06:33:33 -07001960 AC_CHECK_FUNCS(_getshort _getlong)
Tim Riceb284e162003-09-08 14:35:16 -07001961 AC_CHECK_MEMBER(HEADER.ad,
1962 [AC_DEFINE(HAVE_HEADER_AD)],,
1963 [#include <arpa/nameser.h>])
Damien Miller200d0a72003-06-30 19:21:36 +10001964 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10001965 fi
1966 ]
1967)
1968
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001969# Check whether user wants Kerberos 5 support
1970KRB5_MSG="no"
1971AC_ARG_WITH(kerberos5,
1972 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1973 [
1974 if test "x$withval" != "xno" ; then
1975 if test "x$withval" = "xyes" ; then
1976 KRB5ROOT="/usr/local"
1977 else
1978 KRB5ROOT=${withval}
1979 fi
1980 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1981 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1982 AC_DEFINE(KRB5)
1983 KRB5_MSG="yes"
1984 AC_MSG_CHECKING(whether we are using Heimdal)
1985 AC_TRY_COMPILE([ #include <krb5.h> ],
1986 [ char *tmp = heimdal_version; ],
1987 [ AC_MSG_RESULT(yes)
1988 AC_DEFINE(HEIMDAL)
1989 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1990 ],
1991 [ AC_MSG_RESULT(no)
1992 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1993 ]
1994 )
1995 if test ! -z "$need_dash_r" ; then
1996 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1997 fi
1998 if test ! -z "$blibpath" ; then
1999 blibpath="$blibpath:${KRB5ROOT}/lib"
2000 fi
Damien Miller200d0a72003-06-30 19:21:36 +10002001 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002002
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002003 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2004 [ AC_DEFINE(GSSAPI)
2005 K5LIBS="-lgssapi $K5LIBS" ],
2006 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2007 [ AC_DEFINE(GSSAPI)
2008 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2009 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2010 $K5LIBS)
2011 ],
2012 $K5LIBS)
2013
2014 AC_CHECK_HEADER(gssapi.h, ,
2015 [ unset ac_cv_header_gssapi_h
2016 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2017 AC_CHECK_HEADERS(gssapi.h, ,
2018 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2019 )
2020 ]
2021 )
2022
2023 oldCPP="$CPPFLAGS"
2024 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2025 AC_CHECK_HEADER(gssapi_krb5.h, ,
2026 [ CPPFLAGS="$oldCPP" ])
2027
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002028 KRB5=yes
2029 fi
2030 ]
2031)
Darren Tucker6aaa58c2003-08-02 22:24:49 +10002032LIBS="$LIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10002033
Damien Millera22ba012000-03-02 23:09:20 +11002034# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002035
Damien Millerf58c6722002-05-13 13:15:42 +10002036PRIVSEP_PATH=/var/empty
2037AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002038 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002039 [
2040 if test "x$withval" != "$no" ; then
2041 PRIVSEP_PATH=$withval
2042 fi
2043 ]
2044)
2045AC_SUBST(PRIVSEP_PATH)
2046
Damien Millera22ba012000-03-02 23:09:20 +11002047AC_ARG_WITH(xauth,
2048 [ --with-xauth=PATH Specify path to xauth program ],
2049 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002050 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002051 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002052 fi
2053 ],
2054 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002055 TestPath="$PATH"
2056 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2057 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2058 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2059 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2060 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002061 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002062 xauth_path="/usr/openwin/bin/xauth"
2063 fi
2064 ]
2065)
2066
Damien Miller7d901272003-01-13 16:55:22 +11002067STRIP_OPT=-s
2068AC_ARG_ENABLE(strip,
2069 [ --disable-strip Disable calling strip(1) on install],
2070 [
2071 if test "x$enableval" = "xno" ; then
2072 STRIP_OPT=
2073 fi
2074 ]
2075)
2076AC_SUBST(STRIP_OPT)
2077
Damien Millera19cf472000-11-29 13:28:50 +11002078if test -z "$xauth_path" ; then
2079 XAUTH_PATH="undefined"
2080 AC_SUBST(XAUTH_PATH)
2081else
Damien Millera22ba012000-03-02 23:09:20 +11002082 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002083 XAUTH_PATH=$xauth_path
2084 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002085fi
Damien Millera22ba012000-03-02 23:09:20 +11002086
2087# Check for mail directory (last resort if we cannot get it from headers)
2088if test ! -z "$MAIL" ; then
2089 maildir=`dirname $MAIL`
2090 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2091fi
2092
Damien Millera22ba012000-03-02 23:09:20 +11002093if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002094 if test "x$disable_ptmx_check" != "xyes" ; then
2095 AC_CHECK_FILE("/dev/ptmx",
2096 [
2097 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2098 have_dev_ptmx=1
2099 ]
2100 )
2101 fi
Damien Millera22ba012000-03-02 23:09:20 +11002102fi
Damien Miller204ad072000-03-02 23:56:12 +11002103AC_CHECK_FILE("/dev/ptc",
2104 [
2105 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2106 have_dev_ptc=1
2107 ]
2108)
2109
Damien Millera22ba012000-03-02 23:09:20 +11002110# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002111AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002112 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002113 [
Damien Miller897741e2001-04-16 10:41:46 +10002114 case "$withval" in
2115 man|cat|doc)
2116 MANTYPE=$withval
2117 ;;
2118 *)
2119 AC_MSG_ERROR(invalid man type: $withval)
2120 ;;
2121 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002122 ]
2123)
Ben Lindstrombc709922001-04-18 18:04:21 +00002124if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002125 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2126 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002127 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2128 MANTYPE=doc
2129 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2130 MANTYPE=man
2131 else
2132 MANTYPE=cat
2133 fi
2134fi
Damien Miller670a4b82000-01-22 13:53:11 +11002135AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002136if test "$MANTYPE" = "doc"; then
2137 mansubdir=man;
2138else
2139 mansubdir=$MANTYPE;
2140fi
2141AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002142
Damien Millera22ba012000-03-02 23:09:20 +11002143# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10002144MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002145AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002146 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002147 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002148 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002149 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10002150 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002151 fi
2152 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002153)
2154
Damien Millera22ba012000-03-02 23:09:20 +11002155# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002156AC_ARG_WITH(shadow,
2157 [ --without-shadow Disable shadow password support],
2158 [
2159 if test "x$withval" = "xno" ; then
2160 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002161 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002162 fi
2163 ]
2164)
2165
Damien Miller1f335fb2000-06-26 11:31:33 +10002166if test -z "$disable_shadow" ; then
2167 AC_MSG_CHECKING([if the systems has expire shadow information])
2168 AC_TRY_COMPILE(
2169 [
2170#include <sys/types.h>
2171#include <shadow.h>
2172 struct spwd sp;
2173 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2174 [ sp_expire_available=yes ], []
2175 )
2176
2177 if test "x$sp_expire_available" = "xyes" ; then
2178 AC_MSG_RESULT(yes)
2179 AC_DEFINE(HAS_SHADOW_EXPIRE)
2180 else
2181 AC_MSG_RESULT(no)
2182 fi
2183fi
2184
Damien Millera22ba012000-03-02 23:09:20 +11002185# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002186if test ! -z "$IPADDR_IN_DISPLAY" ; then
2187 DISPLAY_HACK_MSG="yes"
2188 AC_DEFINE(IPADDR_IN_DISPLAY)
2189else
2190 DISPLAY_HACK_MSG="no"
2191 AC_ARG_WITH(ipaddr-display,
2192 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2193 [
2194 if test "x$withval" != "xno" ; then
2195 AC_DEFINE(IPADDR_IN_DISPLAY)
2196 DISPLAY_HACK_MSG="yes"
2197 fi
2198 ]
2199 )
2200fi
Damien Miller76112de1999-12-21 11:18:08 +11002201
Darren Tuckere1a790d2003-09-16 11:52:19 +10002202# check for /etc/default/login and use it if present.
2203AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2204
2205if test "x$external_path_file" = "x/etc/default/login"; then
2206 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2207fi
2208
Tim Rice43a1c132002-04-17 21:19:14 -07002209dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2210if test $ac_cv_func_login_getcapbool = "yes" -a \
2211 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002212 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002213fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002214
Damien Millera22ba012000-03-02 23:09:20 +11002215# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002216SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002217AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002218 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002219 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002220 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002221 AC_MSG_WARN([
2222--with-default-path=PATH has no effect on this system.
2223Edit /etc/login.conf instead.])
2224 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002225 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002226 AC_MSG_WARN([
2227--with-default-path=PATH will only be used if PATH is not defined in
2228$external_path_file .])
2229 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002230 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002231 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002232 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002233 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002234 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2235 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002236 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002237 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002238 AC_MSG_WARN([
2239If PATH is defined in $external_path_file, ensure the path to scp is included,
2240otherwise scp will not work.])
2241 fi
2242 AC_TRY_RUN(
2243 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002244/* find out what STDPATH is */
2245#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002246#ifdef HAVE_PATHS_H
2247# include <paths.h>
2248#endif
2249#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002250# ifdef _PATH_USERPATH /* Irix */
2251# define _PATH_STDPATH _PATH_USERPATH
2252# else
2253# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2254# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002255#endif
2256#include <sys/types.h>
2257#include <sys/stat.h>
2258#include <fcntl.h>
2259#define DATA "conftest.stdpath"
2260
2261main()
2262{
2263 FILE *fd;
2264 int rc;
2265
2266 fd = fopen(DATA,"w");
2267 if(fd == NULL)
2268 exit(1);
2269
2270 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2271 exit(1);
2272
2273 exit(0);
2274}
2275 ], [ user_path=`cat conftest.stdpath` ],
2276 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2277 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2278 )
2279# make sure $bindir is in USER_PATH so scp will work
2280 t_bindir=`eval echo ${bindir}`
2281 case $t_bindir in
2282 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2283 esac
2284 case $t_bindir in
2285 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2286 esac
2287 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2288 if test $? -ne 0 ; then
2289 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2290 if test $? -ne 0 ; then
2291 user_path=$user_path:$t_bindir
2292 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2293 fi
2294 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002295 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002296)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002297if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002298 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2299 AC_SUBST(user_path)
2300fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002301
Damien Millera18bbd32002-05-13 10:48:57 +10002302# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002303AC_ARG_WITH(superuser-path,
2304 [ --with-superuser-path= Specify different path for super-user],
2305 [
2306 if test "x$withval" != "xno" ; then
2307 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2308 superuser_path=$withval
2309 fi
2310 ]
2311)
2312
2313
Damien Miller61e50f12000-05-08 20:49:37 +10002314AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002315IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002316AC_ARG_WITH(4in6,
2317 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2318 [
2319 if test "x$withval" != "xno" ; then
2320 AC_MSG_RESULT(yes)
2321 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002322 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002323 else
2324 AC_MSG_RESULT(no)
2325 fi
2326 ],[
2327 if test "x$inet6_default_4in6" = "xyes"; then
2328 AC_MSG_RESULT([yes (default)])
2329 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002330 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002331 else
2332 AC_MSG_RESULT([no (default)])
2333 fi
2334 ]
2335)
2336
Damien Miller60396b02001-02-18 17:01:00 +11002337# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002338BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002339AC_ARG_WITH(bsd-auth,
2340 [ --with-bsd-auth Enable BSD auth support],
2341 [
2342 if test "x$withval" != "xno" ; then
2343 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002344 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002345 fi
2346 ]
2347)
2348
Damien Millera22ba012000-03-02 23:09:20 +11002349# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002350piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002351# make sure the directory exists
2352if test ! -d $piddir ; then
2353 piddir=`eval echo ${sysconfdir}`
2354 case $piddir in
2355 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2356 esac
2357fi
2358
Tim Rice88f2ab52002-03-17 12:17:34 -08002359AC_ARG_WITH(pid-dir,
2360 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2361 [
2362 if test "x$withval" != "xno" ; then
2363 piddir=$withval
2364 if test ! -d $piddir ; then
2365 AC_MSG_WARN([** no $piddir directory on this system **])
2366 fi
2367 fi
2368 ]
2369)
2370
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002371AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002372AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002373
andre2ff7b5d2000-06-03 14:57:40 +00002374dnl allow user to disable some login recording features
2375AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002376 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002377 [
2378 if test "x$enableval" = "xno" ; then
2379 AC_DEFINE(DISABLE_LASTLOG)
2380 fi
2381 ]
andre2ff7b5d2000-06-03 14:57:40 +00002382)
2383AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002384 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002385 [
2386 if test "x$enableval" = "xno" ; then
2387 AC_DEFINE(DISABLE_UTMP)
2388 fi
2389 ]
andre2ff7b5d2000-06-03 14:57:40 +00002390)
2391AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002392 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002393 [
2394 if test "x$enableval" = "xno" ; then
2395 AC_DEFINE(DISABLE_UTMPX)
2396 fi
2397 ]
andre2ff7b5d2000-06-03 14:57:40 +00002398)
2399AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002400 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002401 [
2402 if test "x$enableval" = "xno" ; then
2403 AC_DEFINE(DISABLE_WTMP)
2404 fi
2405 ]
andre2ff7b5d2000-06-03 14:57:40 +00002406)
2407AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002408 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002409 [
2410 if test "x$enableval" = "xno" ; then
2411 AC_DEFINE(DISABLE_WTMPX)
2412 fi
2413 ]
andre2ff7b5d2000-06-03 14:57:40 +00002414)
2415AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002416 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002417 [
2418 if test "x$enableval" = "xno" ; then
2419 AC_DEFINE(DISABLE_LOGIN)
2420 fi
2421 ]
andre2ff7b5d2000-06-03 14:57:40 +00002422)
2423AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002424 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002425 [
2426 if test "x$enableval" = "xno" ; then
2427 AC_DEFINE(DISABLE_PUTUTLINE)
2428 fi
2429 ]
andre2ff7b5d2000-06-03 14:57:40 +00002430)
2431AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002432 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002433 [
2434 if test "x$enableval" = "xno" ; then
2435 AC_DEFINE(DISABLE_PUTUTXLINE)
2436 fi
2437 ]
andre2ff7b5d2000-06-03 14:57:40 +00002438)
2439AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002440 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002441 [
2442 if test "x$withval" = "xno" ; then
2443 AC_DEFINE(DISABLE_LASTLOG)
2444 else
2445 conf_lastlog_location=$withval
2446 fi
2447 ]
2448)
andre2ff7b5d2000-06-03 14:57:40 +00002449
2450dnl lastlog, [uw]tmpx? detection
2451dnl NOTE: set the paths in the platform section to avoid the
2452dnl need for command-line parameters
2453dnl lastlog and [uw]tmp are subject to a file search if all else fails
2454
2455dnl lastlog detection
2456dnl NOTE: the code itself will detect if lastlog is a directory
2457AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2458AC_TRY_COMPILE([
2459#include <sys/types.h>
2460#include <utmp.h>
2461#ifdef HAVE_LASTLOG_H
2462# include <lastlog.h>
2463#endif
Damien Miller2994e082000-06-04 15:51:47 +10002464#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002465# include <paths.h>
2466#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002467#ifdef HAVE_LOGIN_H
2468# include <login.h>
2469#endif
andre2ff7b5d2000-06-03 14:57:40 +00002470 ],
2471 [ char *lastlog = LASTLOG_FILE; ],
2472 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002473 [
2474 AC_MSG_RESULT(no)
2475 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2476 AC_TRY_COMPILE([
2477#include <sys/types.h>
2478#include <utmp.h>
2479#ifdef HAVE_LASTLOG_H
2480# include <lastlog.h>
2481#endif
2482#ifdef HAVE_PATHS_H
2483# include <paths.h>
2484#endif
2485 ],
2486 [ char *lastlog = _PATH_LASTLOG; ],
2487 [ AC_MSG_RESULT(yes) ],
2488 [
andree441aa32000-06-12 22:34:38 +00002489 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002490 system_lastlog_path=no
2491 ])
2492 ]
andre2ff7b5d2000-06-03 14:57:40 +00002493)
Damien Miller2994e082000-06-04 15:51:47 +10002494
andre2ff7b5d2000-06-03 14:57:40 +00002495if test -z "$conf_lastlog_location"; then
2496 if test x"$system_lastlog_path" = x"no" ; then
2497 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002498 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002499 conf_lastlog_location=$f
2500 fi
2501 done
2502 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002503 AC_MSG_WARN([** Cannot find lastlog **])
2504 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002505 fi
2506 fi
2507fi
2508
2509if test -n "$conf_lastlog_location"; then
2510 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2511fi
2512
2513dnl utmp detection
2514AC_MSG_CHECKING([if your system defines UTMP_FILE])
2515AC_TRY_COMPILE([
2516#include <sys/types.h>
2517#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002518#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002519# include <paths.h>
2520#endif
2521 ],
2522 [ char *utmp = UTMP_FILE; ],
2523 [ AC_MSG_RESULT(yes) ],
2524 [ AC_MSG_RESULT(no)
2525 system_utmp_path=no ]
2526)
2527if test -z "$conf_utmp_location"; then
2528 if test x"$system_utmp_path" = x"no" ; then
2529 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2530 if test -f $f ; then
2531 conf_utmp_location=$f
2532 fi
2533 done
2534 if test -z "$conf_utmp_location"; then
2535 AC_DEFINE(DISABLE_UTMP)
2536 fi
2537 fi
2538fi
2539if test -n "$conf_utmp_location"; then
2540 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2541fi
2542
2543dnl wtmp detection
2544AC_MSG_CHECKING([if your system defines WTMP_FILE])
2545AC_TRY_COMPILE([
2546#include <sys/types.h>
2547#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002548#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002549# include <paths.h>
2550#endif
2551 ],
2552 [ char *wtmp = WTMP_FILE; ],
2553 [ AC_MSG_RESULT(yes) ],
2554 [ AC_MSG_RESULT(no)
2555 system_wtmp_path=no ]
2556)
2557if test -z "$conf_wtmp_location"; then
2558 if test x"$system_wtmp_path" = x"no" ; then
2559 for f in /usr/adm/wtmp /var/log/wtmp; do
2560 if test -f $f ; then
2561 conf_wtmp_location=$f
2562 fi
2563 done
2564 if test -z "$conf_wtmp_location"; then
2565 AC_DEFINE(DISABLE_WTMP)
2566 fi
2567 fi
2568fi
2569if test -n "$conf_wtmp_location"; then
2570 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2571fi
2572
2573
2574dnl utmpx detection - I don't know any system so perverse as to require
2575dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2576dnl there, though.
2577AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2578AC_TRY_COMPILE([
2579#include <sys/types.h>
2580#include <utmp.h>
2581#ifdef HAVE_UTMPX_H
2582#include <utmpx.h>
2583#endif
Damien Miller2994e082000-06-04 15:51:47 +10002584#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002585# include <paths.h>
2586#endif
2587 ],
2588 [ char *utmpx = UTMPX_FILE; ],
2589 [ AC_MSG_RESULT(yes) ],
2590 [ AC_MSG_RESULT(no)
2591 system_utmpx_path=no ]
2592)
2593if test -z "$conf_utmpx_location"; then
2594 if test x"$system_utmpx_path" = x"no" ; then
2595 AC_DEFINE(DISABLE_UTMPX)
2596 fi
2597else
2598 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2599fi
2600
2601dnl wtmpx detection
2602AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2603AC_TRY_COMPILE([
2604#include <sys/types.h>
2605#include <utmp.h>
2606#ifdef HAVE_UTMPX_H
2607#include <utmpx.h>
2608#endif
Damien Miller2994e082000-06-04 15:51:47 +10002609#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002610# include <paths.h>
2611#endif
2612 ],
2613 [ char *wtmpx = WTMPX_FILE; ],
2614 [ AC_MSG_RESULT(yes) ],
2615 [ AC_MSG_RESULT(no)
2616 system_wtmpx_path=no ]
2617)
2618if test -z "$conf_wtmpx_location"; then
2619 if test x"$system_wtmpx_path" = x"no" ; then
2620 AC_DEFINE(DISABLE_WTMPX)
2621 fi
2622else
2623 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2624fi
2625
Damien Miller4018c192000-04-30 09:30:44 +10002626
Damien Miller29ea30d2000-03-17 10:54:15 +11002627if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002628 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2629 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002630fi
2631
Tim Rice4cec93f2002-02-26 08:40:48 -08002632dnl remove pam and dl because they are in $LIBPAM
2633if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002634 LIBS=`echo $LIBS | sed 's/-lpam //'`
2635fi
2636if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2637 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002638fi
2639
Damien Millerbac2d8a2000-09-05 16:13:06 +11002640AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002641AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2642AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002643
Damien Miller7b22d652000-06-18 14:07:04 +10002644# Print summary of options
2645
Damien Miller7b22d652000-06-18 14:07:04 +10002646# Someone please show me a better way :)
2647A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2648B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2649C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2650D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002651E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002652F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002653G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002654H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2655I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2656J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002657
2658echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002659echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002660echo " User binaries: $B"
2661echo " System binaries: $C"
2662echo " Configuration files: $D"
2663echo " Askpass program: $E"
2664echo " Manual pages: $F"
2665echo " PID file: $G"
2666echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002667if test "x$external_path_file" = "x/etc/login.conf" ; then
2668echo " At runtime, sshd will use the path defined in $external_path_file"
2669echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002670else
Damien Millerf58c6722002-05-13 13:15:42 +10002671echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002672 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002673echo " (If PATH is set in $external_path_file it will be used instead. If"
2674echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2675 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002676fi
Damien Millera18bbd32002-05-13 10:48:57 +10002677if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002678echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002679fi
Damien Millerf58c6722002-05-13 13:15:42 +10002680echo " Manpage format: $MANTYPE"
Damien Miller9d2be482003-05-15 11:12:19 +10002681echo " DNS support: $DNS_MSG"
Damien Miller7abe09b2003-05-15 10:53:49 +10002682echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002683echo " KerberosV support: $KRB5_MSG"
2684echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002685echo " S/KEY support: $SKEY_MSG"
2686echo " TCP Wrappers support: $TCPW_MSG"
2687echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002688echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002689echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2690echo " BSD Auth support: $BSD_AUTH_MSG"
2691echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002692if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002693echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002694fi
2695
Damien Miller7b22d652000-06-18 14:07:04 +10002696echo ""
2697
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002698echo " Host: ${host}"
2699echo " Compiler: ${CC}"
2700echo " Compiler flags: ${CFLAGS}"
2701echo "Preprocessor flags: ${CPPFLAGS}"
2702echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002703echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002704
2705echo ""
2706
Damien Miller82cf0ce2000-12-20 13:34:48 +11002707if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002708 echo "PAM is enabled. You may need to install a PAM control file "
2709 echo "for sshd, otherwise password authentication may fail. "
2710 echo "Example PAM control files can be found in the contrib/ "
2711 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002712 echo ""
2713fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002714
Damien Miller6c21c512002-01-22 21:57:53 +11002715if test ! -z "$RAND_HELPER_CMDHASH" ; then
2716 echo "WARNING: you are using the builtin random number collection "
2717 echo "service. Please read WARNING.RNG and request that your OS "
2718 echo "vendor includes kernel-based random number collection in "
2719 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002720 echo ""
2721fi
Damien Miller60396b02001-02-18 17:01:00 +11002722