blob: ab630115b0a6c6eee3cf1941a02d8fb7429bf1a6 [file] [log] [blame]
Darren Tuckere1a790d2003-09-16 11:52:19 +10001# $Id: configure.ac,v 1.154 2003/09/16 01:52:19 dtucker Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Tim Rice13aae5e2001-10-21 17:53:58 -07003AC_INIT
4AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +10005
6AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11007AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11008AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11009AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100010
Damien Millera22ba012000-03-02 23:09:20 +110011# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100012AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110013AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100014AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110015AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000016AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070017AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080018AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110019AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100020AC_PATH_PROG(ENT, ent)
21AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110022AC_PATH_PROG(TEST_MINUS_S_SH, bash)
23AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
24AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070025AC_PATH_PROG(SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110026
Damien Millere8bb4502001-09-25 16:39:35 +100027# System features
28AC_SYS_LARGEFILE
29
Damien Miller3f62aba2000-11-29 11:56:35 +110030if test -z "$AR" ; then
31 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
32fi
33
Damien Millerad833b32000-08-23 10:46:23 +100034# Use LOGIN_PROGRAM from environment if possible
35if test ! -z "$LOGIN_PROGRAM" ; then
36 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
37else
38 # Search for login
39 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
40 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
41 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
42 fi
43fi
44
Damien Miller166bd442000-03-16 10:48:25 +110045if test -z "$LD" ; then
46 LD=$CC
47fi
48AC_SUBST(LD)
49
Damien Miller166bd442000-03-16 10:48:25 +110050AC_C_INLINE
Damien Miller649d9992001-06-27 23:35:51 +100051if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
52 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110053fi
54
Damien Millera22ba012000-03-02 23:09:20 +110055# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110056case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110057*-*-aix*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000058 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110059 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millereab4bae2003-04-29 23:22:40 +100060 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
61 if (test -z "$blibpath"); then
62 blibpath="/usr/lib:/lib:/usr/local/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +110063 fi
Damien Millereab4bae2003-04-29 23:22:40 +100064 saved_LDFLAGS="$LDFLAGS"
65 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
66 if (test -z "$blibflags"); then
67 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
68 AC_TRY_LINK([], [], [blibflags=$tryflags])
69 fi
70 done
71 if (test -z "$blibflags"); then
72 AC_MSG_RESULT(not found)
73 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
74 else
75 AC_MSG_RESULT($blibflags)
76 fi
77 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +100078 dnl Check for authenticate. Might be in libs.a on older AIXes
79 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -070080 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +100081 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -070082 LIBS="$LIBS -ls"
83 ])
84 ])
Darren Tucker5c6a91a2003-07-14 16:21:44 +100085 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
86 AC_CHECK_DECL(loginfailed,
87 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
88 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +100089 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +100090 [(void)loginfailed("user","host","tty",0);],
91 [AC_MSG_RESULT(yes)
92 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +100093 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +100094 )],
95 [],
96 [#include <usersec.h>]
97 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +100098 AC_CHECK_FUNCS(setauthdb)
Damien Millereca71f82000-01-20 22:38:27 +110099 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +1000100 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000101 AC_DEFINE(SETEUID_BREAKS_SETUID)
102 AC_DEFINE(BROKEN_SETREUID)
103 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000104 dnl AIX handles lastlog as part of its login message
105 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000106 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000107 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100108 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100109*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100110 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800111 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100112 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000113 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100114 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100115 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000116 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000117 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700118 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +0000119 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100120 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000121*-*-dgux*)
122 AC_DEFINE(IP_TOS_IS_BROKEN)
123 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000124*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000125 AC_MSG_CHECKING(if we have working getaddrinfo)
126 AC_TRY_RUN([#include <mach-o/dyld.h>
127main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
128 exit(0);
129 else
130 exit(1);
131}], [AC_MSG_RESULT(working)],
132 [AC_MSG_RESULT(buggy)
133 AC_DEFINE(BROKEN_GETADDRINFO)],
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)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000253 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000254 # hardwire lastlog location (can't detect it on some versions)
255 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000256 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
257 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
258 if test "$sol2ver" -ge 8; then
259 AC_MSG_RESULT(yes)
260 AC_DEFINE(DISABLE_UTMP)
261 AC_DEFINE(DISABLE_WTMP)
262 else
263 AC_MSG_RESULT(no)
264 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100265 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000266*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000267 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000268 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100269 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000270 conf_utmp_location=/etc/utmp
271 conf_wtmp_location=/var/adm/wtmp
272 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000273 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000274 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000275*-ncr-sysv*)
276 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
277 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700278 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000279 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000280 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000281 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000282*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000283 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700284 # /usr/ucblib MUST NOT be searched on ReliantUNIX
285 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100286 IPADDR_IN_DISPLAY=yes
287 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000288 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000289 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000290 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700291 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
292 # Attention: always take care to bind libsocket and libnsl before libc,
293 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000294 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100295*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000296 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100297 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100298 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700299 AC_DEFINE(SETEUID_BREAKS_SETUID)
300 AC_DEFINE(BROKEN_SETREUID)
301 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100302 ;;
303*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000304 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100305 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100306 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700307 AC_DEFINE(SETEUID_BREAKS_SETUID)
308 AC_DEFINE(BROKEN_SETREUID)
309 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100310 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100311*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000312 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100313 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100314 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100315*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000316 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100317 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700318 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100319 RANLIB=true
320 no_dev_ptmx=1
321 AC_DEFINE(BROKEN_SYS_TERMIO_H)
322 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000323 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000324 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100325 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Riceae477e92003-09-12 18:15:15 -0700326 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100327 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700328 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700329 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100330 ;;
331*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800332 if test -z "$GCC"; then
333 CFLAGS="$CFLAGS -belf"
334 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000335 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000336 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100337 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000338 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100339 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000340 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000341 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700342 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700343 AC_DEFINE(SETEUID_BREAKS_SETUID)
344 AC_DEFINE(BROKEN_SETREUID)
345 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700346 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100347 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700348 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000349 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000350*-*-unicosmk*)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000351 AC_DEFINE(USE_PIPES)
352 AC_DEFINE(DISABLE_FD_PASSING)
353 LDFLAGS="$LDFLAGS"
354 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
355 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000356 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000357*-*-unicosmp*)
358 AC_DEFINE(WITH_ABBREV_NO_TTY)
359 AC_DEFINE(USE_PIPES)
360 AC_DEFINE(DISABLE_FD_PASSING)
361 LDFLAGS="$LDFLAGS"
362 LIBS="$LIBS -lgen -lacid"
363 MANTYPE=cat
364 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000365*-*-unicos*)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000366 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700367 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700368 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000369 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
370 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
371 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700372 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000373*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000374 AC_MSG_CHECKING(for Digital Unix SIA)
375 no_osfsia=""
376 AC_ARG_WITH(osfsia,
377 [ --with-osfsia Enable Digital Unix SIA],
378 [
379 if test "x$withval" = "xno" ; then
380 AC_MSG_RESULT(disabled)
381 no_osfsia=1
382 fi
383 ],
384 )
385 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000386 if test -f /etc/sia/matrix.conf; then
387 AC_MSG_RESULT(yes)
388 AC_DEFINE(HAVE_OSF_SIA)
389 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000390 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000391 LIBS="$LIBS -lsecurity -ldb -lm -laud"
392 else
393 AC_MSG_RESULT(no)
394 fi
395 fi
Ben Lindstromdc3c7572002-10-04 23:54:54 +0000396 AC_DEFINE(DISABLE_FD_PASSING)
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000397 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tuckere41bba52003-08-25 11:51:19 +1000398 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000399 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000400
401*-*-nto-qnx)
402 AC_DEFINE(USE_PIPES)
403 AC_DEFINE(NO_X11_UNIX_SOCKETS)
404 AC_DEFINE(MISSING_NFDBITS)
405 AC_DEFINE(MISSING_HOWMANY)
406 AC_DEFINE(MISSING_FD_MASK)
407 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100408esac
409
Damien Millere37bfc12000-06-05 09:37:43 +1000410# Allow user to specify flags
411AC_ARG_WITH(cflags,
412 [ --with-cflags Specify additional flags to pass to compiler],
413 [
414 if test "x$withval" != "xno" ; then
415 CFLAGS="$CFLAGS $withval"
416 fi
417 ]
418)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000419AC_ARG_WITH(cppflags,
420 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
421 [
422 if test "x$withval" != "xno"; then
423 CPPFLAGS="$CPPFLAGS $withval"
424 fi
425 ]
426)
Damien Millere37bfc12000-06-05 09:37:43 +1000427AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000428 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000429 [
430 if test "x$withval" != "xno" ; then
431 LDFLAGS="$LDFLAGS $withval"
432 fi
433 ]
434)
435AC_ARG_WITH(libs,
436 [ --with-libs Specify additional libraries to link with],
437 [
438 if test "x$withval" != "xno" ; then
439 LIBS="$LIBS $withval"
440 fi
441 ]
442)
443
Darren Tucker6eb93042003-06-29 21:30:41 +1000444AC_MSG_CHECKING(compiler and flags for sanity)
445AC_TRY_RUN([
446#include <stdio.h>
447int main(){exit(0);}
448 ],
449 [ AC_MSG_RESULT(yes) ],
450 [
451 AC_MSG_RESULT(no)
452 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
453 ]
454)
455
Tim Rice4cec93f2002-02-26 08:40:48 -0800456# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000457AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000458 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800459 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000460 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000461 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000462 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
463 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
Ben Lindstrom4b0f1ad2003-02-01 04:43:34 +0000464 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
Tim Rice81ed5182002-09-25 17:38:46 -0700465 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800466 util.h utime.h utmp.h utmpx.h)
467
Damien Millera22ba012000-03-02 23:09:20 +1100468# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700469AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
470AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000471
Damien Millerdf288022001-02-18 13:07:07 +1100472dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700473if test "x$with_tcp_wrappers" != "xno" ; then
474 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
475 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
476 fi
477fi
Damien Millerdf288022001-02-18 13:07:07 +1100478
Tim Rice1e1ef642003-09-11 22:19:31 -0700479dnl IRIX and Solaris 2.5.1 have dirname() in libgen
480AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
481 AC_CHECK_LIB(gen, dirname,[
482 AC_CACHE_CHECK([for broken dirname],
483 ac_cv_have_broken_dirname, [
484 save_LIBS="$LIBS"
485 LIBS="$LIBS -lgen"
486 AC_TRY_RUN(
487 [
488#include <libgen.h>
489#include <string.h>
490
491int main(int argc, char **argv) {
492 char *s, buf[32];
493
494 strncpy(buf,"/etc", 32);
495 s = dirname(buf);
496 if (!s || strncmp(s, "/", 32) != 0) {
497 exit(1);
498 } else {
499 exit(0);
500 }
501}
502 ],
503 [ ac_cv_have_broken_dirname="no" ],
504 [ ac_cv_have_broken_dirname="yes" ]
505 )
506 LIBS="$save_LIBS"
507 ])
508 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
509 LIBS="$LIBS -lgen"
510 AC_DEFINE(HAVE_DIRNAME)
511 AC_CHECK_HEADERS(libgen.h)
512 fi
513 ])
514])
515
516AC_CHECK_FUNC(getspnam, ,
517 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
518AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
519
Damien Miller150c8b52002-02-13 23:06:56 +1100520AC_ARG_WITH(rpath,
521 [ --without-rpath Disable auto-added -R linker paths],
522 [
523 if test "x$withval" = "xno" ; then
524 need_dash_r=""
525 fi
526 if test "x$withval" = "xyes" ; then
527 need_dash_r=1
528 fi
529 ]
530)
531
Tim Rice13aae5e2001-10-21 17:53:58 -0700532dnl zlib is required
533AC_ARG_WITH(zlib,
534 [ --with-zlib=PATH Use zlib in PATH],
535 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000536 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100537 AC_MSG_ERROR([*** zlib is required ***])
538 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700539 if test -d "$withval/lib"; then
540 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700541 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700542 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700543 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700544 fi
545 else
546 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700547 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700548 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700549 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700550 fi
551 fi
552 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700553 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700554 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700555 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700556 fi
557 ]
558)
559
Tim Rice17b93e52001-10-23 22:36:54 -0700560AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100561
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000562dnl UnixWare 2.x
563AC_CHECK_FUNC(strcasecmp,
564 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
565)
566AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700567 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
568 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000569)
Damien Millerab18c411999-11-11 10:40:23 +1100570
Tim Ricee589a292001-11-03 11:09:32 -0800571dnl Checks for libutil functions
572AC_CHECK_HEADERS(libutil.h)
573AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
574AC_CHECK_FUNCS(logout updwtmp logwtmp)
575
Ben Lindstrom8697e082001-02-24 21:41:10 +0000576AC_FUNC_STRFTIME
577
Damien Miller3c027682001-03-14 11:39:45 +1100578# Check for ALTDIRFUNC glob() extension
579AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
580AC_EGREP_CPP(FOUNDIT,
581 [
582 #include <glob.h>
583 #ifdef GLOB_ALTDIRFUNC
584 FOUNDIT
585 #endif
586 ],
587 [
588 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
589 AC_MSG_RESULT(yes)
590 ],
591 [
592 AC_MSG_RESULT(no)
593 ]
594)
Damien Millerab18c411999-11-11 10:40:23 +1100595
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000596# Check for g.gl_matchc glob() extension
597AC_MSG_CHECKING(for gl_matchc field in glob_t)
598AC_EGREP_CPP(FOUNDIT,
599 [
600 #include <glob.h>
601 int main(void){glob_t g; g.gl_matchc = 1;}
602 ],
603 [
604 AC_DEFINE(GLOB_HAS_GL_MATCHC)
605 AC_MSG_RESULT(yes)
606 ],
607 [
608 AC_MSG_RESULT(no)
609 ]
610)
611
Damien Miller18bb4732001-03-28 14:35:30 +1000612AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
613AC_TRY_RUN(
614 [
615#include <sys/types.h>
616#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700617int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000618 ],
619 [AC_MSG_RESULT(yes)],
620 [
621 AC_MSG_RESULT(no)
622 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
623 ]
624)
625
Damien Millerc547bf12001-02-16 10:18:12 +1100626# Check whether user wants S/Key support
627SKEY_MSG="no"
628AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700629 [ --with-skey[[=PATH]] Enable S/Key support
630 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100631 [
632 if test "x$withval" != "xno" ; then
633
634 if test "x$withval" != "xyes" ; then
635 CPPFLAGS="$CPPFLAGS -I${withval}/include"
636 LDFLAGS="$LDFLAGS -L${withval}/lib"
637 fi
638
639 AC_DEFINE(SKEY)
640 LIBS="-lskey $LIBS"
641 SKEY_MSG="yes"
642
Tim Rice4cec93f2002-02-26 08:40:48 -0800643 AC_MSG_CHECKING([for s/key support])
644 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100645 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800646#include <stdio.h>
647#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700648int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800649 ],
650 [AC_MSG_RESULT(yes)],
651 [
652 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100653 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
654 ])
655 fi
656 ]
657)
658
659# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700660TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100661AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700662 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
663 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100664 [
665 if test "x$withval" != "xno" ; then
666 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700667 saved_LDFLAGS="$LDFLAGS"
668 saved_CPPFLAGS="$CPPFLAGS"
669 if test -n "${withval}" -a "${withval}" != "yes"; then
670 if test -d "${withval}/lib"; then
671 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700672 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700673 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700674 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700675 fi
676 else
677 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700678 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700679 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700680 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700681 fi
682 fi
683 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700684 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700685 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700686 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700687 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700688 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800689 LIBWRAP="-lwrap"
690 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100691 AC_MSG_CHECKING(for libwrap)
692 AC_TRY_LINK(
693 [
694#include <tcpd.h>
695 int deny_severity = 0, allow_severity = 0;
696 ],
697 [hosts_access(0);],
698 [
699 AC_MSG_RESULT(yes)
700 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800701 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700702 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100703 ],
704 [
705 AC_MSG_ERROR([*** libwrap missing])
706 ]
707 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800708 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100709 fi
710 ]
711)
712
Damien Millerfe1f1432003-02-24 15:45:42 +1100713dnl Checks for library functions. Please keep in alphabetical order
714AC_CHECK_FUNCS(\
Damien Miller5fe46a42003-06-05 09:53:31 +1000715 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
716 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Damien Millerfe1f1432003-02-24 15:45:42 +1100717 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000718 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100719 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000720 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
721 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
722 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Damien Miller5fe46a42003-06-05 09:53:31 +1000723 setproctitle setregid setresgid setresuid setreuid setrlimit \
724 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tuckerb2427c82003-09-10 15:22:44 +1000725 strlcat strlcpy strmode strnvis sysconf tcgetpgrp \
Darren Tuckerf38ea772003-08-13 20:48:07 +1000726 truncate utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100727)
Tim Rice13aae5e2001-10-21 17:53:58 -0700728
Damien Millercd6853c2003-01-28 11:33:42 +1100729AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
730
Darren Tuckerf1159b52003-07-07 19:44:01 +1000731dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000732AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000733AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000734
Darren Tuckerb2427c82003-09-10 15:22:44 +1000735dnl tcsendbreak might be a macro
736AC_CHECK_DECL(tcsendbreak,
737 [AC_DEFINE(HAVE_TCSENDBREAK)],
738 [AC_CHECK_FUNCS(tcsendbreak)],
739 [#include <termios.h>]
740)
741
Damien Millerad833b32000-08-23 10:46:23 +1000742dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000743AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000744dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000745AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000746AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000747dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000748AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000749AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100750
Damien Miller04f80141999-11-19 15:32:34 +1100751AC_CHECK_FUNC(daemon,
752 [AC_DEFINE(HAVE_DAEMON)],
753 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
754)
755
Damien Miller9fb07e42000-03-05 16:22:59 +1100756AC_CHECK_FUNC(getpagesize,
757 [AC_DEFINE(HAVE_GETPAGESIZE)],
758 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
759)
760
Damien Millercb170cb2000-07-01 16:52:55 +1000761# Check for broken snprintf
762if test "x$ac_cv_func_snprintf" = "xyes" ; then
763 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
764 AC_TRY_RUN(
765 [
766#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700767int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000768 ],
769 [AC_MSG_RESULT(yes)],
770 [
771 AC_MSG_RESULT(no)
772 AC_DEFINE(BROKEN_SNPRINTF)
773 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
774 ]
775 )
776fi
777
Damien Millere8328192003-01-07 15:18:32 +1100778dnl see whether mkstemp() requires XXXXXX
779if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
780AC_MSG_CHECKING([for (overly) strict mkstemp])
781AC_TRY_RUN(
782 [
783#include <stdlib.h>
784main() { char template[]="conftest.mkstemp-test";
785if (mkstemp(template) == -1)
786 exit(1);
787unlink(template); exit(0);
788}
789 ],
790 [
791 AC_MSG_RESULT(no)
792 ],
793 [
794 AC_MSG_RESULT(yes)
795 AC_DEFINE(HAVE_STRICT_MKSTEMP)
796 ],
797 [
798 AC_MSG_RESULT(yes)
799 AC_DEFINE(HAVE_STRICT_MKSTEMP)
800 ]
801)
802fi
803
Darren Tucker70a3d552003-08-21 17:58:29 +1000804dnl make sure that openpty does not reacquire controlling terminal
805if test ! -z "$check_for_openpty_ctty_bug"; then
806 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
807 AC_TRY_RUN(
808 [
809#include <stdio.h>
810#include <sys/fcntl.h>
811#include <sys/types.h>
812#include <sys/wait.h>
813
814int
815main()
816{
817 pid_t pid;
818 int fd, ptyfd, ttyfd, status;
819
820 pid = fork();
821 if (pid < 0) { /* failed */
822 exit(1);
823 } else if (pid > 0) { /* parent */
824 waitpid(pid, &status, 0);
825 if (WIFEXITED(status))
826 exit(WEXITSTATUS(status));
827 else
828 exit(2);
829 } else { /* child */
830 close(0); close(1); close(2);
831 setsid();
832 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
833 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
834 if (fd >= 0)
835 exit(3); /* Acquired ctty: broken */
836 else
837 exit(0); /* Did not acquire ctty: OK */
838 }
839}
840 ],
841 [
842 AC_MSG_RESULT(yes)
843 ],
844 [
845 AC_MSG_RESULT(no)
846 AC_DEFINE(SSHD_ACQUIRES_CTTY)
847 ]
848 )
849fi
850
Damien Miller606f8802000-09-16 15:39:56 +1100851AC_FUNC_GETPGRP
852
Damien Millera64b57a2001-01-17 10:44:13 +1100853# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000854PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100855AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100856 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100857 [
Damien Millera64b57a2001-01-17 10:44:13 +1100858 if test "x$withval" != "xno" ; then
859 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
860 AC_MSG_ERROR([PAM headers not found])
861 fi
862
863 AC_CHECK_LIB(dl, dlopen, , )
864 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
865 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000866 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +1100867
868 disable_shadow=yes
869 PAM_MSG="yes"
870
871 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800872 if test $ac_cv_lib_dl_dlopen = yes; then
873 LIBPAM="-lpam -ldl"
874 else
875 LIBPAM="-lpam"
876 fi
877 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100878 fi
879 ]
880)
Damien Millera22ba012000-03-02 23:09:20 +1100881
Damien Millera64b57a2001-01-17 10:44:13 +1100882# Check for older PAM
883if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100884 # Check PAM strerror arguments (old PAM)
885 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
886 AC_TRY_COMPILE(
887 [
Damien Miller81171112000-04-23 11:14:01 +1000888#include <stdlib.h>
889#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100890 ],
891 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
892 [AC_MSG_RESULT(no)],
893 [
894 AC_DEFINE(HAVE_OLD_PAM)
895 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000896 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100897 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100898 )
Damien Millera22ba012000-03-02 23:09:20 +1100899fi
900
Damien Millerfc93d4b2002-09-04 23:26:29 +1000901# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
902# because the system crypt() is more featureful.
903if test "x$check_for_libcrypt_before" = "x1"; then
904 AC_CHECK_LIB(crypt, crypt)
905fi
906
Tim Riceaef73712002-05-11 13:17:42 -0700907# Search for OpenSSL
908saved_CPPFLAGS="$CPPFLAGS"
909saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100910AC_ARG_WITH(ssl-dir,
911 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
912 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000913 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700914 if test -d "$withval/lib"; then
915 if test -n "${need_dash_r}"; then
916 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
917 else
918 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
919 fi
920 else
921 if test -n "${need_dash_r}"; then
922 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
923 else
924 LDFLAGS="-L${withval} ${LDFLAGS}"
925 fi
926 fi
927 if test -d "$withval/include"; then
928 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
929 else
930 CPPFLAGS="-I${withval} ${CPPFLAGS}"
931 fi
Damien Millera22ba012000-03-02 23:09:20 +1100932 fi
933 ]
934)
Tim Riceaef73712002-05-11 13:17:42 -0700935LIBS="$LIBS -lcrypto"
936AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000937 [
Tim Riceaef73712002-05-11 13:17:42 -0700938 dnl Check default openssl install dir
939 if test -n "${need_dash_r}"; then
940 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000941 else
Tim Riceaef73712002-05-11 13:17:42 -0700942 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000943 fi
Tim Riceaef73712002-05-11 13:17:42 -0700944 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
945 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
946 [
947 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
948 ]
949 )
950 ]
951)
952
Tim Riced730b782002-08-13 18:52:10 -0700953# Determine OpenSSL header version
954AC_MSG_CHECKING([OpenSSL header version])
955AC_TRY_RUN(
956 [
957#include <stdio.h>
958#include <string.h>
959#include <openssl/opensslv.h>
960#define DATA "conftest.sslincver"
961int main(void) {
962 FILE *fd;
963 int rc;
964
965 fd = fopen(DATA,"w");
966 if(fd == NULL)
967 exit(1);
968
969 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
970 exit(1);
971
972 exit(0);
973}
974 ],
975 [
976 ssl_header_ver=`cat conftest.sslincver`
977 AC_MSG_RESULT($ssl_header_ver)
978 ],
979 [
980 AC_MSG_RESULT(not found)
981 AC_MSG_ERROR(OpenSSL version header not found.)
982 ]
983)
984
985# Determine OpenSSL library version
986AC_MSG_CHECKING([OpenSSL library version])
987AC_TRY_RUN(
988 [
989#include <stdio.h>
990#include <string.h>
991#include <openssl/opensslv.h>
992#include <openssl/crypto.h>
993#define DATA "conftest.ssllibver"
994int main(void) {
995 FILE *fd;
996 int rc;
997
998 fd = fopen(DATA,"w");
999 if(fd == NULL)
1000 exit(1);
1001
1002 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1003 exit(1);
1004
1005 exit(0);
1006}
1007 ],
1008 [
1009 ssl_library_ver=`cat conftest.ssllibver`
1010 AC_MSG_RESULT($ssl_library_ver)
1011 ],
1012 [
1013 AC_MSG_RESULT(not found)
1014 AC_MSG_ERROR(OpenSSL library not found.)
1015 ]
1016)
Damien Millera22ba012000-03-02 23:09:20 +11001017
Damien Millerec932372002-01-22 22:16:03 +11001018# Sanity check OpenSSL headers
1019AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1020AC_TRY_RUN(
1021 [
1022#include <string.h>
1023#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001024int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001025 ],
1026 [
1027 AC_MSG_RESULT(yes)
1028 ],
1029 [
1030 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001031 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1032Check config.log for details.
1033Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001034 ]
1035)
1036
Damien Millera64b57a2001-01-17 10:44:13 +11001037# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1038# version in OpenSSL. Skip this for PAM
Damien Miller4f9f42a2003-05-10 19:28:02 +10001039if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001040 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001041fi
1042
Damien Miller6c21c512002-01-22 21:57:53 +11001043
1044### Configure cryptographic random number support
1045
1046# Check wheter OpenSSL seeds itself
1047AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1048AC_TRY_RUN(
1049 [
1050#include <string.h>
1051#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001052int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001053 ],
1054 [
1055 OPENSSL_SEEDS_ITSELF=yes
1056 AC_MSG_RESULT(yes)
1057 ],
1058 [
1059 AC_MSG_RESULT(no)
1060 # Default to use of the rand helper if OpenSSL doesn't
1061 # seed itself
1062 USE_RAND_HELPER=yes
1063 ]
1064)
1065
1066
1067# Do we want to force the use of the rand helper?
1068AC_ARG_WITH(rand-helper,
1069 [ --with-rand-helper Use subprocess to gather strong randomness ],
1070 [
1071 if test "x$withval" = "xno" ; then
1072 # Force use of OpenSSL's internal RNG, even if
1073 # the previous test showed it to be unseeded.
1074 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1075 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1076 OPENSSL_SEEDS_ITSELF=yes
1077 USE_RAND_HELPER=""
1078 fi
1079 else
1080 USE_RAND_HELPER=yes
1081 fi
1082 ],
1083)
1084
1085# Which randomness source do we use?
1086if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1087 # OpenSSL only
1088 AC_DEFINE(OPENSSL_PRNG_ONLY)
1089 RAND_MSG="OpenSSL internal ONLY"
1090 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001091elif test ! -z "$USE_RAND_HELPER" ; then
1092 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001093 RAND_MSG="ssh-rand-helper"
1094 INSTALL_SSH_RAND_HELPER="yes"
1095fi
1096AC_SUBST(INSTALL_SSH_RAND_HELPER)
1097
1098### Configuration of ssh-rand-helper
1099
1100# PRNGD TCP socket
1101AC_ARG_WITH(prngd-port,
1102 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1103 [
Damien Millere996d722002-01-23 11:20:59 +11001104 case "$withval" in
1105 no)
1106 withval=""
1107 ;;
1108 [[0-9]]*)
1109 ;;
1110 *)
1111 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1112 ;;
1113 esac
1114 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001115 PRNGD_PORT="$withval"
1116 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1117 fi
1118 ]
1119)
1120
1121# PRNGD Unix domain socket
1122AC_ARG_WITH(prngd-socket,
1123 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1124 [
Damien Millere996d722002-01-23 11:20:59 +11001125 case "$withval" in
1126 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001127 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001128 ;;
1129 no)
1130 withval=""
1131 ;;
1132 /*)
1133 ;;
1134 *)
1135 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1136 ;;
1137 esac
1138
1139 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001140 if test ! -z "$PRNGD_PORT" ; then
1141 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1142 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001143 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001144 AC_MSG_WARN(Entropy socket is not readable)
1145 fi
1146 PRNGD_SOCKET="$withval"
1147 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1148 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001149 ],
1150 [
1151 # Check for existing socket only if we don't have a random device already
1152 if test "$USE_RAND_HELPER" = yes ; then
1153 AC_MSG_CHECKING(for PRNGD/EGD socket)
1154 # Insert other locations here
1155 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1156 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1157 PRNGD_SOCKET="$sock"
1158 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1159 break;
1160 fi
1161 done
1162 if test ! -z "$PRNGD_SOCKET" ; then
1163 AC_MSG_RESULT($PRNGD_SOCKET)
1164 else
1165 AC_MSG_RESULT(not found)
1166 fi
1167 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001168 ]
1169)
1170
1171# Change default command timeout for hashing entropy source
1172entropy_timeout=200
1173AC_ARG_WITH(entropy-timeout,
1174 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1175 [
1176 if test "x$withval" != "xno" ; then
1177 entropy_timeout=$withval
1178 fi
1179 ]
1180)
Damien Miller6c21c512002-01-22 21:57:53 +11001181AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1182
Damien Millerd3f6ad22002-06-25 10:24:47 +10001183SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001184AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001185 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001186 [
1187 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001188 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001189 fi
1190 ]
1191)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001192AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1193AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001194
Tim Rice88f2ab52002-03-17 12:17:34 -08001195# We do this little dance with the search path to insure
1196# that programs that we select for use by installed programs
1197# (which may be run by the super-user) come from trusted
1198# locations before they come from the user's private area.
1199# This should help avoid accidentally configuring some
1200# random version of a program in someone's personal bin.
1201
1202OPATH=$PATH
1203PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001204test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001205test -d /sbin && PATH=$PATH:/sbin
1206test -d /usr/sbin && PATH=$PATH:/usr/sbin
1207PATH=$PATH:/etc:$OPATH
1208
Damien Miller6c21c512002-01-22 21:57:53 +11001209# These programs are used by the command hashing source to gather entropy
1210OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1211OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1212OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1213OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1214OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1215OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1216OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1217OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1218OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1219OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1220OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1221OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1222OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1223OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1224OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1225OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001226# restore PATH
1227PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001228
1229# Where does ssh-rand-helper get its randomness from?
1230INSTALL_SSH_PRNG_CMDS=""
1231if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1232 if test ! -z "$PRNGD_PORT" ; then
1233 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1234 elif test ! -z "$PRNGD_SOCKET" ; then
1235 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1236 else
1237 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1238 RAND_HELPER_CMDHASH=yes
1239 INSTALL_SSH_PRNG_CMDS="yes"
1240 fi
1241fi
1242AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1243
1244
Ben Lindstromb5628642000-10-18 00:02:25 +00001245# Cheap hack to ensure NEWS-OS libraries are arranged right.
1246if test ! -z "$SONY" ; then
1247 LIBS="$LIBS -liberty";
1248fi
1249
Damien Millera22ba012000-03-02 23:09:20 +11001250# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001251AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001252AC_CHECK_SIZEOF(short int, 2)
1253AC_CHECK_SIZEOF(int, 4)
1254AC_CHECK_SIZEOF(long int, 4)
1255AC_CHECK_SIZEOF(long long int, 8)
1256
Damien Millerfa2bb692002-04-23 23:22:25 +10001257# Sanity check long long for some platforms (AIX)
1258if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1259 ac_cv_sizeof_long_long_int=0
1260fi
1261
Damien Millera22ba012000-03-02 23:09:20 +11001262# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001263AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1264 AC_TRY_COMPILE(
1265 [ #include <sys/types.h> ],
1266 [ u_int a; a = 1;],
1267 [ ac_cv_have_u_int="yes" ],
1268 [ ac_cv_have_u_int="no" ]
1269 )
1270])
1271if test "x$ac_cv_have_u_int" = "xyes" ; then
1272 AC_DEFINE(HAVE_U_INT)
1273 have_u_int=1
1274fi
1275
Damien Miller61e50f12000-05-08 20:49:37 +10001276AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1277 AC_TRY_COMPILE(
1278 [ #include <sys/types.h> ],
1279 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1280 [ ac_cv_have_intxx_t="yes" ],
1281 [ ac_cv_have_intxx_t="no" ]
1282 )
1283])
1284if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1285 AC_DEFINE(HAVE_INTXX_T)
1286 have_intxx_t=1
1287fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001288
1289if (test -z "$have_intxx_t" && \
1290 test "x$ac_cv_header_stdint_h" = "xyes")
1291then
1292 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1293 AC_TRY_COMPILE(
1294 [ #include <stdint.h> ],
1295 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1296 [
1297 AC_DEFINE(HAVE_INTXX_T)
1298 AC_MSG_RESULT(yes)
1299 ],
1300 [ AC_MSG_RESULT(no) ]
1301 )
1302fi
1303
Damien Miller578783e2000-09-23 14:12:24 +11001304AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1305 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001306 [
1307#include <sys/types.h>
1308#ifdef HAVE_STDINT_H
1309# include <stdint.h>
1310#endif
1311#include <sys/socket.h>
1312#ifdef HAVE_SYS_BITYPES_H
1313# include <sys/bitypes.h>
1314#endif
1315 ],
Damien Miller578783e2000-09-23 14:12:24 +11001316 [ int64_t a; a = 1;],
1317 [ ac_cv_have_int64_t="yes" ],
1318 [ ac_cv_have_int64_t="no" ]
1319 )
1320])
1321if test "x$ac_cv_have_int64_t" = "xyes" ; then
1322 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001323fi
1324
Damien Miller61e50f12000-05-08 20:49:37 +10001325AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1326 AC_TRY_COMPILE(
1327 [ #include <sys/types.h> ],
1328 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1329 [ ac_cv_have_u_intxx_t="yes" ],
1330 [ ac_cv_have_u_intxx_t="no" ]
1331 )
1332])
1333if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1334 AC_DEFINE(HAVE_U_INTXX_T)
1335 have_u_intxx_t=1
1336fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001337
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001338if test -z "$have_u_intxx_t" ; then
1339 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1340 AC_TRY_COMPILE(
1341 [ #include <sys/socket.h> ],
1342 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1343 [
1344 AC_DEFINE(HAVE_U_INTXX_T)
1345 AC_MSG_RESULT(yes)
1346 ],
1347 [ AC_MSG_RESULT(no) ]
1348 )
1349fi
1350
Damien Miller578783e2000-09-23 14:12:24 +11001351AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1352 AC_TRY_COMPILE(
1353 [ #include <sys/types.h> ],
1354 [ u_int64_t a; a = 1;],
1355 [ ac_cv_have_u_int64_t="yes" ],
1356 [ ac_cv_have_u_int64_t="no" ]
1357 )
1358])
1359if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1360 AC_DEFINE(HAVE_U_INT64_T)
1361 have_u_int64_t=1
1362fi
1363
Tim Rice4cec93f2002-02-26 08:40:48 -08001364if test -z "$have_u_int64_t" ; then
1365 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1366 AC_TRY_COMPILE(
1367 [ #include <sys/bitypes.h> ],
1368 [ u_int64_t a; a = 1],
1369 [
1370 AC_DEFINE(HAVE_U_INT64_T)
1371 AC_MSG_RESULT(yes)
1372 ],
1373 [ AC_MSG_RESULT(no) ]
1374 )
1375fi
1376
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001377if test -z "$have_u_intxx_t" ; then
1378 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1379 AC_TRY_COMPILE(
1380 [
1381#include <sys/types.h>
1382 ],
1383 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1384 [ ac_cv_have_uintxx_t="yes" ],
1385 [ ac_cv_have_uintxx_t="no" ]
1386 )
1387 ])
1388 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1389 AC_DEFINE(HAVE_UINTXX_T)
1390 fi
1391fi
1392
1393if test -z "$have_uintxx_t" ; then
1394 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1395 AC_TRY_COMPILE(
1396 [ #include <stdint.h> ],
1397 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1398 [
1399 AC_DEFINE(HAVE_UINTXX_T)
1400 AC_MSG_RESULT(yes)
1401 ],
1402 [ AC_MSG_RESULT(no) ]
1403 )
1404fi
1405
Damien Milleredb82922000-06-20 13:25:52 +10001406if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1407 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001408then
1409 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1410 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001411 [
1412#include <sys/bitypes.h>
1413 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001414 [
Damien Miller70494d12000-04-03 15:57:06 +10001415 int8_t a; int16_t b; int32_t c;
1416 u_int8_t e; u_int16_t f; u_int32_t g;
1417 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001418 ],
1419 [
1420 AC_DEFINE(HAVE_U_INTXX_T)
1421 AC_DEFINE(HAVE_INTXX_T)
1422 AC_MSG_RESULT(yes)
1423 ],
1424 [AC_MSG_RESULT(no)]
1425 )
1426fi
1427
Damien Miller58be7382001-09-15 21:31:54 +10001428
1429AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1430 AC_TRY_COMPILE(
1431 [
1432#include <sys/types.h>
1433 ],
1434 [ u_char foo; foo = 125; ],
1435 [ ac_cv_have_u_char="yes" ],
1436 [ ac_cv_have_u_char="no" ]
1437 )
1438])
1439if test "x$ac_cv_have_u_char" = "xyes" ; then
1440 AC_DEFINE(HAVE_U_CHAR)
1441fi
1442
Tim Rice13aae5e2001-10-21 17:53:58 -07001443TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001444
Tim Rice200a5c02002-02-26 22:12:34 -08001445AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001446
Damien Miller61e50f12000-05-08 20:49:37 +10001447AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1448 AC_TRY_COMPILE(
1449 [
1450#include <sys/types.h>
1451 ],
1452 [ size_t foo; foo = 1235; ],
1453 [ ac_cv_have_size_t="yes" ],
1454 [ ac_cv_have_size_t="no" ]
1455 )
1456])
1457if test "x$ac_cv_have_size_t" = "xyes" ; then
1458 AC_DEFINE(HAVE_SIZE_T)
1459fi
Damien Miller95058511999-12-29 10:36:45 +11001460
Damien Miller615f9392000-05-17 22:53:33 +10001461AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1462 AC_TRY_COMPILE(
1463 [
1464#include <sys/types.h>
1465 ],
1466 [ ssize_t foo; foo = 1235; ],
1467 [ ac_cv_have_ssize_t="yes" ],
1468 [ ac_cv_have_ssize_t="no" ]
1469 )
1470])
1471if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1472 AC_DEFINE(HAVE_SSIZE_T)
1473fi
1474
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001475AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1476 AC_TRY_COMPILE(
1477 [
1478#include <time.h>
1479 ],
1480 [ clock_t foo; foo = 1235; ],
1481 [ ac_cv_have_clock_t="yes" ],
1482 [ ac_cv_have_clock_t="no" ]
1483 )
1484])
1485if test "x$ac_cv_have_clock_t" = "xyes" ; then
1486 AC_DEFINE(HAVE_CLOCK_T)
1487fi
1488
Damien Millerb54b40e2000-06-23 08:23:34 +10001489AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1490 AC_TRY_COMPILE(
1491 [
1492#include <sys/types.h>
1493#include <sys/socket.h>
1494 ],
1495 [ sa_family_t foo; foo = 1235; ],
1496 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001497 [ AC_TRY_COMPILE(
1498 [
1499#include <sys/types.h>
1500#include <sys/socket.h>
1501#include <netinet/in.h>
1502 ],
1503 [ sa_family_t foo; foo = 1235; ],
1504 [ ac_cv_have_sa_family_t="yes" ],
1505
Damien Millerb54b40e2000-06-23 08:23:34 +10001506 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001507 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001508 )
1509])
1510if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1511 AC_DEFINE(HAVE_SA_FAMILY_T)
1512fi
1513
Damien Miller0f91b4e2000-06-18 15:43:25 +10001514AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1515 AC_TRY_COMPILE(
1516 [
1517#include <sys/types.h>
1518 ],
1519 [ pid_t foo; foo = 1235; ],
1520 [ ac_cv_have_pid_t="yes" ],
1521 [ ac_cv_have_pid_t="no" ]
1522 )
1523])
1524if test "x$ac_cv_have_pid_t" = "xyes" ; then
1525 AC_DEFINE(HAVE_PID_T)
1526fi
1527
1528AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1529 AC_TRY_COMPILE(
1530 [
1531#include <sys/types.h>
1532 ],
1533 [ mode_t foo; foo = 1235; ],
1534 [ ac_cv_have_mode_t="yes" ],
1535 [ ac_cv_have_mode_t="no" ]
1536 )
1537])
1538if test "x$ac_cv_have_mode_t" = "xyes" ; then
1539 AC_DEFINE(HAVE_MODE_T)
1540fi
1541
Damien Miller61e50f12000-05-08 20:49:37 +10001542
1543AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1544 AC_TRY_COMPILE(
1545 [
Damien Miller81171112000-04-23 11:14:01 +10001546#include <sys/types.h>
1547#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001548 ],
1549 [ struct sockaddr_storage s; ],
1550 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1551 [ ac_cv_have_struct_sockaddr_storage="no" ]
1552 )
1553])
1554if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1555 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1556fi
Damien Miller34132e52000-01-14 15:45:46 +11001557
Damien Miller61e50f12000-05-08 20:49:37 +10001558AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1559 AC_TRY_COMPILE(
1560 [
Damien Miller7b22d652000-06-18 14:07:04 +10001561#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001562#include <netinet/in.h>
1563 ],
1564 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1565 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1566 [ ac_cv_have_struct_sockaddr_in6="no" ]
1567 )
1568])
1569if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1570 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1571fi
Damien Miller34132e52000-01-14 15:45:46 +11001572
Damien Miller61e50f12000-05-08 20:49:37 +10001573AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1574 AC_TRY_COMPILE(
1575 [
Damien Miller7b22d652000-06-18 14:07:04 +10001576#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001577#include <netinet/in.h>
1578 ],
1579 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1580 [ ac_cv_have_struct_in6_addr="yes" ],
1581 [ ac_cv_have_struct_in6_addr="no" ]
1582 )
1583])
1584if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1585 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1586fi
Damien Miller34132e52000-01-14 15:45:46 +11001587
Damien Miller61e50f12000-05-08 20:49:37 +10001588AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1589 AC_TRY_COMPILE(
1590 [
Damien Miller81171112000-04-23 11:14:01 +10001591#include <sys/types.h>
1592#include <sys/socket.h>
1593#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001594 ],
1595 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1596 [ ac_cv_have_struct_addrinfo="yes" ],
1597 [ ac_cv_have_struct_addrinfo="no" ]
1598 )
1599])
1600if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1601 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1602fi
1603
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001604AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1605 AC_TRY_COMPILE(
1606 [ #include <sys/time.h> ],
1607 [ struct timeval tv; tv.tv_sec = 1;],
1608 [ ac_cv_have_struct_timeval="yes" ],
1609 [ ac_cv_have_struct_timeval="no" ]
1610 )
1611])
1612if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1613 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1614 have_struct_timeval=1
1615fi
1616
Tim Rice4e4dc562003-03-18 10:21:40 -08001617AC_CHECK_TYPES(struct timespec)
1618
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001619# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001620if test "x$ac_cv_have_int64_t" = "xno" -a \
1621 "x$ac_cv_sizeof_long_int" != "x8" -a \
1622 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001623 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1624 echo "an alternative compiler (I.E., GCC) before continuing."
1625 echo ""
1626 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001627else
1628dnl test snprintf (broken on SCO w/gcc)
1629 AC_TRY_RUN(
1630 [
1631#include <stdio.h>
1632#include <string.h>
1633#ifdef HAVE_SNPRINTF
1634main()
1635{
1636 char buf[50];
1637 char expected_out[50];
1638 int mazsize = 50 ;
1639#if (SIZEOF_LONG_INT == 8)
1640 long int num = 0x7fffffffffffffff;
1641#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001642 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001643#endif
1644 strcpy(expected_out, "9223372036854775807");
1645 snprintf(buf, mazsize, "%lld", num);
1646 if(strcmp(buf, expected_out) != 0)
1647 exit(1);
1648 exit(0);
1649}
1650#else
1651main() { exit(0); }
1652#endif
1653 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1654 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001655fi
1656
Damien Miller78315eb2000-09-29 23:01:36 +11001657dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001658OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1659OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1660OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1661OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1662OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001663OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001664OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1665OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001666OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001667OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1668OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1669OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1670OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001671OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1672OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1673OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1674OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001675
1676AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001677
Damien Miller61e50f12000-05-08 20:49:37 +10001678AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1679 ac_cv_have_ss_family_in_struct_ss, [
1680 AC_TRY_COMPILE(
1681 [
Damien Miller81171112000-04-23 11:14:01 +10001682#include <sys/types.h>
1683#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001684 ],
1685 [ struct sockaddr_storage s; s.ss_family = 1; ],
1686 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1687 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1688 )
1689])
1690if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1691 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1692fi
1693
Damien Miller61e50f12000-05-08 20:49:37 +10001694AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1695 ac_cv_have___ss_family_in_struct_ss, [
1696 AC_TRY_COMPILE(
1697 [
Damien Miller81171112000-04-23 11:14:01 +10001698#include <sys/types.h>
1699#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001700 ],
1701 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1702 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1703 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1704 )
1705])
1706if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1707 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1708fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001709
Damien Millerad833b32000-08-23 10:46:23 +10001710AC_CACHE_CHECK([for pw_class field in struct passwd],
1711 ac_cv_have_pw_class_in_struct_passwd, [
1712 AC_TRY_COMPILE(
1713 [
Damien Millerad833b32000-08-23 10:46:23 +10001714#include <pwd.h>
1715 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001716 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001717 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1718 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1719 )
1720])
1721if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1722 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1723fi
1724
Kevin Steves82456952001-06-22 21:14:18 +00001725AC_CACHE_CHECK([for pw_expire field in struct passwd],
1726 ac_cv_have_pw_expire_in_struct_passwd, [
1727 AC_TRY_COMPILE(
1728 [
1729#include <pwd.h>
1730 ],
1731 [ struct passwd p; p.pw_expire = 0; ],
1732 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1733 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1734 )
1735])
1736if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1737 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1738fi
1739
1740AC_CACHE_CHECK([for pw_change field in struct passwd],
1741 ac_cv_have_pw_change_in_struct_passwd, [
1742 AC_TRY_COMPILE(
1743 [
1744#include <pwd.h>
1745 ],
1746 [ struct passwd p; p.pw_change = 0; ],
1747 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1748 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1749 )
1750])
1751if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1752 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1753fi
Damien Miller61e50f12000-05-08 20:49:37 +10001754
Tim Rice28bbb0c2002-05-27 17:37:32 -07001755dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001756AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1757 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001758 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001759 [
Tim Riceae49fe62002-04-12 10:26:21 -07001760#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001761#include <sys/socket.h>
1762#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001763int main() {
1764#ifdef msg_accrights
1765exit(1);
1766#endif
1767struct msghdr m;
1768m.msg_accrights = 0;
1769exit(0);
1770}
Kevin Steves939c9db2002-03-22 17:23:25 +00001771 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001772 [ ac_cv_have_accrights_in_msghdr="yes" ],
1773 [ ac_cv_have_accrights_in_msghdr="no" ]
1774 )
1775])
1776if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1777 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1778fi
1779
Kevin Stevesa44e0352002-04-07 16:18:03 +00001780AC_CACHE_CHECK([for msg_control field in struct msghdr],
1781 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001782 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001783 [
Tim Riceae49fe62002-04-12 10:26:21 -07001784#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001785#include <sys/socket.h>
1786#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001787int main() {
1788#ifdef msg_control
1789exit(1);
1790#endif
1791struct msghdr m;
1792m.msg_control = 0;
1793exit(0);
1794}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001795 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001796 [ ac_cv_have_control_in_msghdr="yes" ],
1797 [ ac_cv_have_control_in_msghdr="no" ]
1798 )
1799])
1800if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1801 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1802fi
1803
Damien Miller61e50f12000-05-08 20:49:37 +10001804AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1805 AC_TRY_LINK([],
1806 [ extern char *__progname; printf("%s", __progname); ],
1807 [ ac_cv_libc_defines___progname="yes" ],
1808 [ ac_cv_libc_defines___progname="no" ]
1809 )
1810])
1811if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1812 AC_DEFINE(HAVE___PROGNAME)
1813fi
1814
Kevin Steves4846f4a2002-03-22 18:19:53 +00001815AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1816 AC_TRY_LINK([
1817#include <stdio.h>
1818],
1819 [ printf("%s", __FUNCTION__); ],
1820 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1821 [ ac_cv_cc_implements___FUNCTION__="no" ]
1822 )
1823])
1824if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1825 AC_DEFINE(HAVE___FUNCTION__)
1826fi
1827
1828AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1829 AC_TRY_LINK([
1830#include <stdio.h>
1831],
1832 [ printf("%s", __func__); ],
1833 [ ac_cv_cc_implements___func__="yes" ],
1834 [ ac_cv_cc_implements___func__="no" ]
1835 )
1836])
1837if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1838 AC_DEFINE(HAVE___func__)
1839fi
1840
Damien Miller4f8e6692001-07-14 13:22:53 +10001841AC_CACHE_CHECK([whether getopt has optreset support],
1842 ac_cv_have_getopt_optreset, [
1843 AC_TRY_LINK(
1844 [
1845#include <getopt.h>
1846 ],
1847 [ extern int optreset; optreset = 0; ],
1848 [ ac_cv_have_getopt_optreset="yes" ],
1849 [ ac_cv_have_getopt_optreset="no" ]
1850 )
1851])
1852if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1853 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1854fi
Damien Millera22ba012000-03-02 23:09:20 +11001855
Damien Millerecbb26d2000-07-15 14:59:14 +10001856AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1857 AC_TRY_LINK([],
1858 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1859 [ ac_cv_libc_defines_sys_errlist="yes" ],
1860 [ ac_cv_libc_defines_sys_errlist="no" ]
1861 )
1862])
1863if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1864 AC_DEFINE(HAVE_SYS_ERRLIST)
1865fi
1866
1867
Damien Miller11fa2cc2000-08-16 10:35:58 +10001868AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1869 AC_TRY_LINK([],
1870 [ extern int sys_nerr; printf("%i", sys_nerr);],
1871 [ ac_cv_libc_defines_sys_nerr="yes" ],
1872 [ ac_cv_libc_defines_sys_nerr="no" ]
1873 )
1874])
1875if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1876 AC_DEFINE(HAVE_SYS_NERR)
1877fi
1878
Damien Miller85de5802001-09-18 14:01:11 +10001879SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001880# Check whether user wants sectok support
1881AC_ARG_WITH(sectok,
1882 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001883 [
1884 if test "x$withval" != "xno" ; then
1885 if test "x$withval" != "xyes" ; then
1886 CPPFLAGS="$CPPFLAGS -I${withval}"
1887 LDFLAGS="$LDFLAGS -L${withval}"
1888 if test ! -z "$need_dash_r" ; then
1889 LDFLAGS="$LDFLAGS -R${withval}"
1890 fi
1891 if test ! -z "$blibpath" ; then
1892 blibpath="$blibpath:${withval}"
1893 fi
1894 fi
1895 AC_CHECK_HEADERS(sectok.h)
1896 if test "$ac_cv_header_sectok_h" != yes; then
1897 AC_MSG_ERROR(Can't find sectok.h)
1898 fi
1899 AC_CHECK_LIB(sectok, sectok_open)
1900 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1901 AC_MSG_ERROR(Can't find libsectok)
1902 fi
1903 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001904 AC_DEFINE(USE_SECTOK)
1905 SCARD_MSG="yes, using sectok"
1906 fi
1907 ]
1908)
1909
1910# Check whether user wants OpenSC support
1911AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001912 AC_HELP_STRING([--with-opensc=PFX],
1913 [Enable smartcard support using OpenSC]),
1914 opensc_config_prefix="$withval", opensc_config_prefix="")
1915if test x$opensc_config_prefix != x ; then
1916 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1917 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1918 if test "$OPENSC_CONFIG" != "no"; then
1919 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1920 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1921 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1922 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1923 AC_DEFINE(SMARTCARD)
1924 AC_DEFINE(USE_OPENSC)
1925 SCARD_MSG="yes, using OpenSC"
1926 fi
1927fi
Damien Miller85de5802001-09-18 14:01:11 +10001928
Damien Miller7abe09b2003-05-15 10:53:49 +10001929# Check whether user wants DNS support
1930DNS_MSG="no"
1931AC_ARG_WITH(dns,
1932 [ --with-dns Support for fetching keys from DNS (experimental)],
1933 [
1934 if test "x$withval" != "xno" ; then
Damien Millerd9ec3702003-05-15 12:27:08 +10001935 DNS_MSG="yes"
1936 AC_DEFINE(DNS)
1937 AC_SEARCH_LIBS(getrrsetbyname, resolv,
Damien Miller200d0a72003-06-30 19:21:36 +10001938 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1939 [
1940 # Needed by our getrrsetbyname()
1941 AC_SEARCH_LIBS(res_query, resolv)
1942 AC_SEARCH_LIBS(dn_expand, resolv)
Tim Rice0ac16a42003-09-08 06:33:33 -07001943 AC_CHECK_FUNCS(_getshort _getlong)
Tim Riceb284e162003-09-08 14:35:16 -07001944 AC_CHECK_MEMBER(HEADER.ad,
1945 [AC_DEFINE(HAVE_HEADER_AD)],,
1946 [#include <arpa/nameser.h>])
Damien Miller200d0a72003-06-30 19:21:36 +10001947 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10001948 fi
1949 ]
1950)
1951
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001952# Check whether user wants Kerberos 5 support
1953KRB5_MSG="no"
1954AC_ARG_WITH(kerberos5,
1955 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1956 [
1957 if test "x$withval" != "xno" ; then
1958 if test "x$withval" = "xyes" ; then
1959 KRB5ROOT="/usr/local"
1960 else
1961 KRB5ROOT=${withval}
1962 fi
1963 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1964 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1965 AC_DEFINE(KRB5)
1966 KRB5_MSG="yes"
1967 AC_MSG_CHECKING(whether we are using Heimdal)
1968 AC_TRY_COMPILE([ #include <krb5.h> ],
1969 [ char *tmp = heimdal_version; ],
1970 [ AC_MSG_RESULT(yes)
1971 AC_DEFINE(HEIMDAL)
1972 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1973 ],
1974 [ AC_MSG_RESULT(no)
1975 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1976 ]
1977 )
1978 if test ! -z "$need_dash_r" ; then
1979 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1980 fi
1981 if test ! -z "$blibpath" ; then
1982 blibpath="$blibpath:${KRB5ROOT}/lib"
1983 fi
Damien Miller200d0a72003-06-30 19:21:36 +10001984 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001985
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001986 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1987 [ AC_DEFINE(GSSAPI)
1988 K5LIBS="-lgssapi $K5LIBS" ],
1989 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1990 [ AC_DEFINE(GSSAPI)
1991 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
1992 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
1993 $K5LIBS)
1994 ],
1995 $K5LIBS)
1996
1997 AC_CHECK_HEADER(gssapi.h, ,
1998 [ unset ac_cv_header_gssapi_h
1999 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2000 AC_CHECK_HEADERS(gssapi.h, ,
2001 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2002 )
2003 ]
2004 )
2005
2006 oldCPP="$CPPFLAGS"
2007 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2008 AC_CHECK_HEADER(gssapi_krb5.h, ,
2009 [ CPPFLAGS="$oldCPP" ])
2010
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002011 KRB5=yes
2012 fi
2013 ]
2014)
Darren Tucker6aaa58c2003-08-02 22:24:49 +10002015LIBS="$LIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10002016
Damien Millera22ba012000-03-02 23:09:20 +11002017# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002018
Damien Millerf58c6722002-05-13 13:15:42 +10002019PRIVSEP_PATH=/var/empty
2020AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002021 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002022 [
2023 if test "x$withval" != "$no" ; then
2024 PRIVSEP_PATH=$withval
2025 fi
2026 ]
2027)
2028AC_SUBST(PRIVSEP_PATH)
2029
Damien Millera22ba012000-03-02 23:09:20 +11002030AC_ARG_WITH(xauth,
2031 [ --with-xauth=PATH Specify path to xauth program ],
2032 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002033 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002034 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002035 fi
2036 ],
2037 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002038 TestPath="$PATH"
2039 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2040 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2041 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2042 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2043 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002044 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002045 xauth_path="/usr/openwin/bin/xauth"
2046 fi
2047 ]
2048)
2049
Damien Miller7d901272003-01-13 16:55:22 +11002050STRIP_OPT=-s
2051AC_ARG_ENABLE(strip,
2052 [ --disable-strip Disable calling strip(1) on install],
2053 [
2054 if test "x$enableval" = "xno" ; then
2055 STRIP_OPT=
2056 fi
2057 ]
2058)
2059AC_SUBST(STRIP_OPT)
2060
Damien Millera19cf472000-11-29 13:28:50 +11002061if test -z "$xauth_path" ; then
2062 XAUTH_PATH="undefined"
2063 AC_SUBST(XAUTH_PATH)
2064else
Damien Millera22ba012000-03-02 23:09:20 +11002065 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002066 XAUTH_PATH=$xauth_path
2067 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002068fi
Damien Millera22ba012000-03-02 23:09:20 +11002069
2070# Check for mail directory (last resort if we cannot get it from headers)
2071if test ! -z "$MAIL" ; then
2072 maildir=`dirname $MAIL`
2073 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2074fi
2075
Damien Millera22ba012000-03-02 23:09:20 +11002076if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002077 if test "x$disable_ptmx_check" != "xyes" ; then
2078 AC_CHECK_FILE("/dev/ptmx",
2079 [
2080 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2081 have_dev_ptmx=1
2082 ]
2083 )
2084 fi
Damien Millera22ba012000-03-02 23:09:20 +11002085fi
Damien Miller204ad072000-03-02 23:56:12 +11002086AC_CHECK_FILE("/dev/ptc",
2087 [
2088 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2089 have_dev_ptc=1
2090 ]
2091)
2092
Damien Millera22ba012000-03-02 23:09:20 +11002093# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002094AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002095 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002096 [
Damien Miller897741e2001-04-16 10:41:46 +10002097 case "$withval" in
2098 man|cat|doc)
2099 MANTYPE=$withval
2100 ;;
2101 *)
2102 AC_MSG_ERROR(invalid man type: $withval)
2103 ;;
2104 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002105 ]
2106)
Ben Lindstrombc709922001-04-18 18:04:21 +00002107if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002108 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2109 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002110 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2111 MANTYPE=doc
2112 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2113 MANTYPE=man
2114 else
2115 MANTYPE=cat
2116 fi
2117fi
Damien Miller670a4b82000-01-22 13:53:11 +11002118AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002119if test "$MANTYPE" = "doc"; then
2120 mansubdir=man;
2121else
2122 mansubdir=$MANTYPE;
2123fi
2124AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002125
Damien Millera22ba012000-03-02 23:09:20 +11002126# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10002127MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002128AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002129 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002130 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002131 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002132 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10002133 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002134 fi
2135 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002136)
2137
Damien Millera22ba012000-03-02 23:09:20 +11002138# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002139AC_ARG_WITH(shadow,
2140 [ --without-shadow Disable shadow password support],
2141 [
2142 if test "x$withval" = "xno" ; then
2143 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002144 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002145 fi
2146 ]
2147)
2148
Damien Miller1f335fb2000-06-26 11:31:33 +10002149if test -z "$disable_shadow" ; then
2150 AC_MSG_CHECKING([if the systems has expire shadow information])
2151 AC_TRY_COMPILE(
2152 [
2153#include <sys/types.h>
2154#include <shadow.h>
2155 struct spwd sp;
2156 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2157 [ sp_expire_available=yes ], []
2158 )
2159
2160 if test "x$sp_expire_available" = "xyes" ; then
2161 AC_MSG_RESULT(yes)
2162 AC_DEFINE(HAS_SHADOW_EXPIRE)
2163 else
2164 AC_MSG_RESULT(no)
2165 fi
2166fi
2167
Damien Millera22ba012000-03-02 23:09:20 +11002168# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002169if test ! -z "$IPADDR_IN_DISPLAY" ; then
2170 DISPLAY_HACK_MSG="yes"
2171 AC_DEFINE(IPADDR_IN_DISPLAY)
2172else
2173 DISPLAY_HACK_MSG="no"
2174 AC_ARG_WITH(ipaddr-display,
2175 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2176 [
2177 if test "x$withval" != "xno" ; then
2178 AC_DEFINE(IPADDR_IN_DISPLAY)
2179 DISPLAY_HACK_MSG="yes"
2180 fi
2181 ]
2182 )
2183fi
Damien Miller76112de1999-12-21 11:18:08 +11002184
Darren Tuckere1a790d2003-09-16 11:52:19 +10002185# check for /etc/default/login and use it if present.
2186AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2187
2188if test "x$external_path_file" = "x/etc/default/login"; then
2189 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2190fi
2191
Tim Rice43a1c132002-04-17 21:19:14 -07002192dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2193if test $ac_cv_func_login_getcapbool = "yes" -a \
2194 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002195 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002196fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002197
Damien Millera22ba012000-03-02 23:09:20 +11002198# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002199SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002200AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002201 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002202 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002203 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002204 AC_MSG_WARN([
2205--with-default-path=PATH has no effect on this system.
2206Edit /etc/login.conf instead.])
2207 elif test "x$withval" != "xno" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002208 if ! test -z "$external_path_file" ; then
2209 AC_MSG_WARN([
2210--with-default-path=PATH will only be used if PATH is not defined in
2211$external_path_file .])
2212 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002213 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002214 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002215 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002216 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002217 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2218 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002219 else
Darren Tuckere1a790d2003-09-16 11:52:19 +10002220 if ! test -z "$external_path_file" ; then
2221 AC_MSG_WARN([
2222If PATH is defined in $external_path_file, ensure the path to scp is included,
2223otherwise scp will not work.])
2224 fi
2225 AC_TRY_RUN(
2226 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002227/* find out what STDPATH is */
2228#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002229#ifdef HAVE_PATHS_H
2230# include <paths.h>
2231#endif
2232#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002233# ifdef _PATH_USERPATH /* Irix */
2234# define _PATH_STDPATH _PATH_USERPATH
2235# else
2236# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2237# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002238#endif
2239#include <sys/types.h>
2240#include <sys/stat.h>
2241#include <fcntl.h>
2242#define DATA "conftest.stdpath"
2243
2244main()
2245{
2246 FILE *fd;
2247 int rc;
2248
2249 fd = fopen(DATA,"w");
2250 if(fd == NULL)
2251 exit(1);
2252
2253 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2254 exit(1);
2255
2256 exit(0);
2257}
2258 ], [ user_path=`cat conftest.stdpath` ],
2259 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2260 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2261 )
2262# make sure $bindir is in USER_PATH so scp will work
2263 t_bindir=`eval echo ${bindir}`
2264 case $t_bindir in
2265 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2266 esac
2267 case $t_bindir in
2268 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2269 esac
2270 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2271 if test $? -ne 0 ; then
2272 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2273 if test $? -ne 0 ; then
2274 user_path=$user_path:$t_bindir
2275 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2276 fi
2277 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002278 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002279)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002280if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002281 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2282 AC_SUBST(user_path)
2283fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002284
Damien Millera18bbd32002-05-13 10:48:57 +10002285# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002286AC_ARG_WITH(superuser-path,
2287 [ --with-superuser-path= Specify different path for super-user],
2288 [
2289 if test "x$withval" != "xno" ; then
2290 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2291 superuser_path=$withval
2292 fi
2293 ]
2294)
2295
2296
Damien Miller61e50f12000-05-08 20:49:37 +10002297AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002298IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002299AC_ARG_WITH(4in6,
2300 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2301 [
2302 if test "x$withval" != "xno" ; then
2303 AC_MSG_RESULT(yes)
2304 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002305 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002306 else
2307 AC_MSG_RESULT(no)
2308 fi
2309 ],[
2310 if test "x$inet6_default_4in6" = "xyes"; then
2311 AC_MSG_RESULT([yes (default)])
2312 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002313 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002314 else
2315 AC_MSG_RESULT([no (default)])
2316 fi
2317 ]
2318)
2319
Damien Miller60396b02001-02-18 17:01:00 +11002320# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002321BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002322AC_ARG_WITH(bsd-auth,
2323 [ --with-bsd-auth Enable BSD auth support],
2324 [
2325 if test "x$withval" != "xno" ; then
2326 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002327 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002328 fi
2329 ]
2330)
2331
Damien Millera22ba012000-03-02 23:09:20 +11002332# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002333piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002334# make sure the directory exists
2335if test ! -d $piddir ; then
2336 piddir=`eval echo ${sysconfdir}`
2337 case $piddir in
2338 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2339 esac
2340fi
2341
Tim Rice88f2ab52002-03-17 12:17:34 -08002342AC_ARG_WITH(pid-dir,
2343 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2344 [
2345 if test "x$withval" != "xno" ; then
2346 piddir=$withval
2347 if test ! -d $piddir ; then
2348 AC_MSG_WARN([** no $piddir directory on this system **])
2349 fi
2350 fi
2351 ]
2352)
2353
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002354AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002355AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002356
andre2ff7b5d2000-06-03 14:57:40 +00002357dnl allow user to disable some login recording features
2358AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002359 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002360 [
2361 if test "x$enableval" = "xno" ; then
2362 AC_DEFINE(DISABLE_LASTLOG)
2363 fi
2364 ]
andre2ff7b5d2000-06-03 14:57:40 +00002365)
2366AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002367 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002368 [
2369 if test "x$enableval" = "xno" ; then
2370 AC_DEFINE(DISABLE_UTMP)
2371 fi
2372 ]
andre2ff7b5d2000-06-03 14:57:40 +00002373)
2374AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002375 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002376 [
2377 if test "x$enableval" = "xno" ; then
2378 AC_DEFINE(DISABLE_UTMPX)
2379 fi
2380 ]
andre2ff7b5d2000-06-03 14:57:40 +00002381)
2382AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002383 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002384 [
2385 if test "x$enableval" = "xno" ; then
2386 AC_DEFINE(DISABLE_WTMP)
2387 fi
2388 ]
andre2ff7b5d2000-06-03 14:57:40 +00002389)
2390AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002391 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002392 [
2393 if test "x$enableval" = "xno" ; then
2394 AC_DEFINE(DISABLE_WTMPX)
2395 fi
2396 ]
andre2ff7b5d2000-06-03 14:57:40 +00002397)
2398AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002399 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002400 [
2401 if test "x$enableval" = "xno" ; then
2402 AC_DEFINE(DISABLE_LOGIN)
2403 fi
2404 ]
andre2ff7b5d2000-06-03 14:57:40 +00002405)
2406AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002407 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002408 [
2409 if test "x$enableval" = "xno" ; then
2410 AC_DEFINE(DISABLE_PUTUTLINE)
2411 fi
2412 ]
andre2ff7b5d2000-06-03 14:57:40 +00002413)
2414AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002415 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002416 [
2417 if test "x$enableval" = "xno" ; then
2418 AC_DEFINE(DISABLE_PUTUTXLINE)
2419 fi
2420 ]
andre2ff7b5d2000-06-03 14:57:40 +00002421)
2422AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002423 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002424 [
2425 if test "x$withval" = "xno" ; then
2426 AC_DEFINE(DISABLE_LASTLOG)
2427 else
2428 conf_lastlog_location=$withval
2429 fi
2430 ]
2431)
andre2ff7b5d2000-06-03 14:57:40 +00002432
2433dnl lastlog, [uw]tmpx? detection
2434dnl NOTE: set the paths in the platform section to avoid the
2435dnl need for command-line parameters
2436dnl lastlog and [uw]tmp are subject to a file search if all else fails
2437
2438dnl lastlog detection
2439dnl NOTE: the code itself will detect if lastlog is a directory
2440AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2441AC_TRY_COMPILE([
2442#include <sys/types.h>
2443#include <utmp.h>
2444#ifdef HAVE_LASTLOG_H
2445# include <lastlog.h>
2446#endif
Damien Miller2994e082000-06-04 15:51:47 +10002447#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002448# include <paths.h>
2449#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002450#ifdef HAVE_LOGIN_H
2451# include <login.h>
2452#endif
andre2ff7b5d2000-06-03 14:57:40 +00002453 ],
2454 [ char *lastlog = LASTLOG_FILE; ],
2455 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002456 [
2457 AC_MSG_RESULT(no)
2458 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2459 AC_TRY_COMPILE([
2460#include <sys/types.h>
2461#include <utmp.h>
2462#ifdef HAVE_LASTLOG_H
2463# include <lastlog.h>
2464#endif
2465#ifdef HAVE_PATHS_H
2466# include <paths.h>
2467#endif
2468 ],
2469 [ char *lastlog = _PATH_LASTLOG; ],
2470 [ AC_MSG_RESULT(yes) ],
2471 [
andree441aa32000-06-12 22:34:38 +00002472 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002473 system_lastlog_path=no
2474 ])
2475 ]
andre2ff7b5d2000-06-03 14:57:40 +00002476)
Damien Miller2994e082000-06-04 15:51:47 +10002477
andre2ff7b5d2000-06-03 14:57:40 +00002478if test -z "$conf_lastlog_location"; then
2479 if test x"$system_lastlog_path" = x"no" ; then
2480 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002481 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002482 conf_lastlog_location=$f
2483 fi
2484 done
2485 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002486 AC_MSG_WARN([** Cannot find lastlog **])
2487 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002488 fi
2489 fi
2490fi
2491
2492if test -n "$conf_lastlog_location"; then
2493 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2494fi
2495
2496dnl utmp detection
2497AC_MSG_CHECKING([if your system defines UTMP_FILE])
2498AC_TRY_COMPILE([
2499#include <sys/types.h>
2500#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002501#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002502# include <paths.h>
2503#endif
2504 ],
2505 [ char *utmp = UTMP_FILE; ],
2506 [ AC_MSG_RESULT(yes) ],
2507 [ AC_MSG_RESULT(no)
2508 system_utmp_path=no ]
2509)
2510if test -z "$conf_utmp_location"; then
2511 if test x"$system_utmp_path" = x"no" ; then
2512 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2513 if test -f $f ; then
2514 conf_utmp_location=$f
2515 fi
2516 done
2517 if test -z "$conf_utmp_location"; then
2518 AC_DEFINE(DISABLE_UTMP)
2519 fi
2520 fi
2521fi
2522if test -n "$conf_utmp_location"; then
2523 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2524fi
2525
2526dnl wtmp detection
2527AC_MSG_CHECKING([if your system defines WTMP_FILE])
2528AC_TRY_COMPILE([
2529#include <sys/types.h>
2530#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002531#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002532# include <paths.h>
2533#endif
2534 ],
2535 [ char *wtmp = WTMP_FILE; ],
2536 [ AC_MSG_RESULT(yes) ],
2537 [ AC_MSG_RESULT(no)
2538 system_wtmp_path=no ]
2539)
2540if test -z "$conf_wtmp_location"; then
2541 if test x"$system_wtmp_path" = x"no" ; then
2542 for f in /usr/adm/wtmp /var/log/wtmp; do
2543 if test -f $f ; then
2544 conf_wtmp_location=$f
2545 fi
2546 done
2547 if test -z "$conf_wtmp_location"; then
2548 AC_DEFINE(DISABLE_WTMP)
2549 fi
2550 fi
2551fi
2552if test -n "$conf_wtmp_location"; then
2553 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2554fi
2555
2556
2557dnl utmpx detection - I don't know any system so perverse as to require
2558dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2559dnl there, though.
2560AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2561AC_TRY_COMPILE([
2562#include <sys/types.h>
2563#include <utmp.h>
2564#ifdef HAVE_UTMPX_H
2565#include <utmpx.h>
2566#endif
Damien Miller2994e082000-06-04 15:51:47 +10002567#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002568# include <paths.h>
2569#endif
2570 ],
2571 [ char *utmpx = UTMPX_FILE; ],
2572 [ AC_MSG_RESULT(yes) ],
2573 [ AC_MSG_RESULT(no)
2574 system_utmpx_path=no ]
2575)
2576if test -z "$conf_utmpx_location"; then
2577 if test x"$system_utmpx_path" = x"no" ; then
2578 AC_DEFINE(DISABLE_UTMPX)
2579 fi
2580else
2581 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2582fi
2583
2584dnl wtmpx detection
2585AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2586AC_TRY_COMPILE([
2587#include <sys/types.h>
2588#include <utmp.h>
2589#ifdef HAVE_UTMPX_H
2590#include <utmpx.h>
2591#endif
Damien Miller2994e082000-06-04 15:51:47 +10002592#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002593# include <paths.h>
2594#endif
2595 ],
2596 [ char *wtmpx = WTMPX_FILE; ],
2597 [ AC_MSG_RESULT(yes) ],
2598 [ AC_MSG_RESULT(no)
2599 system_wtmpx_path=no ]
2600)
2601if test -z "$conf_wtmpx_location"; then
2602 if test x"$system_wtmpx_path" = x"no" ; then
2603 AC_DEFINE(DISABLE_WTMPX)
2604 fi
2605else
2606 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2607fi
2608
Damien Miller4018c192000-04-30 09:30:44 +10002609
Damien Miller29ea30d2000-03-17 10:54:15 +11002610if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002611 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2612 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002613fi
2614
Tim Rice4cec93f2002-02-26 08:40:48 -08002615dnl remove pam and dl because they are in $LIBPAM
2616if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002617 LIBS=`echo $LIBS | sed 's/-lpam //'`
2618fi
2619if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2620 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002621fi
2622
Damien Millerbac2d8a2000-09-05 16:13:06 +11002623AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002624AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2625AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002626
Damien Miller7b22d652000-06-18 14:07:04 +10002627# Print summary of options
2628
Damien Miller7b22d652000-06-18 14:07:04 +10002629# Someone please show me a better way :)
2630A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2631B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2632C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2633D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002634E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002635F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002636G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002637H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2638I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2639J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002640
2641echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002642echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002643echo " User binaries: $B"
2644echo " System binaries: $C"
2645echo " Configuration files: $D"
2646echo " Askpass program: $E"
2647echo " Manual pages: $F"
2648echo " PID file: $G"
2649echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002650if test "x$external_path_file" = "x/etc/login.conf" ; then
2651echo " At runtime, sshd will use the path defined in $external_path_file"
2652echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002653else
Damien Millerf58c6722002-05-13 13:15:42 +10002654echo " sshd default user PATH: $I"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002655 if ! test -z "$external_path_file"; then
2656echo " (If PATH is set in $external_path_file it will be used instead. If"
2657echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2658 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002659fi
Damien Millera18bbd32002-05-13 10:48:57 +10002660if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002661echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002662fi
Damien Millerf58c6722002-05-13 13:15:42 +10002663echo " Manpage format: $MANTYPE"
Damien Miller9d2be482003-05-15 11:12:19 +10002664echo " DNS support: $DNS_MSG"
Damien Miller7abe09b2003-05-15 10:53:49 +10002665echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002666echo " KerberosV support: $KRB5_MSG"
2667echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002668echo " S/KEY support: $SKEY_MSG"
2669echo " TCP Wrappers support: $TCPW_MSG"
2670echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002671echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002672echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2673echo " BSD Auth support: $BSD_AUTH_MSG"
2674echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002675if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002676echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002677fi
2678
Damien Miller7b22d652000-06-18 14:07:04 +10002679echo ""
2680
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002681echo " Host: ${host}"
2682echo " Compiler: ${CC}"
2683echo " Compiler flags: ${CFLAGS}"
2684echo "Preprocessor flags: ${CPPFLAGS}"
2685echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002686echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002687
2688echo ""
2689
Damien Miller82cf0ce2000-12-20 13:34:48 +11002690if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002691 echo "PAM is enabled. You may need to install a PAM control file "
2692 echo "for sshd, otherwise password authentication may fail. "
2693 echo "Example PAM control files can be found in the contrib/ "
2694 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002695 echo ""
2696fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002697
Damien Miller6c21c512002-01-22 21:57:53 +11002698if test ! -z "$RAND_HELPER_CMDHASH" ; then
2699 echo "WARNING: you are using the builtin random number collection "
2700 echo "service. Please read WARNING.RNG and request that your OS "
2701 echo "vendor includes kernel-based random number collection in "
2702 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002703 echo ""
2704fi
Damien Miller60396b02001-02-18 17:01:00 +11002705