blob: 16cc1282cc688ad6328ea5793a604b92d6ca1108 [file] [log] [blame]
Darren Tucker9f7ffc52003-09-10 11:39:05 +10001# $Id: configure.ac,v 1.148 2003/09/10 01:39:05 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)
andre2ff7b5d2000-06-03 14:57:40 +0000253 # hardwire lastlog location (can't detect it on some versions)
254 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000255 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
256 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
257 if test "$sol2ver" -ge 8; then
258 AC_MSG_RESULT(yes)
259 AC_DEFINE(DISABLE_UTMP)
260 AC_DEFINE(DISABLE_WTMP)
261 else
262 AC_MSG_RESULT(no)
263 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100264 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000265*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000266 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000267 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100268 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000269 conf_utmp_location=/etc/utmp
270 conf_wtmp_location=/var/adm/wtmp
271 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000272 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000273 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000274*-ncr-sysv*)
275 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
276 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700277 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000278 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000279 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000280 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000281*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000282 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700283 # /usr/ucblib MUST NOT be searched on ReliantUNIX
284 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100285 IPADDR_IN_DISPLAY=yes
286 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000287 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000288 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700289 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
290 # Attention: always take care to bind libsocket and libnsl before libc,
291 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000292 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100293*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000294 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100295 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100296 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100297 ;;
298*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000299 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100300 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100301 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100302 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100303*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000304 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100305 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100306 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100307*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000308 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100309 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700310 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100311 RANLIB=true
312 no_dev_ptmx=1
313 AC_DEFINE(BROKEN_SYS_TERMIO_H)
314 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000315 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000316 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100317 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100318 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700319 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700320 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100321 ;;
322*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800323 if test -z "$GCC"; then
324 CFLAGS="$CFLAGS -belf"
325 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000326 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000327 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100328 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000329 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100330 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000331 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000332 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700333 AC_DEFINE(DISABLE_FD_PASSING)
Damien Miller217f5672001-02-16 12:12:41 +1100334 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700335 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000336 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000337*-*-unicosmk*)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000338 AC_DEFINE(USE_PIPES)
339 AC_DEFINE(DISABLE_FD_PASSING)
340 LDFLAGS="$LDFLAGS"
341 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
342 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000343 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000344*-*-unicosmp*)
345 AC_DEFINE(WITH_ABBREV_NO_TTY)
346 AC_DEFINE(USE_PIPES)
347 AC_DEFINE(DISABLE_FD_PASSING)
348 LDFLAGS="$LDFLAGS"
349 LIBS="$LIBS -lgen -lacid"
350 MANTYPE=cat
351 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000352*-*-unicos*)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000353 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700354 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700355 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000356 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
357 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
358 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700359 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000360*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000361 AC_MSG_CHECKING(for Digital Unix SIA)
362 no_osfsia=""
363 AC_ARG_WITH(osfsia,
364 [ --with-osfsia Enable Digital Unix SIA],
365 [
366 if test "x$withval" = "xno" ; then
367 AC_MSG_RESULT(disabled)
368 no_osfsia=1
369 fi
370 ],
371 )
372 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000373 if test -f /etc/sia/matrix.conf; then
374 AC_MSG_RESULT(yes)
375 AC_DEFINE(HAVE_OSF_SIA)
376 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000377 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000378 LIBS="$LIBS -lsecurity -ldb -lm -laud"
379 else
380 AC_MSG_RESULT(no)
381 fi
382 fi
Ben Lindstromdc3c7572002-10-04 23:54:54 +0000383 AC_DEFINE(DISABLE_FD_PASSING)
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000384 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tuckere41bba52003-08-25 11:51:19 +1000385 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000386 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000387
388*-*-nto-qnx)
389 AC_DEFINE(USE_PIPES)
390 AC_DEFINE(NO_X11_UNIX_SOCKETS)
391 AC_DEFINE(MISSING_NFDBITS)
392 AC_DEFINE(MISSING_HOWMANY)
393 AC_DEFINE(MISSING_FD_MASK)
394 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100395esac
396
Damien Millere37bfc12000-06-05 09:37:43 +1000397# Allow user to specify flags
398AC_ARG_WITH(cflags,
399 [ --with-cflags Specify additional flags to pass to compiler],
400 [
401 if test "x$withval" != "xno" ; then
402 CFLAGS="$CFLAGS $withval"
403 fi
404 ]
405)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000406AC_ARG_WITH(cppflags,
407 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
408 [
409 if test "x$withval" != "xno"; then
410 CPPFLAGS="$CPPFLAGS $withval"
411 fi
412 ]
413)
Damien Millere37bfc12000-06-05 09:37:43 +1000414AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000415 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000416 [
417 if test "x$withval" != "xno" ; then
418 LDFLAGS="$LDFLAGS $withval"
419 fi
420 ]
421)
422AC_ARG_WITH(libs,
423 [ --with-libs Specify additional libraries to link with],
424 [
425 if test "x$withval" != "xno" ; then
426 LIBS="$LIBS $withval"
427 fi
428 ]
429)
430
Darren Tucker6eb93042003-06-29 21:30:41 +1000431AC_MSG_CHECKING(compiler and flags for sanity)
432AC_TRY_RUN([
433#include <stdio.h>
434int main(){exit(0);}
435 ],
436 [ AC_MSG_RESULT(yes) ],
437 [
438 AC_MSG_RESULT(no)
439 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
440 ]
441)
442
Tim Rice4cec93f2002-02-26 08:40:48 -0800443# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000444AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Damien Millerb16f8742003-02-24 12:47:15 +1100445 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800446 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000447 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000448 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000449 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
450 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
Ben Lindstrom4b0f1ad2003-02-01 04:43:34 +0000451 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
Tim Rice81ed5182002-09-25 17:38:46 -0700452 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800453 util.h utime.h utmp.h utmpx.h)
454
Damien Millera22ba012000-03-02 23:09:20 +1100455# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700456AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
457AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000458
Damien Millerdf288022001-02-18 13:07:07 +1100459dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700460if test "x$with_tcp_wrappers" != "xno" ; then
461 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
462 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
463 fi
464fi
Damien Millerdf288022001-02-18 13:07:07 +1100465
Tim Rice13aae5e2001-10-21 17:53:58 -0700466AC_CHECK_FUNC(getspnam, ,
467 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700468
Damien Miller150c8b52002-02-13 23:06:56 +1100469AC_ARG_WITH(rpath,
470 [ --without-rpath Disable auto-added -R linker paths],
471 [
472 if test "x$withval" = "xno" ; then
473 need_dash_r=""
474 fi
475 if test "x$withval" = "xyes" ; then
476 need_dash_r=1
477 fi
478 ]
479)
480
Tim Rice13aae5e2001-10-21 17:53:58 -0700481dnl zlib is required
482AC_ARG_WITH(zlib,
483 [ --with-zlib=PATH Use zlib in PATH],
484 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000485 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100486 AC_MSG_ERROR([*** zlib is required ***])
487 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700488 if test -d "$withval/lib"; then
489 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700490 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700491 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700492 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700493 fi
494 else
495 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700496 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700497 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700498 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700499 fi
500 fi
501 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700502 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700503 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700504 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700505 fi
506 ]
507)
508
Tim Rice17b93e52001-10-23 22:36:54 -0700509AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100510
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000511dnl UnixWare 2.x
512AC_CHECK_FUNC(strcasecmp,
513 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
514)
515AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700516 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
517 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000518)
Damien Millerab18c411999-11-11 10:40:23 +1100519
Tim Ricee589a292001-11-03 11:09:32 -0800520dnl Checks for libutil functions
521AC_CHECK_HEADERS(libutil.h)
522AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
523AC_CHECK_FUNCS(logout updwtmp logwtmp)
524
Ben Lindstrom8697e082001-02-24 21:41:10 +0000525AC_FUNC_STRFTIME
526
Damien Miller3c027682001-03-14 11:39:45 +1100527# Check for ALTDIRFUNC glob() extension
528AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
529AC_EGREP_CPP(FOUNDIT,
530 [
531 #include <glob.h>
532 #ifdef GLOB_ALTDIRFUNC
533 FOUNDIT
534 #endif
535 ],
536 [
537 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
538 AC_MSG_RESULT(yes)
539 ],
540 [
541 AC_MSG_RESULT(no)
542 ]
543)
Damien Millerab18c411999-11-11 10:40:23 +1100544
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000545# Check for g.gl_matchc glob() extension
546AC_MSG_CHECKING(for gl_matchc field in glob_t)
547AC_EGREP_CPP(FOUNDIT,
548 [
549 #include <glob.h>
550 int main(void){glob_t g; g.gl_matchc = 1;}
551 ],
552 [
553 AC_DEFINE(GLOB_HAS_GL_MATCHC)
554 AC_MSG_RESULT(yes)
555 ],
556 [
557 AC_MSG_RESULT(no)
558 ]
559)
560
Damien Miller18bb4732001-03-28 14:35:30 +1000561AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
562AC_TRY_RUN(
563 [
564#include <sys/types.h>
565#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700566int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000567 ],
568 [AC_MSG_RESULT(yes)],
569 [
570 AC_MSG_RESULT(no)
571 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
572 ]
573)
574
Damien Millerc547bf12001-02-16 10:18:12 +1100575# Check whether user wants S/Key support
576SKEY_MSG="no"
577AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700578 [ --with-skey[[=PATH]] Enable S/Key support
579 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100580 [
581 if test "x$withval" != "xno" ; then
582
583 if test "x$withval" != "xyes" ; then
584 CPPFLAGS="$CPPFLAGS -I${withval}/include"
585 LDFLAGS="$LDFLAGS -L${withval}/lib"
586 fi
587
588 AC_DEFINE(SKEY)
589 LIBS="-lskey $LIBS"
590 SKEY_MSG="yes"
591
Tim Rice4cec93f2002-02-26 08:40:48 -0800592 AC_MSG_CHECKING([for s/key support])
593 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100594 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800595#include <stdio.h>
596#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700597int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800598 ],
599 [AC_MSG_RESULT(yes)],
600 [
601 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100602 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
603 ])
604 fi
605 ]
606)
607
608# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700609TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100610AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700611 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
612 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100613 [
614 if test "x$withval" != "xno" ; then
615 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700616 saved_LDFLAGS="$LDFLAGS"
617 saved_CPPFLAGS="$CPPFLAGS"
618 if test -n "${withval}" -a "${withval}" != "yes"; then
619 if test -d "${withval}/lib"; then
620 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700621 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700622 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700623 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700624 fi
625 else
626 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700627 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700628 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700629 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700630 fi
631 fi
632 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700633 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700634 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700635 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700636 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700637 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800638 LIBWRAP="-lwrap"
639 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100640 AC_MSG_CHECKING(for libwrap)
641 AC_TRY_LINK(
642 [
643#include <tcpd.h>
644 int deny_severity = 0, allow_severity = 0;
645 ],
646 [hosts_access(0);],
647 [
648 AC_MSG_RESULT(yes)
649 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800650 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700651 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100652 ],
653 [
654 AC_MSG_ERROR([*** libwrap missing])
655 ]
656 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800657 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100658 fi
659 ]
660)
661
Damien Millerfe1f1432003-02-24 15:45:42 +1100662dnl Checks for library functions. Please keep in alphabetical order
663AC_CHECK_FUNCS(\
Damien Miller5fe46a42003-06-05 09:53:31 +1000664 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
665 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Damien Millerfe1f1432003-02-24 15:45:42 +1100666 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000667 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100668 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000669 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
670 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
671 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Damien Miller5fe46a42003-06-05 09:53:31 +1000672 setproctitle setregid setresgid setresuid setreuid setrlimit \
673 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tuckerf38ea772003-08-13 20:48:07 +1000674 strlcat strlcpy strmode strnvis sysconf tcgetpgrp tcsendbreak \
675 truncate utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100676)
Tim Rice13aae5e2001-10-21 17:53:58 -0700677
Damien Millercd6853c2003-01-28 11:33:42 +1100678AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
Damien Millereab4bae2003-04-29 23:22:40 +1000679AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
Damien Millercd6853c2003-01-28 11:33:42 +1100680
Darren Tuckerf1159b52003-07-07 19:44:01 +1000681dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000682AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000683AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000684
Tim Rice13aae5e2001-10-21 17:53:58 -0700685dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700686AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700687 AC_CHECK_LIB(gen, dirname,[
688 AC_CACHE_CHECK([for broken dirname],
689 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700690 save_LIBS="$LIBS"
691 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700692 AC_TRY_RUN(
693 [
694#include <libgen.h>
695#include <string.h>
696
697int main(int argc, char **argv) {
698 char *s, buf[32];
699
700 strncpy(buf,"/etc", 32);
701 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700702 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700703 exit(1);
704 } else {
705 exit(0);
706 }
707}
708 ],
709 [ ac_cv_have_broken_dirname="no" ],
710 [ ac_cv_have_broken_dirname="yes" ]
711 )
Tim Rice17b93e52001-10-23 22:36:54 -0700712 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700713 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700714 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700715 LIBS="$LIBS -lgen"
716 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700717 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700718 fi
719 ])
720])
721
Damien Millerad833b32000-08-23 10:46:23 +1000722dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000723AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000724dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000725AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000726AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000727dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000728AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000729AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100730
Damien Miller04f80141999-11-19 15:32:34 +1100731AC_CHECK_FUNC(daemon,
732 [AC_DEFINE(HAVE_DAEMON)],
733 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
734)
735
Damien Miller9fb07e42000-03-05 16:22:59 +1100736AC_CHECK_FUNC(getpagesize,
737 [AC_DEFINE(HAVE_GETPAGESIZE)],
738 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
739)
740
Damien Millercb170cb2000-07-01 16:52:55 +1000741# Check for broken snprintf
742if test "x$ac_cv_func_snprintf" = "xyes" ; then
743 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
744 AC_TRY_RUN(
745 [
746#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700747int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000748 ],
749 [AC_MSG_RESULT(yes)],
750 [
751 AC_MSG_RESULT(no)
752 AC_DEFINE(BROKEN_SNPRINTF)
753 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
754 ]
755 )
756fi
757
Damien Millere8328192003-01-07 15:18:32 +1100758dnl see whether mkstemp() requires XXXXXX
759if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
760AC_MSG_CHECKING([for (overly) strict mkstemp])
761AC_TRY_RUN(
762 [
763#include <stdlib.h>
764main() { char template[]="conftest.mkstemp-test";
765if (mkstemp(template) == -1)
766 exit(1);
767unlink(template); exit(0);
768}
769 ],
770 [
771 AC_MSG_RESULT(no)
772 ],
773 [
774 AC_MSG_RESULT(yes)
775 AC_DEFINE(HAVE_STRICT_MKSTEMP)
776 ],
777 [
778 AC_MSG_RESULT(yes)
779 AC_DEFINE(HAVE_STRICT_MKSTEMP)
780 ]
781)
782fi
783
Darren Tucker70a3d552003-08-21 17:58:29 +1000784dnl make sure that openpty does not reacquire controlling terminal
785if test ! -z "$check_for_openpty_ctty_bug"; then
786 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
787 AC_TRY_RUN(
788 [
789#include <stdio.h>
790#include <sys/fcntl.h>
791#include <sys/types.h>
792#include <sys/wait.h>
793
794int
795main()
796{
797 pid_t pid;
798 int fd, ptyfd, ttyfd, status;
799
800 pid = fork();
801 if (pid < 0) { /* failed */
802 exit(1);
803 } else if (pid > 0) { /* parent */
804 waitpid(pid, &status, 0);
805 if (WIFEXITED(status))
806 exit(WEXITSTATUS(status));
807 else
808 exit(2);
809 } else { /* child */
810 close(0); close(1); close(2);
811 setsid();
812 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
813 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
814 if (fd >= 0)
815 exit(3); /* Acquired ctty: broken */
816 else
817 exit(0); /* Did not acquire ctty: OK */
818 }
819}
820 ],
821 [
822 AC_MSG_RESULT(yes)
823 ],
824 [
825 AC_MSG_RESULT(no)
826 AC_DEFINE(SSHD_ACQUIRES_CTTY)
827 ]
828 )
829fi
830
Damien Miller606f8802000-09-16 15:39:56 +1100831AC_FUNC_GETPGRP
832
Damien Millera64b57a2001-01-17 10:44:13 +1100833# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000834PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100835AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100836 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100837 [
Damien Millera64b57a2001-01-17 10:44:13 +1100838 if test "x$withval" != "xno" ; then
839 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
840 AC_MSG_ERROR([PAM headers not found])
841 fi
842
843 AC_CHECK_LIB(dl, dlopen, , )
844 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
845 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000846 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +1100847
848 disable_shadow=yes
849 PAM_MSG="yes"
850
851 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800852 if test $ac_cv_lib_dl_dlopen = yes; then
853 LIBPAM="-lpam -ldl"
854 else
855 LIBPAM="-lpam"
856 fi
857 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100858 fi
859 ]
860)
Damien Millera22ba012000-03-02 23:09:20 +1100861
Damien Millera64b57a2001-01-17 10:44:13 +1100862# Check for older PAM
863if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100864 # Check PAM strerror arguments (old PAM)
865 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
866 AC_TRY_COMPILE(
867 [
Damien Miller81171112000-04-23 11:14:01 +1000868#include <stdlib.h>
869#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100870 ],
871 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
872 [AC_MSG_RESULT(no)],
873 [
874 AC_DEFINE(HAVE_OLD_PAM)
875 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000876 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100877 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100878 )
Damien Millera22ba012000-03-02 23:09:20 +1100879fi
880
Damien Millerfc93d4b2002-09-04 23:26:29 +1000881# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
882# because the system crypt() is more featureful.
883if test "x$check_for_libcrypt_before" = "x1"; then
884 AC_CHECK_LIB(crypt, crypt)
885fi
886
Tim Riceaef73712002-05-11 13:17:42 -0700887# Search for OpenSSL
888saved_CPPFLAGS="$CPPFLAGS"
889saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100890AC_ARG_WITH(ssl-dir,
891 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
892 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000893 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700894 if test -d "$withval/lib"; then
895 if test -n "${need_dash_r}"; then
896 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
897 else
898 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
899 fi
900 else
901 if test -n "${need_dash_r}"; then
902 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
903 else
904 LDFLAGS="-L${withval} ${LDFLAGS}"
905 fi
906 fi
907 if test -d "$withval/include"; then
908 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
909 else
910 CPPFLAGS="-I${withval} ${CPPFLAGS}"
911 fi
Damien Millera22ba012000-03-02 23:09:20 +1100912 fi
913 ]
914)
Tim Riceaef73712002-05-11 13:17:42 -0700915LIBS="$LIBS -lcrypto"
916AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000917 [
Tim Riceaef73712002-05-11 13:17:42 -0700918 dnl Check default openssl install dir
919 if test -n "${need_dash_r}"; then
920 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000921 else
Tim Riceaef73712002-05-11 13:17:42 -0700922 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000923 fi
Tim Riceaef73712002-05-11 13:17:42 -0700924 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
925 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
926 [
927 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
928 ]
929 )
930 ]
931)
932
Tim Riced730b782002-08-13 18:52:10 -0700933# Determine OpenSSL header version
934AC_MSG_CHECKING([OpenSSL header version])
935AC_TRY_RUN(
936 [
937#include <stdio.h>
938#include <string.h>
939#include <openssl/opensslv.h>
940#define DATA "conftest.sslincver"
941int main(void) {
942 FILE *fd;
943 int rc;
944
945 fd = fopen(DATA,"w");
946 if(fd == NULL)
947 exit(1);
948
949 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
950 exit(1);
951
952 exit(0);
953}
954 ],
955 [
956 ssl_header_ver=`cat conftest.sslincver`
957 AC_MSG_RESULT($ssl_header_ver)
958 ],
959 [
960 AC_MSG_RESULT(not found)
961 AC_MSG_ERROR(OpenSSL version header not found.)
962 ]
963)
964
965# Determine OpenSSL library version
966AC_MSG_CHECKING([OpenSSL library version])
967AC_TRY_RUN(
968 [
969#include <stdio.h>
970#include <string.h>
971#include <openssl/opensslv.h>
972#include <openssl/crypto.h>
973#define DATA "conftest.ssllibver"
974int main(void) {
975 FILE *fd;
976 int rc;
977
978 fd = fopen(DATA,"w");
979 if(fd == NULL)
980 exit(1);
981
982 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
983 exit(1);
984
985 exit(0);
986}
987 ],
988 [
989 ssl_library_ver=`cat conftest.ssllibver`
990 AC_MSG_RESULT($ssl_library_ver)
991 ],
992 [
993 AC_MSG_RESULT(not found)
994 AC_MSG_ERROR(OpenSSL library not found.)
995 ]
996)
Damien Millera22ba012000-03-02 23:09:20 +1100997
Damien Millerec932372002-01-22 22:16:03 +1100998# Sanity check OpenSSL headers
999AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1000AC_TRY_RUN(
1001 [
1002#include <string.h>
1003#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001004int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001005 ],
1006 [
1007 AC_MSG_RESULT(yes)
1008 ],
1009 [
1010 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001011 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1012Check config.log for details.
1013Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001014 ]
1015)
1016
Damien Millera64b57a2001-01-17 10:44:13 +11001017# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1018# version in OpenSSL. Skip this for PAM
Damien Miller4f9f42a2003-05-10 19:28:02 +10001019if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001020 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001021fi
1022
Damien Miller6c21c512002-01-22 21:57:53 +11001023
1024### Configure cryptographic random number support
1025
1026# Check wheter OpenSSL seeds itself
1027AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1028AC_TRY_RUN(
1029 [
1030#include <string.h>
1031#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001032int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001033 ],
1034 [
1035 OPENSSL_SEEDS_ITSELF=yes
1036 AC_MSG_RESULT(yes)
1037 ],
1038 [
1039 AC_MSG_RESULT(no)
1040 # Default to use of the rand helper if OpenSSL doesn't
1041 # seed itself
1042 USE_RAND_HELPER=yes
1043 ]
1044)
1045
1046
1047# Do we want to force the use of the rand helper?
1048AC_ARG_WITH(rand-helper,
1049 [ --with-rand-helper Use subprocess to gather strong randomness ],
1050 [
1051 if test "x$withval" = "xno" ; then
1052 # Force use of OpenSSL's internal RNG, even if
1053 # the previous test showed it to be unseeded.
1054 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1055 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1056 OPENSSL_SEEDS_ITSELF=yes
1057 USE_RAND_HELPER=""
1058 fi
1059 else
1060 USE_RAND_HELPER=yes
1061 fi
1062 ],
1063)
1064
1065# Which randomness source do we use?
1066if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1067 # OpenSSL only
1068 AC_DEFINE(OPENSSL_PRNG_ONLY)
1069 RAND_MSG="OpenSSL internal ONLY"
1070 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001071elif test ! -z "$USE_RAND_HELPER" ; then
1072 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001073 RAND_MSG="ssh-rand-helper"
1074 INSTALL_SSH_RAND_HELPER="yes"
1075fi
1076AC_SUBST(INSTALL_SSH_RAND_HELPER)
1077
1078### Configuration of ssh-rand-helper
1079
1080# PRNGD TCP socket
1081AC_ARG_WITH(prngd-port,
1082 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1083 [
Damien Millere996d722002-01-23 11:20:59 +11001084 case "$withval" in
1085 no)
1086 withval=""
1087 ;;
1088 [[0-9]]*)
1089 ;;
1090 *)
1091 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1092 ;;
1093 esac
1094 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001095 PRNGD_PORT="$withval"
1096 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1097 fi
1098 ]
1099)
1100
1101# PRNGD Unix domain socket
1102AC_ARG_WITH(prngd-socket,
1103 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1104 [
Damien Millere996d722002-01-23 11:20:59 +11001105 case "$withval" in
1106 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001107 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001108 ;;
1109 no)
1110 withval=""
1111 ;;
1112 /*)
1113 ;;
1114 *)
1115 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1116 ;;
1117 esac
1118
1119 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001120 if test ! -z "$PRNGD_PORT" ; then
1121 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1122 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001123 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001124 AC_MSG_WARN(Entropy socket is not readable)
1125 fi
1126 PRNGD_SOCKET="$withval"
1127 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1128 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001129 ],
1130 [
1131 # Check for existing socket only if we don't have a random device already
1132 if test "$USE_RAND_HELPER" = yes ; then
1133 AC_MSG_CHECKING(for PRNGD/EGD socket)
1134 # Insert other locations here
1135 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1136 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1137 PRNGD_SOCKET="$sock"
1138 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1139 break;
1140 fi
1141 done
1142 if test ! -z "$PRNGD_SOCKET" ; then
1143 AC_MSG_RESULT($PRNGD_SOCKET)
1144 else
1145 AC_MSG_RESULT(not found)
1146 fi
1147 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001148 ]
1149)
1150
1151# Change default command timeout for hashing entropy source
1152entropy_timeout=200
1153AC_ARG_WITH(entropy-timeout,
1154 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1155 [
1156 if test "x$withval" != "xno" ; then
1157 entropy_timeout=$withval
1158 fi
1159 ]
1160)
Damien Miller6c21c512002-01-22 21:57:53 +11001161AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1162
Damien Millerd3f6ad22002-06-25 10:24:47 +10001163SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001164AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001165 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001166 [
1167 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001168 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001169 fi
1170 ]
1171)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001172AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1173AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001174
Tim Rice88f2ab52002-03-17 12:17:34 -08001175# We do this little dance with the search path to insure
1176# that programs that we select for use by installed programs
1177# (which may be run by the super-user) come from trusted
1178# locations before they come from the user's private area.
1179# This should help avoid accidentally configuring some
1180# random version of a program in someone's personal bin.
1181
1182OPATH=$PATH
1183PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001184test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001185test -d /sbin && PATH=$PATH:/sbin
1186test -d /usr/sbin && PATH=$PATH:/usr/sbin
1187PATH=$PATH:/etc:$OPATH
1188
Damien Miller6c21c512002-01-22 21:57:53 +11001189# These programs are used by the command hashing source to gather entropy
1190OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1191OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1192OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1193OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1194OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1195OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1196OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1197OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1198OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1199OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1200OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1201OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1202OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1203OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1204OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1205OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001206# restore PATH
1207PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001208
1209# Where does ssh-rand-helper get its randomness from?
1210INSTALL_SSH_PRNG_CMDS=""
1211if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1212 if test ! -z "$PRNGD_PORT" ; then
1213 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1214 elif test ! -z "$PRNGD_SOCKET" ; then
1215 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1216 else
1217 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1218 RAND_HELPER_CMDHASH=yes
1219 INSTALL_SSH_PRNG_CMDS="yes"
1220 fi
1221fi
1222AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1223
1224
Ben Lindstromb5628642000-10-18 00:02:25 +00001225# Cheap hack to ensure NEWS-OS libraries are arranged right.
1226if test ! -z "$SONY" ; then
1227 LIBS="$LIBS -liberty";
1228fi
1229
Damien Millera22ba012000-03-02 23:09:20 +11001230# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001231AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001232AC_CHECK_SIZEOF(short int, 2)
1233AC_CHECK_SIZEOF(int, 4)
1234AC_CHECK_SIZEOF(long int, 4)
1235AC_CHECK_SIZEOF(long long int, 8)
1236
Damien Millerfa2bb692002-04-23 23:22:25 +10001237# Sanity check long long for some platforms (AIX)
1238if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1239 ac_cv_sizeof_long_long_int=0
1240fi
1241
Damien Millera22ba012000-03-02 23:09:20 +11001242# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001243AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1244 AC_TRY_COMPILE(
1245 [ #include <sys/types.h> ],
1246 [ u_int a; a = 1;],
1247 [ ac_cv_have_u_int="yes" ],
1248 [ ac_cv_have_u_int="no" ]
1249 )
1250])
1251if test "x$ac_cv_have_u_int" = "xyes" ; then
1252 AC_DEFINE(HAVE_U_INT)
1253 have_u_int=1
1254fi
1255
Damien Miller61e50f12000-05-08 20:49:37 +10001256AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1257 AC_TRY_COMPILE(
1258 [ #include <sys/types.h> ],
1259 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1260 [ ac_cv_have_intxx_t="yes" ],
1261 [ ac_cv_have_intxx_t="no" ]
1262 )
1263])
1264if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1265 AC_DEFINE(HAVE_INTXX_T)
1266 have_intxx_t=1
1267fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001268
1269if (test -z "$have_intxx_t" && \
1270 test "x$ac_cv_header_stdint_h" = "xyes")
1271then
1272 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1273 AC_TRY_COMPILE(
1274 [ #include <stdint.h> ],
1275 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1276 [
1277 AC_DEFINE(HAVE_INTXX_T)
1278 AC_MSG_RESULT(yes)
1279 ],
1280 [ AC_MSG_RESULT(no) ]
1281 )
1282fi
1283
Damien Miller578783e2000-09-23 14:12:24 +11001284AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1285 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001286 [
1287#include <sys/types.h>
1288#ifdef HAVE_STDINT_H
1289# include <stdint.h>
1290#endif
1291#include <sys/socket.h>
1292#ifdef HAVE_SYS_BITYPES_H
1293# include <sys/bitypes.h>
1294#endif
1295 ],
Damien Miller578783e2000-09-23 14:12:24 +11001296 [ int64_t a; a = 1;],
1297 [ ac_cv_have_int64_t="yes" ],
1298 [ ac_cv_have_int64_t="no" ]
1299 )
1300])
1301if test "x$ac_cv_have_int64_t" = "xyes" ; then
1302 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001303fi
1304
Damien Miller61e50f12000-05-08 20:49:37 +10001305AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1306 AC_TRY_COMPILE(
1307 [ #include <sys/types.h> ],
1308 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1309 [ ac_cv_have_u_intxx_t="yes" ],
1310 [ ac_cv_have_u_intxx_t="no" ]
1311 )
1312])
1313if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1314 AC_DEFINE(HAVE_U_INTXX_T)
1315 have_u_intxx_t=1
1316fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001317
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001318if test -z "$have_u_intxx_t" ; then
1319 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1320 AC_TRY_COMPILE(
1321 [ #include <sys/socket.h> ],
1322 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1323 [
1324 AC_DEFINE(HAVE_U_INTXX_T)
1325 AC_MSG_RESULT(yes)
1326 ],
1327 [ AC_MSG_RESULT(no) ]
1328 )
1329fi
1330
Damien Miller578783e2000-09-23 14:12:24 +11001331AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1332 AC_TRY_COMPILE(
1333 [ #include <sys/types.h> ],
1334 [ u_int64_t a; a = 1;],
1335 [ ac_cv_have_u_int64_t="yes" ],
1336 [ ac_cv_have_u_int64_t="no" ]
1337 )
1338])
1339if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1340 AC_DEFINE(HAVE_U_INT64_T)
1341 have_u_int64_t=1
1342fi
1343
Tim Rice4cec93f2002-02-26 08:40:48 -08001344if test -z "$have_u_int64_t" ; then
1345 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1346 AC_TRY_COMPILE(
1347 [ #include <sys/bitypes.h> ],
1348 [ u_int64_t a; a = 1],
1349 [
1350 AC_DEFINE(HAVE_U_INT64_T)
1351 AC_MSG_RESULT(yes)
1352 ],
1353 [ AC_MSG_RESULT(no) ]
1354 )
1355fi
1356
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001357if test -z "$have_u_intxx_t" ; then
1358 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1359 AC_TRY_COMPILE(
1360 [
1361#include <sys/types.h>
1362 ],
1363 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1364 [ ac_cv_have_uintxx_t="yes" ],
1365 [ ac_cv_have_uintxx_t="no" ]
1366 )
1367 ])
1368 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1369 AC_DEFINE(HAVE_UINTXX_T)
1370 fi
1371fi
1372
1373if test -z "$have_uintxx_t" ; then
1374 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1375 AC_TRY_COMPILE(
1376 [ #include <stdint.h> ],
1377 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1378 [
1379 AC_DEFINE(HAVE_UINTXX_T)
1380 AC_MSG_RESULT(yes)
1381 ],
1382 [ AC_MSG_RESULT(no) ]
1383 )
1384fi
1385
Damien Milleredb82922000-06-20 13:25:52 +10001386if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1387 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001388then
1389 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1390 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001391 [
1392#include <sys/bitypes.h>
1393 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001394 [
Damien Miller70494d12000-04-03 15:57:06 +10001395 int8_t a; int16_t b; int32_t c;
1396 u_int8_t e; u_int16_t f; u_int32_t g;
1397 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001398 ],
1399 [
1400 AC_DEFINE(HAVE_U_INTXX_T)
1401 AC_DEFINE(HAVE_INTXX_T)
1402 AC_MSG_RESULT(yes)
1403 ],
1404 [AC_MSG_RESULT(no)]
1405 )
1406fi
1407
Damien Miller58be7382001-09-15 21:31:54 +10001408
1409AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1410 AC_TRY_COMPILE(
1411 [
1412#include <sys/types.h>
1413 ],
1414 [ u_char foo; foo = 125; ],
1415 [ ac_cv_have_u_char="yes" ],
1416 [ ac_cv_have_u_char="no" ]
1417 )
1418])
1419if test "x$ac_cv_have_u_char" = "xyes" ; then
1420 AC_DEFINE(HAVE_U_CHAR)
1421fi
1422
Tim Rice13aae5e2001-10-21 17:53:58 -07001423TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001424
Tim Rice200a5c02002-02-26 22:12:34 -08001425AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001426
Damien Miller61e50f12000-05-08 20:49:37 +10001427AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1428 AC_TRY_COMPILE(
1429 [
1430#include <sys/types.h>
1431 ],
1432 [ size_t foo; foo = 1235; ],
1433 [ ac_cv_have_size_t="yes" ],
1434 [ ac_cv_have_size_t="no" ]
1435 )
1436])
1437if test "x$ac_cv_have_size_t" = "xyes" ; then
1438 AC_DEFINE(HAVE_SIZE_T)
1439fi
Damien Miller95058511999-12-29 10:36:45 +11001440
Damien Miller615f9392000-05-17 22:53:33 +10001441AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1442 AC_TRY_COMPILE(
1443 [
1444#include <sys/types.h>
1445 ],
1446 [ ssize_t foo; foo = 1235; ],
1447 [ ac_cv_have_ssize_t="yes" ],
1448 [ ac_cv_have_ssize_t="no" ]
1449 )
1450])
1451if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1452 AC_DEFINE(HAVE_SSIZE_T)
1453fi
1454
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001455AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1456 AC_TRY_COMPILE(
1457 [
1458#include <time.h>
1459 ],
1460 [ clock_t foo; foo = 1235; ],
1461 [ ac_cv_have_clock_t="yes" ],
1462 [ ac_cv_have_clock_t="no" ]
1463 )
1464])
1465if test "x$ac_cv_have_clock_t" = "xyes" ; then
1466 AC_DEFINE(HAVE_CLOCK_T)
1467fi
1468
Damien Millerb54b40e2000-06-23 08:23:34 +10001469AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1470 AC_TRY_COMPILE(
1471 [
1472#include <sys/types.h>
1473#include <sys/socket.h>
1474 ],
1475 [ sa_family_t foo; foo = 1235; ],
1476 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001477 [ AC_TRY_COMPILE(
1478 [
1479#include <sys/types.h>
1480#include <sys/socket.h>
1481#include <netinet/in.h>
1482 ],
1483 [ sa_family_t foo; foo = 1235; ],
1484 [ ac_cv_have_sa_family_t="yes" ],
1485
Damien Millerb54b40e2000-06-23 08:23:34 +10001486 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001487 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001488 )
1489])
1490if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1491 AC_DEFINE(HAVE_SA_FAMILY_T)
1492fi
1493
Damien Miller0f91b4e2000-06-18 15:43:25 +10001494AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1495 AC_TRY_COMPILE(
1496 [
1497#include <sys/types.h>
1498 ],
1499 [ pid_t foo; foo = 1235; ],
1500 [ ac_cv_have_pid_t="yes" ],
1501 [ ac_cv_have_pid_t="no" ]
1502 )
1503])
1504if test "x$ac_cv_have_pid_t" = "xyes" ; then
1505 AC_DEFINE(HAVE_PID_T)
1506fi
1507
1508AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1509 AC_TRY_COMPILE(
1510 [
1511#include <sys/types.h>
1512 ],
1513 [ mode_t foo; foo = 1235; ],
1514 [ ac_cv_have_mode_t="yes" ],
1515 [ ac_cv_have_mode_t="no" ]
1516 )
1517])
1518if test "x$ac_cv_have_mode_t" = "xyes" ; then
1519 AC_DEFINE(HAVE_MODE_T)
1520fi
1521
Damien Miller61e50f12000-05-08 20:49:37 +10001522
1523AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1524 AC_TRY_COMPILE(
1525 [
Damien Miller81171112000-04-23 11:14:01 +10001526#include <sys/types.h>
1527#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001528 ],
1529 [ struct sockaddr_storage s; ],
1530 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1531 [ ac_cv_have_struct_sockaddr_storage="no" ]
1532 )
1533])
1534if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1535 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1536fi
Damien Miller34132e52000-01-14 15:45:46 +11001537
Damien Miller61e50f12000-05-08 20:49:37 +10001538AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1539 AC_TRY_COMPILE(
1540 [
Damien Miller7b22d652000-06-18 14:07:04 +10001541#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001542#include <netinet/in.h>
1543 ],
1544 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1545 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1546 [ ac_cv_have_struct_sockaddr_in6="no" ]
1547 )
1548])
1549if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1550 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1551fi
Damien Miller34132e52000-01-14 15:45:46 +11001552
Damien Miller61e50f12000-05-08 20:49:37 +10001553AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1554 AC_TRY_COMPILE(
1555 [
Damien Miller7b22d652000-06-18 14:07:04 +10001556#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001557#include <netinet/in.h>
1558 ],
1559 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1560 [ ac_cv_have_struct_in6_addr="yes" ],
1561 [ ac_cv_have_struct_in6_addr="no" ]
1562 )
1563])
1564if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1565 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1566fi
Damien Miller34132e52000-01-14 15:45:46 +11001567
Damien Miller61e50f12000-05-08 20:49:37 +10001568AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1569 AC_TRY_COMPILE(
1570 [
Damien Miller81171112000-04-23 11:14:01 +10001571#include <sys/types.h>
1572#include <sys/socket.h>
1573#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001574 ],
1575 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1576 [ ac_cv_have_struct_addrinfo="yes" ],
1577 [ ac_cv_have_struct_addrinfo="no" ]
1578 )
1579])
1580if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1581 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1582fi
1583
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001584AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1585 AC_TRY_COMPILE(
1586 [ #include <sys/time.h> ],
1587 [ struct timeval tv; tv.tv_sec = 1;],
1588 [ ac_cv_have_struct_timeval="yes" ],
1589 [ ac_cv_have_struct_timeval="no" ]
1590 )
1591])
1592if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1593 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1594 have_struct_timeval=1
1595fi
1596
Tim Rice4e4dc562003-03-18 10:21:40 -08001597AC_CHECK_TYPES(struct timespec)
1598
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001599# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001600if test "x$ac_cv_have_int64_t" = "xno" -a \
1601 "x$ac_cv_sizeof_long_int" != "x8" -a \
1602 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001603 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1604 echo "an alternative compiler (I.E., GCC) before continuing."
1605 echo ""
1606 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001607else
1608dnl test snprintf (broken on SCO w/gcc)
1609 AC_TRY_RUN(
1610 [
1611#include <stdio.h>
1612#include <string.h>
1613#ifdef HAVE_SNPRINTF
1614main()
1615{
1616 char buf[50];
1617 char expected_out[50];
1618 int mazsize = 50 ;
1619#if (SIZEOF_LONG_INT == 8)
1620 long int num = 0x7fffffffffffffff;
1621#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001622 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001623#endif
1624 strcpy(expected_out, "9223372036854775807");
1625 snprintf(buf, mazsize, "%lld", num);
1626 if(strcmp(buf, expected_out) != 0)
1627 exit(1);
1628 exit(0);
1629}
1630#else
1631main() { exit(0); }
1632#endif
1633 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1634 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001635fi
1636
Damien Miller78315eb2000-09-29 23:01:36 +11001637dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001638OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1639OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1640OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1641OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1642OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001643OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001644OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1645OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001646OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001647OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1648OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1649OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1650OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001651OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1652OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1653OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1654OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001655
1656AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001657
Damien Miller61e50f12000-05-08 20:49:37 +10001658AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1659 ac_cv_have_ss_family_in_struct_ss, [
1660 AC_TRY_COMPILE(
1661 [
Damien Miller81171112000-04-23 11:14:01 +10001662#include <sys/types.h>
1663#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001664 ],
1665 [ struct sockaddr_storage s; s.ss_family = 1; ],
1666 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1667 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1668 )
1669])
1670if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1671 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1672fi
1673
Damien Miller61e50f12000-05-08 20:49:37 +10001674AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1675 ac_cv_have___ss_family_in_struct_ss, [
1676 AC_TRY_COMPILE(
1677 [
Damien Miller81171112000-04-23 11:14:01 +10001678#include <sys/types.h>
1679#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001680 ],
1681 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1682 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1683 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1684 )
1685])
1686if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1687 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1688fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001689
Damien Millerad833b32000-08-23 10:46:23 +10001690AC_CACHE_CHECK([for pw_class field in struct passwd],
1691 ac_cv_have_pw_class_in_struct_passwd, [
1692 AC_TRY_COMPILE(
1693 [
Damien Millerad833b32000-08-23 10:46:23 +10001694#include <pwd.h>
1695 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001696 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001697 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1698 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1699 )
1700])
1701if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1702 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1703fi
1704
Kevin Steves82456952001-06-22 21:14:18 +00001705AC_CACHE_CHECK([for pw_expire field in struct passwd],
1706 ac_cv_have_pw_expire_in_struct_passwd, [
1707 AC_TRY_COMPILE(
1708 [
1709#include <pwd.h>
1710 ],
1711 [ struct passwd p; p.pw_expire = 0; ],
1712 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1713 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1714 )
1715])
1716if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1717 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1718fi
1719
1720AC_CACHE_CHECK([for pw_change field in struct passwd],
1721 ac_cv_have_pw_change_in_struct_passwd, [
1722 AC_TRY_COMPILE(
1723 [
1724#include <pwd.h>
1725 ],
1726 [ struct passwd p; p.pw_change = 0; ],
1727 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1728 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1729 )
1730])
1731if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1732 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1733fi
Damien Miller61e50f12000-05-08 20:49:37 +10001734
Tim Rice28bbb0c2002-05-27 17:37:32 -07001735dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001736AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1737 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001738 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001739 [
Tim Riceae49fe62002-04-12 10:26:21 -07001740#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001741#include <sys/socket.h>
1742#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001743int main() {
1744#ifdef msg_accrights
1745exit(1);
1746#endif
1747struct msghdr m;
1748m.msg_accrights = 0;
1749exit(0);
1750}
Kevin Steves939c9db2002-03-22 17:23:25 +00001751 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001752 [ ac_cv_have_accrights_in_msghdr="yes" ],
1753 [ ac_cv_have_accrights_in_msghdr="no" ]
1754 )
1755])
1756if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1757 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1758fi
1759
Kevin Stevesa44e0352002-04-07 16:18:03 +00001760AC_CACHE_CHECK([for msg_control field in struct msghdr],
1761 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001762 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001763 [
Tim Riceae49fe62002-04-12 10:26:21 -07001764#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001765#include <sys/socket.h>
1766#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001767int main() {
1768#ifdef msg_control
1769exit(1);
1770#endif
1771struct msghdr m;
1772m.msg_control = 0;
1773exit(0);
1774}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001775 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001776 [ ac_cv_have_control_in_msghdr="yes" ],
1777 [ ac_cv_have_control_in_msghdr="no" ]
1778 )
1779])
1780if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1781 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1782fi
1783
Damien Miller61e50f12000-05-08 20:49:37 +10001784AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1785 AC_TRY_LINK([],
1786 [ extern char *__progname; printf("%s", __progname); ],
1787 [ ac_cv_libc_defines___progname="yes" ],
1788 [ ac_cv_libc_defines___progname="no" ]
1789 )
1790])
1791if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1792 AC_DEFINE(HAVE___PROGNAME)
1793fi
1794
Kevin Steves4846f4a2002-03-22 18:19:53 +00001795AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1796 AC_TRY_LINK([
1797#include <stdio.h>
1798],
1799 [ printf("%s", __FUNCTION__); ],
1800 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1801 [ ac_cv_cc_implements___FUNCTION__="no" ]
1802 )
1803])
1804if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1805 AC_DEFINE(HAVE___FUNCTION__)
1806fi
1807
1808AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1809 AC_TRY_LINK([
1810#include <stdio.h>
1811],
1812 [ printf("%s", __func__); ],
1813 [ ac_cv_cc_implements___func__="yes" ],
1814 [ ac_cv_cc_implements___func__="no" ]
1815 )
1816])
1817if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1818 AC_DEFINE(HAVE___func__)
1819fi
1820
Damien Miller4f8e6692001-07-14 13:22:53 +10001821AC_CACHE_CHECK([whether getopt has optreset support],
1822 ac_cv_have_getopt_optreset, [
1823 AC_TRY_LINK(
1824 [
1825#include <getopt.h>
1826 ],
1827 [ extern int optreset; optreset = 0; ],
1828 [ ac_cv_have_getopt_optreset="yes" ],
1829 [ ac_cv_have_getopt_optreset="no" ]
1830 )
1831])
1832if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1833 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1834fi
Damien Millera22ba012000-03-02 23:09:20 +11001835
Damien Millerecbb26d2000-07-15 14:59:14 +10001836AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1837 AC_TRY_LINK([],
1838 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1839 [ ac_cv_libc_defines_sys_errlist="yes" ],
1840 [ ac_cv_libc_defines_sys_errlist="no" ]
1841 )
1842])
1843if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1844 AC_DEFINE(HAVE_SYS_ERRLIST)
1845fi
1846
1847
Damien Miller11fa2cc2000-08-16 10:35:58 +10001848AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1849 AC_TRY_LINK([],
1850 [ extern int sys_nerr; printf("%i", sys_nerr);],
1851 [ ac_cv_libc_defines_sys_nerr="yes" ],
1852 [ ac_cv_libc_defines_sys_nerr="no" ]
1853 )
1854])
1855if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1856 AC_DEFINE(HAVE_SYS_NERR)
1857fi
1858
Damien Miller85de5802001-09-18 14:01:11 +10001859SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001860# Check whether user wants sectok support
1861AC_ARG_WITH(sectok,
1862 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001863 [
1864 if test "x$withval" != "xno" ; then
1865 if test "x$withval" != "xyes" ; then
1866 CPPFLAGS="$CPPFLAGS -I${withval}"
1867 LDFLAGS="$LDFLAGS -L${withval}"
1868 if test ! -z "$need_dash_r" ; then
1869 LDFLAGS="$LDFLAGS -R${withval}"
1870 fi
1871 if test ! -z "$blibpath" ; then
1872 blibpath="$blibpath:${withval}"
1873 fi
1874 fi
1875 AC_CHECK_HEADERS(sectok.h)
1876 if test "$ac_cv_header_sectok_h" != yes; then
1877 AC_MSG_ERROR(Can't find sectok.h)
1878 fi
1879 AC_CHECK_LIB(sectok, sectok_open)
1880 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1881 AC_MSG_ERROR(Can't find libsectok)
1882 fi
1883 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001884 AC_DEFINE(USE_SECTOK)
1885 SCARD_MSG="yes, using sectok"
1886 fi
1887 ]
1888)
1889
1890# Check whether user wants OpenSC support
1891AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001892 AC_HELP_STRING([--with-opensc=PFX],
1893 [Enable smartcard support using OpenSC]),
1894 opensc_config_prefix="$withval", opensc_config_prefix="")
1895if test x$opensc_config_prefix != x ; then
1896 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1897 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1898 if test "$OPENSC_CONFIG" != "no"; then
1899 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1900 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1901 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1902 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1903 AC_DEFINE(SMARTCARD)
1904 AC_DEFINE(USE_OPENSC)
1905 SCARD_MSG="yes, using OpenSC"
1906 fi
1907fi
Damien Miller85de5802001-09-18 14:01:11 +10001908
Damien Miller7abe09b2003-05-15 10:53:49 +10001909# Check whether user wants DNS support
1910DNS_MSG="no"
1911AC_ARG_WITH(dns,
1912 [ --with-dns Support for fetching keys from DNS (experimental)],
1913 [
1914 if test "x$withval" != "xno" ; then
Damien Millerd9ec3702003-05-15 12:27:08 +10001915 DNS_MSG="yes"
1916 AC_DEFINE(DNS)
1917 AC_SEARCH_LIBS(getrrsetbyname, resolv,
Damien Miller200d0a72003-06-30 19:21:36 +10001918 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1919 [
1920 # Needed by our getrrsetbyname()
1921 AC_SEARCH_LIBS(res_query, resolv)
1922 AC_SEARCH_LIBS(dn_expand, resolv)
Tim Rice0ac16a42003-09-08 06:33:33 -07001923 AC_CHECK_FUNCS(_getshort _getlong)
Tim Riceb284e162003-09-08 14:35:16 -07001924 AC_CHECK_MEMBER(HEADER.ad,
1925 [AC_DEFINE(HAVE_HEADER_AD)],,
1926 [#include <arpa/nameser.h>])
Damien Miller200d0a72003-06-30 19:21:36 +10001927 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10001928 fi
1929 ]
1930)
1931
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001932# Check whether user wants Kerberos 5 support
1933KRB5_MSG="no"
1934AC_ARG_WITH(kerberos5,
1935 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1936 [
1937 if test "x$withval" != "xno" ; then
1938 if test "x$withval" = "xyes" ; then
1939 KRB5ROOT="/usr/local"
1940 else
1941 KRB5ROOT=${withval}
1942 fi
1943 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1944 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1945 AC_DEFINE(KRB5)
1946 KRB5_MSG="yes"
1947 AC_MSG_CHECKING(whether we are using Heimdal)
1948 AC_TRY_COMPILE([ #include <krb5.h> ],
1949 [ char *tmp = heimdal_version; ],
1950 [ AC_MSG_RESULT(yes)
1951 AC_DEFINE(HEIMDAL)
1952 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1953 ],
1954 [ AC_MSG_RESULT(no)
1955 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1956 ]
1957 )
1958 if test ! -z "$need_dash_r" ; then
1959 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1960 fi
1961 if test ! -z "$blibpath" ; then
1962 blibpath="$blibpath:${KRB5ROOT}/lib"
1963 fi
Damien Miller200d0a72003-06-30 19:21:36 +10001964 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001965
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001966 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1967 [ AC_DEFINE(GSSAPI)
1968 K5LIBS="-lgssapi $K5LIBS" ],
1969 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1970 [ AC_DEFINE(GSSAPI)
1971 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
1972 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
1973 $K5LIBS)
1974 ],
1975 $K5LIBS)
1976
1977 AC_CHECK_HEADER(gssapi.h, ,
1978 [ unset ac_cv_header_gssapi_h
1979 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1980 AC_CHECK_HEADERS(gssapi.h, ,
1981 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
1982 )
1983 ]
1984 )
1985
1986 oldCPP="$CPPFLAGS"
1987 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1988 AC_CHECK_HEADER(gssapi_krb5.h, ,
1989 [ CPPFLAGS="$oldCPP" ])
1990
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001991 KRB5=yes
1992 fi
1993 ]
1994)
Darren Tucker6aaa58c2003-08-02 22:24:49 +10001995LIBS="$LIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001996
Damien Millera22ba012000-03-02 23:09:20 +11001997# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11001998
Damien Millerf58c6722002-05-13 13:15:42 +10001999PRIVSEP_PATH=/var/empty
2000AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002001 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002002 [
2003 if test "x$withval" != "$no" ; then
2004 PRIVSEP_PATH=$withval
2005 fi
2006 ]
2007)
2008AC_SUBST(PRIVSEP_PATH)
2009
Damien Millera22ba012000-03-02 23:09:20 +11002010AC_ARG_WITH(xauth,
2011 [ --with-xauth=PATH Specify path to xauth program ],
2012 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002013 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002014 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002015 fi
2016 ],
2017 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002018 TestPath="$PATH"
2019 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2020 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2021 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2022 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2023 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002024 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002025 xauth_path="/usr/openwin/bin/xauth"
2026 fi
2027 ]
2028)
2029
Damien Miller7d901272003-01-13 16:55:22 +11002030STRIP_OPT=-s
2031AC_ARG_ENABLE(strip,
2032 [ --disable-strip Disable calling strip(1) on install],
2033 [
2034 if test "x$enableval" = "xno" ; then
2035 STRIP_OPT=
2036 fi
2037 ]
2038)
2039AC_SUBST(STRIP_OPT)
2040
Damien Millera19cf472000-11-29 13:28:50 +11002041if test -z "$xauth_path" ; then
2042 XAUTH_PATH="undefined"
2043 AC_SUBST(XAUTH_PATH)
2044else
Damien Millera22ba012000-03-02 23:09:20 +11002045 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002046 XAUTH_PATH=$xauth_path
2047 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002048fi
Damien Millera22ba012000-03-02 23:09:20 +11002049
2050# Check for mail directory (last resort if we cannot get it from headers)
2051if test ! -z "$MAIL" ; then
2052 maildir=`dirname $MAIL`
2053 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2054fi
2055
Damien Millera22ba012000-03-02 23:09:20 +11002056if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002057 if test "x$disable_ptmx_check" != "xyes" ; then
2058 AC_CHECK_FILE("/dev/ptmx",
2059 [
2060 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2061 have_dev_ptmx=1
2062 ]
2063 )
2064 fi
Damien Millera22ba012000-03-02 23:09:20 +11002065fi
Damien Miller204ad072000-03-02 23:56:12 +11002066AC_CHECK_FILE("/dev/ptc",
2067 [
2068 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2069 have_dev_ptc=1
2070 ]
2071)
2072
Damien Millera22ba012000-03-02 23:09:20 +11002073# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002074AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002075 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002076 [
Damien Miller897741e2001-04-16 10:41:46 +10002077 case "$withval" in
2078 man|cat|doc)
2079 MANTYPE=$withval
2080 ;;
2081 *)
2082 AC_MSG_ERROR(invalid man type: $withval)
2083 ;;
2084 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002085 ]
2086)
Ben Lindstrombc709922001-04-18 18:04:21 +00002087if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002088 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2089 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002090 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2091 MANTYPE=doc
2092 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2093 MANTYPE=man
2094 else
2095 MANTYPE=cat
2096 fi
2097fi
Damien Miller670a4b82000-01-22 13:53:11 +11002098AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002099if test "$MANTYPE" = "doc"; then
2100 mansubdir=man;
2101else
2102 mansubdir=$MANTYPE;
2103fi
2104AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002105
Damien Millera22ba012000-03-02 23:09:20 +11002106# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10002107MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002108AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002109 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002110 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002111 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002112 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10002113 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002114 fi
2115 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002116)
2117
Damien Millera22ba012000-03-02 23:09:20 +11002118# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002119AC_ARG_WITH(shadow,
2120 [ --without-shadow Disable shadow password support],
2121 [
2122 if test "x$withval" = "xno" ; then
2123 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002124 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002125 fi
2126 ]
2127)
2128
Damien Miller1f335fb2000-06-26 11:31:33 +10002129if test -z "$disable_shadow" ; then
2130 AC_MSG_CHECKING([if the systems has expire shadow information])
2131 AC_TRY_COMPILE(
2132 [
2133#include <sys/types.h>
2134#include <shadow.h>
2135 struct spwd sp;
2136 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2137 [ sp_expire_available=yes ], []
2138 )
2139
2140 if test "x$sp_expire_available" = "xyes" ; then
2141 AC_MSG_RESULT(yes)
2142 AC_DEFINE(HAS_SHADOW_EXPIRE)
2143 else
2144 AC_MSG_RESULT(no)
2145 fi
2146fi
2147
Damien Millera22ba012000-03-02 23:09:20 +11002148# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002149if test ! -z "$IPADDR_IN_DISPLAY" ; then
2150 DISPLAY_HACK_MSG="yes"
2151 AC_DEFINE(IPADDR_IN_DISPLAY)
2152else
2153 DISPLAY_HACK_MSG="no"
2154 AC_ARG_WITH(ipaddr-display,
2155 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2156 [
2157 if test "x$withval" != "xno" ; then
2158 AC_DEFINE(IPADDR_IN_DISPLAY)
2159 DISPLAY_HACK_MSG="yes"
2160 fi
2161 ]
2162 )
2163fi
Damien Miller76112de1999-12-21 11:18:08 +11002164
Tim Rice43a1c132002-04-17 21:19:14 -07002165dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2166if test $ac_cv_func_login_getcapbool = "yes" -a \
2167 $ac_cv_header_login_cap_h = "yes" ; then
2168 USES_LOGIN_CONF=yes
2169fi
Damien Millera22ba012000-03-02 23:09:20 +11002170# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002171SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002172AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002173 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002174 [
Tim Rice43a1c132002-04-17 21:19:14 -07002175 if test "$USES_LOGIN_CONF" = "yes" ; then
2176 AC_MSG_WARN([
2177--with-default-path=PATH has no effect on this system.
2178Edit /etc/login.conf instead.])
2179 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08002180 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002181 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002182 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002183 ],
Tim Rice43a1c132002-04-17 21:19:14 -07002184 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2185 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2186 else
Tim Rice59ea0a02001-03-10 13:50:45 -08002187 AC_TRY_RUN(
2188 [
2189/* find out what STDPATH is */
2190#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002191#ifdef HAVE_PATHS_H
2192# include <paths.h>
2193#endif
2194#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002195# ifdef _PATH_USERPATH /* Irix */
2196# define _PATH_STDPATH _PATH_USERPATH
2197# else
2198# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2199# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002200#endif
2201#include <sys/types.h>
2202#include <sys/stat.h>
2203#include <fcntl.h>
2204#define DATA "conftest.stdpath"
2205
2206main()
2207{
2208 FILE *fd;
2209 int rc;
2210
2211 fd = fopen(DATA,"w");
2212 if(fd == NULL)
2213 exit(1);
2214
2215 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2216 exit(1);
2217
2218 exit(0);
2219}
2220 ], [ user_path=`cat conftest.stdpath` ],
2221 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2222 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2223 )
2224# make sure $bindir is in USER_PATH so scp will work
2225 t_bindir=`eval echo ${bindir}`
2226 case $t_bindir in
2227 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2228 esac
2229 case $t_bindir in
2230 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2231 esac
2232 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2233 if test $? -ne 0 ; then
2234 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2235 if test $? -ne 0 ; then
2236 user_path=$user_path:$t_bindir
2237 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2238 fi
2239 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002240 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002241)
Tim Rice43a1c132002-04-17 21:19:14 -07002242if test "$USES_LOGIN_CONF" != "yes" ; then
2243 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2244 AC_SUBST(user_path)
2245fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002246
Damien Millera18bbd32002-05-13 10:48:57 +10002247# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002248AC_ARG_WITH(superuser-path,
2249 [ --with-superuser-path= Specify different path for super-user],
2250 [
2251 if test "x$withval" != "xno" ; then
2252 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2253 superuser_path=$withval
2254 fi
2255 ]
2256)
2257
2258
Damien Miller61e50f12000-05-08 20:49:37 +10002259AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002260IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002261AC_ARG_WITH(4in6,
2262 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2263 [
2264 if test "x$withval" != "xno" ; then
2265 AC_MSG_RESULT(yes)
2266 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002267 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002268 else
2269 AC_MSG_RESULT(no)
2270 fi
2271 ],[
2272 if test "x$inet6_default_4in6" = "xyes"; then
2273 AC_MSG_RESULT([yes (default)])
2274 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002275 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002276 else
2277 AC_MSG_RESULT([no (default)])
2278 fi
2279 ]
2280)
2281
Damien Miller60396b02001-02-18 17:01:00 +11002282# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002283BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002284AC_ARG_WITH(bsd-auth,
2285 [ --with-bsd-auth Enable BSD auth support],
2286 [
2287 if test "x$withval" != "xno" ; then
2288 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002289 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002290 fi
2291 ]
2292)
2293
Damien Millera22ba012000-03-02 23:09:20 +11002294# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002295piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002296# make sure the directory exists
2297if test ! -d $piddir ; then
2298 piddir=`eval echo ${sysconfdir}`
2299 case $piddir in
2300 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2301 esac
2302fi
2303
Tim Rice88f2ab52002-03-17 12:17:34 -08002304AC_ARG_WITH(pid-dir,
2305 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2306 [
2307 if test "x$withval" != "xno" ; then
2308 piddir=$withval
2309 if test ! -d $piddir ; then
2310 AC_MSG_WARN([** no $piddir directory on this system **])
2311 fi
2312 fi
2313 ]
2314)
2315
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002316AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002317AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002318
andre2ff7b5d2000-06-03 14:57:40 +00002319dnl allow user to disable some login recording features
2320AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002321 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002322 [
2323 if test "x$enableval" = "xno" ; then
2324 AC_DEFINE(DISABLE_LASTLOG)
2325 fi
2326 ]
andre2ff7b5d2000-06-03 14:57:40 +00002327)
2328AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002329 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002330 [
2331 if test "x$enableval" = "xno" ; then
2332 AC_DEFINE(DISABLE_UTMP)
2333 fi
2334 ]
andre2ff7b5d2000-06-03 14:57:40 +00002335)
2336AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002337 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002338 [
2339 if test "x$enableval" = "xno" ; then
2340 AC_DEFINE(DISABLE_UTMPX)
2341 fi
2342 ]
andre2ff7b5d2000-06-03 14:57:40 +00002343)
2344AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002345 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002346 [
2347 if test "x$enableval" = "xno" ; then
2348 AC_DEFINE(DISABLE_WTMP)
2349 fi
2350 ]
andre2ff7b5d2000-06-03 14:57:40 +00002351)
2352AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002353 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002354 [
2355 if test "x$enableval" = "xno" ; then
2356 AC_DEFINE(DISABLE_WTMPX)
2357 fi
2358 ]
andre2ff7b5d2000-06-03 14:57:40 +00002359)
2360AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002361 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002362 [
2363 if test "x$enableval" = "xno" ; then
2364 AC_DEFINE(DISABLE_LOGIN)
2365 fi
2366 ]
andre2ff7b5d2000-06-03 14:57:40 +00002367)
2368AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002369 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002370 [
2371 if test "x$enableval" = "xno" ; then
2372 AC_DEFINE(DISABLE_PUTUTLINE)
2373 fi
2374 ]
andre2ff7b5d2000-06-03 14:57:40 +00002375)
2376AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002377 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002378 [
2379 if test "x$enableval" = "xno" ; then
2380 AC_DEFINE(DISABLE_PUTUTXLINE)
2381 fi
2382 ]
andre2ff7b5d2000-06-03 14:57:40 +00002383)
2384AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002385 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002386 [
2387 if test "x$withval" = "xno" ; then
2388 AC_DEFINE(DISABLE_LASTLOG)
2389 else
2390 conf_lastlog_location=$withval
2391 fi
2392 ]
2393)
andre2ff7b5d2000-06-03 14:57:40 +00002394
2395dnl lastlog, [uw]tmpx? detection
2396dnl NOTE: set the paths in the platform section to avoid the
2397dnl need for command-line parameters
2398dnl lastlog and [uw]tmp are subject to a file search if all else fails
2399
2400dnl lastlog detection
2401dnl NOTE: the code itself will detect if lastlog is a directory
2402AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2403AC_TRY_COMPILE([
2404#include <sys/types.h>
2405#include <utmp.h>
2406#ifdef HAVE_LASTLOG_H
2407# include <lastlog.h>
2408#endif
Damien Miller2994e082000-06-04 15:51:47 +10002409#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002410# include <paths.h>
2411#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002412#ifdef HAVE_LOGIN_H
2413# include <login.h>
2414#endif
andre2ff7b5d2000-06-03 14:57:40 +00002415 ],
2416 [ char *lastlog = LASTLOG_FILE; ],
2417 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002418 [
2419 AC_MSG_RESULT(no)
2420 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2421 AC_TRY_COMPILE([
2422#include <sys/types.h>
2423#include <utmp.h>
2424#ifdef HAVE_LASTLOG_H
2425# include <lastlog.h>
2426#endif
2427#ifdef HAVE_PATHS_H
2428# include <paths.h>
2429#endif
2430 ],
2431 [ char *lastlog = _PATH_LASTLOG; ],
2432 [ AC_MSG_RESULT(yes) ],
2433 [
andree441aa32000-06-12 22:34:38 +00002434 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002435 system_lastlog_path=no
2436 ])
2437 ]
andre2ff7b5d2000-06-03 14:57:40 +00002438)
Damien Miller2994e082000-06-04 15:51:47 +10002439
andre2ff7b5d2000-06-03 14:57:40 +00002440if test -z "$conf_lastlog_location"; then
2441 if test x"$system_lastlog_path" = x"no" ; then
2442 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002443 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002444 conf_lastlog_location=$f
2445 fi
2446 done
2447 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002448 AC_MSG_WARN([** Cannot find lastlog **])
2449 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002450 fi
2451 fi
2452fi
2453
2454if test -n "$conf_lastlog_location"; then
2455 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2456fi
2457
2458dnl utmp detection
2459AC_MSG_CHECKING([if your system defines UTMP_FILE])
2460AC_TRY_COMPILE([
2461#include <sys/types.h>
2462#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002463#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002464# include <paths.h>
2465#endif
2466 ],
2467 [ char *utmp = UTMP_FILE; ],
2468 [ AC_MSG_RESULT(yes) ],
2469 [ AC_MSG_RESULT(no)
2470 system_utmp_path=no ]
2471)
2472if test -z "$conf_utmp_location"; then
2473 if test x"$system_utmp_path" = x"no" ; then
2474 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2475 if test -f $f ; then
2476 conf_utmp_location=$f
2477 fi
2478 done
2479 if test -z "$conf_utmp_location"; then
2480 AC_DEFINE(DISABLE_UTMP)
2481 fi
2482 fi
2483fi
2484if test -n "$conf_utmp_location"; then
2485 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2486fi
2487
2488dnl wtmp detection
2489AC_MSG_CHECKING([if your system defines WTMP_FILE])
2490AC_TRY_COMPILE([
2491#include <sys/types.h>
2492#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002493#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002494# include <paths.h>
2495#endif
2496 ],
2497 [ char *wtmp = WTMP_FILE; ],
2498 [ AC_MSG_RESULT(yes) ],
2499 [ AC_MSG_RESULT(no)
2500 system_wtmp_path=no ]
2501)
2502if test -z "$conf_wtmp_location"; then
2503 if test x"$system_wtmp_path" = x"no" ; then
2504 for f in /usr/adm/wtmp /var/log/wtmp; do
2505 if test -f $f ; then
2506 conf_wtmp_location=$f
2507 fi
2508 done
2509 if test -z "$conf_wtmp_location"; then
2510 AC_DEFINE(DISABLE_WTMP)
2511 fi
2512 fi
2513fi
2514if test -n "$conf_wtmp_location"; then
2515 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2516fi
2517
2518
2519dnl utmpx detection - I don't know any system so perverse as to require
2520dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2521dnl there, though.
2522AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2523AC_TRY_COMPILE([
2524#include <sys/types.h>
2525#include <utmp.h>
2526#ifdef HAVE_UTMPX_H
2527#include <utmpx.h>
2528#endif
Damien Miller2994e082000-06-04 15:51:47 +10002529#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002530# include <paths.h>
2531#endif
2532 ],
2533 [ char *utmpx = UTMPX_FILE; ],
2534 [ AC_MSG_RESULT(yes) ],
2535 [ AC_MSG_RESULT(no)
2536 system_utmpx_path=no ]
2537)
2538if test -z "$conf_utmpx_location"; then
2539 if test x"$system_utmpx_path" = x"no" ; then
2540 AC_DEFINE(DISABLE_UTMPX)
2541 fi
2542else
2543 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2544fi
2545
2546dnl wtmpx detection
2547AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2548AC_TRY_COMPILE([
2549#include <sys/types.h>
2550#include <utmp.h>
2551#ifdef HAVE_UTMPX_H
2552#include <utmpx.h>
2553#endif
Damien Miller2994e082000-06-04 15:51:47 +10002554#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002555# include <paths.h>
2556#endif
2557 ],
2558 [ char *wtmpx = WTMPX_FILE; ],
2559 [ AC_MSG_RESULT(yes) ],
2560 [ AC_MSG_RESULT(no)
2561 system_wtmpx_path=no ]
2562)
2563if test -z "$conf_wtmpx_location"; then
2564 if test x"$system_wtmpx_path" = x"no" ; then
2565 AC_DEFINE(DISABLE_WTMPX)
2566 fi
2567else
2568 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2569fi
2570
Damien Miller4018c192000-04-30 09:30:44 +10002571
Damien Miller29ea30d2000-03-17 10:54:15 +11002572if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002573 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2574 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002575fi
2576
Tim Rice4cec93f2002-02-26 08:40:48 -08002577dnl remove pam and dl because they are in $LIBPAM
2578if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002579 LIBS=`echo $LIBS | sed 's/-lpam //'`
2580fi
2581if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2582 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002583fi
2584
Damien Millerbac2d8a2000-09-05 16:13:06 +11002585AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002586AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2587AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002588
Damien Miller7b22d652000-06-18 14:07:04 +10002589# Print summary of options
2590
Damien Miller7b22d652000-06-18 14:07:04 +10002591# Someone please show me a better way :)
2592A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2593B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2594C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2595D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002596E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002597F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002598G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002599H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2600I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2601J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002602
2603echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002604echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002605echo " User binaries: $B"
2606echo " System binaries: $C"
2607echo " Configuration files: $D"
2608echo " Askpass program: $E"
2609echo " Manual pages: $F"
2610echo " PID file: $G"
2611echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002612if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002613echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002614else
Damien Millerf58c6722002-05-13 13:15:42 +10002615echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002616fi
Damien Millera18bbd32002-05-13 10:48:57 +10002617if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002618echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002619fi
Damien Millerf58c6722002-05-13 13:15:42 +10002620echo " Manpage format: $MANTYPE"
Damien Miller9d2be482003-05-15 11:12:19 +10002621echo " DNS support: $DNS_MSG"
Damien Miller7abe09b2003-05-15 10:53:49 +10002622echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002623echo " KerberosV support: $KRB5_MSG"
2624echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002625echo " S/KEY support: $SKEY_MSG"
2626echo " TCP Wrappers support: $TCPW_MSG"
2627echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002628echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002629echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2630echo " BSD Auth support: $BSD_AUTH_MSG"
2631echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002632if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002633echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002634fi
2635
Damien Miller7b22d652000-06-18 14:07:04 +10002636echo ""
2637
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002638echo " Host: ${host}"
2639echo " Compiler: ${CC}"
2640echo " Compiler flags: ${CFLAGS}"
2641echo "Preprocessor flags: ${CPPFLAGS}"
2642echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002643echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002644
2645echo ""
2646
Damien Miller82cf0ce2000-12-20 13:34:48 +11002647if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002648 echo "PAM is enabled. You may need to install a PAM control file "
2649 echo "for sshd, otherwise password authentication may fail. "
2650 echo "Example PAM control files can be found in the contrib/ "
2651 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002652 echo ""
2653fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002654
Damien Miller6c21c512002-01-22 21:57:53 +11002655if test ! -z "$RAND_HELPER_CMDHASH" ; then
2656 echo "WARNING: you are using the builtin random number collection "
2657 echo "service. Please read WARNING.RNG and request that your OS "
2658 echo "vendor includes kernel-based random number collection in "
2659 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002660 echo ""
2661fi
Damien Miller60396b02001-02-18 17:01:00 +11002662