blob: 23f3e5e685c0e2f8973b5f5b85951880ae3da615 [file] [log] [blame]
Darren Tucker9f18be62003-09-06 16:44:39 +10001# $Id: configure.ac,v 1.144 2003/09/06 06:44:39 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.
Damien Millerab18c411999-11-11 10:40:23 +110012AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100013AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110014AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000015AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070016AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080017AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110018AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100019AC_PATH_PROG(ENT, ent)
20AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110021AC_PATH_PROG(TEST_MINUS_S_SH, bash)
22AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
23AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070024AC_PATH_PROG(SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110025
Damien Millere8bb4502001-09-25 16:39:35 +100026# System features
27AC_SYS_LARGEFILE
28
Damien Miller3f62aba2000-11-29 11:56:35 +110029if test -z "$AR" ; then
30 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
31fi
32
Damien Millerad833b32000-08-23 10:46:23 +100033# Use LOGIN_PROGRAM from environment if possible
34if test ! -z "$LOGIN_PROGRAM" ; then
35 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
36else
37 # Search for login
38 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
39 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
40 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
41 fi
42fi
43
Damien Miller166bd442000-03-16 10:48:25 +110044if test -z "$LD" ; then
45 LD=$CC
46fi
47AC_SUBST(LD)
48
Damien Miller166bd442000-03-16 10:48:25 +110049AC_C_INLINE
Damien Miller649d9992001-06-27 23:35:51 +100050if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
51 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110052fi
53
Damien Millera22ba012000-03-02 23:09:20 +110054# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110055case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110056*-*-aix*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000057 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110058 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millereab4bae2003-04-29 23:22:40 +100059 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
60 if (test -z "$blibpath"); then
61 blibpath="/usr/lib:/lib:/usr/local/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +110062 fi
Damien Millereab4bae2003-04-29 23:22:40 +100063 saved_LDFLAGS="$LDFLAGS"
64 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
65 if (test -z "$blibflags"); then
66 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
67 AC_TRY_LINK([], [], [blibflags=$tryflags])
68 fi
69 done
70 if (test -z "$blibflags"); then
71 AC_MSG_RESULT(not found)
72 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
73 else
74 AC_MSG_RESULT($blibflags)
75 fi
76 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +100077 dnl Check for authenticate. Might be in libs.a on older AIXes
78 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -070079 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +100080 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -070081 LIBS="$LIBS -ls"
82 ])
83 ])
Darren Tucker5c6a91a2003-07-14 16:21:44 +100084 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
85 AC_CHECK_DECL(loginfailed,
86 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
87 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +100088 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +100089 [(void)loginfailed("user","host","tty",0);],
90 [AC_MSG_RESULT(yes)
91 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +100092 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +100093 )],
94 [],
95 [#include <usersec.h>]
96 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +100097 AC_CHECK_FUNCS(setauthdb)
Damien Millereca71f82000-01-20 22:38:27 +110098 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +100099 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000100 AC_DEFINE(SETEUID_BREAKS_SETUID)
101 AC_DEFINE(BROKEN_SETREUID)
102 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000103 dnl AIX handles lastlog as part of its login message
104 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000105 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000106 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100107 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100108*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100109 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800110 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100111 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000112 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100113 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100114 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000115 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000116 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700117 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +0000118 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100119 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000120*-*-dgux*)
121 AC_DEFINE(IP_TOS_IS_BROKEN)
122 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000123*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000124 AC_MSG_CHECKING(if we have working getaddrinfo)
125 AC_TRY_RUN([#include <mach-o/dyld.h>
126main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
127 exit(0);
128 else
129 exit(1);
130}], [AC_MSG_RESULT(working)],
131 [AC_MSG_RESULT(buggy)
132 AC_DEFINE(BROKEN_GETADDRINFO)],
133 [AC_MSG_RESULT(assume it is working)])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000134 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000135*-*-hpux10.26)
136 if test -z "$GCC"; then
137 CFLAGS="$CFLAGS -Ae"
138 fi
139 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
140 IPADDR_IN_DISPLAY=yes
141 AC_DEFINE(HAVE_SECUREWARE)
142 AC_DEFINE(USE_PIPES)
143 AC_DEFINE(LOGIN_NO_ENDOPT)
144 AC_DEFINE(LOGIN_NEEDS_UTMPX)
145 AC_DEFINE(DISABLE_SHADOW)
146 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000147 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000148 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700149 LIBS="$LIBS -lsec -lsecpw"
150 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000151 disable_ptmx_check=yes
152 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100153*-*-hpux10*)
154 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000155 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100156 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000157 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100158 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000159 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000160 AC_DEFINE(LOGIN_NO_ENDOPT)
161 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100162 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100163 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000164 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000165 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700166 LIBS="$LIBS -lsec"
167 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100168 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000169*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000170 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100171 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100172 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100173 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000174 AC_DEFINE(LOGIN_NO_ENDOPT)
175 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100176 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100177 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000178 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000179 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700180 LIBS="$LIBS -lsec"
181 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000182 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100183*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000184 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000185 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100186 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000187 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000188 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000189 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100190 ;;
191*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000192 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000193 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100194 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000195 AC_DEFINE(WITH_IRIX_ARRAY)
196 AC_DEFINE(WITH_IRIX_PROJECT)
197 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000198 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000199 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000200 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000201 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100202 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100203*-*-linux*)
204 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100205 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000206 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100207 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000208 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000209 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
Damien Miller35276252003-06-03 10:14:28 +1000210 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller7bcb0892000-03-11 20:45:40 +1100211 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000212 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000213 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000214 AC_DEFINE(BROKEN_CMSG_TYPE)
215 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000216 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100217 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000218mips-sony-bsd|mips-sony-newsos4)
219 AC_DEFINE(HAVE_NEWS4)
220 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000221 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100222*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000223 check_for_libcrypt_before=1
Damien Millera22ba012000-03-02 23:09:20 +1100224 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100225 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100226*-*-freebsd*)
227 check_for_libcrypt_later=1
228 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000229*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000230 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100231 conf_utmp_location=/etc/utmp
232 conf_wtmp_location=/usr/adm/wtmp
233 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000234 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000235 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000236 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100237 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000238 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000239 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000240 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100241*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000242 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000243 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100244 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100245 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000246 AC_DEFINE(LOGIN_NEEDS_UTMPX)
247 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000248 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000249 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000250 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
251 AC_DEFINE(SSHD_ACQUIRES_CTTY)
andre2ff7b5d2000-06-03 14:57:40 +0000252 # hardwire lastlog location (can't detect it on some versions)
253 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000254 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
255 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
256 if test "$sol2ver" -ge 8; then
257 AC_MSG_RESULT(yes)
258 AC_DEFINE(DISABLE_UTMP)
259 AC_DEFINE(DISABLE_WTMP)
260 else
261 AC_MSG_RESULT(no)
262 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100263 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000264*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000265 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000266 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100267 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000268 conf_utmp_location=/etc/utmp
269 conf_wtmp_location=/var/adm/wtmp
270 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000271 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000272 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000273*-ncr-sysv*)
274 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
275 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700276 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000277 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000278 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000279 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000280*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000281 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700282 # /usr/ucblib MUST NOT be searched on ReliantUNIX
283 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100284 IPADDR_IN_DISPLAY=yes
285 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000286 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000287 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700288 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
289 # Attention: always take care to bind libsocket and libnsl before libc,
290 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000291 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100292*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000293 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100294 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100295 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100296 ;;
297*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000298 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100299 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100300 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100301 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100302*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000303 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100304 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100305 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100306*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000307 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100308 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700309 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100310 RANLIB=true
311 no_dev_ptmx=1
312 AC_DEFINE(BROKEN_SYS_TERMIO_H)
313 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000314 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000315 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100316 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100317 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700318 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700319 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100320 ;;
321*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800322 if test -z "$GCC"; then
323 CFLAGS="$CFLAGS -belf"
324 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000325 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000326 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100327 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000328 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100329 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000330 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000331 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700332 AC_DEFINE(DISABLE_FD_PASSING)
Damien Miller217f5672001-02-16 12:12:41 +1100333 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700334 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000335 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000336*-*-unicosmk*)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000337 AC_DEFINE(USE_PIPES)
338 AC_DEFINE(DISABLE_FD_PASSING)
339 LDFLAGS="$LDFLAGS"
340 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
341 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000342 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000343*-*-unicos*)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000344 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700345 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700346 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000347 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
348 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
349 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700350 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000351*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000352 AC_MSG_CHECKING(for Digital Unix SIA)
353 no_osfsia=""
354 AC_ARG_WITH(osfsia,
355 [ --with-osfsia Enable Digital Unix SIA],
356 [
357 if test "x$withval" = "xno" ; then
358 AC_MSG_RESULT(disabled)
359 no_osfsia=1
360 fi
361 ],
362 )
363 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000364 if test -f /etc/sia/matrix.conf; then
365 AC_MSG_RESULT(yes)
366 AC_DEFINE(HAVE_OSF_SIA)
367 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000368 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000369 LIBS="$LIBS -lsecurity -ldb -lm -laud"
370 else
371 AC_MSG_RESULT(no)
372 fi
373 fi
Ben Lindstromdc3c7572002-10-04 23:54:54 +0000374 AC_DEFINE(DISABLE_FD_PASSING)
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000375 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tuckere41bba52003-08-25 11:51:19 +1000376 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000377 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000378
379*-*-nto-qnx)
380 AC_DEFINE(USE_PIPES)
381 AC_DEFINE(NO_X11_UNIX_SOCKETS)
382 AC_DEFINE(MISSING_NFDBITS)
383 AC_DEFINE(MISSING_HOWMANY)
384 AC_DEFINE(MISSING_FD_MASK)
385 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100386esac
387
Damien Millere37bfc12000-06-05 09:37:43 +1000388# Allow user to specify flags
389AC_ARG_WITH(cflags,
390 [ --with-cflags Specify additional flags to pass to compiler],
391 [
392 if test "x$withval" != "xno" ; then
393 CFLAGS="$CFLAGS $withval"
394 fi
395 ]
396)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000397AC_ARG_WITH(cppflags,
398 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
399 [
400 if test "x$withval" != "xno"; then
401 CPPFLAGS="$CPPFLAGS $withval"
402 fi
403 ]
404)
Damien Millere37bfc12000-06-05 09:37:43 +1000405AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000406 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000407 [
408 if test "x$withval" != "xno" ; then
409 LDFLAGS="$LDFLAGS $withval"
410 fi
411 ]
412)
413AC_ARG_WITH(libs,
414 [ --with-libs Specify additional libraries to link with],
415 [
416 if test "x$withval" != "xno" ; then
417 LIBS="$LIBS $withval"
418 fi
419 ]
420)
421
Darren Tucker6eb93042003-06-29 21:30:41 +1000422AC_MSG_CHECKING(compiler and flags for sanity)
423AC_TRY_RUN([
424#include <stdio.h>
425int main(){exit(0);}
426 ],
427 [ AC_MSG_RESULT(yes) ],
428 [
429 AC_MSG_RESULT(no)
430 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
431 ]
432)
433
Tim Rice4cec93f2002-02-26 08:40:48 -0800434# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000435AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Damien Millerb16f8742003-02-24 12:47:15 +1100436 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800437 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000438 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000439 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000440 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
441 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
Ben Lindstrom4b0f1ad2003-02-01 04:43:34 +0000442 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
Tim Rice81ed5182002-09-25 17:38:46 -0700443 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800444 util.h utime.h utmp.h utmpx.h)
445
Damien Millera22ba012000-03-02 23:09:20 +1100446# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700447AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
448AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000449
Damien Millerdf288022001-02-18 13:07:07 +1100450dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700451if test "x$with_tcp_wrappers" != "xno" ; then
452 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
453 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
454 fi
455fi
Damien Millerdf288022001-02-18 13:07:07 +1100456
Tim Rice13aae5e2001-10-21 17:53:58 -0700457AC_CHECK_FUNC(getspnam, ,
458 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700459
Damien Miller150c8b52002-02-13 23:06:56 +1100460AC_ARG_WITH(rpath,
461 [ --without-rpath Disable auto-added -R linker paths],
462 [
463 if test "x$withval" = "xno" ; then
464 need_dash_r=""
465 fi
466 if test "x$withval" = "xyes" ; then
467 need_dash_r=1
468 fi
469 ]
470)
471
Tim Rice13aae5e2001-10-21 17:53:58 -0700472dnl zlib is required
473AC_ARG_WITH(zlib,
474 [ --with-zlib=PATH Use zlib in PATH],
475 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000476 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100477 AC_MSG_ERROR([*** zlib is required ***])
478 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700479 if test -d "$withval/lib"; then
480 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700481 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700482 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700483 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700484 fi
485 else
486 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700487 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700488 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700489 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700490 fi
491 fi
492 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700493 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700494 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700495 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700496 fi
497 ]
498)
499
Tim Rice17b93e52001-10-23 22:36:54 -0700500AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100501
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000502dnl UnixWare 2.x
503AC_CHECK_FUNC(strcasecmp,
504 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
505)
506AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700507 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
508 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000509)
Damien Millerab18c411999-11-11 10:40:23 +1100510
Tim Ricee589a292001-11-03 11:09:32 -0800511dnl Checks for libutil functions
512AC_CHECK_HEADERS(libutil.h)
513AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
514AC_CHECK_FUNCS(logout updwtmp logwtmp)
515
Ben Lindstrom8697e082001-02-24 21:41:10 +0000516AC_FUNC_STRFTIME
517
Damien Miller3c027682001-03-14 11:39:45 +1100518# Check for ALTDIRFUNC glob() extension
519AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
520AC_EGREP_CPP(FOUNDIT,
521 [
522 #include <glob.h>
523 #ifdef GLOB_ALTDIRFUNC
524 FOUNDIT
525 #endif
526 ],
527 [
528 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
529 AC_MSG_RESULT(yes)
530 ],
531 [
532 AC_MSG_RESULT(no)
533 ]
534)
Damien Millerab18c411999-11-11 10:40:23 +1100535
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000536# Check for g.gl_matchc glob() extension
537AC_MSG_CHECKING(for gl_matchc field in glob_t)
538AC_EGREP_CPP(FOUNDIT,
539 [
540 #include <glob.h>
541 int main(void){glob_t g; g.gl_matchc = 1;}
542 ],
543 [
544 AC_DEFINE(GLOB_HAS_GL_MATCHC)
545 AC_MSG_RESULT(yes)
546 ],
547 [
548 AC_MSG_RESULT(no)
549 ]
550)
551
Damien Miller18bb4732001-03-28 14:35:30 +1000552AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
553AC_TRY_RUN(
554 [
555#include <sys/types.h>
556#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700557int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000558 ],
559 [AC_MSG_RESULT(yes)],
560 [
561 AC_MSG_RESULT(no)
562 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
563 ]
564)
565
Damien Millerc547bf12001-02-16 10:18:12 +1100566# Check whether user wants S/Key support
567SKEY_MSG="no"
568AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700569 [ --with-skey[[=PATH]] Enable S/Key support
570 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100571 [
572 if test "x$withval" != "xno" ; then
573
574 if test "x$withval" != "xyes" ; then
575 CPPFLAGS="$CPPFLAGS -I${withval}/include"
576 LDFLAGS="$LDFLAGS -L${withval}/lib"
577 fi
578
579 AC_DEFINE(SKEY)
580 LIBS="-lskey $LIBS"
581 SKEY_MSG="yes"
582
Tim Rice4cec93f2002-02-26 08:40:48 -0800583 AC_MSG_CHECKING([for s/key support])
584 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100585 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800586#include <stdio.h>
587#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700588int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800589 ],
590 [AC_MSG_RESULT(yes)],
591 [
592 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100593 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
594 ])
595 fi
596 ]
597)
598
599# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700600TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100601AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700602 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
603 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100604 [
605 if test "x$withval" != "xno" ; then
606 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700607 saved_LDFLAGS="$LDFLAGS"
608 saved_CPPFLAGS="$CPPFLAGS"
609 if test -n "${withval}" -a "${withval}" != "yes"; then
610 if test -d "${withval}/lib"; then
611 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700612 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700613 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700614 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700615 fi
616 else
617 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700618 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700619 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700620 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700621 fi
622 fi
623 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700624 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700625 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700626 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700627 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700628 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800629 LIBWRAP="-lwrap"
630 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100631 AC_MSG_CHECKING(for libwrap)
632 AC_TRY_LINK(
633 [
634#include <tcpd.h>
635 int deny_severity = 0, allow_severity = 0;
636 ],
637 [hosts_access(0);],
638 [
639 AC_MSG_RESULT(yes)
640 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800641 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700642 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100643 ],
644 [
645 AC_MSG_ERROR([*** libwrap missing])
646 ]
647 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800648 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100649 fi
650 ]
651)
652
Damien Millerfe1f1432003-02-24 15:45:42 +1100653dnl Checks for library functions. Please keep in alphabetical order
654AC_CHECK_FUNCS(\
Damien Miller5fe46a42003-06-05 09:53:31 +1000655 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
656 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Damien Millerfe1f1432003-02-24 15:45:42 +1100657 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000658 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100659 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000660 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
661 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
662 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Damien Miller5fe46a42003-06-05 09:53:31 +1000663 setproctitle setregid setresgid setresuid setreuid setrlimit \
664 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tuckerf38ea772003-08-13 20:48:07 +1000665 strlcat strlcpy strmode strnvis sysconf tcgetpgrp tcsendbreak \
666 truncate utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100667)
Tim Rice13aae5e2001-10-21 17:53:58 -0700668
Damien Millercd6853c2003-01-28 11:33:42 +1100669AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
Damien Millereab4bae2003-04-29 23:22:40 +1000670AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
Damien Millercd6853c2003-01-28 11:33:42 +1100671
Darren Tuckerf1159b52003-07-07 19:44:01 +1000672dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000673AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000674AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000675
Tim Rice13aae5e2001-10-21 17:53:58 -0700676dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700677AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700678 AC_CHECK_LIB(gen, dirname,[
679 AC_CACHE_CHECK([for broken dirname],
680 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700681 save_LIBS="$LIBS"
682 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700683 AC_TRY_RUN(
684 [
685#include <libgen.h>
686#include <string.h>
687
688int main(int argc, char **argv) {
689 char *s, buf[32];
690
691 strncpy(buf,"/etc", 32);
692 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700693 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700694 exit(1);
695 } else {
696 exit(0);
697 }
698}
699 ],
700 [ ac_cv_have_broken_dirname="no" ],
701 [ ac_cv_have_broken_dirname="yes" ]
702 )
Tim Rice17b93e52001-10-23 22:36:54 -0700703 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700704 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700705 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700706 LIBS="$LIBS -lgen"
707 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700708 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700709 fi
710 ])
711])
712
Damien Millerad833b32000-08-23 10:46:23 +1000713dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000714AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000715dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000716AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000717AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000718dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000719AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000720AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100721
Damien Miller04f80141999-11-19 15:32:34 +1100722AC_CHECK_FUNC(daemon,
723 [AC_DEFINE(HAVE_DAEMON)],
724 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
725)
726
Damien Miller9fb07e42000-03-05 16:22:59 +1100727AC_CHECK_FUNC(getpagesize,
728 [AC_DEFINE(HAVE_GETPAGESIZE)],
729 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
730)
731
Damien Millercb170cb2000-07-01 16:52:55 +1000732# Check for broken snprintf
733if test "x$ac_cv_func_snprintf" = "xyes" ; then
734 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
735 AC_TRY_RUN(
736 [
737#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700738int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000739 ],
740 [AC_MSG_RESULT(yes)],
741 [
742 AC_MSG_RESULT(no)
743 AC_DEFINE(BROKEN_SNPRINTF)
744 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
745 ]
746 )
747fi
748
Damien Millere8328192003-01-07 15:18:32 +1100749dnl see whether mkstemp() requires XXXXXX
750if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
751AC_MSG_CHECKING([for (overly) strict mkstemp])
752AC_TRY_RUN(
753 [
754#include <stdlib.h>
755main() { char template[]="conftest.mkstemp-test";
756if (mkstemp(template) == -1)
757 exit(1);
758unlink(template); exit(0);
759}
760 ],
761 [
762 AC_MSG_RESULT(no)
763 ],
764 [
765 AC_MSG_RESULT(yes)
766 AC_DEFINE(HAVE_STRICT_MKSTEMP)
767 ],
768 [
769 AC_MSG_RESULT(yes)
770 AC_DEFINE(HAVE_STRICT_MKSTEMP)
771 ]
772)
773fi
774
Darren Tucker70a3d552003-08-21 17:58:29 +1000775dnl make sure that openpty does not reacquire controlling terminal
776if test ! -z "$check_for_openpty_ctty_bug"; then
777 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
778 AC_TRY_RUN(
779 [
780#include <stdio.h>
781#include <sys/fcntl.h>
782#include <sys/types.h>
783#include <sys/wait.h>
784
785int
786main()
787{
788 pid_t pid;
789 int fd, ptyfd, ttyfd, status;
790
791 pid = fork();
792 if (pid < 0) { /* failed */
793 exit(1);
794 } else if (pid > 0) { /* parent */
795 waitpid(pid, &status, 0);
796 if (WIFEXITED(status))
797 exit(WEXITSTATUS(status));
798 else
799 exit(2);
800 } else { /* child */
801 close(0); close(1); close(2);
802 setsid();
803 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
804 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
805 if (fd >= 0)
806 exit(3); /* Acquired ctty: broken */
807 else
808 exit(0); /* Did not acquire ctty: OK */
809 }
810}
811 ],
812 [
813 AC_MSG_RESULT(yes)
814 ],
815 [
816 AC_MSG_RESULT(no)
817 AC_DEFINE(SSHD_ACQUIRES_CTTY)
818 ]
819 )
820fi
821
Damien Miller606f8802000-09-16 15:39:56 +1100822AC_FUNC_GETPGRP
823
Damien Millera64b57a2001-01-17 10:44:13 +1100824# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000825PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100826AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100827 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100828 [
Damien Millera64b57a2001-01-17 10:44:13 +1100829 if test "x$withval" != "xno" ; then
830 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
831 AC_MSG_ERROR([PAM headers not found])
832 fi
833
834 AC_CHECK_LIB(dl, dlopen, , )
835 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
836 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000837 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +1100838
839 disable_shadow=yes
840 PAM_MSG="yes"
841
842 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800843 if test $ac_cv_lib_dl_dlopen = yes; then
844 LIBPAM="-lpam -ldl"
845 else
846 LIBPAM="-lpam"
847 fi
848 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100849 fi
850 ]
851)
Damien Millera22ba012000-03-02 23:09:20 +1100852
Damien Millera64b57a2001-01-17 10:44:13 +1100853# Check for older PAM
854if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100855 # Check PAM strerror arguments (old PAM)
856 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
857 AC_TRY_COMPILE(
858 [
Damien Miller81171112000-04-23 11:14:01 +1000859#include <stdlib.h>
860#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100861 ],
862 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
863 [AC_MSG_RESULT(no)],
864 [
865 AC_DEFINE(HAVE_OLD_PAM)
866 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000867 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100868 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100869 )
Damien Millera22ba012000-03-02 23:09:20 +1100870fi
871
Damien Millerfc93d4b2002-09-04 23:26:29 +1000872# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
873# because the system crypt() is more featureful.
874if test "x$check_for_libcrypt_before" = "x1"; then
875 AC_CHECK_LIB(crypt, crypt)
876fi
877
Tim Riceaef73712002-05-11 13:17:42 -0700878# Search for OpenSSL
879saved_CPPFLAGS="$CPPFLAGS"
880saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100881AC_ARG_WITH(ssl-dir,
882 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
883 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000884 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700885 if test -d "$withval/lib"; then
886 if test -n "${need_dash_r}"; then
887 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
888 else
889 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
890 fi
891 else
892 if test -n "${need_dash_r}"; then
893 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
894 else
895 LDFLAGS="-L${withval} ${LDFLAGS}"
896 fi
897 fi
898 if test -d "$withval/include"; then
899 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
900 else
901 CPPFLAGS="-I${withval} ${CPPFLAGS}"
902 fi
Damien Millera22ba012000-03-02 23:09:20 +1100903 fi
904 ]
905)
Tim Riceaef73712002-05-11 13:17:42 -0700906LIBS="$LIBS -lcrypto"
907AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000908 [
Tim Riceaef73712002-05-11 13:17:42 -0700909 dnl Check default openssl install dir
910 if test -n "${need_dash_r}"; then
911 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000912 else
Tim Riceaef73712002-05-11 13:17:42 -0700913 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000914 fi
Tim Riceaef73712002-05-11 13:17:42 -0700915 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
916 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
917 [
918 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
919 ]
920 )
921 ]
922)
923
Tim Riced730b782002-08-13 18:52:10 -0700924# Determine OpenSSL header version
925AC_MSG_CHECKING([OpenSSL header version])
926AC_TRY_RUN(
927 [
928#include <stdio.h>
929#include <string.h>
930#include <openssl/opensslv.h>
931#define DATA "conftest.sslincver"
932int main(void) {
933 FILE *fd;
934 int rc;
935
936 fd = fopen(DATA,"w");
937 if(fd == NULL)
938 exit(1);
939
940 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
941 exit(1);
942
943 exit(0);
944}
945 ],
946 [
947 ssl_header_ver=`cat conftest.sslincver`
948 AC_MSG_RESULT($ssl_header_ver)
949 ],
950 [
951 AC_MSG_RESULT(not found)
952 AC_MSG_ERROR(OpenSSL version header not found.)
953 ]
954)
955
956# Determine OpenSSL library version
957AC_MSG_CHECKING([OpenSSL library version])
958AC_TRY_RUN(
959 [
960#include <stdio.h>
961#include <string.h>
962#include <openssl/opensslv.h>
963#include <openssl/crypto.h>
964#define DATA "conftest.ssllibver"
965int main(void) {
966 FILE *fd;
967 int rc;
968
969 fd = fopen(DATA,"w");
970 if(fd == NULL)
971 exit(1);
972
973 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
974 exit(1);
975
976 exit(0);
977}
978 ],
979 [
980 ssl_library_ver=`cat conftest.ssllibver`
981 AC_MSG_RESULT($ssl_library_ver)
982 ],
983 [
984 AC_MSG_RESULT(not found)
985 AC_MSG_ERROR(OpenSSL library not found.)
986 ]
987)
Damien Millera22ba012000-03-02 23:09:20 +1100988
Damien Millerec932372002-01-22 22:16:03 +1100989# Sanity check OpenSSL headers
990AC_MSG_CHECKING([whether OpenSSL's headers match the library])
991AC_TRY_RUN(
992 [
993#include <string.h>
994#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700995int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +1100996 ],
997 [
998 AC_MSG_RESULT(yes)
999 ],
1000 [
1001 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001002 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1003Check config.log for details.
1004Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001005 ]
1006)
1007
Damien Millera64b57a2001-01-17 10:44:13 +11001008# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1009# version in OpenSSL. Skip this for PAM
Damien Miller4f9f42a2003-05-10 19:28:02 +10001010if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001011 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001012fi
1013
Damien Miller6c21c512002-01-22 21:57:53 +11001014
1015### Configure cryptographic random number support
1016
1017# Check wheter OpenSSL seeds itself
1018AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1019AC_TRY_RUN(
1020 [
1021#include <string.h>
1022#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001023int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001024 ],
1025 [
1026 OPENSSL_SEEDS_ITSELF=yes
1027 AC_MSG_RESULT(yes)
1028 ],
1029 [
1030 AC_MSG_RESULT(no)
1031 # Default to use of the rand helper if OpenSSL doesn't
1032 # seed itself
1033 USE_RAND_HELPER=yes
1034 ]
1035)
1036
1037
1038# Do we want to force the use of the rand helper?
1039AC_ARG_WITH(rand-helper,
1040 [ --with-rand-helper Use subprocess to gather strong randomness ],
1041 [
1042 if test "x$withval" = "xno" ; then
1043 # Force use of OpenSSL's internal RNG, even if
1044 # the previous test showed it to be unseeded.
1045 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1046 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1047 OPENSSL_SEEDS_ITSELF=yes
1048 USE_RAND_HELPER=""
1049 fi
1050 else
1051 USE_RAND_HELPER=yes
1052 fi
1053 ],
1054)
1055
1056# Which randomness source do we use?
1057if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1058 # OpenSSL only
1059 AC_DEFINE(OPENSSL_PRNG_ONLY)
1060 RAND_MSG="OpenSSL internal ONLY"
1061 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001062elif test ! -z "$USE_RAND_HELPER" ; then
1063 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001064 RAND_MSG="ssh-rand-helper"
1065 INSTALL_SSH_RAND_HELPER="yes"
1066fi
1067AC_SUBST(INSTALL_SSH_RAND_HELPER)
1068
1069### Configuration of ssh-rand-helper
1070
1071# PRNGD TCP socket
1072AC_ARG_WITH(prngd-port,
1073 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1074 [
Damien Millere996d722002-01-23 11:20:59 +11001075 case "$withval" in
1076 no)
1077 withval=""
1078 ;;
1079 [[0-9]]*)
1080 ;;
1081 *)
1082 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1083 ;;
1084 esac
1085 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001086 PRNGD_PORT="$withval"
1087 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1088 fi
1089 ]
1090)
1091
1092# PRNGD Unix domain socket
1093AC_ARG_WITH(prngd-socket,
1094 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1095 [
Damien Millere996d722002-01-23 11:20:59 +11001096 case "$withval" in
1097 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001098 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001099 ;;
1100 no)
1101 withval=""
1102 ;;
1103 /*)
1104 ;;
1105 *)
1106 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1107 ;;
1108 esac
1109
1110 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001111 if test ! -z "$PRNGD_PORT" ; then
1112 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1113 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001114 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001115 AC_MSG_WARN(Entropy socket is not readable)
1116 fi
1117 PRNGD_SOCKET="$withval"
1118 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1119 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001120 ],
1121 [
1122 # Check for existing socket only if we don't have a random device already
1123 if test "$USE_RAND_HELPER" = yes ; then
1124 AC_MSG_CHECKING(for PRNGD/EGD socket)
1125 # Insert other locations here
1126 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1127 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1128 PRNGD_SOCKET="$sock"
1129 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1130 break;
1131 fi
1132 done
1133 if test ! -z "$PRNGD_SOCKET" ; then
1134 AC_MSG_RESULT($PRNGD_SOCKET)
1135 else
1136 AC_MSG_RESULT(not found)
1137 fi
1138 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001139 ]
1140)
1141
1142# Change default command timeout for hashing entropy source
1143entropy_timeout=200
1144AC_ARG_WITH(entropy-timeout,
1145 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1146 [
1147 if test "x$withval" != "xno" ; then
1148 entropy_timeout=$withval
1149 fi
1150 ]
1151)
Damien Miller6c21c512002-01-22 21:57:53 +11001152AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1153
Damien Millerd3f6ad22002-06-25 10:24:47 +10001154SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001155AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001156 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001157 [
1158 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001159 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001160 fi
1161 ]
1162)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001163AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1164AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001165
Tim Rice88f2ab52002-03-17 12:17:34 -08001166# We do this little dance with the search path to insure
1167# that programs that we select for use by installed programs
1168# (which may be run by the super-user) come from trusted
1169# locations before they come from the user's private area.
1170# This should help avoid accidentally configuring some
1171# random version of a program in someone's personal bin.
1172
1173OPATH=$PATH
1174PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001175test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001176test -d /sbin && PATH=$PATH:/sbin
1177test -d /usr/sbin && PATH=$PATH:/usr/sbin
1178PATH=$PATH:/etc:$OPATH
1179
Damien Miller6c21c512002-01-22 21:57:53 +11001180# These programs are used by the command hashing source to gather entropy
1181OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1182OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1183OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1184OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1185OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1186OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1187OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1188OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1189OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1190OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1191OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1192OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1193OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1194OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1195OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1196OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001197# restore PATH
1198PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001199
1200# Where does ssh-rand-helper get its randomness from?
1201INSTALL_SSH_PRNG_CMDS=""
1202if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1203 if test ! -z "$PRNGD_PORT" ; then
1204 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1205 elif test ! -z "$PRNGD_SOCKET" ; then
1206 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1207 else
1208 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1209 RAND_HELPER_CMDHASH=yes
1210 INSTALL_SSH_PRNG_CMDS="yes"
1211 fi
1212fi
1213AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1214
1215
Ben Lindstromb5628642000-10-18 00:02:25 +00001216# Cheap hack to ensure NEWS-OS libraries are arranged right.
1217if test ! -z "$SONY" ; then
1218 LIBS="$LIBS -liberty";
1219fi
1220
Damien Millera22ba012000-03-02 23:09:20 +11001221# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001222AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001223AC_CHECK_SIZEOF(short int, 2)
1224AC_CHECK_SIZEOF(int, 4)
1225AC_CHECK_SIZEOF(long int, 4)
1226AC_CHECK_SIZEOF(long long int, 8)
1227
Damien Millerfa2bb692002-04-23 23:22:25 +10001228# Sanity check long long for some platforms (AIX)
1229if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1230 ac_cv_sizeof_long_long_int=0
1231fi
1232
Damien Millera22ba012000-03-02 23:09:20 +11001233# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001234AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1235 AC_TRY_COMPILE(
1236 [ #include <sys/types.h> ],
1237 [ u_int a; a = 1;],
1238 [ ac_cv_have_u_int="yes" ],
1239 [ ac_cv_have_u_int="no" ]
1240 )
1241])
1242if test "x$ac_cv_have_u_int" = "xyes" ; then
1243 AC_DEFINE(HAVE_U_INT)
1244 have_u_int=1
1245fi
1246
Damien Miller61e50f12000-05-08 20:49:37 +10001247AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1248 AC_TRY_COMPILE(
1249 [ #include <sys/types.h> ],
1250 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1251 [ ac_cv_have_intxx_t="yes" ],
1252 [ ac_cv_have_intxx_t="no" ]
1253 )
1254])
1255if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1256 AC_DEFINE(HAVE_INTXX_T)
1257 have_intxx_t=1
1258fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001259
1260if (test -z "$have_intxx_t" && \
1261 test "x$ac_cv_header_stdint_h" = "xyes")
1262then
1263 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1264 AC_TRY_COMPILE(
1265 [ #include <stdint.h> ],
1266 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1267 [
1268 AC_DEFINE(HAVE_INTXX_T)
1269 AC_MSG_RESULT(yes)
1270 ],
1271 [ AC_MSG_RESULT(no) ]
1272 )
1273fi
1274
Damien Miller578783e2000-09-23 14:12:24 +11001275AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1276 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001277 [
1278#include <sys/types.h>
1279#ifdef HAVE_STDINT_H
1280# include <stdint.h>
1281#endif
1282#include <sys/socket.h>
1283#ifdef HAVE_SYS_BITYPES_H
1284# include <sys/bitypes.h>
1285#endif
1286 ],
Damien Miller578783e2000-09-23 14:12:24 +11001287 [ int64_t a; a = 1;],
1288 [ ac_cv_have_int64_t="yes" ],
1289 [ ac_cv_have_int64_t="no" ]
1290 )
1291])
1292if test "x$ac_cv_have_int64_t" = "xyes" ; then
1293 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001294fi
1295
Damien Miller61e50f12000-05-08 20:49:37 +10001296AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1297 AC_TRY_COMPILE(
1298 [ #include <sys/types.h> ],
1299 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1300 [ ac_cv_have_u_intxx_t="yes" ],
1301 [ ac_cv_have_u_intxx_t="no" ]
1302 )
1303])
1304if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1305 AC_DEFINE(HAVE_U_INTXX_T)
1306 have_u_intxx_t=1
1307fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001308
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001309if test -z "$have_u_intxx_t" ; then
1310 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1311 AC_TRY_COMPILE(
1312 [ #include <sys/socket.h> ],
1313 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1314 [
1315 AC_DEFINE(HAVE_U_INTXX_T)
1316 AC_MSG_RESULT(yes)
1317 ],
1318 [ AC_MSG_RESULT(no) ]
1319 )
1320fi
1321
Damien Miller578783e2000-09-23 14:12:24 +11001322AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1323 AC_TRY_COMPILE(
1324 [ #include <sys/types.h> ],
1325 [ u_int64_t a; a = 1;],
1326 [ ac_cv_have_u_int64_t="yes" ],
1327 [ ac_cv_have_u_int64_t="no" ]
1328 )
1329])
1330if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1331 AC_DEFINE(HAVE_U_INT64_T)
1332 have_u_int64_t=1
1333fi
1334
Tim Rice4cec93f2002-02-26 08:40:48 -08001335if test -z "$have_u_int64_t" ; then
1336 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1337 AC_TRY_COMPILE(
1338 [ #include <sys/bitypes.h> ],
1339 [ u_int64_t a; a = 1],
1340 [
1341 AC_DEFINE(HAVE_U_INT64_T)
1342 AC_MSG_RESULT(yes)
1343 ],
1344 [ AC_MSG_RESULT(no) ]
1345 )
1346fi
1347
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001348if test -z "$have_u_intxx_t" ; then
1349 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1350 AC_TRY_COMPILE(
1351 [
1352#include <sys/types.h>
1353 ],
1354 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1355 [ ac_cv_have_uintxx_t="yes" ],
1356 [ ac_cv_have_uintxx_t="no" ]
1357 )
1358 ])
1359 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1360 AC_DEFINE(HAVE_UINTXX_T)
1361 fi
1362fi
1363
1364if test -z "$have_uintxx_t" ; then
1365 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1366 AC_TRY_COMPILE(
1367 [ #include <stdint.h> ],
1368 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1369 [
1370 AC_DEFINE(HAVE_UINTXX_T)
1371 AC_MSG_RESULT(yes)
1372 ],
1373 [ AC_MSG_RESULT(no) ]
1374 )
1375fi
1376
Damien Milleredb82922000-06-20 13:25:52 +10001377if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1378 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001379then
1380 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1381 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001382 [
1383#include <sys/bitypes.h>
1384 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001385 [
Damien Miller70494d12000-04-03 15:57:06 +10001386 int8_t a; int16_t b; int32_t c;
1387 u_int8_t e; u_int16_t f; u_int32_t g;
1388 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001389 ],
1390 [
1391 AC_DEFINE(HAVE_U_INTXX_T)
1392 AC_DEFINE(HAVE_INTXX_T)
1393 AC_MSG_RESULT(yes)
1394 ],
1395 [AC_MSG_RESULT(no)]
1396 )
1397fi
1398
Damien Miller58be7382001-09-15 21:31:54 +10001399
1400AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1401 AC_TRY_COMPILE(
1402 [
1403#include <sys/types.h>
1404 ],
1405 [ u_char foo; foo = 125; ],
1406 [ ac_cv_have_u_char="yes" ],
1407 [ ac_cv_have_u_char="no" ]
1408 )
1409])
1410if test "x$ac_cv_have_u_char" = "xyes" ; then
1411 AC_DEFINE(HAVE_U_CHAR)
1412fi
1413
Tim Rice13aae5e2001-10-21 17:53:58 -07001414TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001415
Tim Rice200a5c02002-02-26 22:12:34 -08001416AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001417
Damien Miller61e50f12000-05-08 20:49:37 +10001418AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1419 AC_TRY_COMPILE(
1420 [
1421#include <sys/types.h>
1422 ],
1423 [ size_t foo; foo = 1235; ],
1424 [ ac_cv_have_size_t="yes" ],
1425 [ ac_cv_have_size_t="no" ]
1426 )
1427])
1428if test "x$ac_cv_have_size_t" = "xyes" ; then
1429 AC_DEFINE(HAVE_SIZE_T)
1430fi
Damien Miller95058511999-12-29 10:36:45 +11001431
Damien Miller615f9392000-05-17 22:53:33 +10001432AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1433 AC_TRY_COMPILE(
1434 [
1435#include <sys/types.h>
1436 ],
1437 [ ssize_t foo; foo = 1235; ],
1438 [ ac_cv_have_ssize_t="yes" ],
1439 [ ac_cv_have_ssize_t="no" ]
1440 )
1441])
1442if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1443 AC_DEFINE(HAVE_SSIZE_T)
1444fi
1445
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001446AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1447 AC_TRY_COMPILE(
1448 [
1449#include <time.h>
1450 ],
1451 [ clock_t foo; foo = 1235; ],
1452 [ ac_cv_have_clock_t="yes" ],
1453 [ ac_cv_have_clock_t="no" ]
1454 )
1455])
1456if test "x$ac_cv_have_clock_t" = "xyes" ; then
1457 AC_DEFINE(HAVE_CLOCK_T)
1458fi
1459
Damien Millerb54b40e2000-06-23 08:23:34 +10001460AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1461 AC_TRY_COMPILE(
1462 [
1463#include <sys/types.h>
1464#include <sys/socket.h>
1465 ],
1466 [ sa_family_t foo; foo = 1235; ],
1467 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001468 [ AC_TRY_COMPILE(
1469 [
1470#include <sys/types.h>
1471#include <sys/socket.h>
1472#include <netinet/in.h>
1473 ],
1474 [ sa_family_t foo; foo = 1235; ],
1475 [ ac_cv_have_sa_family_t="yes" ],
1476
Damien Millerb54b40e2000-06-23 08:23:34 +10001477 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001478 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001479 )
1480])
1481if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1482 AC_DEFINE(HAVE_SA_FAMILY_T)
1483fi
1484
Damien Miller0f91b4e2000-06-18 15:43:25 +10001485AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1486 AC_TRY_COMPILE(
1487 [
1488#include <sys/types.h>
1489 ],
1490 [ pid_t foo; foo = 1235; ],
1491 [ ac_cv_have_pid_t="yes" ],
1492 [ ac_cv_have_pid_t="no" ]
1493 )
1494])
1495if test "x$ac_cv_have_pid_t" = "xyes" ; then
1496 AC_DEFINE(HAVE_PID_T)
1497fi
1498
1499AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1500 AC_TRY_COMPILE(
1501 [
1502#include <sys/types.h>
1503 ],
1504 [ mode_t foo; foo = 1235; ],
1505 [ ac_cv_have_mode_t="yes" ],
1506 [ ac_cv_have_mode_t="no" ]
1507 )
1508])
1509if test "x$ac_cv_have_mode_t" = "xyes" ; then
1510 AC_DEFINE(HAVE_MODE_T)
1511fi
1512
Damien Miller61e50f12000-05-08 20:49:37 +10001513
1514AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1515 AC_TRY_COMPILE(
1516 [
Damien Miller81171112000-04-23 11:14:01 +10001517#include <sys/types.h>
1518#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001519 ],
1520 [ struct sockaddr_storage s; ],
1521 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1522 [ ac_cv_have_struct_sockaddr_storage="no" ]
1523 )
1524])
1525if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1526 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1527fi
Damien Miller34132e52000-01-14 15:45:46 +11001528
Damien Miller61e50f12000-05-08 20:49:37 +10001529AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1530 AC_TRY_COMPILE(
1531 [
Damien Miller7b22d652000-06-18 14:07:04 +10001532#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001533#include <netinet/in.h>
1534 ],
1535 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1536 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1537 [ ac_cv_have_struct_sockaddr_in6="no" ]
1538 )
1539])
1540if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1541 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1542fi
Damien Miller34132e52000-01-14 15:45:46 +11001543
Damien Miller61e50f12000-05-08 20:49:37 +10001544AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1545 AC_TRY_COMPILE(
1546 [
Damien Miller7b22d652000-06-18 14:07:04 +10001547#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001548#include <netinet/in.h>
1549 ],
1550 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1551 [ ac_cv_have_struct_in6_addr="yes" ],
1552 [ ac_cv_have_struct_in6_addr="no" ]
1553 )
1554])
1555if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1556 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1557fi
Damien Miller34132e52000-01-14 15:45:46 +11001558
Damien Miller61e50f12000-05-08 20:49:37 +10001559AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1560 AC_TRY_COMPILE(
1561 [
Damien Miller81171112000-04-23 11:14:01 +10001562#include <sys/types.h>
1563#include <sys/socket.h>
1564#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001565 ],
1566 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1567 [ ac_cv_have_struct_addrinfo="yes" ],
1568 [ ac_cv_have_struct_addrinfo="no" ]
1569 )
1570])
1571if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1572 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1573fi
1574
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001575AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1576 AC_TRY_COMPILE(
1577 [ #include <sys/time.h> ],
1578 [ struct timeval tv; tv.tv_sec = 1;],
1579 [ ac_cv_have_struct_timeval="yes" ],
1580 [ ac_cv_have_struct_timeval="no" ]
1581 )
1582])
1583if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1584 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1585 have_struct_timeval=1
1586fi
1587
Tim Rice4e4dc562003-03-18 10:21:40 -08001588AC_CHECK_TYPES(struct timespec)
1589
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001590# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001591if test "x$ac_cv_have_int64_t" = "xno" -a \
1592 "x$ac_cv_sizeof_long_int" != "x8" -a \
1593 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001594 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1595 echo "an alternative compiler (I.E., GCC) before continuing."
1596 echo ""
1597 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001598else
1599dnl test snprintf (broken on SCO w/gcc)
1600 AC_TRY_RUN(
1601 [
1602#include <stdio.h>
1603#include <string.h>
1604#ifdef HAVE_SNPRINTF
1605main()
1606{
1607 char buf[50];
1608 char expected_out[50];
1609 int mazsize = 50 ;
1610#if (SIZEOF_LONG_INT == 8)
1611 long int num = 0x7fffffffffffffff;
1612#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001613 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001614#endif
1615 strcpy(expected_out, "9223372036854775807");
1616 snprintf(buf, mazsize, "%lld", num);
1617 if(strcmp(buf, expected_out) != 0)
1618 exit(1);
1619 exit(0);
1620}
1621#else
1622main() { exit(0); }
1623#endif
1624 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1625 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001626fi
1627
Damien Miller78315eb2000-09-29 23:01:36 +11001628dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001629OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1630OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1631OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1632OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1633OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001634OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001635OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1636OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001637OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001638OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1639OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1640OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1641OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001642OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1643OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1644OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1645OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001646
1647AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001648
Damien Miller61e50f12000-05-08 20:49:37 +10001649AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1650 ac_cv_have_ss_family_in_struct_ss, [
1651 AC_TRY_COMPILE(
1652 [
Damien Miller81171112000-04-23 11:14:01 +10001653#include <sys/types.h>
1654#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001655 ],
1656 [ struct sockaddr_storage s; s.ss_family = 1; ],
1657 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1658 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1659 )
1660])
1661if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1662 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1663fi
1664
Damien Miller61e50f12000-05-08 20:49:37 +10001665AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1666 ac_cv_have___ss_family_in_struct_ss, [
1667 AC_TRY_COMPILE(
1668 [
Damien Miller81171112000-04-23 11:14:01 +10001669#include <sys/types.h>
1670#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001671 ],
1672 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1673 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1674 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1675 )
1676])
1677if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1678 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1679fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001680
Damien Millerad833b32000-08-23 10:46:23 +10001681AC_CACHE_CHECK([for pw_class field in struct passwd],
1682 ac_cv_have_pw_class_in_struct_passwd, [
1683 AC_TRY_COMPILE(
1684 [
Damien Millerad833b32000-08-23 10:46:23 +10001685#include <pwd.h>
1686 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001687 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001688 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1689 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1690 )
1691])
1692if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1693 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1694fi
1695
Kevin Steves82456952001-06-22 21:14:18 +00001696AC_CACHE_CHECK([for pw_expire field in struct passwd],
1697 ac_cv_have_pw_expire_in_struct_passwd, [
1698 AC_TRY_COMPILE(
1699 [
1700#include <pwd.h>
1701 ],
1702 [ struct passwd p; p.pw_expire = 0; ],
1703 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1704 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1705 )
1706])
1707if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1708 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1709fi
1710
1711AC_CACHE_CHECK([for pw_change field in struct passwd],
1712 ac_cv_have_pw_change_in_struct_passwd, [
1713 AC_TRY_COMPILE(
1714 [
1715#include <pwd.h>
1716 ],
1717 [ struct passwd p; p.pw_change = 0; ],
1718 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1719 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1720 )
1721])
1722if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1723 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1724fi
Damien Miller61e50f12000-05-08 20:49:37 +10001725
Tim Rice28bbb0c2002-05-27 17:37:32 -07001726dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001727AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1728 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001729 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001730 [
Tim Riceae49fe62002-04-12 10:26:21 -07001731#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001732#include <sys/socket.h>
1733#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001734int main() {
1735#ifdef msg_accrights
1736exit(1);
1737#endif
1738struct msghdr m;
1739m.msg_accrights = 0;
1740exit(0);
1741}
Kevin Steves939c9db2002-03-22 17:23:25 +00001742 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001743 [ ac_cv_have_accrights_in_msghdr="yes" ],
1744 [ ac_cv_have_accrights_in_msghdr="no" ]
1745 )
1746])
1747if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1748 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1749fi
1750
Kevin Stevesa44e0352002-04-07 16:18:03 +00001751AC_CACHE_CHECK([for msg_control field in struct msghdr],
1752 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001753 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001754 [
Tim Riceae49fe62002-04-12 10:26:21 -07001755#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001756#include <sys/socket.h>
1757#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001758int main() {
1759#ifdef msg_control
1760exit(1);
1761#endif
1762struct msghdr m;
1763m.msg_control = 0;
1764exit(0);
1765}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001766 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001767 [ ac_cv_have_control_in_msghdr="yes" ],
1768 [ ac_cv_have_control_in_msghdr="no" ]
1769 )
1770])
1771if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1772 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1773fi
1774
Damien Miller61e50f12000-05-08 20:49:37 +10001775AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1776 AC_TRY_LINK([],
1777 [ extern char *__progname; printf("%s", __progname); ],
1778 [ ac_cv_libc_defines___progname="yes" ],
1779 [ ac_cv_libc_defines___progname="no" ]
1780 )
1781])
1782if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1783 AC_DEFINE(HAVE___PROGNAME)
1784fi
1785
Kevin Steves4846f4a2002-03-22 18:19:53 +00001786AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1787 AC_TRY_LINK([
1788#include <stdio.h>
1789],
1790 [ printf("%s", __FUNCTION__); ],
1791 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1792 [ ac_cv_cc_implements___FUNCTION__="no" ]
1793 )
1794])
1795if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1796 AC_DEFINE(HAVE___FUNCTION__)
1797fi
1798
1799AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1800 AC_TRY_LINK([
1801#include <stdio.h>
1802],
1803 [ printf("%s", __func__); ],
1804 [ ac_cv_cc_implements___func__="yes" ],
1805 [ ac_cv_cc_implements___func__="no" ]
1806 )
1807])
1808if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1809 AC_DEFINE(HAVE___func__)
1810fi
1811
Damien Miller4f8e6692001-07-14 13:22:53 +10001812AC_CACHE_CHECK([whether getopt has optreset support],
1813 ac_cv_have_getopt_optreset, [
1814 AC_TRY_LINK(
1815 [
1816#include <getopt.h>
1817 ],
1818 [ extern int optreset; optreset = 0; ],
1819 [ ac_cv_have_getopt_optreset="yes" ],
1820 [ ac_cv_have_getopt_optreset="no" ]
1821 )
1822])
1823if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1824 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1825fi
Damien Millera22ba012000-03-02 23:09:20 +11001826
Damien Millerecbb26d2000-07-15 14:59:14 +10001827AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1828 AC_TRY_LINK([],
1829 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1830 [ ac_cv_libc_defines_sys_errlist="yes" ],
1831 [ ac_cv_libc_defines_sys_errlist="no" ]
1832 )
1833])
1834if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1835 AC_DEFINE(HAVE_SYS_ERRLIST)
1836fi
1837
1838
Damien Miller11fa2cc2000-08-16 10:35:58 +10001839AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1840 AC_TRY_LINK([],
1841 [ extern int sys_nerr; printf("%i", sys_nerr);],
1842 [ ac_cv_libc_defines_sys_nerr="yes" ],
1843 [ ac_cv_libc_defines_sys_nerr="no" ]
1844 )
1845])
1846if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1847 AC_DEFINE(HAVE_SYS_NERR)
1848fi
1849
Damien Miller85de5802001-09-18 14:01:11 +10001850SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001851# Check whether user wants sectok support
1852AC_ARG_WITH(sectok,
1853 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001854 [
1855 if test "x$withval" != "xno" ; then
1856 if test "x$withval" != "xyes" ; then
1857 CPPFLAGS="$CPPFLAGS -I${withval}"
1858 LDFLAGS="$LDFLAGS -L${withval}"
1859 if test ! -z "$need_dash_r" ; then
1860 LDFLAGS="$LDFLAGS -R${withval}"
1861 fi
1862 if test ! -z "$blibpath" ; then
1863 blibpath="$blibpath:${withval}"
1864 fi
1865 fi
1866 AC_CHECK_HEADERS(sectok.h)
1867 if test "$ac_cv_header_sectok_h" != yes; then
1868 AC_MSG_ERROR(Can't find sectok.h)
1869 fi
1870 AC_CHECK_LIB(sectok, sectok_open)
1871 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1872 AC_MSG_ERROR(Can't find libsectok)
1873 fi
1874 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001875 AC_DEFINE(USE_SECTOK)
1876 SCARD_MSG="yes, using sectok"
1877 fi
1878 ]
1879)
1880
1881# Check whether user wants OpenSC support
1882AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001883 AC_HELP_STRING([--with-opensc=PFX],
1884 [Enable smartcard support using OpenSC]),
1885 opensc_config_prefix="$withval", opensc_config_prefix="")
1886if test x$opensc_config_prefix != x ; then
1887 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1888 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1889 if test "$OPENSC_CONFIG" != "no"; then
1890 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1891 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1892 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1893 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1894 AC_DEFINE(SMARTCARD)
1895 AC_DEFINE(USE_OPENSC)
1896 SCARD_MSG="yes, using OpenSC"
1897 fi
1898fi
Damien Miller85de5802001-09-18 14:01:11 +10001899
Damien Miller7abe09b2003-05-15 10:53:49 +10001900# Check whether user wants DNS support
1901DNS_MSG="no"
1902AC_ARG_WITH(dns,
1903 [ --with-dns Support for fetching keys from DNS (experimental)],
1904 [
1905 if test "x$withval" != "xno" ; then
Damien Millerd9ec3702003-05-15 12:27:08 +10001906 DNS_MSG="yes"
1907 AC_DEFINE(DNS)
1908 AC_SEARCH_LIBS(getrrsetbyname, resolv,
Damien Miller200d0a72003-06-30 19:21:36 +10001909 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1910 [
1911 # Needed by our getrrsetbyname()
1912 AC_SEARCH_LIBS(res_query, resolv)
1913 AC_SEARCH_LIBS(dn_expand, resolv)
1914 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10001915 fi
1916 ]
1917)
1918
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001919# Check whether user wants Kerberos 5 support
1920KRB5_MSG="no"
1921AC_ARG_WITH(kerberos5,
1922 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1923 [
1924 if test "x$withval" != "xno" ; then
1925 if test "x$withval" = "xyes" ; then
1926 KRB5ROOT="/usr/local"
1927 else
1928 KRB5ROOT=${withval}
1929 fi
1930 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1931 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1932 AC_DEFINE(KRB5)
1933 KRB5_MSG="yes"
1934 AC_MSG_CHECKING(whether we are using Heimdal)
1935 AC_TRY_COMPILE([ #include <krb5.h> ],
1936 [ char *tmp = heimdal_version; ],
1937 [ AC_MSG_RESULT(yes)
1938 AC_DEFINE(HEIMDAL)
1939 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1940 ],
1941 [ AC_MSG_RESULT(no)
1942 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1943 ]
1944 )
1945 if test ! -z "$need_dash_r" ; then
1946 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1947 fi
1948 if test ! -z "$blibpath" ; then
1949 blibpath="$blibpath:${KRB5ROOT}/lib"
1950 fi
Damien Miller200d0a72003-06-30 19:21:36 +10001951 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001952
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001953 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1954 [ AC_DEFINE(GSSAPI)
1955 K5LIBS="-lgssapi $K5LIBS" ],
1956 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1957 [ AC_DEFINE(GSSAPI)
1958 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
1959 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
1960 $K5LIBS)
1961 ],
1962 $K5LIBS)
1963
1964 AC_CHECK_HEADER(gssapi.h, ,
1965 [ unset ac_cv_header_gssapi_h
1966 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1967 AC_CHECK_HEADERS(gssapi.h, ,
1968 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
1969 )
1970 ]
1971 )
1972
1973 oldCPP="$CPPFLAGS"
1974 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1975 AC_CHECK_HEADER(gssapi_krb5.h, ,
1976 [ CPPFLAGS="$oldCPP" ])
1977
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001978 KRB5=yes
1979 fi
1980 ]
1981)
Darren Tucker6aaa58c2003-08-02 22:24:49 +10001982LIBS="$LIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001983
Damien Millera22ba012000-03-02 23:09:20 +11001984# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11001985
Damien Millerf58c6722002-05-13 13:15:42 +10001986PRIVSEP_PATH=/var/empty
1987AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07001988 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10001989 [
1990 if test "x$withval" != "$no" ; then
1991 PRIVSEP_PATH=$withval
1992 fi
1993 ]
1994)
1995AC_SUBST(PRIVSEP_PATH)
1996
Damien Millera22ba012000-03-02 23:09:20 +11001997AC_ARG_WITH(xauth,
1998 [ --with-xauth=PATH Specify path to xauth program ],
1999 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002000 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002001 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002002 fi
2003 ],
2004 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002005 TestPath="$PATH"
2006 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2007 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2008 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2009 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2010 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002011 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002012 xauth_path="/usr/openwin/bin/xauth"
2013 fi
2014 ]
2015)
2016
Damien Miller7d901272003-01-13 16:55:22 +11002017STRIP_OPT=-s
2018AC_ARG_ENABLE(strip,
2019 [ --disable-strip Disable calling strip(1) on install],
2020 [
2021 if test "x$enableval" = "xno" ; then
2022 STRIP_OPT=
2023 fi
2024 ]
2025)
2026AC_SUBST(STRIP_OPT)
2027
Damien Millera19cf472000-11-29 13:28:50 +11002028if test -z "$xauth_path" ; then
2029 XAUTH_PATH="undefined"
2030 AC_SUBST(XAUTH_PATH)
2031else
Damien Millera22ba012000-03-02 23:09:20 +11002032 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002033 XAUTH_PATH=$xauth_path
2034 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002035fi
Damien Millera22ba012000-03-02 23:09:20 +11002036
2037# Check for mail directory (last resort if we cannot get it from headers)
2038if test ! -z "$MAIL" ; then
2039 maildir=`dirname $MAIL`
2040 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2041fi
2042
Damien Millera22ba012000-03-02 23:09:20 +11002043if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002044 if test "x$disable_ptmx_check" != "xyes" ; then
2045 AC_CHECK_FILE("/dev/ptmx",
2046 [
2047 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2048 have_dev_ptmx=1
2049 ]
2050 )
2051 fi
Damien Millera22ba012000-03-02 23:09:20 +11002052fi
Damien Miller204ad072000-03-02 23:56:12 +11002053AC_CHECK_FILE("/dev/ptc",
2054 [
2055 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2056 have_dev_ptc=1
2057 ]
2058)
2059
Damien Millera22ba012000-03-02 23:09:20 +11002060# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002061AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002062 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002063 [
Damien Miller897741e2001-04-16 10:41:46 +10002064 case "$withval" in
2065 man|cat|doc)
2066 MANTYPE=$withval
2067 ;;
2068 *)
2069 AC_MSG_ERROR(invalid man type: $withval)
2070 ;;
2071 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002072 ]
2073)
Ben Lindstrombc709922001-04-18 18:04:21 +00002074if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002075 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2076 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002077 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2078 MANTYPE=doc
2079 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2080 MANTYPE=man
2081 else
2082 MANTYPE=cat
2083 fi
2084fi
Damien Miller670a4b82000-01-22 13:53:11 +11002085AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002086if test "$MANTYPE" = "doc"; then
2087 mansubdir=man;
2088else
2089 mansubdir=$MANTYPE;
2090fi
2091AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002092
Damien Millera22ba012000-03-02 23:09:20 +11002093# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10002094MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002095AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002096 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002097 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002098 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002099 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10002100 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002101 fi
2102 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002103)
2104
Damien Millera22ba012000-03-02 23:09:20 +11002105# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002106AC_ARG_WITH(shadow,
2107 [ --without-shadow Disable shadow password support],
2108 [
2109 if test "x$withval" = "xno" ; then
2110 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002111 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002112 fi
2113 ]
2114)
2115
Damien Miller1f335fb2000-06-26 11:31:33 +10002116if test -z "$disable_shadow" ; then
2117 AC_MSG_CHECKING([if the systems has expire shadow information])
2118 AC_TRY_COMPILE(
2119 [
2120#include <sys/types.h>
2121#include <shadow.h>
2122 struct spwd sp;
2123 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2124 [ sp_expire_available=yes ], []
2125 )
2126
2127 if test "x$sp_expire_available" = "xyes" ; then
2128 AC_MSG_RESULT(yes)
2129 AC_DEFINE(HAS_SHADOW_EXPIRE)
2130 else
2131 AC_MSG_RESULT(no)
2132 fi
2133fi
2134
Damien Millera22ba012000-03-02 23:09:20 +11002135# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002136if test ! -z "$IPADDR_IN_DISPLAY" ; then
2137 DISPLAY_HACK_MSG="yes"
2138 AC_DEFINE(IPADDR_IN_DISPLAY)
2139else
2140 DISPLAY_HACK_MSG="no"
2141 AC_ARG_WITH(ipaddr-display,
2142 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2143 [
2144 if test "x$withval" != "xno" ; then
2145 AC_DEFINE(IPADDR_IN_DISPLAY)
2146 DISPLAY_HACK_MSG="yes"
2147 fi
2148 ]
2149 )
2150fi
Damien Miller76112de1999-12-21 11:18:08 +11002151
Tim Rice43a1c132002-04-17 21:19:14 -07002152dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2153if test $ac_cv_func_login_getcapbool = "yes" -a \
2154 $ac_cv_header_login_cap_h = "yes" ; then
2155 USES_LOGIN_CONF=yes
2156fi
Damien Millera22ba012000-03-02 23:09:20 +11002157# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002158SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002159AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002160 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002161 [
Tim Rice43a1c132002-04-17 21:19:14 -07002162 if test "$USES_LOGIN_CONF" = "yes" ; then
2163 AC_MSG_WARN([
2164--with-default-path=PATH has no effect on this system.
2165Edit /etc/login.conf instead.])
2166 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08002167 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002168 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002169 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002170 ],
Tim Rice43a1c132002-04-17 21:19:14 -07002171 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2172 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2173 else
Tim Rice59ea0a02001-03-10 13:50:45 -08002174 AC_TRY_RUN(
2175 [
2176/* find out what STDPATH is */
2177#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002178#ifdef HAVE_PATHS_H
2179# include <paths.h>
2180#endif
2181#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002182# ifdef _PATH_USERPATH /* Irix */
2183# define _PATH_STDPATH _PATH_USERPATH
2184# else
2185# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2186# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002187#endif
2188#include <sys/types.h>
2189#include <sys/stat.h>
2190#include <fcntl.h>
2191#define DATA "conftest.stdpath"
2192
2193main()
2194{
2195 FILE *fd;
2196 int rc;
2197
2198 fd = fopen(DATA,"w");
2199 if(fd == NULL)
2200 exit(1);
2201
2202 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2203 exit(1);
2204
2205 exit(0);
2206}
2207 ], [ user_path=`cat conftest.stdpath` ],
2208 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2209 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2210 )
2211# make sure $bindir is in USER_PATH so scp will work
2212 t_bindir=`eval echo ${bindir}`
2213 case $t_bindir in
2214 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2215 esac
2216 case $t_bindir in
2217 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2218 esac
2219 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2220 if test $? -ne 0 ; then
2221 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2222 if test $? -ne 0 ; then
2223 user_path=$user_path:$t_bindir
2224 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2225 fi
2226 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002227 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002228)
Tim Rice43a1c132002-04-17 21:19:14 -07002229if test "$USES_LOGIN_CONF" != "yes" ; then
2230 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2231 AC_SUBST(user_path)
2232fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002233
Damien Millera18bbd32002-05-13 10:48:57 +10002234# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002235AC_ARG_WITH(superuser-path,
2236 [ --with-superuser-path= Specify different path for super-user],
2237 [
2238 if test "x$withval" != "xno" ; then
2239 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2240 superuser_path=$withval
2241 fi
2242 ]
2243)
2244
2245
Damien Miller61e50f12000-05-08 20:49:37 +10002246AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002247IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002248AC_ARG_WITH(4in6,
2249 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2250 [
2251 if test "x$withval" != "xno" ; then
2252 AC_MSG_RESULT(yes)
2253 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002254 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002255 else
2256 AC_MSG_RESULT(no)
2257 fi
2258 ],[
2259 if test "x$inet6_default_4in6" = "xyes"; then
2260 AC_MSG_RESULT([yes (default)])
2261 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002262 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002263 else
2264 AC_MSG_RESULT([no (default)])
2265 fi
2266 ]
2267)
2268
Damien Miller60396b02001-02-18 17:01:00 +11002269# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002270BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002271AC_ARG_WITH(bsd-auth,
2272 [ --with-bsd-auth Enable BSD auth support],
2273 [
2274 if test "x$withval" != "xno" ; then
2275 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002276 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002277 fi
2278 ]
2279)
2280
Damien Millera22ba012000-03-02 23:09:20 +11002281# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002282piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002283# make sure the directory exists
2284if test ! -d $piddir ; then
2285 piddir=`eval echo ${sysconfdir}`
2286 case $piddir in
2287 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2288 esac
2289fi
2290
Tim Rice88f2ab52002-03-17 12:17:34 -08002291AC_ARG_WITH(pid-dir,
2292 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2293 [
2294 if test "x$withval" != "xno" ; then
2295 piddir=$withval
2296 if test ! -d $piddir ; then
2297 AC_MSG_WARN([** no $piddir directory on this system **])
2298 fi
2299 fi
2300 ]
2301)
2302
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002303AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002304AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002305
andre2ff7b5d2000-06-03 14:57:40 +00002306dnl allow user to disable some login recording features
2307AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002308 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002309 [
2310 if test "x$enableval" = "xno" ; then
2311 AC_DEFINE(DISABLE_LASTLOG)
2312 fi
2313 ]
andre2ff7b5d2000-06-03 14:57:40 +00002314)
2315AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002316 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002317 [
2318 if test "x$enableval" = "xno" ; then
2319 AC_DEFINE(DISABLE_UTMP)
2320 fi
2321 ]
andre2ff7b5d2000-06-03 14:57:40 +00002322)
2323AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002324 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002325 [
2326 if test "x$enableval" = "xno" ; then
2327 AC_DEFINE(DISABLE_UTMPX)
2328 fi
2329 ]
andre2ff7b5d2000-06-03 14:57:40 +00002330)
2331AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002332 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002333 [
2334 if test "x$enableval" = "xno" ; then
2335 AC_DEFINE(DISABLE_WTMP)
2336 fi
2337 ]
andre2ff7b5d2000-06-03 14:57:40 +00002338)
2339AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002340 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002341 [
2342 if test "x$enableval" = "xno" ; then
2343 AC_DEFINE(DISABLE_WTMPX)
2344 fi
2345 ]
andre2ff7b5d2000-06-03 14:57:40 +00002346)
2347AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002348 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002349 [
2350 if test "x$enableval" = "xno" ; then
2351 AC_DEFINE(DISABLE_LOGIN)
2352 fi
2353 ]
andre2ff7b5d2000-06-03 14:57:40 +00002354)
2355AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002356 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002357 [
2358 if test "x$enableval" = "xno" ; then
2359 AC_DEFINE(DISABLE_PUTUTLINE)
2360 fi
2361 ]
andre2ff7b5d2000-06-03 14:57:40 +00002362)
2363AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002364 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002365 [
2366 if test "x$enableval" = "xno" ; then
2367 AC_DEFINE(DISABLE_PUTUTXLINE)
2368 fi
2369 ]
andre2ff7b5d2000-06-03 14:57:40 +00002370)
2371AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002372 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002373 [
2374 if test "x$withval" = "xno" ; then
2375 AC_DEFINE(DISABLE_LASTLOG)
2376 else
2377 conf_lastlog_location=$withval
2378 fi
2379 ]
2380)
andre2ff7b5d2000-06-03 14:57:40 +00002381
2382dnl lastlog, [uw]tmpx? detection
2383dnl NOTE: set the paths in the platform section to avoid the
2384dnl need for command-line parameters
2385dnl lastlog and [uw]tmp are subject to a file search if all else fails
2386
2387dnl lastlog detection
2388dnl NOTE: the code itself will detect if lastlog is a directory
2389AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2390AC_TRY_COMPILE([
2391#include <sys/types.h>
2392#include <utmp.h>
2393#ifdef HAVE_LASTLOG_H
2394# include <lastlog.h>
2395#endif
Damien Miller2994e082000-06-04 15:51:47 +10002396#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002397# include <paths.h>
2398#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002399#ifdef HAVE_LOGIN_H
2400# include <login.h>
2401#endif
andre2ff7b5d2000-06-03 14:57:40 +00002402 ],
2403 [ char *lastlog = LASTLOG_FILE; ],
2404 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002405 [
2406 AC_MSG_RESULT(no)
2407 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2408 AC_TRY_COMPILE([
2409#include <sys/types.h>
2410#include <utmp.h>
2411#ifdef HAVE_LASTLOG_H
2412# include <lastlog.h>
2413#endif
2414#ifdef HAVE_PATHS_H
2415# include <paths.h>
2416#endif
2417 ],
2418 [ char *lastlog = _PATH_LASTLOG; ],
2419 [ AC_MSG_RESULT(yes) ],
2420 [
andree441aa32000-06-12 22:34:38 +00002421 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002422 system_lastlog_path=no
2423 ])
2424 ]
andre2ff7b5d2000-06-03 14:57:40 +00002425)
Damien Miller2994e082000-06-04 15:51:47 +10002426
andre2ff7b5d2000-06-03 14:57:40 +00002427if test -z "$conf_lastlog_location"; then
2428 if test x"$system_lastlog_path" = x"no" ; then
2429 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002430 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002431 conf_lastlog_location=$f
2432 fi
2433 done
2434 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002435 AC_MSG_WARN([** Cannot find lastlog **])
2436 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002437 fi
2438 fi
2439fi
2440
2441if test -n "$conf_lastlog_location"; then
2442 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2443fi
2444
2445dnl utmp detection
2446AC_MSG_CHECKING([if your system defines UTMP_FILE])
2447AC_TRY_COMPILE([
2448#include <sys/types.h>
2449#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002450#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002451# include <paths.h>
2452#endif
2453 ],
2454 [ char *utmp = UTMP_FILE; ],
2455 [ AC_MSG_RESULT(yes) ],
2456 [ AC_MSG_RESULT(no)
2457 system_utmp_path=no ]
2458)
2459if test -z "$conf_utmp_location"; then
2460 if test x"$system_utmp_path" = x"no" ; then
2461 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2462 if test -f $f ; then
2463 conf_utmp_location=$f
2464 fi
2465 done
2466 if test -z "$conf_utmp_location"; then
2467 AC_DEFINE(DISABLE_UTMP)
2468 fi
2469 fi
2470fi
2471if test -n "$conf_utmp_location"; then
2472 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2473fi
2474
2475dnl wtmp detection
2476AC_MSG_CHECKING([if your system defines WTMP_FILE])
2477AC_TRY_COMPILE([
2478#include <sys/types.h>
2479#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002480#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002481# include <paths.h>
2482#endif
2483 ],
2484 [ char *wtmp = WTMP_FILE; ],
2485 [ AC_MSG_RESULT(yes) ],
2486 [ AC_MSG_RESULT(no)
2487 system_wtmp_path=no ]
2488)
2489if test -z "$conf_wtmp_location"; then
2490 if test x"$system_wtmp_path" = x"no" ; then
2491 for f in /usr/adm/wtmp /var/log/wtmp; do
2492 if test -f $f ; then
2493 conf_wtmp_location=$f
2494 fi
2495 done
2496 if test -z "$conf_wtmp_location"; then
2497 AC_DEFINE(DISABLE_WTMP)
2498 fi
2499 fi
2500fi
2501if test -n "$conf_wtmp_location"; then
2502 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2503fi
2504
2505
2506dnl utmpx detection - I don't know any system so perverse as to require
2507dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2508dnl there, though.
2509AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2510AC_TRY_COMPILE([
2511#include <sys/types.h>
2512#include <utmp.h>
2513#ifdef HAVE_UTMPX_H
2514#include <utmpx.h>
2515#endif
Damien Miller2994e082000-06-04 15:51:47 +10002516#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002517# include <paths.h>
2518#endif
2519 ],
2520 [ char *utmpx = UTMPX_FILE; ],
2521 [ AC_MSG_RESULT(yes) ],
2522 [ AC_MSG_RESULT(no)
2523 system_utmpx_path=no ]
2524)
2525if test -z "$conf_utmpx_location"; then
2526 if test x"$system_utmpx_path" = x"no" ; then
2527 AC_DEFINE(DISABLE_UTMPX)
2528 fi
2529else
2530 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2531fi
2532
2533dnl wtmpx detection
2534AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2535AC_TRY_COMPILE([
2536#include <sys/types.h>
2537#include <utmp.h>
2538#ifdef HAVE_UTMPX_H
2539#include <utmpx.h>
2540#endif
Damien Miller2994e082000-06-04 15:51:47 +10002541#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002542# include <paths.h>
2543#endif
2544 ],
2545 [ char *wtmpx = WTMPX_FILE; ],
2546 [ AC_MSG_RESULT(yes) ],
2547 [ AC_MSG_RESULT(no)
2548 system_wtmpx_path=no ]
2549)
2550if test -z "$conf_wtmpx_location"; then
2551 if test x"$system_wtmpx_path" = x"no" ; then
2552 AC_DEFINE(DISABLE_WTMPX)
2553 fi
2554else
2555 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2556fi
2557
Damien Miller4018c192000-04-30 09:30:44 +10002558
Damien Miller29ea30d2000-03-17 10:54:15 +11002559if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002560 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2561 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002562fi
2563
Tim Rice4cec93f2002-02-26 08:40:48 -08002564dnl remove pam and dl because they are in $LIBPAM
2565if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002566 LIBS=`echo $LIBS | sed 's/-lpam //'`
2567fi
2568if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2569 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002570fi
2571
Damien Millerbac2d8a2000-09-05 16:13:06 +11002572AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002573AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2574AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002575
Damien Miller7b22d652000-06-18 14:07:04 +10002576# Print summary of options
2577
Damien Miller7b22d652000-06-18 14:07:04 +10002578# Someone please show me a better way :)
2579A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2580B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2581C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2582D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002583E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002584F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002585G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002586H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2587I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2588J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002589
2590echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002591echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002592echo " User binaries: $B"
2593echo " System binaries: $C"
2594echo " Configuration files: $D"
2595echo " Askpass program: $E"
2596echo " Manual pages: $F"
2597echo " PID file: $G"
2598echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002599if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002600echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002601else
Damien Millerf58c6722002-05-13 13:15:42 +10002602echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002603fi
Damien Millera18bbd32002-05-13 10:48:57 +10002604if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002605echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002606fi
Damien Millerf58c6722002-05-13 13:15:42 +10002607echo " Manpage format: $MANTYPE"
Damien Miller9d2be482003-05-15 11:12:19 +10002608echo " DNS support: $DNS_MSG"
Damien Miller7abe09b2003-05-15 10:53:49 +10002609echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002610echo " KerberosV support: $KRB5_MSG"
2611echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002612echo " S/KEY support: $SKEY_MSG"
2613echo " TCP Wrappers support: $TCPW_MSG"
2614echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002615echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002616echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2617echo " BSD Auth support: $BSD_AUTH_MSG"
2618echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002619if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002620echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002621fi
2622
Damien Miller7b22d652000-06-18 14:07:04 +10002623echo ""
2624
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002625echo " Host: ${host}"
2626echo " Compiler: ${CC}"
2627echo " Compiler flags: ${CFLAGS}"
2628echo "Preprocessor flags: ${CPPFLAGS}"
2629echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002630echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002631
2632echo ""
2633
Damien Miller82cf0ce2000-12-20 13:34:48 +11002634if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002635 echo "PAM is enabled. You may need to install a PAM control file "
2636 echo "for sshd, otherwise password authentication may fail. "
2637 echo "Example PAM control files can be found in the contrib/ "
2638 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002639 echo ""
2640fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002641
Damien Miller6c21c512002-01-22 21:57:53 +11002642if test ! -z "$RAND_HELPER_CMDHASH" ; then
2643 echo "WARNING: you are using the builtin random number collection "
2644 echo "service. Please read WARNING.RNG and request that your OS "
2645 echo "vendor includes kernel-based random number collection in "
2646 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002647 echo ""
2648fi
Damien Miller60396b02001-02-18 17:01:00 +11002649