blob: ad0eedc687d94b1ee5dfcd09bc0a4e2b9873a511 [file] [log] [blame]
Tim Rice1e1ef642003-09-11 22:19:31 -07001# $Id: configure.ac,v 1.151 2003/09/12 05:19:31 tim 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)],
134 [AC_MSG_RESULT(assume it is working)])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000135 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000136*-*-hpux10.26)
137 if test -z "$GCC"; then
138 CFLAGS="$CFLAGS -Ae"
139 fi
140 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
141 IPADDR_IN_DISPLAY=yes
142 AC_DEFINE(HAVE_SECUREWARE)
143 AC_DEFINE(USE_PIPES)
144 AC_DEFINE(LOGIN_NO_ENDOPT)
145 AC_DEFINE(LOGIN_NEEDS_UTMPX)
146 AC_DEFINE(DISABLE_SHADOW)
147 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000148 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000149 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700150 LIBS="$LIBS -lsec -lsecpw"
151 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000152 disable_ptmx_check=yes
153 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100154*-*-hpux10*)
155 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000156 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100157 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000158 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100159 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000160 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000161 AC_DEFINE(LOGIN_NO_ENDOPT)
162 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100163 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100164 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000165 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000166 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700167 LIBS="$LIBS -lsec"
168 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100169 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000170*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000171 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100172 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100173 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100174 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000175 AC_DEFINE(LOGIN_NO_ENDOPT)
176 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100177 AC_DEFINE(DISABLE_SHADOW)
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)
Damien Millerf1b9d112002-04-23 23:09:19 +1000189 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000190 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100191 ;;
192*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000193 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000194 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100195 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000196 AC_DEFINE(WITH_IRIX_ARRAY)
197 AC_DEFINE(WITH_IRIX_PROJECT)
198 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000199 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000200 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000201 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000202 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100203 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100204*-*-linux*)
205 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100206 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000207 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100208 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000209 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000210 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
Damien Miller35276252003-06-03 10:14:28 +1000211 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller7bcb0892000-03-11 20:45:40 +1100212 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000213 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000214 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000215 AC_DEFINE(BROKEN_CMSG_TYPE)
216 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000217 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100218 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000219mips-sony-bsd|mips-sony-newsos4)
220 AC_DEFINE(HAVE_NEWS4)
221 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000222 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100223*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000224 check_for_libcrypt_before=1
Damien Millera22ba012000-03-02 23:09:20 +1100225 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100226 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100227*-*-freebsd*)
228 check_for_libcrypt_later=1
229 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000230*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000231 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100232 conf_utmp_location=/etc/utmp
233 conf_wtmp_location=/usr/adm/wtmp
234 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000235 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000236 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000237 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100238 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000239 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000240 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000241 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100242*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000243 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000244 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100245 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100246 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000247 AC_DEFINE(LOGIN_NEEDS_UTMPX)
248 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000249 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000250 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000251 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
252 AC_DEFINE(SSHD_ACQUIRES_CTTY)
andre2ff7b5d2000-06-03 14:57:40 +0000253 # hardwire lastlog location (can't detect it on some versions)
254 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000255 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
256 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
257 if test "$sol2ver" -ge 8; then
258 AC_MSG_RESULT(yes)
259 AC_DEFINE(DISABLE_UTMP)
260 AC_DEFINE(DISABLE_WTMP)
261 else
262 AC_MSG_RESULT(no)
263 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100264 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000265*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000266 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000267 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100268 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000269 conf_utmp_location=/etc/utmp
270 conf_wtmp_location=/var/adm/wtmp
271 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000272 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000273 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000274*-ncr-sysv*)
275 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
276 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700277 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000278 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000279 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000280 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000281*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000282 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700283 # /usr/ucblib MUST NOT be searched on ReliantUNIX
284 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100285 IPADDR_IN_DISPLAY=yes
286 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000287 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000288 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700289 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
290 # Attention: always take care to bind libsocket and libnsl before libc,
291 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000292 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100293*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000294 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100295 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100296 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100297 ;;
298*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000299 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100300 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100301 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100302 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100303*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000304 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100305 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100306 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100307*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000308 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100309 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700310 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100311 RANLIB=true
312 no_dev_ptmx=1
313 AC_DEFINE(BROKEN_SYS_TERMIO_H)
314 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000315 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000316 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100317 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100318 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700319 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700320 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100321 ;;
322*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800323 if test -z "$GCC"; then
324 CFLAGS="$CFLAGS -belf"
325 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000326 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000327 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100328 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000329 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100330 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000331 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000332 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700333 AC_DEFINE(DISABLE_FD_PASSING)
Damien Miller217f5672001-02-16 12:12:41 +1100334 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700335 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000336 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000337*-*-unicosmk*)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000338 AC_DEFINE(USE_PIPES)
339 AC_DEFINE(DISABLE_FD_PASSING)
340 LDFLAGS="$LDFLAGS"
341 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
342 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000343 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000344*-*-unicosmp*)
345 AC_DEFINE(WITH_ABBREV_NO_TTY)
346 AC_DEFINE(USE_PIPES)
347 AC_DEFINE(DISABLE_FD_PASSING)
348 LDFLAGS="$LDFLAGS"
349 LIBS="$LIBS -lgen -lacid"
350 MANTYPE=cat
351 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000352*-*-unicos*)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000353 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700354 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700355 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000356 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
357 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
358 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700359 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000360*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000361 AC_MSG_CHECKING(for Digital Unix SIA)
362 no_osfsia=""
363 AC_ARG_WITH(osfsia,
364 [ --with-osfsia Enable Digital Unix SIA],
365 [
366 if test "x$withval" = "xno" ; then
367 AC_MSG_RESULT(disabled)
368 no_osfsia=1
369 fi
370 ],
371 )
372 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000373 if test -f /etc/sia/matrix.conf; then
374 AC_MSG_RESULT(yes)
375 AC_DEFINE(HAVE_OSF_SIA)
376 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000377 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000378 LIBS="$LIBS -lsecurity -ldb -lm -laud"
379 else
380 AC_MSG_RESULT(no)
381 fi
382 fi
Ben Lindstromdc3c7572002-10-04 23:54:54 +0000383 AC_DEFINE(DISABLE_FD_PASSING)
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000384 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tuckere41bba52003-08-25 11:51:19 +1000385 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000386 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000387
388*-*-nto-qnx)
389 AC_DEFINE(USE_PIPES)
390 AC_DEFINE(NO_X11_UNIX_SOCKETS)
391 AC_DEFINE(MISSING_NFDBITS)
392 AC_DEFINE(MISSING_HOWMANY)
393 AC_DEFINE(MISSING_FD_MASK)
394 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100395esac
396
Damien Millere37bfc12000-06-05 09:37:43 +1000397# Allow user to specify flags
398AC_ARG_WITH(cflags,
399 [ --with-cflags Specify additional flags to pass to compiler],
400 [
401 if test "x$withval" != "xno" ; then
402 CFLAGS="$CFLAGS $withval"
403 fi
404 ]
405)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000406AC_ARG_WITH(cppflags,
407 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
408 [
409 if test "x$withval" != "xno"; then
410 CPPFLAGS="$CPPFLAGS $withval"
411 fi
412 ]
413)
Damien Millere37bfc12000-06-05 09:37:43 +1000414AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000415 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000416 [
417 if test "x$withval" != "xno" ; then
418 LDFLAGS="$LDFLAGS $withval"
419 fi
420 ]
421)
422AC_ARG_WITH(libs,
423 [ --with-libs Specify additional libraries to link with],
424 [
425 if test "x$withval" != "xno" ; then
426 LIBS="$LIBS $withval"
427 fi
428 ]
429)
430
Darren Tucker6eb93042003-06-29 21:30:41 +1000431AC_MSG_CHECKING(compiler and flags for sanity)
432AC_TRY_RUN([
433#include <stdio.h>
434int main(){exit(0);}
435 ],
436 [ AC_MSG_RESULT(yes) ],
437 [
438 AC_MSG_RESULT(no)
439 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
440 ]
441)
442
Tim Rice4cec93f2002-02-26 08:40:48 -0800443# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000444AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000445 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800446 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000447 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000448 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000449 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
450 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
Ben Lindstrom4b0f1ad2003-02-01 04:43:34 +0000451 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
Tim Rice81ed5182002-09-25 17:38:46 -0700452 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800453 util.h utime.h utmp.h utmpx.h)
454
Damien Millera22ba012000-03-02 23:09:20 +1100455# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700456AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
457AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000458
Damien Millerdf288022001-02-18 13:07:07 +1100459dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700460if test "x$with_tcp_wrappers" != "xno" ; then
461 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
462 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
463 fi
464fi
Damien Millerdf288022001-02-18 13:07:07 +1100465
Tim Rice1e1ef642003-09-11 22:19:31 -0700466dnl IRIX and Solaris 2.5.1 have dirname() in libgen
467AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
468 AC_CHECK_LIB(gen, dirname,[
469 AC_CACHE_CHECK([for broken dirname],
470 ac_cv_have_broken_dirname, [
471 save_LIBS="$LIBS"
472 LIBS="$LIBS -lgen"
473 AC_TRY_RUN(
474 [
475#include <libgen.h>
476#include <string.h>
477
478int main(int argc, char **argv) {
479 char *s, buf[32];
480
481 strncpy(buf,"/etc", 32);
482 s = dirname(buf);
483 if (!s || strncmp(s, "/", 32) != 0) {
484 exit(1);
485 } else {
486 exit(0);
487 }
488}
489 ],
490 [ ac_cv_have_broken_dirname="no" ],
491 [ ac_cv_have_broken_dirname="yes" ]
492 )
493 LIBS="$save_LIBS"
494 ])
495 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
496 LIBS="$LIBS -lgen"
497 AC_DEFINE(HAVE_DIRNAME)
498 AC_CHECK_HEADERS(libgen.h)
499 fi
500 ])
501])
502
503AC_CHECK_FUNC(getspnam, ,
504 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
505AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
506
Damien Miller150c8b52002-02-13 23:06:56 +1100507AC_ARG_WITH(rpath,
508 [ --without-rpath Disable auto-added -R linker paths],
509 [
510 if test "x$withval" = "xno" ; then
511 need_dash_r=""
512 fi
513 if test "x$withval" = "xyes" ; then
514 need_dash_r=1
515 fi
516 ]
517)
518
Tim Rice13aae5e2001-10-21 17:53:58 -0700519dnl zlib is required
520AC_ARG_WITH(zlib,
521 [ --with-zlib=PATH Use zlib in PATH],
522 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000523 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100524 AC_MSG_ERROR([*** zlib is required ***])
525 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700526 if test -d "$withval/lib"; then
527 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700528 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700529 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700530 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700531 fi
532 else
533 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700534 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700535 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700536 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700537 fi
538 fi
539 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700540 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700541 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700542 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700543 fi
544 ]
545)
546
Tim Rice17b93e52001-10-23 22:36:54 -0700547AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100548
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000549dnl UnixWare 2.x
550AC_CHECK_FUNC(strcasecmp,
551 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
552)
553AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700554 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
555 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000556)
Damien Millerab18c411999-11-11 10:40:23 +1100557
Tim Ricee589a292001-11-03 11:09:32 -0800558dnl Checks for libutil functions
559AC_CHECK_HEADERS(libutil.h)
560AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
561AC_CHECK_FUNCS(logout updwtmp logwtmp)
562
Ben Lindstrom8697e082001-02-24 21:41:10 +0000563AC_FUNC_STRFTIME
564
Damien Miller3c027682001-03-14 11:39:45 +1100565# Check for ALTDIRFUNC glob() extension
566AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
567AC_EGREP_CPP(FOUNDIT,
568 [
569 #include <glob.h>
570 #ifdef GLOB_ALTDIRFUNC
571 FOUNDIT
572 #endif
573 ],
574 [
575 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
576 AC_MSG_RESULT(yes)
577 ],
578 [
579 AC_MSG_RESULT(no)
580 ]
581)
Damien Millerab18c411999-11-11 10:40:23 +1100582
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000583# Check for g.gl_matchc glob() extension
584AC_MSG_CHECKING(for gl_matchc field in glob_t)
585AC_EGREP_CPP(FOUNDIT,
586 [
587 #include <glob.h>
588 int main(void){glob_t g; g.gl_matchc = 1;}
589 ],
590 [
591 AC_DEFINE(GLOB_HAS_GL_MATCHC)
592 AC_MSG_RESULT(yes)
593 ],
594 [
595 AC_MSG_RESULT(no)
596 ]
597)
598
Damien Miller18bb4732001-03-28 14:35:30 +1000599AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
600AC_TRY_RUN(
601 [
602#include <sys/types.h>
603#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700604int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000605 ],
606 [AC_MSG_RESULT(yes)],
607 [
608 AC_MSG_RESULT(no)
609 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
610 ]
611)
612
Damien Millerc547bf12001-02-16 10:18:12 +1100613# Check whether user wants S/Key support
614SKEY_MSG="no"
615AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700616 [ --with-skey[[=PATH]] Enable S/Key support
617 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100618 [
619 if test "x$withval" != "xno" ; then
620
621 if test "x$withval" != "xyes" ; then
622 CPPFLAGS="$CPPFLAGS -I${withval}/include"
623 LDFLAGS="$LDFLAGS -L${withval}/lib"
624 fi
625
626 AC_DEFINE(SKEY)
627 LIBS="-lskey $LIBS"
628 SKEY_MSG="yes"
629
Tim Rice4cec93f2002-02-26 08:40:48 -0800630 AC_MSG_CHECKING([for s/key support])
631 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100632 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800633#include <stdio.h>
634#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700635int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800636 ],
637 [AC_MSG_RESULT(yes)],
638 [
639 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100640 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
641 ])
642 fi
643 ]
644)
645
646# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700647TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100648AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700649 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
650 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100651 [
652 if test "x$withval" != "xno" ; then
653 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700654 saved_LDFLAGS="$LDFLAGS"
655 saved_CPPFLAGS="$CPPFLAGS"
656 if test -n "${withval}" -a "${withval}" != "yes"; then
657 if test -d "${withval}/lib"; then
658 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700659 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700660 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700661 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700662 fi
663 else
664 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700665 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700666 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700667 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700668 fi
669 fi
670 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700671 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700672 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700673 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700674 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700675 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800676 LIBWRAP="-lwrap"
677 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100678 AC_MSG_CHECKING(for libwrap)
679 AC_TRY_LINK(
680 [
681#include <tcpd.h>
682 int deny_severity = 0, allow_severity = 0;
683 ],
684 [hosts_access(0);],
685 [
686 AC_MSG_RESULT(yes)
687 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800688 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700689 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100690 ],
691 [
692 AC_MSG_ERROR([*** libwrap missing])
693 ]
694 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800695 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100696 fi
697 ]
698)
699
Damien Millerfe1f1432003-02-24 15:45:42 +1100700dnl Checks for library functions. Please keep in alphabetical order
701AC_CHECK_FUNCS(\
Damien Miller5fe46a42003-06-05 09:53:31 +1000702 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
703 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Damien Millerfe1f1432003-02-24 15:45:42 +1100704 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000705 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100706 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000707 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
708 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
709 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Damien Miller5fe46a42003-06-05 09:53:31 +1000710 setproctitle setregid setresgid setresuid setreuid setrlimit \
711 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tuckerb2427c82003-09-10 15:22:44 +1000712 strlcat strlcpy strmode strnvis sysconf tcgetpgrp \
Darren Tuckerf38ea772003-08-13 20:48:07 +1000713 truncate utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100714)
Tim Rice13aae5e2001-10-21 17:53:58 -0700715
Damien Millercd6853c2003-01-28 11:33:42 +1100716AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
717
Darren Tuckerf1159b52003-07-07 19:44:01 +1000718dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000719AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000720AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000721
Darren Tuckerb2427c82003-09-10 15:22:44 +1000722dnl tcsendbreak might be a macro
723AC_CHECK_DECL(tcsendbreak,
724 [AC_DEFINE(HAVE_TCSENDBREAK)],
725 [AC_CHECK_FUNCS(tcsendbreak)],
726 [#include <termios.h>]
727)
728
Damien Millerad833b32000-08-23 10:46:23 +1000729dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000730AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000731dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000732AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000733AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000734dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000735AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000736AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100737
Damien Miller04f80141999-11-19 15:32:34 +1100738AC_CHECK_FUNC(daemon,
739 [AC_DEFINE(HAVE_DAEMON)],
740 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
741)
742
Damien Miller9fb07e42000-03-05 16:22:59 +1100743AC_CHECK_FUNC(getpagesize,
744 [AC_DEFINE(HAVE_GETPAGESIZE)],
745 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
746)
747
Damien Millercb170cb2000-07-01 16:52:55 +1000748# Check for broken snprintf
749if test "x$ac_cv_func_snprintf" = "xyes" ; then
750 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
751 AC_TRY_RUN(
752 [
753#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700754int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000755 ],
756 [AC_MSG_RESULT(yes)],
757 [
758 AC_MSG_RESULT(no)
759 AC_DEFINE(BROKEN_SNPRINTF)
760 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
761 ]
762 )
763fi
764
Damien Millere8328192003-01-07 15:18:32 +1100765dnl see whether mkstemp() requires XXXXXX
766if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
767AC_MSG_CHECKING([for (overly) strict mkstemp])
768AC_TRY_RUN(
769 [
770#include <stdlib.h>
771main() { char template[]="conftest.mkstemp-test";
772if (mkstemp(template) == -1)
773 exit(1);
774unlink(template); exit(0);
775}
776 ],
777 [
778 AC_MSG_RESULT(no)
779 ],
780 [
781 AC_MSG_RESULT(yes)
782 AC_DEFINE(HAVE_STRICT_MKSTEMP)
783 ],
784 [
785 AC_MSG_RESULT(yes)
786 AC_DEFINE(HAVE_STRICT_MKSTEMP)
787 ]
788)
789fi
790
Darren Tucker70a3d552003-08-21 17:58:29 +1000791dnl make sure that openpty does not reacquire controlling terminal
792if test ! -z "$check_for_openpty_ctty_bug"; then
793 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
794 AC_TRY_RUN(
795 [
796#include <stdio.h>
797#include <sys/fcntl.h>
798#include <sys/types.h>
799#include <sys/wait.h>
800
801int
802main()
803{
804 pid_t pid;
805 int fd, ptyfd, ttyfd, status;
806
807 pid = fork();
808 if (pid < 0) { /* failed */
809 exit(1);
810 } else if (pid > 0) { /* parent */
811 waitpid(pid, &status, 0);
812 if (WIFEXITED(status))
813 exit(WEXITSTATUS(status));
814 else
815 exit(2);
816 } else { /* child */
817 close(0); close(1); close(2);
818 setsid();
819 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
820 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
821 if (fd >= 0)
822 exit(3); /* Acquired ctty: broken */
823 else
824 exit(0); /* Did not acquire ctty: OK */
825 }
826}
827 ],
828 [
829 AC_MSG_RESULT(yes)
830 ],
831 [
832 AC_MSG_RESULT(no)
833 AC_DEFINE(SSHD_ACQUIRES_CTTY)
834 ]
835 )
836fi
837
Damien Miller606f8802000-09-16 15:39:56 +1100838AC_FUNC_GETPGRP
839
Damien Millera64b57a2001-01-17 10:44:13 +1100840# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000841PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100842AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100843 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100844 [
Damien Millera64b57a2001-01-17 10:44:13 +1100845 if test "x$withval" != "xno" ; then
846 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
847 AC_MSG_ERROR([PAM headers not found])
848 fi
849
850 AC_CHECK_LIB(dl, dlopen, , )
851 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
852 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000853 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +1100854
855 disable_shadow=yes
856 PAM_MSG="yes"
857
858 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800859 if test $ac_cv_lib_dl_dlopen = yes; then
860 LIBPAM="-lpam -ldl"
861 else
862 LIBPAM="-lpam"
863 fi
864 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100865 fi
866 ]
867)
Damien Millera22ba012000-03-02 23:09:20 +1100868
Damien Millera64b57a2001-01-17 10:44:13 +1100869# Check for older PAM
870if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100871 # Check PAM strerror arguments (old PAM)
872 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
873 AC_TRY_COMPILE(
874 [
Damien Miller81171112000-04-23 11:14:01 +1000875#include <stdlib.h>
876#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100877 ],
878 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
879 [AC_MSG_RESULT(no)],
880 [
881 AC_DEFINE(HAVE_OLD_PAM)
882 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000883 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100884 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100885 )
Damien Millera22ba012000-03-02 23:09:20 +1100886fi
887
Damien Millerfc93d4b2002-09-04 23:26:29 +1000888# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
889# because the system crypt() is more featureful.
890if test "x$check_for_libcrypt_before" = "x1"; then
891 AC_CHECK_LIB(crypt, crypt)
892fi
893
Tim Riceaef73712002-05-11 13:17:42 -0700894# Search for OpenSSL
895saved_CPPFLAGS="$CPPFLAGS"
896saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100897AC_ARG_WITH(ssl-dir,
898 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
899 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000900 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700901 if test -d "$withval/lib"; then
902 if test -n "${need_dash_r}"; then
903 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
904 else
905 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
906 fi
907 else
908 if test -n "${need_dash_r}"; then
909 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
910 else
911 LDFLAGS="-L${withval} ${LDFLAGS}"
912 fi
913 fi
914 if test -d "$withval/include"; then
915 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
916 else
917 CPPFLAGS="-I${withval} ${CPPFLAGS}"
918 fi
Damien Millera22ba012000-03-02 23:09:20 +1100919 fi
920 ]
921)
Tim Riceaef73712002-05-11 13:17:42 -0700922LIBS="$LIBS -lcrypto"
923AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000924 [
Tim Riceaef73712002-05-11 13:17:42 -0700925 dnl Check default openssl install dir
926 if test -n "${need_dash_r}"; then
927 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000928 else
Tim Riceaef73712002-05-11 13:17:42 -0700929 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000930 fi
Tim Riceaef73712002-05-11 13:17:42 -0700931 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
932 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
933 [
934 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
935 ]
936 )
937 ]
938)
939
Tim Riced730b782002-08-13 18:52:10 -0700940# Determine OpenSSL header version
941AC_MSG_CHECKING([OpenSSL header version])
942AC_TRY_RUN(
943 [
944#include <stdio.h>
945#include <string.h>
946#include <openssl/opensslv.h>
947#define DATA "conftest.sslincver"
948int main(void) {
949 FILE *fd;
950 int rc;
951
952 fd = fopen(DATA,"w");
953 if(fd == NULL)
954 exit(1);
955
956 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
957 exit(1);
958
959 exit(0);
960}
961 ],
962 [
963 ssl_header_ver=`cat conftest.sslincver`
964 AC_MSG_RESULT($ssl_header_ver)
965 ],
966 [
967 AC_MSG_RESULT(not found)
968 AC_MSG_ERROR(OpenSSL version header not found.)
969 ]
970)
971
972# Determine OpenSSL library version
973AC_MSG_CHECKING([OpenSSL library version])
974AC_TRY_RUN(
975 [
976#include <stdio.h>
977#include <string.h>
978#include <openssl/opensslv.h>
979#include <openssl/crypto.h>
980#define DATA "conftest.ssllibver"
981int main(void) {
982 FILE *fd;
983 int rc;
984
985 fd = fopen(DATA,"w");
986 if(fd == NULL)
987 exit(1);
988
989 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
990 exit(1);
991
992 exit(0);
993}
994 ],
995 [
996 ssl_library_ver=`cat conftest.ssllibver`
997 AC_MSG_RESULT($ssl_library_ver)
998 ],
999 [
1000 AC_MSG_RESULT(not found)
1001 AC_MSG_ERROR(OpenSSL library not found.)
1002 ]
1003)
Damien Millera22ba012000-03-02 23:09:20 +11001004
Damien Millerec932372002-01-22 22:16:03 +11001005# Sanity check OpenSSL headers
1006AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1007AC_TRY_RUN(
1008 [
1009#include <string.h>
1010#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001011int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001012 ],
1013 [
1014 AC_MSG_RESULT(yes)
1015 ],
1016 [
1017 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001018 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1019Check config.log for details.
1020Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001021 ]
1022)
1023
Damien Millera64b57a2001-01-17 10:44:13 +11001024# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1025# version in OpenSSL. Skip this for PAM
Damien Miller4f9f42a2003-05-10 19:28:02 +10001026if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001027 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001028fi
1029
Damien Miller6c21c512002-01-22 21:57:53 +11001030
1031### Configure cryptographic random number support
1032
1033# Check wheter OpenSSL seeds itself
1034AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1035AC_TRY_RUN(
1036 [
1037#include <string.h>
1038#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001039int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001040 ],
1041 [
1042 OPENSSL_SEEDS_ITSELF=yes
1043 AC_MSG_RESULT(yes)
1044 ],
1045 [
1046 AC_MSG_RESULT(no)
1047 # Default to use of the rand helper if OpenSSL doesn't
1048 # seed itself
1049 USE_RAND_HELPER=yes
1050 ]
1051)
1052
1053
1054# Do we want to force the use of the rand helper?
1055AC_ARG_WITH(rand-helper,
1056 [ --with-rand-helper Use subprocess to gather strong randomness ],
1057 [
1058 if test "x$withval" = "xno" ; then
1059 # Force use of OpenSSL's internal RNG, even if
1060 # the previous test showed it to be unseeded.
1061 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1062 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1063 OPENSSL_SEEDS_ITSELF=yes
1064 USE_RAND_HELPER=""
1065 fi
1066 else
1067 USE_RAND_HELPER=yes
1068 fi
1069 ],
1070)
1071
1072# Which randomness source do we use?
1073if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1074 # OpenSSL only
1075 AC_DEFINE(OPENSSL_PRNG_ONLY)
1076 RAND_MSG="OpenSSL internal ONLY"
1077 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001078elif test ! -z "$USE_RAND_HELPER" ; then
1079 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001080 RAND_MSG="ssh-rand-helper"
1081 INSTALL_SSH_RAND_HELPER="yes"
1082fi
1083AC_SUBST(INSTALL_SSH_RAND_HELPER)
1084
1085### Configuration of ssh-rand-helper
1086
1087# PRNGD TCP socket
1088AC_ARG_WITH(prngd-port,
1089 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1090 [
Damien Millere996d722002-01-23 11:20:59 +11001091 case "$withval" in
1092 no)
1093 withval=""
1094 ;;
1095 [[0-9]]*)
1096 ;;
1097 *)
1098 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1099 ;;
1100 esac
1101 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001102 PRNGD_PORT="$withval"
1103 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1104 fi
1105 ]
1106)
1107
1108# PRNGD Unix domain socket
1109AC_ARG_WITH(prngd-socket,
1110 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1111 [
Damien Millere996d722002-01-23 11:20:59 +11001112 case "$withval" in
1113 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001114 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001115 ;;
1116 no)
1117 withval=""
1118 ;;
1119 /*)
1120 ;;
1121 *)
1122 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1123 ;;
1124 esac
1125
1126 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001127 if test ! -z "$PRNGD_PORT" ; then
1128 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1129 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001130 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001131 AC_MSG_WARN(Entropy socket is not readable)
1132 fi
1133 PRNGD_SOCKET="$withval"
1134 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1135 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001136 ],
1137 [
1138 # Check for existing socket only if we don't have a random device already
1139 if test "$USE_RAND_HELPER" = yes ; then
1140 AC_MSG_CHECKING(for PRNGD/EGD socket)
1141 # Insert other locations here
1142 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1143 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1144 PRNGD_SOCKET="$sock"
1145 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1146 break;
1147 fi
1148 done
1149 if test ! -z "$PRNGD_SOCKET" ; then
1150 AC_MSG_RESULT($PRNGD_SOCKET)
1151 else
1152 AC_MSG_RESULT(not found)
1153 fi
1154 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001155 ]
1156)
1157
1158# Change default command timeout for hashing entropy source
1159entropy_timeout=200
1160AC_ARG_WITH(entropy-timeout,
1161 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1162 [
1163 if test "x$withval" != "xno" ; then
1164 entropy_timeout=$withval
1165 fi
1166 ]
1167)
Damien Miller6c21c512002-01-22 21:57:53 +11001168AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1169
Damien Millerd3f6ad22002-06-25 10:24:47 +10001170SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001171AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001172 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001173 [
1174 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001175 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001176 fi
1177 ]
1178)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001179AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1180AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001181
Tim Rice88f2ab52002-03-17 12:17:34 -08001182# We do this little dance with the search path to insure
1183# that programs that we select for use by installed programs
1184# (which may be run by the super-user) come from trusted
1185# locations before they come from the user's private area.
1186# This should help avoid accidentally configuring some
1187# random version of a program in someone's personal bin.
1188
1189OPATH=$PATH
1190PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001191test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001192test -d /sbin && PATH=$PATH:/sbin
1193test -d /usr/sbin && PATH=$PATH:/usr/sbin
1194PATH=$PATH:/etc:$OPATH
1195
Damien Miller6c21c512002-01-22 21:57:53 +11001196# These programs are used by the command hashing source to gather entropy
1197OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1198OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1199OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1200OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1201OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1202OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1203OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1204OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1205OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1206OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1207OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1208OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1209OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1210OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1211OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1212OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001213# restore PATH
1214PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001215
1216# Where does ssh-rand-helper get its randomness from?
1217INSTALL_SSH_PRNG_CMDS=""
1218if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1219 if test ! -z "$PRNGD_PORT" ; then
1220 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1221 elif test ! -z "$PRNGD_SOCKET" ; then
1222 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1223 else
1224 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1225 RAND_HELPER_CMDHASH=yes
1226 INSTALL_SSH_PRNG_CMDS="yes"
1227 fi
1228fi
1229AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1230
1231
Ben Lindstromb5628642000-10-18 00:02:25 +00001232# Cheap hack to ensure NEWS-OS libraries are arranged right.
1233if test ! -z "$SONY" ; then
1234 LIBS="$LIBS -liberty";
1235fi
1236
Damien Millera22ba012000-03-02 23:09:20 +11001237# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001238AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001239AC_CHECK_SIZEOF(short int, 2)
1240AC_CHECK_SIZEOF(int, 4)
1241AC_CHECK_SIZEOF(long int, 4)
1242AC_CHECK_SIZEOF(long long int, 8)
1243
Damien Millerfa2bb692002-04-23 23:22:25 +10001244# Sanity check long long for some platforms (AIX)
1245if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1246 ac_cv_sizeof_long_long_int=0
1247fi
1248
Damien Millera22ba012000-03-02 23:09:20 +11001249# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001250AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1251 AC_TRY_COMPILE(
1252 [ #include <sys/types.h> ],
1253 [ u_int a; a = 1;],
1254 [ ac_cv_have_u_int="yes" ],
1255 [ ac_cv_have_u_int="no" ]
1256 )
1257])
1258if test "x$ac_cv_have_u_int" = "xyes" ; then
1259 AC_DEFINE(HAVE_U_INT)
1260 have_u_int=1
1261fi
1262
Damien Miller61e50f12000-05-08 20:49:37 +10001263AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1264 AC_TRY_COMPILE(
1265 [ #include <sys/types.h> ],
1266 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1267 [ ac_cv_have_intxx_t="yes" ],
1268 [ ac_cv_have_intxx_t="no" ]
1269 )
1270])
1271if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1272 AC_DEFINE(HAVE_INTXX_T)
1273 have_intxx_t=1
1274fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001275
1276if (test -z "$have_intxx_t" && \
1277 test "x$ac_cv_header_stdint_h" = "xyes")
1278then
1279 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1280 AC_TRY_COMPILE(
1281 [ #include <stdint.h> ],
1282 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1283 [
1284 AC_DEFINE(HAVE_INTXX_T)
1285 AC_MSG_RESULT(yes)
1286 ],
1287 [ AC_MSG_RESULT(no) ]
1288 )
1289fi
1290
Damien Miller578783e2000-09-23 14:12:24 +11001291AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1292 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001293 [
1294#include <sys/types.h>
1295#ifdef HAVE_STDINT_H
1296# include <stdint.h>
1297#endif
1298#include <sys/socket.h>
1299#ifdef HAVE_SYS_BITYPES_H
1300# include <sys/bitypes.h>
1301#endif
1302 ],
Damien Miller578783e2000-09-23 14:12:24 +11001303 [ int64_t a; a = 1;],
1304 [ ac_cv_have_int64_t="yes" ],
1305 [ ac_cv_have_int64_t="no" ]
1306 )
1307])
1308if test "x$ac_cv_have_int64_t" = "xyes" ; then
1309 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001310fi
1311
Damien Miller61e50f12000-05-08 20:49:37 +10001312AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1313 AC_TRY_COMPILE(
1314 [ #include <sys/types.h> ],
1315 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1316 [ ac_cv_have_u_intxx_t="yes" ],
1317 [ ac_cv_have_u_intxx_t="no" ]
1318 )
1319])
1320if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1321 AC_DEFINE(HAVE_U_INTXX_T)
1322 have_u_intxx_t=1
1323fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001324
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001325if test -z "$have_u_intxx_t" ; then
1326 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1327 AC_TRY_COMPILE(
1328 [ #include <sys/socket.h> ],
1329 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1330 [
1331 AC_DEFINE(HAVE_U_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 u_int64_t types], ac_cv_have_u_int64_t, [
1339 AC_TRY_COMPILE(
1340 [ #include <sys/types.h> ],
1341 [ u_int64_t a; a = 1;],
1342 [ ac_cv_have_u_int64_t="yes" ],
1343 [ ac_cv_have_u_int64_t="no" ]
1344 )
1345])
1346if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1347 AC_DEFINE(HAVE_U_INT64_T)
1348 have_u_int64_t=1
1349fi
1350
Tim Rice4cec93f2002-02-26 08:40:48 -08001351if test -z "$have_u_int64_t" ; then
1352 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1353 AC_TRY_COMPILE(
1354 [ #include <sys/bitypes.h> ],
1355 [ u_int64_t a; a = 1],
1356 [
1357 AC_DEFINE(HAVE_U_INT64_T)
1358 AC_MSG_RESULT(yes)
1359 ],
1360 [ AC_MSG_RESULT(no) ]
1361 )
1362fi
1363
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001364if test -z "$have_u_intxx_t" ; then
1365 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1366 AC_TRY_COMPILE(
1367 [
1368#include <sys/types.h>
1369 ],
1370 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1371 [ ac_cv_have_uintxx_t="yes" ],
1372 [ ac_cv_have_uintxx_t="no" ]
1373 )
1374 ])
1375 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1376 AC_DEFINE(HAVE_UINTXX_T)
1377 fi
1378fi
1379
1380if test -z "$have_uintxx_t" ; then
1381 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1382 AC_TRY_COMPILE(
1383 [ #include <stdint.h> ],
1384 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1385 [
1386 AC_DEFINE(HAVE_UINTXX_T)
1387 AC_MSG_RESULT(yes)
1388 ],
1389 [ AC_MSG_RESULT(no) ]
1390 )
1391fi
1392
Damien Milleredb82922000-06-20 13:25:52 +10001393if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1394 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001395then
1396 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1397 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001398 [
1399#include <sys/bitypes.h>
1400 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001401 [
Damien Miller70494d12000-04-03 15:57:06 +10001402 int8_t a; int16_t b; int32_t c;
1403 u_int8_t e; u_int16_t f; u_int32_t g;
1404 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001405 ],
1406 [
1407 AC_DEFINE(HAVE_U_INTXX_T)
1408 AC_DEFINE(HAVE_INTXX_T)
1409 AC_MSG_RESULT(yes)
1410 ],
1411 [AC_MSG_RESULT(no)]
1412 )
1413fi
1414
Damien Miller58be7382001-09-15 21:31:54 +10001415
1416AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1417 AC_TRY_COMPILE(
1418 [
1419#include <sys/types.h>
1420 ],
1421 [ u_char foo; foo = 125; ],
1422 [ ac_cv_have_u_char="yes" ],
1423 [ ac_cv_have_u_char="no" ]
1424 )
1425])
1426if test "x$ac_cv_have_u_char" = "xyes" ; then
1427 AC_DEFINE(HAVE_U_CHAR)
1428fi
1429
Tim Rice13aae5e2001-10-21 17:53:58 -07001430TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001431
Tim Rice200a5c02002-02-26 22:12:34 -08001432AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001433
Damien Miller61e50f12000-05-08 20:49:37 +10001434AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1435 AC_TRY_COMPILE(
1436 [
1437#include <sys/types.h>
1438 ],
1439 [ size_t foo; foo = 1235; ],
1440 [ ac_cv_have_size_t="yes" ],
1441 [ ac_cv_have_size_t="no" ]
1442 )
1443])
1444if test "x$ac_cv_have_size_t" = "xyes" ; then
1445 AC_DEFINE(HAVE_SIZE_T)
1446fi
Damien Miller95058511999-12-29 10:36:45 +11001447
Damien Miller615f9392000-05-17 22:53:33 +10001448AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1449 AC_TRY_COMPILE(
1450 [
1451#include <sys/types.h>
1452 ],
1453 [ ssize_t foo; foo = 1235; ],
1454 [ ac_cv_have_ssize_t="yes" ],
1455 [ ac_cv_have_ssize_t="no" ]
1456 )
1457])
1458if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1459 AC_DEFINE(HAVE_SSIZE_T)
1460fi
1461
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001462AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1463 AC_TRY_COMPILE(
1464 [
1465#include <time.h>
1466 ],
1467 [ clock_t foo; foo = 1235; ],
1468 [ ac_cv_have_clock_t="yes" ],
1469 [ ac_cv_have_clock_t="no" ]
1470 )
1471])
1472if test "x$ac_cv_have_clock_t" = "xyes" ; then
1473 AC_DEFINE(HAVE_CLOCK_T)
1474fi
1475
Damien Millerb54b40e2000-06-23 08:23:34 +10001476AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1477 AC_TRY_COMPILE(
1478 [
1479#include <sys/types.h>
1480#include <sys/socket.h>
1481 ],
1482 [ sa_family_t foo; foo = 1235; ],
1483 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001484 [ AC_TRY_COMPILE(
1485 [
1486#include <sys/types.h>
1487#include <sys/socket.h>
1488#include <netinet/in.h>
1489 ],
1490 [ sa_family_t foo; foo = 1235; ],
1491 [ ac_cv_have_sa_family_t="yes" ],
1492
Damien Millerb54b40e2000-06-23 08:23:34 +10001493 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001494 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001495 )
1496])
1497if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1498 AC_DEFINE(HAVE_SA_FAMILY_T)
1499fi
1500
Damien Miller0f91b4e2000-06-18 15:43:25 +10001501AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1502 AC_TRY_COMPILE(
1503 [
1504#include <sys/types.h>
1505 ],
1506 [ pid_t foo; foo = 1235; ],
1507 [ ac_cv_have_pid_t="yes" ],
1508 [ ac_cv_have_pid_t="no" ]
1509 )
1510])
1511if test "x$ac_cv_have_pid_t" = "xyes" ; then
1512 AC_DEFINE(HAVE_PID_T)
1513fi
1514
1515AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1516 AC_TRY_COMPILE(
1517 [
1518#include <sys/types.h>
1519 ],
1520 [ mode_t foo; foo = 1235; ],
1521 [ ac_cv_have_mode_t="yes" ],
1522 [ ac_cv_have_mode_t="no" ]
1523 )
1524])
1525if test "x$ac_cv_have_mode_t" = "xyes" ; then
1526 AC_DEFINE(HAVE_MODE_T)
1527fi
1528
Damien Miller61e50f12000-05-08 20:49:37 +10001529
1530AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1531 AC_TRY_COMPILE(
1532 [
Damien Miller81171112000-04-23 11:14:01 +10001533#include <sys/types.h>
1534#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001535 ],
1536 [ struct sockaddr_storage s; ],
1537 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1538 [ ac_cv_have_struct_sockaddr_storage="no" ]
1539 )
1540])
1541if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1542 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1543fi
Damien Miller34132e52000-01-14 15:45:46 +11001544
Damien Miller61e50f12000-05-08 20:49:37 +10001545AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1546 AC_TRY_COMPILE(
1547 [
Damien Miller7b22d652000-06-18 14:07:04 +10001548#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001549#include <netinet/in.h>
1550 ],
1551 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1552 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1553 [ ac_cv_have_struct_sockaddr_in6="no" ]
1554 )
1555])
1556if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1557 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1558fi
Damien Miller34132e52000-01-14 15:45:46 +11001559
Damien Miller61e50f12000-05-08 20:49:37 +10001560AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1561 AC_TRY_COMPILE(
1562 [
Damien Miller7b22d652000-06-18 14:07:04 +10001563#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001564#include <netinet/in.h>
1565 ],
1566 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1567 [ ac_cv_have_struct_in6_addr="yes" ],
1568 [ ac_cv_have_struct_in6_addr="no" ]
1569 )
1570])
1571if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1572 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1573fi
Damien Miller34132e52000-01-14 15:45:46 +11001574
Damien Miller61e50f12000-05-08 20:49:37 +10001575AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1576 AC_TRY_COMPILE(
1577 [
Damien Miller81171112000-04-23 11:14:01 +10001578#include <sys/types.h>
1579#include <sys/socket.h>
1580#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001581 ],
1582 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1583 [ ac_cv_have_struct_addrinfo="yes" ],
1584 [ ac_cv_have_struct_addrinfo="no" ]
1585 )
1586])
1587if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1588 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1589fi
1590
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001591AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1592 AC_TRY_COMPILE(
1593 [ #include <sys/time.h> ],
1594 [ struct timeval tv; tv.tv_sec = 1;],
1595 [ ac_cv_have_struct_timeval="yes" ],
1596 [ ac_cv_have_struct_timeval="no" ]
1597 )
1598])
1599if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1600 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1601 have_struct_timeval=1
1602fi
1603
Tim Rice4e4dc562003-03-18 10:21:40 -08001604AC_CHECK_TYPES(struct timespec)
1605
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001606# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001607if test "x$ac_cv_have_int64_t" = "xno" -a \
1608 "x$ac_cv_sizeof_long_int" != "x8" -a \
1609 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001610 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1611 echo "an alternative compiler (I.E., GCC) before continuing."
1612 echo ""
1613 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001614else
1615dnl test snprintf (broken on SCO w/gcc)
1616 AC_TRY_RUN(
1617 [
1618#include <stdio.h>
1619#include <string.h>
1620#ifdef HAVE_SNPRINTF
1621main()
1622{
1623 char buf[50];
1624 char expected_out[50];
1625 int mazsize = 50 ;
1626#if (SIZEOF_LONG_INT == 8)
1627 long int num = 0x7fffffffffffffff;
1628#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001629 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001630#endif
1631 strcpy(expected_out, "9223372036854775807");
1632 snprintf(buf, mazsize, "%lld", num);
1633 if(strcmp(buf, expected_out) != 0)
1634 exit(1);
1635 exit(0);
1636}
1637#else
1638main() { exit(0); }
1639#endif
1640 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1641 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001642fi
1643
Damien Miller78315eb2000-09-29 23:01:36 +11001644dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001645OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1646OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1647OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1648OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1649OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001650OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001651OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1652OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001653OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001654OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1655OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1656OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1657OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001658OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1659OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1660OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1661OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001662
1663AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001664
Damien Miller61e50f12000-05-08 20:49:37 +10001665AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1666 ac_cv_have_ss_family_in_struct_ss, [
1667 AC_TRY_COMPILE(
1668 [
Damien Miller81171112000-04-23 11:14:01 +10001669#include <sys/types.h>
1670#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001671 ],
1672 [ struct sockaddr_storage s; s.ss_family = 1; ],
1673 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1674 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1675 )
1676])
1677if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1678 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1679fi
1680
Damien Miller61e50f12000-05-08 20:49:37 +10001681AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1682 ac_cv_have___ss_family_in_struct_ss, [
1683 AC_TRY_COMPILE(
1684 [
Damien Miller81171112000-04-23 11:14:01 +10001685#include <sys/types.h>
1686#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001687 ],
1688 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1689 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1690 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1691 )
1692])
1693if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1694 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1695fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001696
Damien Millerad833b32000-08-23 10:46:23 +10001697AC_CACHE_CHECK([for pw_class field in struct passwd],
1698 ac_cv_have_pw_class_in_struct_passwd, [
1699 AC_TRY_COMPILE(
1700 [
Damien Millerad833b32000-08-23 10:46:23 +10001701#include <pwd.h>
1702 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001703 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001704 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1705 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1706 )
1707])
1708if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1709 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1710fi
1711
Kevin Steves82456952001-06-22 21:14:18 +00001712AC_CACHE_CHECK([for pw_expire field in struct passwd],
1713 ac_cv_have_pw_expire_in_struct_passwd, [
1714 AC_TRY_COMPILE(
1715 [
1716#include <pwd.h>
1717 ],
1718 [ struct passwd p; p.pw_expire = 0; ],
1719 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1720 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1721 )
1722])
1723if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1724 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1725fi
1726
1727AC_CACHE_CHECK([for pw_change field in struct passwd],
1728 ac_cv_have_pw_change_in_struct_passwd, [
1729 AC_TRY_COMPILE(
1730 [
1731#include <pwd.h>
1732 ],
1733 [ struct passwd p; p.pw_change = 0; ],
1734 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1735 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1736 )
1737])
1738if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1739 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1740fi
Damien Miller61e50f12000-05-08 20:49:37 +10001741
Tim Rice28bbb0c2002-05-27 17:37:32 -07001742dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001743AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1744 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001745 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001746 [
Tim Riceae49fe62002-04-12 10:26:21 -07001747#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001748#include <sys/socket.h>
1749#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001750int main() {
1751#ifdef msg_accrights
1752exit(1);
1753#endif
1754struct msghdr m;
1755m.msg_accrights = 0;
1756exit(0);
1757}
Kevin Steves939c9db2002-03-22 17:23:25 +00001758 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001759 [ ac_cv_have_accrights_in_msghdr="yes" ],
1760 [ ac_cv_have_accrights_in_msghdr="no" ]
1761 )
1762])
1763if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1764 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1765fi
1766
Kevin Stevesa44e0352002-04-07 16:18:03 +00001767AC_CACHE_CHECK([for msg_control field in struct msghdr],
1768 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001769 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001770 [
Tim Riceae49fe62002-04-12 10:26:21 -07001771#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001772#include <sys/socket.h>
1773#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001774int main() {
1775#ifdef msg_control
1776exit(1);
1777#endif
1778struct msghdr m;
1779m.msg_control = 0;
1780exit(0);
1781}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001782 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001783 [ ac_cv_have_control_in_msghdr="yes" ],
1784 [ ac_cv_have_control_in_msghdr="no" ]
1785 )
1786])
1787if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1788 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1789fi
1790
Damien Miller61e50f12000-05-08 20:49:37 +10001791AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1792 AC_TRY_LINK([],
1793 [ extern char *__progname; printf("%s", __progname); ],
1794 [ ac_cv_libc_defines___progname="yes" ],
1795 [ ac_cv_libc_defines___progname="no" ]
1796 )
1797])
1798if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1799 AC_DEFINE(HAVE___PROGNAME)
1800fi
1801
Kevin Steves4846f4a2002-03-22 18:19:53 +00001802AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1803 AC_TRY_LINK([
1804#include <stdio.h>
1805],
1806 [ printf("%s", __FUNCTION__); ],
1807 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1808 [ ac_cv_cc_implements___FUNCTION__="no" ]
1809 )
1810])
1811if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1812 AC_DEFINE(HAVE___FUNCTION__)
1813fi
1814
1815AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1816 AC_TRY_LINK([
1817#include <stdio.h>
1818],
1819 [ printf("%s", __func__); ],
1820 [ ac_cv_cc_implements___func__="yes" ],
1821 [ ac_cv_cc_implements___func__="no" ]
1822 )
1823])
1824if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1825 AC_DEFINE(HAVE___func__)
1826fi
1827
Damien Miller4f8e6692001-07-14 13:22:53 +10001828AC_CACHE_CHECK([whether getopt has optreset support],
1829 ac_cv_have_getopt_optreset, [
1830 AC_TRY_LINK(
1831 [
1832#include <getopt.h>
1833 ],
1834 [ extern int optreset; optreset = 0; ],
1835 [ ac_cv_have_getopt_optreset="yes" ],
1836 [ ac_cv_have_getopt_optreset="no" ]
1837 )
1838])
1839if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1840 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1841fi
Damien Millera22ba012000-03-02 23:09:20 +11001842
Damien Millerecbb26d2000-07-15 14:59:14 +10001843AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1844 AC_TRY_LINK([],
1845 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1846 [ ac_cv_libc_defines_sys_errlist="yes" ],
1847 [ ac_cv_libc_defines_sys_errlist="no" ]
1848 )
1849])
1850if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1851 AC_DEFINE(HAVE_SYS_ERRLIST)
1852fi
1853
1854
Damien Miller11fa2cc2000-08-16 10:35:58 +10001855AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1856 AC_TRY_LINK([],
1857 [ extern int sys_nerr; printf("%i", sys_nerr);],
1858 [ ac_cv_libc_defines_sys_nerr="yes" ],
1859 [ ac_cv_libc_defines_sys_nerr="no" ]
1860 )
1861])
1862if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1863 AC_DEFINE(HAVE_SYS_NERR)
1864fi
1865
Damien Miller85de5802001-09-18 14:01:11 +10001866SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001867# Check whether user wants sectok support
1868AC_ARG_WITH(sectok,
1869 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001870 [
1871 if test "x$withval" != "xno" ; then
1872 if test "x$withval" != "xyes" ; then
1873 CPPFLAGS="$CPPFLAGS -I${withval}"
1874 LDFLAGS="$LDFLAGS -L${withval}"
1875 if test ! -z "$need_dash_r" ; then
1876 LDFLAGS="$LDFLAGS -R${withval}"
1877 fi
1878 if test ! -z "$blibpath" ; then
1879 blibpath="$blibpath:${withval}"
1880 fi
1881 fi
1882 AC_CHECK_HEADERS(sectok.h)
1883 if test "$ac_cv_header_sectok_h" != yes; then
1884 AC_MSG_ERROR(Can't find sectok.h)
1885 fi
1886 AC_CHECK_LIB(sectok, sectok_open)
1887 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1888 AC_MSG_ERROR(Can't find libsectok)
1889 fi
1890 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001891 AC_DEFINE(USE_SECTOK)
1892 SCARD_MSG="yes, using sectok"
1893 fi
1894 ]
1895)
1896
1897# Check whether user wants OpenSC support
1898AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001899 AC_HELP_STRING([--with-opensc=PFX],
1900 [Enable smartcard support using OpenSC]),
1901 opensc_config_prefix="$withval", opensc_config_prefix="")
1902if test x$opensc_config_prefix != x ; then
1903 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1904 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1905 if test "$OPENSC_CONFIG" != "no"; then
1906 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1907 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1908 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1909 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1910 AC_DEFINE(SMARTCARD)
1911 AC_DEFINE(USE_OPENSC)
1912 SCARD_MSG="yes, using OpenSC"
1913 fi
1914fi
Damien Miller85de5802001-09-18 14:01:11 +10001915
Damien Miller7abe09b2003-05-15 10:53:49 +10001916# Check whether user wants DNS support
1917DNS_MSG="no"
1918AC_ARG_WITH(dns,
1919 [ --with-dns Support for fetching keys from DNS (experimental)],
1920 [
1921 if test "x$withval" != "xno" ; then
Damien Millerd9ec3702003-05-15 12:27:08 +10001922 DNS_MSG="yes"
1923 AC_DEFINE(DNS)
1924 AC_SEARCH_LIBS(getrrsetbyname, resolv,
Damien Miller200d0a72003-06-30 19:21:36 +10001925 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1926 [
1927 # Needed by our getrrsetbyname()
1928 AC_SEARCH_LIBS(res_query, resolv)
1929 AC_SEARCH_LIBS(dn_expand, resolv)
Tim Rice0ac16a42003-09-08 06:33:33 -07001930 AC_CHECK_FUNCS(_getshort _getlong)
Tim Riceb284e162003-09-08 14:35:16 -07001931 AC_CHECK_MEMBER(HEADER.ad,
1932 [AC_DEFINE(HAVE_HEADER_AD)],,
1933 [#include <arpa/nameser.h>])
Damien Miller200d0a72003-06-30 19:21:36 +10001934 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10001935 fi
1936 ]
1937)
1938
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001939# Check whether user wants Kerberos 5 support
1940KRB5_MSG="no"
1941AC_ARG_WITH(kerberos5,
1942 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1943 [
1944 if test "x$withval" != "xno" ; then
1945 if test "x$withval" = "xyes" ; then
1946 KRB5ROOT="/usr/local"
1947 else
1948 KRB5ROOT=${withval}
1949 fi
1950 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1951 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1952 AC_DEFINE(KRB5)
1953 KRB5_MSG="yes"
1954 AC_MSG_CHECKING(whether we are using Heimdal)
1955 AC_TRY_COMPILE([ #include <krb5.h> ],
1956 [ char *tmp = heimdal_version; ],
1957 [ AC_MSG_RESULT(yes)
1958 AC_DEFINE(HEIMDAL)
1959 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1960 ],
1961 [ AC_MSG_RESULT(no)
1962 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1963 ]
1964 )
1965 if test ! -z "$need_dash_r" ; then
1966 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1967 fi
1968 if test ! -z "$blibpath" ; then
1969 blibpath="$blibpath:${KRB5ROOT}/lib"
1970 fi
Damien Miller200d0a72003-06-30 19:21:36 +10001971 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001972
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001973 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1974 [ AC_DEFINE(GSSAPI)
1975 K5LIBS="-lgssapi $K5LIBS" ],
1976 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1977 [ AC_DEFINE(GSSAPI)
1978 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
1979 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
1980 $K5LIBS)
1981 ],
1982 $K5LIBS)
1983
1984 AC_CHECK_HEADER(gssapi.h, ,
1985 [ unset ac_cv_header_gssapi_h
1986 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1987 AC_CHECK_HEADERS(gssapi.h, ,
1988 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
1989 )
1990 ]
1991 )
1992
1993 oldCPP="$CPPFLAGS"
1994 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1995 AC_CHECK_HEADER(gssapi_krb5.h, ,
1996 [ CPPFLAGS="$oldCPP" ])
1997
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001998 KRB5=yes
1999 fi
2000 ]
2001)
Darren Tucker6aaa58c2003-08-02 22:24:49 +10002002LIBS="$LIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10002003
Damien Millera22ba012000-03-02 23:09:20 +11002004# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002005
Damien Millerf58c6722002-05-13 13:15:42 +10002006PRIVSEP_PATH=/var/empty
2007AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002008 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002009 [
2010 if test "x$withval" != "$no" ; then
2011 PRIVSEP_PATH=$withval
2012 fi
2013 ]
2014)
2015AC_SUBST(PRIVSEP_PATH)
2016
Damien Millera22ba012000-03-02 23:09:20 +11002017AC_ARG_WITH(xauth,
2018 [ --with-xauth=PATH Specify path to xauth program ],
2019 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002020 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002021 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002022 fi
2023 ],
2024 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002025 TestPath="$PATH"
2026 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2027 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2028 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2029 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2030 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002031 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002032 xauth_path="/usr/openwin/bin/xauth"
2033 fi
2034 ]
2035)
2036
Damien Miller7d901272003-01-13 16:55:22 +11002037STRIP_OPT=-s
2038AC_ARG_ENABLE(strip,
2039 [ --disable-strip Disable calling strip(1) on install],
2040 [
2041 if test "x$enableval" = "xno" ; then
2042 STRIP_OPT=
2043 fi
2044 ]
2045)
2046AC_SUBST(STRIP_OPT)
2047
Damien Millera19cf472000-11-29 13:28:50 +11002048if test -z "$xauth_path" ; then
2049 XAUTH_PATH="undefined"
2050 AC_SUBST(XAUTH_PATH)
2051else
Damien Millera22ba012000-03-02 23:09:20 +11002052 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002053 XAUTH_PATH=$xauth_path
2054 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002055fi
Damien Millera22ba012000-03-02 23:09:20 +11002056
2057# Check for mail directory (last resort if we cannot get it from headers)
2058if test ! -z "$MAIL" ; then
2059 maildir=`dirname $MAIL`
2060 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2061fi
2062
Damien Millera22ba012000-03-02 23:09:20 +11002063if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002064 if test "x$disable_ptmx_check" != "xyes" ; then
2065 AC_CHECK_FILE("/dev/ptmx",
2066 [
2067 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2068 have_dev_ptmx=1
2069 ]
2070 )
2071 fi
Damien Millera22ba012000-03-02 23:09:20 +11002072fi
Damien Miller204ad072000-03-02 23:56:12 +11002073AC_CHECK_FILE("/dev/ptc",
2074 [
2075 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2076 have_dev_ptc=1
2077 ]
2078)
2079
Damien Millera22ba012000-03-02 23:09:20 +11002080# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002081AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002082 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002083 [
Damien Miller897741e2001-04-16 10:41:46 +10002084 case "$withval" in
2085 man|cat|doc)
2086 MANTYPE=$withval
2087 ;;
2088 *)
2089 AC_MSG_ERROR(invalid man type: $withval)
2090 ;;
2091 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002092 ]
2093)
Ben Lindstrombc709922001-04-18 18:04:21 +00002094if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002095 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2096 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002097 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2098 MANTYPE=doc
2099 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2100 MANTYPE=man
2101 else
2102 MANTYPE=cat
2103 fi
2104fi
Damien Miller670a4b82000-01-22 13:53:11 +11002105AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002106if test "$MANTYPE" = "doc"; then
2107 mansubdir=man;
2108else
2109 mansubdir=$MANTYPE;
2110fi
2111AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002112
Damien Millera22ba012000-03-02 23:09:20 +11002113# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10002114MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002115AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002116 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002117 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002118 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002119 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10002120 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002121 fi
2122 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002123)
2124
Damien Millera22ba012000-03-02 23:09:20 +11002125# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002126AC_ARG_WITH(shadow,
2127 [ --without-shadow Disable shadow password support],
2128 [
2129 if test "x$withval" = "xno" ; then
2130 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002131 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002132 fi
2133 ]
2134)
2135
Damien Miller1f335fb2000-06-26 11:31:33 +10002136if test -z "$disable_shadow" ; then
2137 AC_MSG_CHECKING([if the systems has expire shadow information])
2138 AC_TRY_COMPILE(
2139 [
2140#include <sys/types.h>
2141#include <shadow.h>
2142 struct spwd sp;
2143 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2144 [ sp_expire_available=yes ], []
2145 )
2146
2147 if test "x$sp_expire_available" = "xyes" ; then
2148 AC_MSG_RESULT(yes)
2149 AC_DEFINE(HAS_SHADOW_EXPIRE)
2150 else
2151 AC_MSG_RESULT(no)
2152 fi
2153fi
2154
Damien Millera22ba012000-03-02 23:09:20 +11002155# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002156if test ! -z "$IPADDR_IN_DISPLAY" ; then
2157 DISPLAY_HACK_MSG="yes"
2158 AC_DEFINE(IPADDR_IN_DISPLAY)
2159else
2160 DISPLAY_HACK_MSG="no"
2161 AC_ARG_WITH(ipaddr-display,
2162 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2163 [
2164 if test "x$withval" != "xno" ; then
2165 AC_DEFINE(IPADDR_IN_DISPLAY)
2166 DISPLAY_HACK_MSG="yes"
2167 fi
2168 ]
2169 )
2170fi
Damien Miller76112de1999-12-21 11:18:08 +11002171
Tim Rice43a1c132002-04-17 21:19:14 -07002172dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2173if test $ac_cv_func_login_getcapbool = "yes" -a \
2174 $ac_cv_header_login_cap_h = "yes" ; then
2175 USES_LOGIN_CONF=yes
2176fi
Damien Millera22ba012000-03-02 23:09:20 +11002177# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002178SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002179AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002180 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002181 [
Tim Rice43a1c132002-04-17 21:19:14 -07002182 if test "$USES_LOGIN_CONF" = "yes" ; then
2183 AC_MSG_WARN([
2184--with-default-path=PATH has no effect on this system.
2185Edit /etc/login.conf instead.])
2186 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08002187 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002188 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002189 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002190 ],
Tim Rice43a1c132002-04-17 21:19:14 -07002191 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2192 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2193 else
Tim Rice59ea0a02001-03-10 13:50:45 -08002194 AC_TRY_RUN(
2195 [
2196/* find out what STDPATH is */
2197#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002198#ifdef HAVE_PATHS_H
2199# include <paths.h>
2200#endif
2201#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002202# ifdef _PATH_USERPATH /* Irix */
2203# define _PATH_STDPATH _PATH_USERPATH
2204# else
2205# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2206# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002207#endif
2208#include <sys/types.h>
2209#include <sys/stat.h>
2210#include <fcntl.h>
2211#define DATA "conftest.stdpath"
2212
2213main()
2214{
2215 FILE *fd;
2216 int rc;
2217
2218 fd = fopen(DATA,"w");
2219 if(fd == NULL)
2220 exit(1);
2221
2222 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2223 exit(1);
2224
2225 exit(0);
2226}
2227 ], [ user_path=`cat conftest.stdpath` ],
2228 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2229 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2230 )
2231# make sure $bindir is in USER_PATH so scp will work
2232 t_bindir=`eval echo ${bindir}`
2233 case $t_bindir in
2234 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2235 esac
2236 case $t_bindir in
2237 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2238 esac
2239 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2240 if test $? -ne 0 ; then
2241 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2242 if test $? -ne 0 ; then
2243 user_path=$user_path:$t_bindir
2244 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2245 fi
2246 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002247 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002248)
Tim Rice43a1c132002-04-17 21:19:14 -07002249if test "$USES_LOGIN_CONF" != "yes" ; then
2250 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2251 AC_SUBST(user_path)
2252fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002253
Damien Millera18bbd32002-05-13 10:48:57 +10002254# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002255AC_ARG_WITH(superuser-path,
2256 [ --with-superuser-path= Specify different path for super-user],
2257 [
2258 if test "x$withval" != "xno" ; then
2259 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2260 superuser_path=$withval
2261 fi
2262 ]
2263)
2264
2265
Damien Miller61e50f12000-05-08 20:49:37 +10002266AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002267IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002268AC_ARG_WITH(4in6,
2269 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2270 [
2271 if test "x$withval" != "xno" ; then
2272 AC_MSG_RESULT(yes)
2273 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002274 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002275 else
2276 AC_MSG_RESULT(no)
2277 fi
2278 ],[
2279 if test "x$inet6_default_4in6" = "xyes"; then
2280 AC_MSG_RESULT([yes (default)])
2281 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002282 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002283 else
2284 AC_MSG_RESULT([no (default)])
2285 fi
2286 ]
2287)
2288
Damien Miller60396b02001-02-18 17:01:00 +11002289# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002290BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002291AC_ARG_WITH(bsd-auth,
2292 [ --with-bsd-auth Enable BSD auth support],
2293 [
2294 if test "x$withval" != "xno" ; then
2295 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002296 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002297 fi
2298 ]
2299)
2300
Damien Millera22ba012000-03-02 23:09:20 +11002301# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002302piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002303# make sure the directory exists
2304if test ! -d $piddir ; then
2305 piddir=`eval echo ${sysconfdir}`
2306 case $piddir in
2307 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2308 esac
2309fi
2310
Tim Rice88f2ab52002-03-17 12:17:34 -08002311AC_ARG_WITH(pid-dir,
2312 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2313 [
2314 if test "x$withval" != "xno" ; then
2315 piddir=$withval
2316 if test ! -d $piddir ; then
2317 AC_MSG_WARN([** no $piddir directory on this system **])
2318 fi
2319 fi
2320 ]
2321)
2322
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002323AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002324AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002325
andre2ff7b5d2000-06-03 14:57:40 +00002326dnl allow user to disable some login recording features
2327AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002328 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002329 [
2330 if test "x$enableval" = "xno" ; then
2331 AC_DEFINE(DISABLE_LASTLOG)
2332 fi
2333 ]
andre2ff7b5d2000-06-03 14:57:40 +00002334)
2335AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002336 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002337 [
2338 if test "x$enableval" = "xno" ; then
2339 AC_DEFINE(DISABLE_UTMP)
2340 fi
2341 ]
andre2ff7b5d2000-06-03 14:57:40 +00002342)
2343AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002344 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002345 [
2346 if test "x$enableval" = "xno" ; then
2347 AC_DEFINE(DISABLE_UTMPX)
2348 fi
2349 ]
andre2ff7b5d2000-06-03 14:57:40 +00002350)
2351AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002352 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002353 [
2354 if test "x$enableval" = "xno" ; then
2355 AC_DEFINE(DISABLE_WTMP)
2356 fi
2357 ]
andre2ff7b5d2000-06-03 14:57:40 +00002358)
2359AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002360 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002361 [
2362 if test "x$enableval" = "xno" ; then
2363 AC_DEFINE(DISABLE_WTMPX)
2364 fi
2365 ]
andre2ff7b5d2000-06-03 14:57:40 +00002366)
2367AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002368 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002369 [
2370 if test "x$enableval" = "xno" ; then
2371 AC_DEFINE(DISABLE_LOGIN)
2372 fi
2373 ]
andre2ff7b5d2000-06-03 14:57:40 +00002374)
2375AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002376 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002377 [
2378 if test "x$enableval" = "xno" ; then
2379 AC_DEFINE(DISABLE_PUTUTLINE)
2380 fi
2381 ]
andre2ff7b5d2000-06-03 14:57:40 +00002382)
2383AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002384 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002385 [
2386 if test "x$enableval" = "xno" ; then
2387 AC_DEFINE(DISABLE_PUTUTXLINE)
2388 fi
2389 ]
andre2ff7b5d2000-06-03 14:57:40 +00002390)
2391AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002392 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002393 [
2394 if test "x$withval" = "xno" ; then
2395 AC_DEFINE(DISABLE_LASTLOG)
2396 else
2397 conf_lastlog_location=$withval
2398 fi
2399 ]
2400)
andre2ff7b5d2000-06-03 14:57:40 +00002401
2402dnl lastlog, [uw]tmpx? detection
2403dnl NOTE: set the paths in the platform section to avoid the
2404dnl need for command-line parameters
2405dnl lastlog and [uw]tmp are subject to a file search if all else fails
2406
2407dnl lastlog detection
2408dnl NOTE: the code itself will detect if lastlog is a directory
2409AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2410AC_TRY_COMPILE([
2411#include <sys/types.h>
2412#include <utmp.h>
2413#ifdef HAVE_LASTLOG_H
2414# include <lastlog.h>
2415#endif
Damien Miller2994e082000-06-04 15:51:47 +10002416#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002417# include <paths.h>
2418#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002419#ifdef HAVE_LOGIN_H
2420# include <login.h>
2421#endif
andre2ff7b5d2000-06-03 14:57:40 +00002422 ],
2423 [ char *lastlog = LASTLOG_FILE; ],
2424 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002425 [
2426 AC_MSG_RESULT(no)
2427 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2428 AC_TRY_COMPILE([
2429#include <sys/types.h>
2430#include <utmp.h>
2431#ifdef HAVE_LASTLOG_H
2432# include <lastlog.h>
2433#endif
2434#ifdef HAVE_PATHS_H
2435# include <paths.h>
2436#endif
2437 ],
2438 [ char *lastlog = _PATH_LASTLOG; ],
2439 [ AC_MSG_RESULT(yes) ],
2440 [
andree441aa32000-06-12 22:34:38 +00002441 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002442 system_lastlog_path=no
2443 ])
2444 ]
andre2ff7b5d2000-06-03 14:57:40 +00002445)
Damien Miller2994e082000-06-04 15:51:47 +10002446
andre2ff7b5d2000-06-03 14:57:40 +00002447if test -z "$conf_lastlog_location"; then
2448 if test x"$system_lastlog_path" = x"no" ; then
2449 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002450 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002451 conf_lastlog_location=$f
2452 fi
2453 done
2454 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002455 AC_MSG_WARN([** Cannot find lastlog **])
2456 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002457 fi
2458 fi
2459fi
2460
2461if test -n "$conf_lastlog_location"; then
2462 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2463fi
2464
2465dnl utmp detection
2466AC_MSG_CHECKING([if your system defines UTMP_FILE])
2467AC_TRY_COMPILE([
2468#include <sys/types.h>
2469#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002470#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002471# include <paths.h>
2472#endif
2473 ],
2474 [ char *utmp = UTMP_FILE; ],
2475 [ AC_MSG_RESULT(yes) ],
2476 [ AC_MSG_RESULT(no)
2477 system_utmp_path=no ]
2478)
2479if test -z "$conf_utmp_location"; then
2480 if test x"$system_utmp_path" = x"no" ; then
2481 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2482 if test -f $f ; then
2483 conf_utmp_location=$f
2484 fi
2485 done
2486 if test -z "$conf_utmp_location"; then
2487 AC_DEFINE(DISABLE_UTMP)
2488 fi
2489 fi
2490fi
2491if test -n "$conf_utmp_location"; then
2492 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2493fi
2494
2495dnl wtmp detection
2496AC_MSG_CHECKING([if your system defines WTMP_FILE])
2497AC_TRY_COMPILE([
2498#include <sys/types.h>
2499#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002500#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002501# include <paths.h>
2502#endif
2503 ],
2504 [ char *wtmp = WTMP_FILE; ],
2505 [ AC_MSG_RESULT(yes) ],
2506 [ AC_MSG_RESULT(no)
2507 system_wtmp_path=no ]
2508)
2509if test -z "$conf_wtmp_location"; then
2510 if test x"$system_wtmp_path" = x"no" ; then
2511 for f in /usr/adm/wtmp /var/log/wtmp; do
2512 if test -f $f ; then
2513 conf_wtmp_location=$f
2514 fi
2515 done
2516 if test -z "$conf_wtmp_location"; then
2517 AC_DEFINE(DISABLE_WTMP)
2518 fi
2519 fi
2520fi
2521if test -n "$conf_wtmp_location"; then
2522 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2523fi
2524
2525
2526dnl utmpx detection - I don't know any system so perverse as to require
2527dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2528dnl there, though.
2529AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2530AC_TRY_COMPILE([
2531#include <sys/types.h>
2532#include <utmp.h>
2533#ifdef HAVE_UTMPX_H
2534#include <utmpx.h>
2535#endif
Damien Miller2994e082000-06-04 15:51:47 +10002536#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002537# include <paths.h>
2538#endif
2539 ],
2540 [ char *utmpx = UTMPX_FILE; ],
2541 [ AC_MSG_RESULT(yes) ],
2542 [ AC_MSG_RESULT(no)
2543 system_utmpx_path=no ]
2544)
2545if test -z "$conf_utmpx_location"; then
2546 if test x"$system_utmpx_path" = x"no" ; then
2547 AC_DEFINE(DISABLE_UTMPX)
2548 fi
2549else
2550 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2551fi
2552
2553dnl wtmpx detection
2554AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2555AC_TRY_COMPILE([
2556#include <sys/types.h>
2557#include <utmp.h>
2558#ifdef HAVE_UTMPX_H
2559#include <utmpx.h>
2560#endif
Damien Miller2994e082000-06-04 15:51:47 +10002561#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002562# include <paths.h>
2563#endif
2564 ],
2565 [ char *wtmpx = WTMPX_FILE; ],
2566 [ AC_MSG_RESULT(yes) ],
2567 [ AC_MSG_RESULT(no)
2568 system_wtmpx_path=no ]
2569)
2570if test -z "$conf_wtmpx_location"; then
2571 if test x"$system_wtmpx_path" = x"no" ; then
2572 AC_DEFINE(DISABLE_WTMPX)
2573 fi
2574else
2575 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2576fi
2577
Damien Miller4018c192000-04-30 09:30:44 +10002578
Damien Miller29ea30d2000-03-17 10:54:15 +11002579if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002580 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2581 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002582fi
2583
Tim Rice4cec93f2002-02-26 08:40:48 -08002584dnl remove pam and dl because they are in $LIBPAM
2585if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002586 LIBS=`echo $LIBS | sed 's/-lpam //'`
2587fi
2588if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2589 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002590fi
2591
Damien Millerbac2d8a2000-09-05 16:13:06 +11002592AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002593AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2594AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002595
Damien Miller7b22d652000-06-18 14:07:04 +10002596# Print summary of options
2597
Damien Miller7b22d652000-06-18 14:07:04 +10002598# Someone please show me a better way :)
2599A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2600B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2601C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2602D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002603E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002604F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002605G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002606H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2607I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2608J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002609
2610echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002611echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002612echo " User binaries: $B"
2613echo " System binaries: $C"
2614echo " Configuration files: $D"
2615echo " Askpass program: $E"
2616echo " Manual pages: $F"
2617echo " PID file: $G"
2618echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002619if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002620echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002621else
Damien Millerf58c6722002-05-13 13:15:42 +10002622echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002623fi
Damien Millera18bbd32002-05-13 10:48:57 +10002624if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002625echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002626fi
Damien Millerf58c6722002-05-13 13:15:42 +10002627echo " Manpage format: $MANTYPE"
Damien Miller9d2be482003-05-15 11:12:19 +10002628echo " DNS support: $DNS_MSG"
Damien Miller7abe09b2003-05-15 10:53:49 +10002629echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002630echo " KerberosV support: $KRB5_MSG"
2631echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002632echo " S/KEY support: $SKEY_MSG"
2633echo " TCP Wrappers support: $TCPW_MSG"
2634echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002635echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002636echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2637echo " BSD Auth support: $BSD_AUTH_MSG"
2638echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002639if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002640echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002641fi
2642
Damien Miller7b22d652000-06-18 14:07:04 +10002643echo ""
2644
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002645echo " Host: ${host}"
2646echo " Compiler: ${CC}"
2647echo " Compiler flags: ${CFLAGS}"
2648echo "Preprocessor flags: ${CPPFLAGS}"
2649echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002650echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002651
2652echo ""
2653
Damien Miller82cf0ce2000-12-20 13:34:48 +11002654if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002655 echo "PAM is enabled. You may need to install a PAM control file "
2656 echo "for sshd, otherwise password authentication may fail. "
2657 echo "Example PAM control files can be found in the contrib/ "
2658 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002659 echo ""
2660fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002661
Damien Miller6c21c512002-01-22 21:57:53 +11002662if test ! -z "$RAND_HELPER_CMDHASH" ; then
2663 echo "WARNING: you are using the builtin random number collection "
2664 echo "service. Please read WARNING.RNG and request that your OS "
2665 echo "vendor includes kernel-based random number collection in "
2666 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002667 echo ""
2668fi
Damien Miller60396b02001-02-18 17:01:00 +11002669