blob: 45d21573f25d538625db7b803653c17bf652b55e [file] [log] [blame]
Darren Tucker3b2a06c2003-10-07 18:37:11 +10001# $Id: configure.ac,v 1.171 2003/10/07 08:37:11 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)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700134 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000135 AC_DEFINE(SETEUID_BREAKS_SETUID)
136 AC_DEFINE(BROKEN_SETREUID)
137 AC_DEFINE(BROKEN_SETREGID)
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)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000149 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000150 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000151 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700152 LIBS="$LIBS -lsec -lsecpw"
153 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000154 disable_ptmx_check=yes
155 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100156*-*-hpux10*)
157 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000158 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100159 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000160 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100161 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000162 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000163 AC_DEFINE(LOGIN_NO_ENDOPT)
164 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100165 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000166 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000167 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700168 LIBS="$LIBS -lsec"
169 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100170 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000171*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000172 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100173 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100174 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100175 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000176 AC_DEFINE(LOGIN_NO_ENDOPT)
177 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100178 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000179 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000180 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700181 LIBS="$LIBS -lsec"
182 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000183 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100184*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000185 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000186 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100187 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000188 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000189 AC_DEFINE(SETEUID_BREAKS_SETUID)
190 AC_DEFINE(BROKEN_SETREUID)
191 AC_DEFINE(BROKEN_SETREGID)
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 Tucker3b2a06c2003-10-07 18:37:11 +1000303 AC_DEFINE(SETEUID_BREAKS_SETUID)
304 AC_DEFINE(BROKEN_SETREUID)
305 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000306 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000307 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700308 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
309 # Attention: always take care to bind libsocket and libnsl before libc,
310 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000311 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100312*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000313 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100314 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100315 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700316 AC_DEFINE(SETEUID_BREAKS_SETUID)
317 AC_DEFINE(BROKEN_SETREUID)
318 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100319 ;;
320*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000321 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100322 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100323 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700324 AC_DEFINE(SETEUID_BREAKS_SETUID)
325 AC_DEFINE(BROKEN_SETREUID)
326 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100327 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100328*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000329 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100330 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100331 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100332*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000333 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100334 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700335 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100336 RANLIB=true
337 no_dev_ptmx=1
338 AC_DEFINE(BROKEN_SYS_TERMIO_H)
339 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000340 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000341 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100342 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Riceae477e92003-09-12 18:15:15 -0700343 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100344 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700345 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700346 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100347 ;;
348*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800349 if test -z "$GCC"; then
350 CFLAGS="$CFLAGS -belf"
351 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000352 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000353 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100354 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000355 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100356 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000357 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000358 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700359 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700360 AC_DEFINE(SETEUID_BREAKS_SETUID)
361 AC_DEFINE(BROKEN_SETREUID)
362 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700363 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100364 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700365 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000366 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000367*-*-unicosmk*)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000368 AC_DEFINE(USE_PIPES)
369 AC_DEFINE(DISABLE_FD_PASSING)
370 LDFLAGS="$LDFLAGS"
371 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
372 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000373 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000374*-*-unicosmp*)
375 AC_DEFINE(WITH_ABBREV_NO_TTY)
376 AC_DEFINE(USE_PIPES)
377 AC_DEFINE(DISABLE_FD_PASSING)
378 LDFLAGS="$LDFLAGS"
379 LIBS="$LIBS -lgen -lacid"
380 MANTYPE=cat
381 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000382*-*-unicos*)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000383 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700384 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700385 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000386 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
387 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
388 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700389 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000390*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000391 AC_MSG_CHECKING(for Digital Unix SIA)
392 no_osfsia=""
393 AC_ARG_WITH(osfsia,
394 [ --with-osfsia Enable Digital Unix SIA],
395 [
396 if test "x$withval" = "xno" ; then
397 AC_MSG_RESULT(disabled)
398 no_osfsia=1
399 fi
400 ],
401 )
402 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000403 if test -f /etc/sia/matrix.conf; then
404 AC_MSG_RESULT(yes)
405 AC_DEFINE(HAVE_OSF_SIA)
406 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000407 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000408 LIBS="$LIBS -lsecurity -ldb -lm -laud"
409 else
410 AC_MSG_RESULT(no)
411 fi
412 fi
Ben Lindstromdc3c7572002-10-04 23:54:54 +0000413 AC_DEFINE(DISABLE_FD_PASSING)
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000414 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700415 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000416 AC_DEFINE(BROKEN_SETREUID)
417 AC_DEFINE(BROKEN_SETREGID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000418 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000419 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000420
421*-*-nto-qnx)
422 AC_DEFINE(USE_PIPES)
423 AC_DEFINE(NO_X11_UNIX_SOCKETS)
424 AC_DEFINE(MISSING_NFDBITS)
425 AC_DEFINE(MISSING_HOWMANY)
426 AC_DEFINE(MISSING_FD_MASK)
427 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100428esac
429
Damien Millere37bfc12000-06-05 09:37:43 +1000430# Allow user to specify flags
431AC_ARG_WITH(cflags,
432 [ --with-cflags Specify additional flags to pass to compiler],
433 [
434 if test "x$withval" != "xno" ; then
435 CFLAGS="$CFLAGS $withval"
436 fi
437 ]
438)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000439AC_ARG_WITH(cppflags,
440 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
441 [
442 if test "x$withval" != "xno"; then
443 CPPFLAGS="$CPPFLAGS $withval"
444 fi
445 ]
446)
Damien Millere37bfc12000-06-05 09:37:43 +1000447AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000448 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000449 [
450 if test "x$withval" != "xno" ; then
451 LDFLAGS="$LDFLAGS $withval"
452 fi
453 ]
454)
455AC_ARG_WITH(libs,
456 [ --with-libs Specify additional libraries to link with],
457 [
458 if test "x$withval" != "xno" ; then
459 LIBS="$LIBS $withval"
460 fi
461 ]
462)
463
Darren Tucker6eb93042003-06-29 21:30:41 +1000464AC_MSG_CHECKING(compiler and flags for sanity)
465AC_TRY_RUN([
466#include <stdio.h>
467int main(){exit(0);}
468 ],
469 [ AC_MSG_RESULT(yes) ],
470 [
471 AC_MSG_RESULT(no)
472 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
473 ]
474)
475
Tim Rice4cec93f2002-02-26 08:40:48 -0800476# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000477AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000478 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800479 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000480 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000481 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000482 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
483 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
Ben Lindstrom4b0f1ad2003-02-01 04:43:34 +0000484 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
Tim Rice81ed5182002-09-25 17:38:46 -0700485 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
Damien Miller5c3a5582003-09-23 22:12:38 +1000486 util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800487
Damien Millera22ba012000-03-02 23:09:20 +1100488# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700489AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
490AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000491
Damien Millerdf288022001-02-18 13:07:07 +1100492dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700493if test "x$with_tcp_wrappers" != "xno" ; then
494 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
495 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
496 fi
497fi
Damien Millerdf288022001-02-18 13:07:07 +1100498
Tim Rice1e1ef642003-09-11 22:19:31 -0700499dnl IRIX and Solaris 2.5.1 have dirname() in libgen
500AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
501 AC_CHECK_LIB(gen, dirname,[
502 AC_CACHE_CHECK([for broken dirname],
503 ac_cv_have_broken_dirname, [
504 save_LIBS="$LIBS"
505 LIBS="$LIBS -lgen"
506 AC_TRY_RUN(
507 [
508#include <libgen.h>
509#include <string.h>
510
511int main(int argc, char **argv) {
512 char *s, buf[32];
513
514 strncpy(buf,"/etc", 32);
515 s = dirname(buf);
516 if (!s || strncmp(s, "/", 32) != 0) {
517 exit(1);
518 } else {
519 exit(0);
520 }
521}
522 ],
523 [ ac_cv_have_broken_dirname="no" ],
524 [ ac_cv_have_broken_dirname="yes" ]
525 )
526 LIBS="$save_LIBS"
527 ])
528 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
529 LIBS="$LIBS -lgen"
530 AC_DEFINE(HAVE_DIRNAME)
531 AC_CHECK_HEADERS(libgen.h)
532 fi
533 ])
534])
535
536AC_CHECK_FUNC(getspnam, ,
537 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
538AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
539
Damien Miller150c8b52002-02-13 23:06:56 +1100540AC_ARG_WITH(rpath,
541 [ --without-rpath Disable auto-added -R linker paths],
542 [
543 if test "x$withval" = "xno" ; then
544 need_dash_r=""
545 fi
546 if test "x$withval" = "xyes" ; then
547 need_dash_r=1
548 fi
549 ]
550)
551
Tim Rice13aae5e2001-10-21 17:53:58 -0700552dnl zlib is required
553AC_ARG_WITH(zlib,
554 [ --with-zlib=PATH Use zlib in PATH],
555 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000556 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100557 AC_MSG_ERROR([*** zlib is required ***])
558 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700559 if test -d "$withval/lib"; then
560 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700561 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700562 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700563 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700564 fi
565 else
566 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700567 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700568 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700569 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700570 fi
571 fi
572 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700573 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700574 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700575 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700576 fi
577 ]
578)
579
Tim Rice17b93e52001-10-23 22:36:54 -0700580AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100581
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000582dnl UnixWare 2.x
583AC_CHECK_FUNC(strcasecmp,
584 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
585)
586AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700587 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
588 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000589)
Damien Millerab18c411999-11-11 10:40:23 +1100590
Tim Ricee589a292001-11-03 11:09:32 -0800591dnl Checks for libutil functions
592AC_CHECK_HEADERS(libutil.h)
593AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
594AC_CHECK_FUNCS(logout updwtmp logwtmp)
595
Ben Lindstrom8697e082001-02-24 21:41:10 +0000596AC_FUNC_STRFTIME
597
Damien Miller3c027682001-03-14 11:39:45 +1100598# Check for ALTDIRFUNC glob() extension
599AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
600AC_EGREP_CPP(FOUNDIT,
601 [
602 #include <glob.h>
603 #ifdef GLOB_ALTDIRFUNC
604 FOUNDIT
605 #endif
606 ],
607 [
608 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
609 AC_MSG_RESULT(yes)
610 ],
611 [
612 AC_MSG_RESULT(no)
613 ]
614)
Damien Millerab18c411999-11-11 10:40:23 +1100615
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000616# Check for g.gl_matchc glob() extension
617AC_MSG_CHECKING(for gl_matchc field in glob_t)
618AC_EGREP_CPP(FOUNDIT,
619 [
620 #include <glob.h>
621 int main(void){glob_t g; g.gl_matchc = 1;}
622 ],
623 [
624 AC_DEFINE(GLOB_HAS_GL_MATCHC)
625 AC_MSG_RESULT(yes)
626 ],
627 [
628 AC_MSG_RESULT(no)
629 ]
630)
631
Damien Miller18bb4732001-03-28 14:35:30 +1000632AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
633AC_TRY_RUN(
634 [
635#include <sys/types.h>
636#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700637int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000638 ],
639 [AC_MSG_RESULT(yes)],
640 [
641 AC_MSG_RESULT(no)
642 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
643 ]
644)
645
Damien Millerc547bf12001-02-16 10:18:12 +1100646# Check whether user wants S/Key support
647SKEY_MSG="no"
648AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700649 [ --with-skey[[=PATH]] Enable S/Key support
650 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100651 [
652 if test "x$withval" != "xno" ; then
653
654 if test "x$withval" != "xyes" ; then
655 CPPFLAGS="$CPPFLAGS -I${withval}/include"
656 LDFLAGS="$LDFLAGS -L${withval}/lib"
657 fi
658
659 AC_DEFINE(SKEY)
660 LIBS="-lskey $LIBS"
661 SKEY_MSG="yes"
662
Tim Rice4cec93f2002-02-26 08:40:48 -0800663 AC_MSG_CHECKING([for s/key support])
664 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100665 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800666#include <stdio.h>
667#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700668int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800669 ],
670 [AC_MSG_RESULT(yes)],
671 [
672 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100673 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
674 ])
675 fi
676 ]
677)
678
679# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700680TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100681AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700682 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
683 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100684 [
685 if test "x$withval" != "xno" ; then
686 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700687 saved_LDFLAGS="$LDFLAGS"
688 saved_CPPFLAGS="$CPPFLAGS"
689 if test -n "${withval}" -a "${withval}" != "yes"; then
690 if test -d "${withval}/lib"; then
691 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700692 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700693 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700694 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700695 fi
696 else
697 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700698 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700699 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700700 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700701 fi
702 fi
703 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700704 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700705 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700706 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700707 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700708 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800709 LIBWRAP="-lwrap"
710 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100711 AC_MSG_CHECKING(for libwrap)
712 AC_TRY_LINK(
713 [
714#include <tcpd.h>
715 int deny_severity = 0, allow_severity = 0;
716 ],
717 [hosts_access(0);],
718 [
719 AC_MSG_RESULT(yes)
720 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800721 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700722 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100723 ],
724 [
725 AC_MSG_ERROR([*** libwrap missing])
726 ]
727 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800728 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100729 fi
730 ]
731)
732
Damien Millerfe1f1432003-02-24 15:45:42 +1100733dnl Checks for library functions. Please keep in alphabetical order
734AC_CHECK_FUNCS(\
Damien Millerf09ad862003-09-19 16:41:01 +1000735 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
Damien Miller5fe46a42003-06-05 09:53:31 +1000736 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000737 getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000738 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100739 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000740 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
741 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
742 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Damien Miller5fe46a42003-06-05 09:53:31 +1000743 setproctitle setregid setresgid setresuid setreuid setrlimit \
744 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000745 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tuckerf38ea772003-08-13 20:48:07 +1000746 truncate utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100747)
Tim Rice13aae5e2001-10-21 17:53:58 -0700748
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000749# IRIX has a const char return value for gai_strerror()
750AC_CHECK_FUNCS(gai_strerror,[
751 AC_DEFINE(HAVE_GAI_STRERROR)
752 AC_TRY_COMPILE([
753#include <sys/types.h>
754#include <sys/socket.h>
755#include <netdb.h>
756
757const char *gai_strerror(int);],[
758char *str;
759
760str = gai_strerror(0);],[
761 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
762 [Define if gai_strerror() returns const char *])])])
763
Damien Millercd6853c2003-01-28 11:33:42 +1100764AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
765
Darren Tuckerf1159b52003-07-07 19:44:01 +1000766dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000767AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000768AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000769
Darren Tuckerb2427c82003-09-10 15:22:44 +1000770dnl tcsendbreak might be a macro
771AC_CHECK_DECL(tcsendbreak,
772 [AC_DEFINE(HAVE_TCSENDBREAK)],
773 [AC_CHECK_FUNCS(tcsendbreak)],
774 [#include <termios.h>]
775)
776
Damien Millerad833b32000-08-23 10:46:23 +1000777dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000778AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000779dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000780AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000781AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000782dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000783AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000784AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100785
Damien Miller04f80141999-11-19 15:32:34 +1100786AC_CHECK_FUNC(daemon,
787 [AC_DEFINE(HAVE_DAEMON)],
788 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
789)
790
Damien Miller9fb07e42000-03-05 16:22:59 +1100791AC_CHECK_FUNC(getpagesize,
792 [AC_DEFINE(HAVE_GETPAGESIZE)],
793 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
794)
795
Damien Millercb170cb2000-07-01 16:52:55 +1000796# Check for broken snprintf
797if test "x$ac_cv_func_snprintf" = "xyes" ; then
798 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
799 AC_TRY_RUN(
800 [
801#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700802int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000803 ],
804 [AC_MSG_RESULT(yes)],
805 [
806 AC_MSG_RESULT(no)
807 AC_DEFINE(BROKEN_SNPRINTF)
808 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
809 ]
810 )
811fi
812
Damien Millere8328192003-01-07 15:18:32 +1100813dnl see whether mkstemp() requires XXXXXX
814if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
815AC_MSG_CHECKING([for (overly) strict mkstemp])
816AC_TRY_RUN(
817 [
818#include <stdlib.h>
819main() { char template[]="conftest.mkstemp-test";
820if (mkstemp(template) == -1)
821 exit(1);
822unlink(template); exit(0);
823}
824 ],
825 [
826 AC_MSG_RESULT(no)
827 ],
828 [
829 AC_MSG_RESULT(yes)
830 AC_DEFINE(HAVE_STRICT_MKSTEMP)
831 ],
832 [
833 AC_MSG_RESULT(yes)
834 AC_DEFINE(HAVE_STRICT_MKSTEMP)
835 ]
836)
837fi
838
Darren Tucker70a3d552003-08-21 17:58:29 +1000839dnl make sure that openpty does not reacquire controlling terminal
840if test ! -z "$check_for_openpty_ctty_bug"; then
841 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
842 AC_TRY_RUN(
843 [
844#include <stdio.h>
845#include <sys/fcntl.h>
846#include <sys/types.h>
847#include <sys/wait.h>
848
849int
850main()
851{
852 pid_t pid;
853 int fd, ptyfd, ttyfd, status;
854
855 pid = fork();
856 if (pid < 0) { /* failed */
857 exit(1);
858 } else if (pid > 0) { /* parent */
859 waitpid(pid, &status, 0);
860 if (WIFEXITED(status))
861 exit(WEXITSTATUS(status));
862 else
863 exit(2);
864 } else { /* child */
865 close(0); close(1); close(2);
866 setsid();
867 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
868 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
869 if (fd >= 0)
870 exit(3); /* Acquired ctty: broken */
871 else
872 exit(0); /* Did not acquire ctty: OK */
873 }
874}
875 ],
876 [
877 AC_MSG_RESULT(yes)
878 ],
879 [
880 AC_MSG_RESULT(no)
881 AC_DEFINE(SSHD_ACQUIRES_CTTY)
882 ]
883 )
884fi
885
Damien Miller606f8802000-09-16 15:39:56 +1100886AC_FUNC_GETPGRP
887
Damien Millera64b57a2001-01-17 10:44:13 +1100888# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000889PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100890AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100891 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100892 [
Damien Millera64b57a2001-01-17 10:44:13 +1100893 if test "x$withval" != "xno" ; then
894 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
895 AC_MSG_ERROR([PAM headers not found])
896 fi
897
898 AC_CHECK_LIB(dl, dlopen, , )
899 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
900 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000901 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +1100902
Damien Millera64b57a2001-01-17 10:44:13 +1100903 PAM_MSG="yes"
904
905 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800906 if test $ac_cv_lib_dl_dlopen = yes; then
907 LIBPAM="-lpam -ldl"
908 else
909 LIBPAM="-lpam"
910 fi
911 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100912 fi
913 ]
914)
Damien Millera22ba012000-03-02 23:09:20 +1100915
Damien Millera64b57a2001-01-17 10:44:13 +1100916# Check for older PAM
917if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100918 # Check PAM strerror arguments (old PAM)
919 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
920 AC_TRY_COMPILE(
921 [
Damien Miller81171112000-04-23 11:14:01 +1000922#include <stdlib.h>
923#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100924 ],
925 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
926 [AC_MSG_RESULT(no)],
927 [
928 AC_DEFINE(HAVE_OLD_PAM)
929 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000930 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100931 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100932 )
Damien Millera22ba012000-03-02 23:09:20 +1100933fi
934
Damien Millerfc93d4b2002-09-04 23:26:29 +1000935# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
936# because the system crypt() is more featureful.
937if test "x$check_for_libcrypt_before" = "x1"; then
938 AC_CHECK_LIB(crypt, crypt)
939fi
940
Tim Riceaef73712002-05-11 13:17:42 -0700941# Search for OpenSSL
942saved_CPPFLAGS="$CPPFLAGS"
943saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100944AC_ARG_WITH(ssl-dir,
945 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
946 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000947 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700948 if test -d "$withval/lib"; then
949 if test -n "${need_dash_r}"; then
950 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
951 else
952 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
953 fi
954 else
955 if test -n "${need_dash_r}"; then
956 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
957 else
958 LDFLAGS="-L${withval} ${LDFLAGS}"
959 fi
960 fi
961 if test -d "$withval/include"; then
962 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
963 else
964 CPPFLAGS="-I${withval} ${CPPFLAGS}"
965 fi
Damien Millera22ba012000-03-02 23:09:20 +1100966 fi
967 ]
968)
Tim Riceaef73712002-05-11 13:17:42 -0700969LIBS="$LIBS -lcrypto"
970AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000971 [
Tim Riceaef73712002-05-11 13:17:42 -0700972 dnl Check default openssl install dir
973 if test -n "${need_dash_r}"; then
974 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000975 else
Tim Riceaef73712002-05-11 13:17:42 -0700976 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000977 fi
Tim Riceaef73712002-05-11 13:17:42 -0700978 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
979 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
980 [
981 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
982 ]
983 )
984 ]
985)
986
Tim Riced730b782002-08-13 18:52:10 -0700987# Determine OpenSSL header version
988AC_MSG_CHECKING([OpenSSL header version])
989AC_TRY_RUN(
990 [
991#include <stdio.h>
992#include <string.h>
993#include <openssl/opensslv.h>
994#define DATA "conftest.sslincver"
995int main(void) {
996 FILE *fd;
997 int rc;
998
999 fd = fopen(DATA,"w");
1000 if(fd == NULL)
1001 exit(1);
1002
1003 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1004 exit(1);
1005
1006 exit(0);
1007}
1008 ],
1009 [
1010 ssl_header_ver=`cat conftest.sslincver`
1011 AC_MSG_RESULT($ssl_header_ver)
1012 ],
1013 [
1014 AC_MSG_RESULT(not found)
1015 AC_MSG_ERROR(OpenSSL version header not found.)
1016 ]
1017)
1018
1019# Determine OpenSSL library version
1020AC_MSG_CHECKING([OpenSSL library version])
1021AC_TRY_RUN(
1022 [
1023#include <stdio.h>
1024#include <string.h>
1025#include <openssl/opensslv.h>
1026#include <openssl/crypto.h>
1027#define DATA "conftest.ssllibver"
1028int main(void) {
1029 FILE *fd;
1030 int rc;
1031
1032 fd = fopen(DATA,"w");
1033 if(fd == NULL)
1034 exit(1);
1035
1036 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1037 exit(1);
1038
1039 exit(0);
1040}
1041 ],
1042 [
1043 ssl_library_ver=`cat conftest.ssllibver`
1044 AC_MSG_RESULT($ssl_library_ver)
1045 ],
1046 [
1047 AC_MSG_RESULT(not found)
1048 AC_MSG_ERROR(OpenSSL library not found.)
1049 ]
1050)
Damien Millera22ba012000-03-02 23:09:20 +11001051
Damien Millerec932372002-01-22 22:16:03 +11001052# Sanity check OpenSSL headers
1053AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1054AC_TRY_RUN(
1055 [
1056#include <string.h>
1057#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001058int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001059 ],
1060 [
1061 AC_MSG_RESULT(yes)
1062 ],
1063 [
1064 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001065 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1066Check config.log for details.
1067Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001068 ]
1069)
1070
Damien Millera64b57a2001-01-17 10:44:13 +11001071# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1072# version in OpenSSL. Skip this for PAM
Damien Miller4f9f42a2003-05-10 19:28:02 +10001073if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001074 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001075fi
1076
Damien Miller6c21c512002-01-22 21:57:53 +11001077
1078### Configure cryptographic random number support
1079
1080# Check wheter OpenSSL seeds itself
1081AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1082AC_TRY_RUN(
1083 [
1084#include <string.h>
1085#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001086int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001087 ],
1088 [
1089 OPENSSL_SEEDS_ITSELF=yes
1090 AC_MSG_RESULT(yes)
1091 ],
1092 [
1093 AC_MSG_RESULT(no)
1094 # Default to use of the rand helper if OpenSSL doesn't
1095 # seed itself
1096 USE_RAND_HELPER=yes
1097 ]
1098)
1099
1100
1101# Do we want to force the use of the rand helper?
1102AC_ARG_WITH(rand-helper,
1103 [ --with-rand-helper Use subprocess to gather strong randomness ],
1104 [
1105 if test "x$withval" = "xno" ; then
1106 # Force use of OpenSSL's internal RNG, even if
1107 # the previous test showed it to be unseeded.
1108 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1109 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1110 OPENSSL_SEEDS_ITSELF=yes
1111 USE_RAND_HELPER=""
1112 fi
1113 else
1114 USE_RAND_HELPER=yes
1115 fi
1116 ],
1117)
1118
1119# Which randomness source do we use?
1120if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1121 # OpenSSL only
1122 AC_DEFINE(OPENSSL_PRNG_ONLY)
1123 RAND_MSG="OpenSSL internal ONLY"
1124 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001125elif test ! -z "$USE_RAND_HELPER" ; then
1126 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001127 RAND_MSG="ssh-rand-helper"
1128 INSTALL_SSH_RAND_HELPER="yes"
1129fi
1130AC_SUBST(INSTALL_SSH_RAND_HELPER)
1131
1132### Configuration of ssh-rand-helper
1133
1134# PRNGD TCP socket
1135AC_ARG_WITH(prngd-port,
1136 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1137 [
Damien Millere996d722002-01-23 11:20:59 +11001138 case "$withval" in
1139 no)
1140 withval=""
1141 ;;
1142 [[0-9]]*)
1143 ;;
1144 *)
1145 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1146 ;;
1147 esac
1148 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001149 PRNGD_PORT="$withval"
1150 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1151 fi
1152 ]
1153)
1154
1155# PRNGD Unix domain socket
1156AC_ARG_WITH(prngd-socket,
1157 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1158 [
Damien Millere996d722002-01-23 11:20:59 +11001159 case "$withval" in
1160 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001161 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001162 ;;
1163 no)
1164 withval=""
1165 ;;
1166 /*)
1167 ;;
1168 *)
1169 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1170 ;;
1171 esac
1172
1173 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001174 if test ! -z "$PRNGD_PORT" ; then
1175 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1176 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001177 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001178 AC_MSG_WARN(Entropy socket is not readable)
1179 fi
1180 PRNGD_SOCKET="$withval"
1181 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1182 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001183 ],
1184 [
1185 # Check for existing socket only if we don't have a random device already
1186 if test "$USE_RAND_HELPER" = yes ; then
1187 AC_MSG_CHECKING(for PRNGD/EGD socket)
1188 # Insert other locations here
1189 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1190 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1191 PRNGD_SOCKET="$sock"
1192 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1193 break;
1194 fi
1195 done
1196 if test ! -z "$PRNGD_SOCKET" ; then
1197 AC_MSG_RESULT($PRNGD_SOCKET)
1198 else
1199 AC_MSG_RESULT(not found)
1200 fi
1201 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001202 ]
1203)
1204
1205# Change default command timeout for hashing entropy source
1206entropy_timeout=200
1207AC_ARG_WITH(entropy-timeout,
1208 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1209 [
1210 if test "x$withval" != "xno" ; then
1211 entropy_timeout=$withval
1212 fi
1213 ]
1214)
Damien Miller6c21c512002-01-22 21:57:53 +11001215AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1216
Damien Millerd3f6ad22002-06-25 10:24:47 +10001217SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001218AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001219 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001220 [
1221 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001222 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001223 fi
1224 ]
1225)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001226AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1227AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001228
Tim Rice88f2ab52002-03-17 12:17:34 -08001229# We do this little dance with the search path to insure
1230# that programs that we select for use by installed programs
1231# (which may be run by the super-user) come from trusted
1232# locations before they come from the user's private area.
1233# This should help avoid accidentally configuring some
1234# random version of a program in someone's personal bin.
1235
1236OPATH=$PATH
1237PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001238test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001239test -d /sbin && PATH=$PATH:/sbin
1240test -d /usr/sbin && PATH=$PATH:/usr/sbin
1241PATH=$PATH:/etc:$OPATH
1242
Damien Miller6c21c512002-01-22 21:57:53 +11001243# These programs are used by the command hashing source to gather entropy
1244OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1245OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1246OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1247OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1248OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1249OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1250OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1251OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1252OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1253OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1254OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1255OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1256OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1257OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1258OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1259OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001260# restore PATH
1261PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001262
1263# Where does ssh-rand-helper get its randomness from?
1264INSTALL_SSH_PRNG_CMDS=""
1265if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1266 if test ! -z "$PRNGD_PORT" ; then
1267 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1268 elif test ! -z "$PRNGD_SOCKET" ; then
1269 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1270 else
1271 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1272 RAND_HELPER_CMDHASH=yes
1273 INSTALL_SSH_PRNG_CMDS="yes"
1274 fi
1275fi
1276AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1277
1278
Ben Lindstromb5628642000-10-18 00:02:25 +00001279# Cheap hack to ensure NEWS-OS libraries are arranged right.
1280if test ! -z "$SONY" ; then
1281 LIBS="$LIBS -liberty";
1282fi
1283
Damien Millera22ba012000-03-02 23:09:20 +11001284# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001285AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001286AC_CHECK_SIZEOF(short int, 2)
1287AC_CHECK_SIZEOF(int, 4)
1288AC_CHECK_SIZEOF(long int, 4)
1289AC_CHECK_SIZEOF(long long int, 8)
1290
Damien Millerfa2bb692002-04-23 23:22:25 +10001291# Sanity check long long for some platforms (AIX)
1292if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1293 ac_cv_sizeof_long_long_int=0
1294fi
1295
Damien Millera22ba012000-03-02 23:09:20 +11001296# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001297AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1298 AC_TRY_COMPILE(
1299 [ #include <sys/types.h> ],
1300 [ u_int a; a = 1;],
1301 [ ac_cv_have_u_int="yes" ],
1302 [ ac_cv_have_u_int="no" ]
1303 )
1304])
1305if test "x$ac_cv_have_u_int" = "xyes" ; then
1306 AC_DEFINE(HAVE_U_INT)
1307 have_u_int=1
1308fi
1309
Damien Miller61e50f12000-05-08 20:49:37 +10001310AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1311 AC_TRY_COMPILE(
1312 [ #include <sys/types.h> ],
1313 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1314 [ ac_cv_have_intxx_t="yes" ],
1315 [ ac_cv_have_intxx_t="no" ]
1316 )
1317])
1318if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1319 AC_DEFINE(HAVE_INTXX_T)
1320 have_intxx_t=1
1321fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001322
1323if (test -z "$have_intxx_t" && \
1324 test "x$ac_cv_header_stdint_h" = "xyes")
1325then
1326 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1327 AC_TRY_COMPILE(
1328 [ #include <stdint.h> ],
1329 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1330 [
1331 AC_DEFINE(HAVE_INTXX_T)
1332 AC_MSG_RESULT(yes)
1333 ],
1334 [ AC_MSG_RESULT(no) ]
1335 )
1336fi
1337
Damien Miller578783e2000-09-23 14:12:24 +11001338AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1339 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001340 [
1341#include <sys/types.h>
1342#ifdef HAVE_STDINT_H
1343# include <stdint.h>
1344#endif
1345#include <sys/socket.h>
1346#ifdef HAVE_SYS_BITYPES_H
1347# include <sys/bitypes.h>
1348#endif
1349 ],
Damien Miller578783e2000-09-23 14:12:24 +11001350 [ int64_t a; a = 1;],
1351 [ ac_cv_have_int64_t="yes" ],
1352 [ ac_cv_have_int64_t="no" ]
1353 )
1354])
1355if test "x$ac_cv_have_int64_t" = "xyes" ; then
1356 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001357fi
1358
Damien Miller61e50f12000-05-08 20:49:37 +10001359AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1360 AC_TRY_COMPILE(
1361 [ #include <sys/types.h> ],
1362 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1363 [ ac_cv_have_u_intxx_t="yes" ],
1364 [ ac_cv_have_u_intxx_t="no" ]
1365 )
1366])
1367if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1368 AC_DEFINE(HAVE_U_INTXX_T)
1369 have_u_intxx_t=1
1370fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001371
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001372if test -z "$have_u_intxx_t" ; then
1373 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1374 AC_TRY_COMPILE(
1375 [ #include <sys/socket.h> ],
1376 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1377 [
1378 AC_DEFINE(HAVE_U_INTXX_T)
1379 AC_MSG_RESULT(yes)
1380 ],
1381 [ AC_MSG_RESULT(no) ]
1382 )
1383fi
1384
Damien Miller578783e2000-09-23 14:12:24 +11001385AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1386 AC_TRY_COMPILE(
1387 [ #include <sys/types.h> ],
1388 [ u_int64_t a; a = 1;],
1389 [ ac_cv_have_u_int64_t="yes" ],
1390 [ ac_cv_have_u_int64_t="no" ]
1391 )
1392])
1393if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1394 AC_DEFINE(HAVE_U_INT64_T)
1395 have_u_int64_t=1
1396fi
1397
Tim Rice4cec93f2002-02-26 08:40:48 -08001398if test -z "$have_u_int64_t" ; then
1399 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1400 AC_TRY_COMPILE(
1401 [ #include <sys/bitypes.h> ],
1402 [ u_int64_t a; a = 1],
1403 [
1404 AC_DEFINE(HAVE_U_INT64_T)
1405 AC_MSG_RESULT(yes)
1406 ],
1407 [ AC_MSG_RESULT(no) ]
1408 )
1409fi
1410
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001411if test -z "$have_u_intxx_t" ; then
1412 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1413 AC_TRY_COMPILE(
1414 [
1415#include <sys/types.h>
1416 ],
1417 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1418 [ ac_cv_have_uintxx_t="yes" ],
1419 [ ac_cv_have_uintxx_t="no" ]
1420 )
1421 ])
1422 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1423 AC_DEFINE(HAVE_UINTXX_T)
1424 fi
1425fi
1426
1427if test -z "$have_uintxx_t" ; then
1428 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1429 AC_TRY_COMPILE(
1430 [ #include <stdint.h> ],
1431 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1432 [
1433 AC_DEFINE(HAVE_UINTXX_T)
1434 AC_MSG_RESULT(yes)
1435 ],
1436 [ AC_MSG_RESULT(no) ]
1437 )
1438fi
1439
Damien Milleredb82922000-06-20 13:25:52 +10001440if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1441 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001442then
1443 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1444 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001445 [
1446#include <sys/bitypes.h>
1447 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001448 [
Damien Miller70494d12000-04-03 15:57:06 +10001449 int8_t a; int16_t b; int32_t c;
1450 u_int8_t e; u_int16_t f; u_int32_t g;
1451 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001452 ],
1453 [
1454 AC_DEFINE(HAVE_U_INTXX_T)
1455 AC_DEFINE(HAVE_INTXX_T)
1456 AC_MSG_RESULT(yes)
1457 ],
1458 [AC_MSG_RESULT(no)]
1459 )
1460fi
1461
Damien Miller58be7382001-09-15 21:31:54 +10001462
1463AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1464 AC_TRY_COMPILE(
1465 [
1466#include <sys/types.h>
1467 ],
1468 [ u_char foo; foo = 125; ],
1469 [ ac_cv_have_u_char="yes" ],
1470 [ ac_cv_have_u_char="no" ]
1471 )
1472])
1473if test "x$ac_cv_have_u_char" = "xyes" ; then
1474 AC_DEFINE(HAVE_U_CHAR)
1475fi
1476
Tim Rice13aae5e2001-10-21 17:53:58 -07001477TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001478
Tim Rice200a5c02002-02-26 22:12:34 -08001479AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001480
Damien Miller61e50f12000-05-08 20:49:37 +10001481AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1482 AC_TRY_COMPILE(
1483 [
1484#include <sys/types.h>
1485 ],
1486 [ size_t foo; foo = 1235; ],
1487 [ ac_cv_have_size_t="yes" ],
1488 [ ac_cv_have_size_t="no" ]
1489 )
1490])
1491if test "x$ac_cv_have_size_t" = "xyes" ; then
1492 AC_DEFINE(HAVE_SIZE_T)
1493fi
Damien Miller95058511999-12-29 10:36:45 +11001494
Damien Miller615f9392000-05-17 22:53:33 +10001495AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1496 AC_TRY_COMPILE(
1497 [
1498#include <sys/types.h>
1499 ],
1500 [ ssize_t foo; foo = 1235; ],
1501 [ ac_cv_have_ssize_t="yes" ],
1502 [ ac_cv_have_ssize_t="no" ]
1503 )
1504])
1505if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1506 AC_DEFINE(HAVE_SSIZE_T)
1507fi
1508
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001509AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1510 AC_TRY_COMPILE(
1511 [
1512#include <time.h>
1513 ],
1514 [ clock_t foo; foo = 1235; ],
1515 [ ac_cv_have_clock_t="yes" ],
1516 [ ac_cv_have_clock_t="no" ]
1517 )
1518])
1519if test "x$ac_cv_have_clock_t" = "xyes" ; then
1520 AC_DEFINE(HAVE_CLOCK_T)
1521fi
1522
Damien Millerb54b40e2000-06-23 08:23:34 +10001523AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1524 AC_TRY_COMPILE(
1525 [
1526#include <sys/types.h>
1527#include <sys/socket.h>
1528 ],
1529 [ sa_family_t foo; foo = 1235; ],
1530 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001531 [ AC_TRY_COMPILE(
1532 [
1533#include <sys/types.h>
1534#include <sys/socket.h>
1535#include <netinet/in.h>
1536 ],
1537 [ sa_family_t foo; foo = 1235; ],
1538 [ ac_cv_have_sa_family_t="yes" ],
1539
Damien Millerb54b40e2000-06-23 08:23:34 +10001540 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001541 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001542 )
1543])
1544if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1545 AC_DEFINE(HAVE_SA_FAMILY_T)
1546fi
1547
Damien Miller0f91b4e2000-06-18 15:43:25 +10001548AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1549 AC_TRY_COMPILE(
1550 [
1551#include <sys/types.h>
1552 ],
1553 [ pid_t foo; foo = 1235; ],
1554 [ ac_cv_have_pid_t="yes" ],
1555 [ ac_cv_have_pid_t="no" ]
1556 )
1557])
1558if test "x$ac_cv_have_pid_t" = "xyes" ; then
1559 AC_DEFINE(HAVE_PID_T)
1560fi
1561
1562AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1563 AC_TRY_COMPILE(
1564 [
1565#include <sys/types.h>
1566 ],
1567 [ mode_t foo; foo = 1235; ],
1568 [ ac_cv_have_mode_t="yes" ],
1569 [ ac_cv_have_mode_t="no" ]
1570 )
1571])
1572if test "x$ac_cv_have_mode_t" = "xyes" ; then
1573 AC_DEFINE(HAVE_MODE_T)
1574fi
1575
Damien Miller61e50f12000-05-08 20:49:37 +10001576
1577AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1578 AC_TRY_COMPILE(
1579 [
Damien Miller81171112000-04-23 11:14:01 +10001580#include <sys/types.h>
1581#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001582 ],
1583 [ struct sockaddr_storage s; ],
1584 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1585 [ ac_cv_have_struct_sockaddr_storage="no" ]
1586 )
1587])
1588if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1589 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1590fi
Damien Miller34132e52000-01-14 15:45:46 +11001591
Damien Miller61e50f12000-05-08 20:49:37 +10001592AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1593 AC_TRY_COMPILE(
1594 [
Damien Miller7b22d652000-06-18 14:07:04 +10001595#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001596#include <netinet/in.h>
1597 ],
1598 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1599 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1600 [ ac_cv_have_struct_sockaddr_in6="no" ]
1601 )
1602])
1603if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1604 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1605fi
Damien Miller34132e52000-01-14 15:45:46 +11001606
Damien Miller61e50f12000-05-08 20:49:37 +10001607AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1608 AC_TRY_COMPILE(
1609 [
Damien Miller7b22d652000-06-18 14:07:04 +10001610#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001611#include <netinet/in.h>
1612 ],
1613 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1614 [ ac_cv_have_struct_in6_addr="yes" ],
1615 [ ac_cv_have_struct_in6_addr="no" ]
1616 )
1617])
1618if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1619 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1620fi
Damien Miller34132e52000-01-14 15:45:46 +11001621
Damien Miller61e50f12000-05-08 20:49:37 +10001622AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1623 AC_TRY_COMPILE(
1624 [
Damien Miller81171112000-04-23 11:14:01 +10001625#include <sys/types.h>
1626#include <sys/socket.h>
1627#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001628 ],
1629 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1630 [ ac_cv_have_struct_addrinfo="yes" ],
1631 [ ac_cv_have_struct_addrinfo="no" ]
1632 )
1633])
1634if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1635 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1636fi
1637
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001638AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1639 AC_TRY_COMPILE(
1640 [ #include <sys/time.h> ],
1641 [ struct timeval tv; tv.tv_sec = 1;],
1642 [ ac_cv_have_struct_timeval="yes" ],
1643 [ ac_cv_have_struct_timeval="no" ]
1644 )
1645])
1646if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1647 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1648 have_struct_timeval=1
1649fi
1650
Tim Rice4e4dc562003-03-18 10:21:40 -08001651AC_CHECK_TYPES(struct timespec)
1652
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001653# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001654if test "x$ac_cv_have_int64_t" = "xno" -a \
1655 "x$ac_cv_sizeof_long_int" != "x8" -a \
1656 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001657 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1658 echo "an alternative compiler (I.E., GCC) before continuing."
1659 echo ""
1660 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001661else
1662dnl test snprintf (broken on SCO w/gcc)
1663 AC_TRY_RUN(
1664 [
1665#include <stdio.h>
1666#include <string.h>
1667#ifdef HAVE_SNPRINTF
1668main()
1669{
1670 char buf[50];
1671 char expected_out[50];
1672 int mazsize = 50 ;
1673#if (SIZEOF_LONG_INT == 8)
1674 long int num = 0x7fffffffffffffff;
1675#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001676 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001677#endif
1678 strcpy(expected_out, "9223372036854775807");
1679 snprintf(buf, mazsize, "%lld", num);
1680 if(strcmp(buf, expected_out) != 0)
1681 exit(1);
1682 exit(0);
1683}
1684#else
1685main() { exit(0); }
1686#endif
1687 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1688 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001689fi
1690
Damien Miller78315eb2000-09-29 23:01:36 +11001691dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001692OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1693OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1694OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1695OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1696OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001697OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001698OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1699OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001700OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001701OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1702OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1703OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1704OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001705OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1706OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1707OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1708OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001709
1710AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001711
Damien Miller61e50f12000-05-08 20:49:37 +10001712AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1713 ac_cv_have_ss_family_in_struct_ss, [
1714 AC_TRY_COMPILE(
1715 [
Damien Miller81171112000-04-23 11:14:01 +10001716#include <sys/types.h>
1717#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001718 ],
1719 [ struct sockaddr_storage s; s.ss_family = 1; ],
1720 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1721 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1722 )
1723])
1724if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1725 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1726fi
1727
Damien Miller61e50f12000-05-08 20:49:37 +10001728AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1729 ac_cv_have___ss_family_in_struct_ss, [
1730 AC_TRY_COMPILE(
1731 [
Damien Miller81171112000-04-23 11:14:01 +10001732#include <sys/types.h>
1733#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001734 ],
1735 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1736 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1737 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1738 )
1739])
1740if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1741 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1742fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001743
Damien Millerad833b32000-08-23 10:46:23 +10001744AC_CACHE_CHECK([for pw_class field in struct passwd],
1745 ac_cv_have_pw_class_in_struct_passwd, [
1746 AC_TRY_COMPILE(
1747 [
Damien Millerad833b32000-08-23 10:46:23 +10001748#include <pwd.h>
1749 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001750 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001751 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1752 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1753 )
1754])
1755if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1756 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1757fi
1758
Kevin Steves82456952001-06-22 21:14:18 +00001759AC_CACHE_CHECK([for pw_expire field in struct passwd],
1760 ac_cv_have_pw_expire_in_struct_passwd, [
1761 AC_TRY_COMPILE(
1762 [
1763#include <pwd.h>
1764 ],
1765 [ struct passwd p; p.pw_expire = 0; ],
1766 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1767 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1768 )
1769])
1770if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1771 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1772fi
1773
1774AC_CACHE_CHECK([for pw_change field in struct passwd],
1775 ac_cv_have_pw_change_in_struct_passwd, [
1776 AC_TRY_COMPILE(
1777 [
1778#include <pwd.h>
1779 ],
1780 [ struct passwd p; p.pw_change = 0; ],
1781 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1782 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1783 )
1784])
1785if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1786 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1787fi
Damien Miller61e50f12000-05-08 20:49:37 +10001788
Tim Rice28bbb0c2002-05-27 17:37:32 -07001789dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001790AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1791 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001792 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001793 [
Tim Riceae49fe62002-04-12 10:26:21 -07001794#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001795#include <sys/socket.h>
1796#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001797int main() {
1798#ifdef msg_accrights
1799exit(1);
1800#endif
1801struct msghdr m;
1802m.msg_accrights = 0;
1803exit(0);
1804}
Kevin Steves939c9db2002-03-22 17:23:25 +00001805 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001806 [ ac_cv_have_accrights_in_msghdr="yes" ],
1807 [ ac_cv_have_accrights_in_msghdr="no" ]
1808 )
1809])
1810if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1811 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1812fi
1813
Kevin Stevesa44e0352002-04-07 16:18:03 +00001814AC_CACHE_CHECK([for msg_control field in struct msghdr],
1815 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001816 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001817 [
Tim Riceae49fe62002-04-12 10:26:21 -07001818#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001819#include <sys/socket.h>
1820#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001821int main() {
1822#ifdef msg_control
1823exit(1);
1824#endif
1825struct msghdr m;
1826m.msg_control = 0;
1827exit(0);
1828}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001829 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001830 [ ac_cv_have_control_in_msghdr="yes" ],
1831 [ ac_cv_have_control_in_msghdr="no" ]
1832 )
1833])
1834if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1835 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1836fi
1837
Damien Miller61e50f12000-05-08 20:49:37 +10001838AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1839 AC_TRY_LINK([],
1840 [ extern char *__progname; printf("%s", __progname); ],
1841 [ ac_cv_libc_defines___progname="yes" ],
1842 [ ac_cv_libc_defines___progname="no" ]
1843 )
1844])
1845if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1846 AC_DEFINE(HAVE___PROGNAME)
1847fi
1848
Kevin Steves4846f4a2002-03-22 18:19:53 +00001849AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1850 AC_TRY_LINK([
1851#include <stdio.h>
1852],
1853 [ printf("%s", __FUNCTION__); ],
1854 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1855 [ ac_cv_cc_implements___FUNCTION__="no" ]
1856 )
1857])
1858if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1859 AC_DEFINE(HAVE___FUNCTION__)
1860fi
1861
1862AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1863 AC_TRY_LINK([
1864#include <stdio.h>
1865],
1866 [ printf("%s", __func__); ],
1867 [ ac_cv_cc_implements___func__="yes" ],
1868 [ ac_cv_cc_implements___func__="no" ]
1869 )
1870])
1871if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1872 AC_DEFINE(HAVE___func__)
1873fi
1874
Damien Miller4f8e6692001-07-14 13:22:53 +10001875AC_CACHE_CHECK([whether getopt has optreset support],
1876 ac_cv_have_getopt_optreset, [
1877 AC_TRY_LINK(
1878 [
1879#include <getopt.h>
1880 ],
1881 [ extern int optreset; optreset = 0; ],
1882 [ ac_cv_have_getopt_optreset="yes" ],
1883 [ ac_cv_have_getopt_optreset="no" ]
1884 )
1885])
1886if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1887 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1888fi
Damien Millera22ba012000-03-02 23:09:20 +11001889
Damien Millerecbb26d2000-07-15 14:59:14 +10001890AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1891 AC_TRY_LINK([],
1892 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1893 [ ac_cv_libc_defines_sys_errlist="yes" ],
1894 [ ac_cv_libc_defines_sys_errlist="no" ]
1895 )
1896])
1897if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1898 AC_DEFINE(HAVE_SYS_ERRLIST)
1899fi
1900
1901
Damien Miller11fa2cc2000-08-16 10:35:58 +10001902AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1903 AC_TRY_LINK([],
1904 [ extern int sys_nerr; printf("%i", sys_nerr);],
1905 [ ac_cv_libc_defines_sys_nerr="yes" ],
1906 [ ac_cv_libc_defines_sys_nerr="no" ]
1907 )
1908])
1909if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1910 AC_DEFINE(HAVE_SYS_NERR)
1911fi
1912
Damien Miller85de5802001-09-18 14:01:11 +10001913SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001914# Check whether user wants sectok support
1915AC_ARG_WITH(sectok,
1916 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001917 [
1918 if test "x$withval" != "xno" ; then
1919 if test "x$withval" != "xyes" ; then
1920 CPPFLAGS="$CPPFLAGS -I${withval}"
1921 LDFLAGS="$LDFLAGS -L${withval}"
1922 if test ! -z "$need_dash_r" ; then
1923 LDFLAGS="$LDFLAGS -R${withval}"
1924 fi
1925 if test ! -z "$blibpath" ; then
1926 blibpath="$blibpath:${withval}"
1927 fi
1928 fi
1929 AC_CHECK_HEADERS(sectok.h)
1930 if test "$ac_cv_header_sectok_h" != yes; then
1931 AC_MSG_ERROR(Can't find sectok.h)
1932 fi
1933 AC_CHECK_LIB(sectok, sectok_open)
1934 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1935 AC_MSG_ERROR(Can't find libsectok)
1936 fi
1937 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001938 AC_DEFINE(USE_SECTOK)
1939 SCARD_MSG="yes, using sectok"
1940 fi
1941 ]
1942)
1943
1944# Check whether user wants OpenSC support
1945AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001946 AC_HELP_STRING([--with-opensc=PFX],
1947 [Enable smartcard support using OpenSC]),
1948 opensc_config_prefix="$withval", opensc_config_prefix="")
1949if test x$opensc_config_prefix != x ; then
1950 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1951 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1952 if test "$OPENSC_CONFIG" != "no"; then
1953 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1954 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1955 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1956 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1957 AC_DEFINE(SMARTCARD)
1958 AC_DEFINE(USE_OPENSC)
1959 SCARD_MSG="yes, using OpenSC"
1960 fi
1961fi
Damien Miller85de5802001-09-18 14:01:11 +10001962
Damien Miller7abe09b2003-05-15 10:53:49 +10001963# Check whether user wants DNS support
1964DNS_MSG="no"
1965AC_ARG_WITH(dns,
1966 [ --with-dns Support for fetching keys from DNS (experimental)],
1967 [
1968 if test "x$withval" != "xno" ; then
Damien Millerd9ec3702003-05-15 12:27:08 +10001969 DNS_MSG="yes"
1970 AC_DEFINE(DNS)
1971 AC_SEARCH_LIBS(getrrsetbyname, resolv,
Damien Miller200d0a72003-06-30 19:21:36 +10001972 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1973 [
1974 # Needed by our getrrsetbyname()
1975 AC_SEARCH_LIBS(res_query, resolv)
1976 AC_SEARCH_LIBS(dn_expand, resolv)
Tim Rice0ac16a42003-09-08 06:33:33 -07001977 AC_CHECK_FUNCS(_getshort _getlong)
Tim Riceb284e162003-09-08 14:35:16 -07001978 AC_CHECK_MEMBER(HEADER.ad,
1979 [AC_DEFINE(HAVE_HEADER_AD)],,
1980 [#include <arpa/nameser.h>])
Damien Miller200d0a72003-06-30 19:21:36 +10001981 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10001982 fi
1983 ]
1984)
1985
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001986# Check whether user wants Kerberos 5 support
1987KRB5_MSG="no"
1988AC_ARG_WITH(kerberos5,
1989 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1990 [
1991 if test "x$withval" != "xno" ; then
1992 if test "x$withval" = "xyes" ; then
1993 KRB5ROOT="/usr/local"
1994 else
1995 KRB5ROOT=${withval}
1996 fi
1997 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1998 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1999 AC_DEFINE(KRB5)
2000 KRB5_MSG="yes"
2001 AC_MSG_CHECKING(whether we are using Heimdal)
2002 AC_TRY_COMPILE([ #include <krb5.h> ],
2003 [ char *tmp = heimdal_version; ],
2004 [ AC_MSG_RESULT(yes)
2005 AC_DEFINE(HEIMDAL)
2006 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2007 ],
2008 [ AC_MSG_RESULT(no)
2009 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2010 ]
2011 )
2012 if test ! -z "$need_dash_r" ; then
2013 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2014 fi
2015 if test ! -z "$blibpath" ; then
2016 blibpath="$blibpath:${KRB5ROOT}/lib"
2017 fi
Damien Miller200d0a72003-06-30 19:21:36 +10002018 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002019
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002020 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2021 [ AC_DEFINE(GSSAPI)
2022 K5LIBS="-lgssapi $K5LIBS" ],
2023 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2024 [ AC_DEFINE(GSSAPI)
2025 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2026 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2027 $K5LIBS)
2028 ],
2029 $K5LIBS)
2030
2031 AC_CHECK_HEADER(gssapi.h, ,
2032 [ unset ac_cv_header_gssapi_h
2033 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2034 AC_CHECK_HEADERS(gssapi.h, ,
2035 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2036 )
2037 ]
2038 )
2039
2040 oldCPP="$CPPFLAGS"
2041 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2042 AC_CHECK_HEADER(gssapi_krb5.h, ,
2043 [ CPPFLAGS="$oldCPP" ])
2044
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002045 KRB5=yes
2046 fi
2047 ]
2048)
Darren Tucker6aaa58c2003-08-02 22:24:49 +10002049LIBS="$LIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10002050
Damien Millera22ba012000-03-02 23:09:20 +11002051# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002052
Damien Millerf58c6722002-05-13 13:15:42 +10002053PRIVSEP_PATH=/var/empty
2054AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002055 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002056 [
2057 if test "x$withval" != "$no" ; then
2058 PRIVSEP_PATH=$withval
2059 fi
2060 ]
2061)
2062AC_SUBST(PRIVSEP_PATH)
2063
Damien Millera22ba012000-03-02 23:09:20 +11002064AC_ARG_WITH(xauth,
2065 [ --with-xauth=PATH Specify path to xauth program ],
2066 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002067 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002068 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002069 fi
2070 ],
2071 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002072 TestPath="$PATH"
2073 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2074 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2075 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2076 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2077 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002078 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002079 xauth_path="/usr/openwin/bin/xauth"
2080 fi
2081 ]
2082)
2083
Damien Miller7d901272003-01-13 16:55:22 +11002084STRIP_OPT=-s
2085AC_ARG_ENABLE(strip,
2086 [ --disable-strip Disable calling strip(1) on install],
2087 [
2088 if test "x$enableval" = "xno" ; then
2089 STRIP_OPT=
2090 fi
2091 ]
2092)
2093AC_SUBST(STRIP_OPT)
2094
Damien Millera19cf472000-11-29 13:28:50 +11002095if test -z "$xauth_path" ; then
2096 XAUTH_PATH="undefined"
2097 AC_SUBST(XAUTH_PATH)
2098else
Damien Millera22ba012000-03-02 23:09:20 +11002099 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002100 XAUTH_PATH=$xauth_path
2101 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002102fi
Damien Millera22ba012000-03-02 23:09:20 +11002103
2104# Check for mail directory (last resort if we cannot get it from headers)
2105if test ! -z "$MAIL" ; then
2106 maildir=`dirname $MAIL`
2107 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2108fi
2109
Damien Millera22ba012000-03-02 23:09:20 +11002110if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002111 if test "x$disable_ptmx_check" != "xyes" ; then
2112 AC_CHECK_FILE("/dev/ptmx",
2113 [
2114 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2115 have_dev_ptmx=1
2116 ]
2117 )
2118 fi
Damien Millera22ba012000-03-02 23:09:20 +11002119fi
Damien Miller204ad072000-03-02 23:56:12 +11002120AC_CHECK_FILE("/dev/ptc",
2121 [
2122 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2123 have_dev_ptc=1
2124 ]
2125)
2126
Damien Millera22ba012000-03-02 23:09:20 +11002127# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002128AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002129 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002130 [
Damien Miller897741e2001-04-16 10:41:46 +10002131 case "$withval" in
2132 man|cat|doc)
2133 MANTYPE=$withval
2134 ;;
2135 *)
2136 AC_MSG_ERROR(invalid man type: $withval)
2137 ;;
2138 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002139 ]
2140)
Ben Lindstrombc709922001-04-18 18:04:21 +00002141if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002142 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2143 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002144 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2145 MANTYPE=doc
2146 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2147 MANTYPE=man
2148 else
2149 MANTYPE=cat
2150 fi
2151fi
Damien Miller670a4b82000-01-22 13:53:11 +11002152AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002153if test "$MANTYPE" = "doc"; then
2154 mansubdir=man;
2155else
2156 mansubdir=$MANTYPE;
2157fi
2158AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002159
Damien Millera22ba012000-03-02 23:09:20 +11002160# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10002161MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002162AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002163 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002164 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002165 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002166 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10002167 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002168 fi
2169 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002170)
2171
Damien Millera22ba012000-03-02 23:09:20 +11002172# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002173AC_ARG_WITH(shadow,
2174 [ --without-shadow Disable shadow password support],
2175 [
2176 if test "x$withval" = "xno" ; then
2177 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002178 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002179 fi
2180 ]
2181)
2182
Damien Miller1f335fb2000-06-26 11:31:33 +10002183if test -z "$disable_shadow" ; then
2184 AC_MSG_CHECKING([if the systems has expire shadow information])
2185 AC_TRY_COMPILE(
2186 [
2187#include <sys/types.h>
2188#include <shadow.h>
2189 struct spwd sp;
2190 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2191 [ sp_expire_available=yes ], []
2192 )
2193
2194 if test "x$sp_expire_available" = "xyes" ; then
2195 AC_MSG_RESULT(yes)
2196 AC_DEFINE(HAS_SHADOW_EXPIRE)
2197 else
2198 AC_MSG_RESULT(no)
2199 fi
2200fi
2201
Damien Millera22ba012000-03-02 23:09:20 +11002202# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002203if test ! -z "$IPADDR_IN_DISPLAY" ; then
2204 DISPLAY_HACK_MSG="yes"
2205 AC_DEFINE(IPADDR_IN_DISPLAY)
2206else
2207 DISPLAY_HACK_MSG="no"
2208 AC_ARG_WITH(ipaddr-display,
2209 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2210 [
2211 if test "x$withval" != "xno" ; then
2212 AC_DEFINE(IPADDR_IN_DISPLAY)
2213 DISPLAY_HACK_MSG="yes"
2214 fi
2215 ]
2216 )
2217fi
Damien Miller76112de1999-12-21 11:18:08 +11002218
Darren Tuckere1a790d2003-09-16 11:52:19 +10002219# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002220AC_ARG_ENABLE(etc-default-login,
2221 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2222[
Darren Tuckere1a790d2003-09-16 11:52:19 +10002223AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2224
2225if test "x$external_path_file" = "x/etc/default/login"; then
2226 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2227fi
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002228])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002229
Tim Rice43a1c132002-04-17 21:19:14 -07002230dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2231if test $ac_cv_func_login_getcapbool = "yes" -a \
2232 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002233 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002234fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002235
Damien Millera22ba012000-03-02 23:09:20 +11002236# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002237SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002238AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002239 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002240 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002241 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002242 AC_MSG_WARN([
2243--with-default-path=PATH has no effect on this system.
2244Edit /etc/login.conf instead.])
2245 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002246 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002247 AC_MSG_WARN([
2248--with-default-path=PATH will only be used if PATH is not defined in
2249$external_path_file .])
2250 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002251 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002252 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002253 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002254 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002255 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2256 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002257 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002258 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002259 AC_MSG_WARN([
2260If PATH is defined in $external_path_file, ensure the path to scp is included,
2261otherwise scp will not work.])
2262 fi
2263 AC_TRY_RUN(
2264 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002265/* find out what STDPATH is */
2266#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002267#ifdef HAVE_PATHS_H
2268# include <paths.h>
2269#endif
2270#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002271# ifdef _PATH_USERPATH /* Irix */
2272# define _PATH_STDPATH _PATH_USERPATH
2273# else
2274# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2275# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002276#endif
2277#include <sys/types.h>
2278#include <sys/stat.h>
2279#include <fcntl.h>
2280#define DATA "conftest.stdpath"
2281
2282main()
2283{
2284 FILE *fd;
2285 int rc;
2286
2287 fd = fopen(DATA,"w");
2288 if(fd == NULL)
2289 exit(1);
2290
2291 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2292 exit(1);
2293
2294 exit(0);
2295}
2296 ], [ user_path=`cat conftest.stdpath` ],
2297 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2298 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2299 )
2300# make sure $bindir is in USER_PATH so scp will work
2301 t_bindir=`eval echo ${bindir}`
2302 case $t_bindir in
2303 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2304 esac
2305 case $t_bindir in
2306 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2307 esac
2308 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2309 if test $? -ne 0 ; then
2310 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2311 if test $? -ne 0 ; then
2312 user_path=$user_path:$t_bindir
2313 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2314 fi
2315 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002316 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002317)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002318if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002319 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2320 AC_SUBST(user_path)
2321fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002322
Damien Millera18bbd32002-05-13 10:48:57 +10002323# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002324AC_ARG_WITH(superuser-path,
2325 [ --with-superuser-path= Specify different path for super-user],
2326 [
2327 if test "x$withval" != "xno" ; then
2328 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2329 superuser_path=$withval
2330 fi
2331 ]
2332)
2333
2334
Damien Miller61e50f12000-05-08 20:49:37 +10002335AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002336IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002337AC_ARG_WITH(4in6,
2338 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2339 [
2340 if test "x$withval" != "xno" ; then
2341 AC_MSG_RESULT(yes)
2342 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002343 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002344 else
2345 AC_MSG_RESULT(no)
2346 fi
2347 ],[
2348 if test "x$inet6_default_4in6" = "xyes"; then
2349 AC_MSG_RESULT([yes (default)])
2350 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002351 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002352 else
2353 AC_MSG_RESULT([no (default)])
2354 fi
2355 ]
2356)
2357
Damien Miller60396b02001-02-18 17:01:00 +11002358# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002359BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002360AC_ARG_WITH(bsd-auth,
2361 [ --with-bsd-auth Enable BSD auth support],
2362 [
2363 if test "x$withval" != "xno" ; then
2364 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002365 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002366 fi
2367 ]
2368)
2369
Damien Millera22ba012000-03-02 23:09:20 +11002370# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002371piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002372# make sure the directory exists
2373if test ! -d $piddir ; then
2374 piddir=`eval echo ${sysconfdir}`
2375 case $piddir in
2376 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2377 esac
2378fi
2379
Tim Rice88f2ab52002-03-17 12:17:34 -08002380AC_ARG_WITH(pid-dir,
2381 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2382 [
2383 if test "x$withval" != "xno" ; then
2384 piddir=$withval
2385 if test ! -d $piddir ; then
2386 AC_MSG_WARN([** no $piddir directory on this system **])
2387 fi
2388 fi
2389 ]
2390)
2391
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002392AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002393AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002394
andre2ff7b5d2000-06-03 14:57:40 +00002395dnl allow user to disable some login recording features
2396AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002397 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002398 [
2399 if test "x$enableval" = "xno" ; then
2400 AC_DEFINE(DISABLE_LASTLOG)
2401 fi
2402 ]
andre2ff7b5d2000-06-03 14:57:40 +00002403)
2404AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002405 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002406 [
2407 if test "x$enableval" = "xno" ; then
2408 AC_DEFINE(DISABLE_UTMP)
2409 fi
2410 ]
andre2ff7b5d2000-06-03 14:57:40 +00002411)
2412AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002413 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002414 [
2415 if test "x$enableval" = "xno" ; then
2416 AC_DEFINE(DISABLE_UTMPX)
2417 fi
2418 ]
andre2ff7b5d2000-06-03 14:57:40 +00002419)
2420AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002421 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002422 [
2423 if test "x$enableval" = "xno" ; then
2424 AC_DEFINE(DISABLE_WTMP)
2425 fi
2426 ]
andre2ff7b5d2000-06-03 14:57:40 +00002427)
2428AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002429 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002430 [
2431 if test "x$enableval" = "xno" ; then
2432 AC_DEFINE(DISABLE_WTMPX)
2433 fi
2434 ]
andre2ff7b5d2000-06-03 14:57:40 +00002435)
2436AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002437 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002438 [
2439 if test "x$enableval" = "xno" ; then
2440 AC_DEFINE(DISABLE_LOGIN)
2441 fi
2442 ]
andre2ff7b5d2000-06-03 14:57:40 +00002443)
2444AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002445 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002446 [
2447 if test "x$enableval" = "xno" ; then
2448 AC_DEFINE(DISABLE_PUTUTLINE)
2449 fi
2450 ]
andre2ff7b5d2000-06-03 14:57:40 +00002451)
2452AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002453 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002454 [
2455 if test "x$enableval" = "xno" ; then
2456 AC_DEFINE(DISABLE_PUTUTXLINE)
2457 fi
2458 ]
andre2ff7b5d2000-06-03 14:57:40 +00002459)
2460AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002461 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002462 [
2463 if test "x$withval" = "xno" ; then
2464 AC_DEFINE(DISABLE_LASTLOG)
2465 else
2466 conf_lastlog_location=$withval
2467 fi
2468 ]
2469)
andre2ff7b5d2000-06-03 14:57:40 +00002470
2471dnl lastlog, [uw]tmpx? detection
2472dnl NOTE: set the paths in the platform section to avoid the
2473dnl need for command-line parameters
2474dnl lastlog and [uw]tmp are subject to a file search if all else fails
2475
2476dnl lastlog detection
2477dnl NOTE: the code itself will detect if lastlog is a directory
2478AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2479AC_TRY_COMPILE([
2480#include <sys/types.h>
2481#include <utmp.h>
2482#ifdef HAVE_LASTLOG_H
2483# include <lastlog.h>
2484#endif
Damien Miller2994e082000-06-04 15:51:47 +10002485#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002486# include <paths.h>
2487#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002488#ifdef HAVE_LOGIN_H
2489# include <login.h>
2490#endif
andre2ff7b5d2000-06-03 14:57:40 +00002491 ],
2492 [ char *lastlog = LASTLOG_FILE; ],
2493 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002494 [
2495 AC_MSG_RESULT(no)
2496 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2497 AC_TRY_COMPILE([
2498#include <sys/types.h>
2499#include <utmp.h>
2500#ifdef HAVE_LASTLOG_H
2501# include <lastlog.h>
2502#endif
2503#ifdef HAVE_PATHS_H
2504# include <paths.h>
2505#endif
2506 ],
2507 [ char *lastlog = _PATH_LASTLOG; ],
2508 [ AC_MSG_RESULT(yes) ],
2509 [
andree441aa32000-06-12 22:34:38 +00002510 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002511 system_lastlog_path=no
2512 ])
2513 ]
andre2ff7b5d2000-06-03 14:57:40 +00002514)
Damien Miller2994e082000-06-04 15:51:47 +10002515
andre2ff7b5d2000-06-03 14:57:40 +00002516if test -z "$conf_lastlog_location"; then
2517 if test x"$system_lastlog_path" = x"no" ; then
2518 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002519 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002520 conf_lastlog_location=$f
2521 fi
2522 done
2523 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002524 AC_MSG_WARN([** Cannot find lastlog **])
2525 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002526 fi
2527 fi
2528fi
2529
2530if test -n "$conf_lastlog_location"; then
2531 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2532fi
2533
2534dnl utmp detection
2535AC_MSG_CHECKING([if your system defines UTMP_FILE])
2536AC_TRY_COMPILE([
2537#include <sys/types.h>
2538#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002539#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002540# include <paths.h>
2541#endif
2542 ],
2543 [ char *utmp = UTMP_FILE; ],
2544 [ AC_MSG_RESULT(yes) ],
2545 [ AC_MSG_RESULT(no)
2546 system_utmp_path=no ]
2547)
2548if test -z "$conf_utmp_location"; then
2549 if test x"$system_utmp_path" = x"no" ; then
2550 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2551 if test -f $f ; then
2552 conf_utmp_location=$f
2553 fi
2554 done
2555 if test -z "$conf_utmp_location"; then
2556 AC_DEFINE(DISABLE_UTMP)
2557 fi
2558 fi
2559fi
2560if test -n "$conf_utmp_location"; then
2561 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2562fi
2563
2564dnl wtmp detection
2565AC_MSG_CHECKING([if your system defines WTMP_FILE])
2566AC_TRY_COMPILE([
2567#include <sys/types.h>
2568#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002569#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002570# include <paths.h>
2571#endif
2572 ],
2573 [ char *wtmp = WTMP_FILE; ],
2574 [ AC_MSG_RESULT(yes) ],
2575 [ AC_MSG_RESULT(no)
2576 system_wtmp_path=no ]
2577)
2578if test -z "$conf_wtmp_location"; then
2579 if test x"$system_wtmp_path" = x"no" ; then
2580 for f in /usr/adm/wtmp /var/log/wtmp; do
2581 if test -f $f ; then
2582 conf_wtmp_location=$f
2583 fi
2584 done
2585 if test -z "$conf_wtmp_location"; then
2586 AC_DEFINE(DISABLE_WTMP)
2587 fi
2588 fi
2589fi
2590if test -n "$conf_wtmp_location"; then
2591 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2592fi
2593
2594
2595dnl utmpx detection - I don't know any system so perverse as to require
2596dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2597dnl there, though.
2598AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2599AC_TRY_COMPILE([
2600#include <sys/types.h>
2601#include <utmp.h>
2602#ifdef HAVE_UTMPX_H
2603#include <utmpx.h>
2604#endif
Damien Miller2994e082000-06-04 15:51:47 +10002605#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002606# include <paths.h>
2607#endif
2608 ],
2609 [ char *utmpx = UTMPX_FILE; ],
2610 [ AC_MSG_RESULT(yes) ],
2611 [ AC_MSG_RESULT(no)
2612 system_utmpx_path=no ]
2613)
2614if test -z "$conf_utmpx_location"; then
2615 if test x"$system_utmpx_path" = x"no" ; then
2616 AC_DEFINE(DISABLE_UTMPX)
2617 fi
2618else
2619 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2620fi
2621
2622dnl wtmpx detection
2623AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2624AC_TRY_COMPILE([
2625#include <sys/types.h>
2626#include <utmp.h>
2627#ifdef HAVE_UTMPX_H
2628#include <utmpx.h>
2629#endif
Damien Miller2994e082000-06-04 15:51:47 +10002630#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002631# include <paths.h>
2632#endif
2633 ],
2634 [ char *wtmpx = WTMPX_FILE; ],
2635 [ AC_MSG_RESULT(yes) ],
2636 [ AC_MSG_RESULT(no)
2637 system_wtmpx_path=no ]
2638)
2639if test -z "$conf_wtmpx_location"; then
2640 if test x"$system_wtmpx_path" = x"no" ; then
2641 AC_DEFINE(DISABLE_WTMPX)
2642 fi
2643else
2644 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2645fi
2646
Damien Miller4018c192000-04-30 09:30:44 +10002647
Damien Miller29ea30d2000-03-17 10:54:15 +11002648if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002649 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2650 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002651fi
2652
Tim Rice4cec93f2002-02-26 08:40:48 -08002653dnl remove pam and dl because they are in $LIBPAM
2654if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002655 LIBS=`echo $LIBS | sed 's/-lpam //'`
2656fi
2657if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2658 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002659fi
2660
Damien Millerbac2d8a2000-09-05 16:13:06 +11002661AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002662AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2663AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002664
Damien Miller7b22d652000-06-18 14:07:04 +10002665# Print summary of options
2666
Damien Miller7b22d652000-06-18 14:07:04 +10002667# Someone please show me a better way :)
2668A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2669B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2670C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2671D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002672E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002673F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002674G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002675H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2676I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2677J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002678
2679echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002680echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002681echo " User binaries: $B"
2682echo " System binaries: $C"
2683echo " Configuration files: $D"
2684echo " Askpass program: $E"
2685echo " Manual pages: $F"
2686echo " PID file: $G"
2687echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002688if test "x$external_path_file" = "x/etc/login.conf" ; then
2689echo " At runtime, sshd will use the path defined in $external_path_file"
2690echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002691else
Damien Millerf58c6722002-05-13 13:15:42 +10002692echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002693 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002694echo " (If PATH is set in $external_path_file it will be used instead. If"
2695echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2696 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002697fi
Damien Millera18bbd32002-05-13 10:48:57 +10002698if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002699echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002700fi
Damien Millerf58c6722002-05-13 13:15:42 +10002701echo " Manpage format: $MANTYPE"
Damien Miller9d2be482003-05-15 11:12:19 +10002702echo " DNS support: $DNS_MSG"
Damien Miller7abe09b2003-05-15 10:53:49 +10002703echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002704echo " KerberosV support: $KRB5_MSG"
2705echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002706echo " S/KEY support: $SKEY_MSG"
2707echo " TCP Wrappers support: $TCPW_MSG"
2708echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002709echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002710echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2711echo " BSD Auth support: $BSD_AUTH_MSG"
2712echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002713if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002714echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002715fi
2716
Damien Miller7b22d652000-06-18 14:07:04 +10002717echo ""
2718
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002719echo " Host: ${host}"
2720echo " Compiler: ${CC}"
2721echo " Compiler flags: ${CFLAGS}"
2722echo "Preprocessor flags: ${CPPFLAGS}"
2723echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002724echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002725
2726echo ""
2727
Damien Miller82cf0ce2000-12-20 13:34:48 +11002728if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002729 echo "PAM is enabled. You may need to install a PAM control file "
2730 echo "for sshd, otherwise password authentication may fail. "
2731 echo "Example PAM control files can be found in the contrib/ "
2732 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002733 echo ""
2734fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002735
Damien Miller6c21c512002-01-22 21:57:53 +11002736if test ! -z "$RAND_HELPER_CMDHASH" ; then
2737 echo "WARNING: you are using the builtin random number collection "
2738 echo "service. Please read WARNING.RNG and request that your OS "
2739 echo "vendor includes kernel-based random number collection in "
2740 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002741 echo ""
2742fi
Damien Miller60396b02001-02-18 17:01:00 +11002743