blob: 5f302f5e5b9072fed90eed0ba316d8c046fdcf53 [file] [log] [blame]
Damien Millera8e06ce2003-11-21 23:48:55 +11001# $Id: configure.ac,v 1.174 2003/11/21 12:48:55 djm Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Tim Rice13aae5e2001-10-21 17:53:58 -07003AC_INIT
4AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +10005
6AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11007AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11008AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11009AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100010
Damien Millera22ba012000-03-02 23:09:20 +110011# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100012AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110013AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100014AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110015AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000016AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070017AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080018AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110019AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100020AC_PATH_PROG(ENT, ent)
21AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110022AC_PATH_PROG(TEST_MINUS_S_SH, bash)
23AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
24AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070025AC_PATH_PROG(SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110026
Damien Millere8bb4502001-09-25 16:39:35 +100027# System features
28AC_SYS_LARGEFILE
29
Damien Miller3f62aba2000-11-29 11:56:35 +110030if test -z "$AR" ; then
31 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
32fi
33
Damien Millerad833b32000-08-23 10:46:23 +100034# Use LOGIN_PROGRAM from environment if possible
35if test ! -z "$LOGIN_PROGRAM" ; then
36 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
37else
38 # Search for login
39 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
40 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
41 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
42 fi
43fi
44
Damien Miller166bd442000-03-16 10:48:25 +110045if test -z "$LD" ; then
46 LD=$CC
47fi
48AC_SUBST(LD)
49
Damien Miller166bd442000-03-16 10:48:25 +110050AC_C_INLINE
Damien Millera8e06ce2003-11-21 23:48:55 +110051if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100052 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110053fi
54
Damien Millera22ba012000-03-02 23:09:20 +110055# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110056case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110057*-*-aix*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000058 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110059 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +110060 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +100061 if (test -z "$blibpath"); then
62 blibpath="/usr/lib:/lib:/usr/local/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +110063 fi
Damien Millereab4bae2003-04-29 23:22:40 +100064 saved_LDFLAGS="$LDFLAGS"
65 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
66 if (test -z "$blibflags"); then
67 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
68 AC_TRY_LINK([], [], [blibflags=$tryflags])
69 fi
70 done
71 if (test -z "$blibflags"); then
72 AC_MSG_RESULT(not found)
73 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
74 else
75 AC_MSG_RESULT($blibflags)
76 fi
77 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +100078 dnl Check for authenticate. Might be in libs.a on older AIXes
79 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -070080 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +100081 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -070082 LIBS="$LIBS -ls"
83 ])
84 ])
Darren Tucker5c6a91a2003-07-14 16:21:44 +100085 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
86 AC_CHECK_DECL(loginfailed,
87 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
88 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +100089 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +100090 [(void)loginfailed("user","host","tty",0);],
91 [AC_MSG_RESULT(yes)
92 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +100093 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +100094 )],
95 [],
96 [#include <usersec.h>]
97 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +100098 AC_CHECK_FUNCS(setauthdb)
Damien Millereca71f82000-01-20 22:38:27 +110099 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +1000100 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000101 AC_DEFINE(SETEUID_BREAKS_SETUID)
102 AC_DEFINE(BROKEN_SETREUID)
103 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000104 dnl AIX handles lastlog as part of its login message
105 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000106 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000107 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100108 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100109*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100110 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800111 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100112 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000113 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100114 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100115 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000116 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000117 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700118 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +0000119 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100120 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000121*-*-dgux*)
122 AC_DEFINE(IP_TOS_IS_BROKEN)
123 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000124*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000125 AC_MSG_CHECKING(if we have working getaddrinfo)
126 AC_TRY_RUN([#include <mach-o/dyld.h>
127main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
128 exit(0);
129 else
130 exit(1);
131}], [AC_MSG_RESULT(working)],
132 [AC_MSG_RESULT(buggy)
133 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700134 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000135 AC_DEFINE(SETEUID_BREAKS_SETUID)
136 AC_DEFINE(BROKEN_SETREUID)
137 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000138 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000139*-*-hpux10.26)
140 if test -z "$GCC"; then
141 CFLAGS="$CFLAGS -Ae"
142 fi
143 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
144 IPADDR_IN_DISPLAY=yes
145 AC_DEFINE(HAVE_SECUREWARE)
146 AC_DEFINE(USE_PIPES)
147 AC_DEFINE(LOGIN_NO_ENDOPT)
148 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000149 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000150 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000151 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700152 LIBS="$LIBS -lsec -lsecpw"
153 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000154 disable_ptmx_check=yes
155 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100156*-*-hpux10*)
157 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000158 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100159 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000160 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100161 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000162 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000163 AC_DEFINE(LOGIN_NO_ENDOPT)
164 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100165 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000166 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000167 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700168 LIBS="$LIBS -lsec"
169 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100170 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000171*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000172 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100173 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100174 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100175 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000176 AC_DEFINE(LOGIN_NO_ENDOPT)
177 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100178 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000179 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000180 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700181 LIBS="$LIBS -lsec"
182 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000183 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100184*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000185 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000186 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100187 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000188 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000189 AC_DEFINE(SETEUID_BREAKS_SETUID)
190 AC_DEFINE(BROKEN_SETREUID)
191 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000192 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000193 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100194 ;;
195*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000196 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000197 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100198 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000199 AC_DEFINE(WITH_IRIX_ARRAY)
200 AC_DEFINE(WITH_IRIX_PROJECT)
201 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000202 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000203 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000204 AC_DEFINE(SETEUID_BREAKS_SETUID)
205 AC_DEFINE(BROKEN_SETREUID)
206 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000207 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000208 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100209 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100210*-*-linux*)
211 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100212 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000213 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100214 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000215 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000216 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
Damien Miller35276252003-06-03 10:14:28 +1000217 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller7bcb0892000-03-11 20:45:40 +1100218 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000219 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000220 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000221 AC_DEFINE(BROKEN_CMSG_TYPE)
222 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000223 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100224 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000225mips-sony-bsd|mips-sony-newsos4)
226 AC_DEFINE(HAVE_NEWS4)
227 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000228 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100229*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000230 check_for_libcrypt_before=1
Damien Millera22ba012000-03-02 23:09:20 +1100231 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100232 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100233*-*-freebsd*)
234 check_for_libcrypt_later=1
235 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000236*-*-bsdi*)
237 AC_DEFINE(SETEUID_BREAKS_SETUID)
238 AC_DEFINE(BROKEN_SETREUID)
239 AC_DEFINE(BROKEN_SETREGID)
240 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000241*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000242 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100243 conf_utmp_location=/etc/utmp
244 conf_wtmp_location=/usr/adm/wtmp
245 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000246 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000247 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000248 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100249 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000250 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000251 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000252 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100253*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000254 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera8e06ce2003-11-21 23:48:55 +1100255 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100256 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100257 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000258 AC_DEFINE(LOGIN_NEEDS_UTMPX)
259 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000260 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000261 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000262 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
263 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000264 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000265 # hardwire lastlog location (can't detect it on some versions)
266 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000267 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
268 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
269 if test "$sol2ver" -ge 8; then
270 AC_MSG_RESULT(yes)
271 AC_DEFINE(DISABLE_UTMP)
272 AC_DEFINE(DISABLE_WTMP)
273 else
274 AC_MSG_RESULT(no)
275 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100276 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000277*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000278 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000279 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100280 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000281 conf_utmp_location=/etc/utmp
282 conf_wtmp_location=/var/adm/wtmp
283 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000284 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000285 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000286*-ncr-sysv*)
287 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
288 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700289 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000290 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000291 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000292 AC_DEFINE(SETEUID_BREAKS_SETUID)
293 AC_DEFINE(BROKEN_SETREUID)
294 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000295 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000296*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000297 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700298 # /usr/ucblib MUST NOT be searched on ReliantUNIX
299 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Darren Tucker89df7a32003-10-07 20:35:57 +1000300 AC_CHECK_LIB(dl, dlsym, ,)
Damien Millerfd9885e2001-01-10 08:16:53 +1100301 IPADDR_IN_DISPLAY=yes
302 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000303 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000304 AC_DEFINE(SETEUID_BREAKS_SETUID)
305 AC_DEFINE(BROKEN_SETREUID)
306 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000307 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000308 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700309 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
310 # Attention: always take care to bind libsocket and libnsl before libc,
311 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000312 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100313*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000314 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100315 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100316 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700317 AC_DEFINE(SETEUID_BREAKS_SETUID)
318 AC_DEFINE(BROKEN_SETREUID)
319 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100320 ;;
321*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000322 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100323 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100324 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700325 AC_DEFINE(SETEUID_BREAKS_SETUID)
326 AC_DEFINE(BROKEN_SETREUID)
327 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100328 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100329*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000330 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100331 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100332 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100333*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000334 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100335 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700336 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100337 RANLIB=true
338 no_dev_ptmx=1
339 AC_DEFINE(BROKEN_SYS_TERMIO_H)
340 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000341 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000342 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100343 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Riceae477e92003-09-12 18:15:15 -0700344 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100345 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700346 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700347 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100348 ;;
349*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800350 if test -z "$GCC"; then
351 CFLAGS="$CFLAGS -belf"
352 fi
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000353 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000354 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100355 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000356 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100357 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000358 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000359 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700360 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700361 AC_DEFINE(SETEUID_BREAKS_SETUID)
362 AC_DEFINE(BROKEN_SETREUID)
363 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700364 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100365 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700366 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000367 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000368*-*-unicosmk*)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000369 AC_DEFINE(USE_PIPES)
370 AC_DEFINE(DISABLE_FD_PASSING)
371 LDFLAGS="$LDFLAGS"
372 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
373 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000374 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000375*-*-unicosmp*)
376 AC_DEFINE(WITH_ABBREV_NO_TTY)
377 AC_DEFINE(USE_PIPES)
378 AC_DEFINE(DISABLE_FD_PASSING)
379 LDFLAGS="$LDFLAGS"
380 LIBS="$LIBS -lgen -lacid"
381 MANTYPE=cat
382 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000383*-*-unicos*)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000384 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700385 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700386 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000387 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
388 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
389 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700390 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000391*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000392 AC_MSG_CHECKING(for Digital Unix SIA)
393 no_osfsia=""
394 AC_ARG_WITH(osfsia,
395 [ --with-osfsia Enable Digital Unix SIA],
396 [
397 if test "x$withval" = "xno" ; then
398 AC_MSG_RESULT(disabled)
399 no_osfsia=1
400 fi
401 ],
402 )
403 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000404 if test -f /etc/sia/matrix.conf; then
405 AC_MSG_RESULT(yes)
406 AC_DEFINE(HAVE_OSF_SIA)
407 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000408 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000409 LIBS="$LIBS -lsecurity -ldb -lm -laud"
410 else
411 AC_MSG_RESULT(no)
412 fi
413 fi
Ben Lindstromdc3c7572002-10-04 23:54:54 +0000414 AC_DEFINE(DISABLE_FD_PASSING)
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000415 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700416 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000417 AC_DEFINE(BROKEN_SETREUID)
418 AC_DEFINE(BROKEN_SETREGID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000419 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000420 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000421
422*-*-nto-qnx)
423 AC_DEFINE(USE_PIPES)
424 AC_DEFINE(NO_X11_UNIX_SOCKETS)
425 AC_DEFINE(MISSING_NFDBITS)
426 AC_DEFINE(MISSING_HOWMANY)
427 AC_DEFINE(MISSING_FD_MASK)
428 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100429esac
430
Damien Millere37bfc12000-06-05 09:37:43 +1000431# Allow user to specify flags
432AC_ARG_WITH(cflags,
433 [ --with-cflags Specify additional flags to pass to compiler],
434 [
435 if test "x$withval" != "xno" ; then
436 CFLAGS="$CFLAGS $withval"
437 fi
438 ]
439)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000440AC_ARG_WITH(cppflags,
441 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
442 [
443 if test "x$withval" != "xno"; then
444 CPPFLAGS="$CPPFLAGS $withval"
445 fi
446 ]
447)
Damien Millere37bfc12000-06-05 09:37:43 +1000448AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000449 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000450 [
451 if test "x$withval" != "xno" ; then
452 LDFLAGS="$LDFLAGS $withval"
453 fi
454 ]
455)
456AC_ARG_WITH(libs,
457 [ --with-libs Specify additional libraries to link with],
458 [
459 if test "x$withval" != "xno" ; then
460 LIBS="$LIBS $withval"
461 fi
462 ]
463)
464
Darren Tucker6eb93042003-06-29 21:30:41 +1000465AC_MSG_CHECKING(compiler and flags for sanity)
466AC_TRY_RUN([
467#include <stdio.h>
468int main(){exit(0);}
469 ],
470 [ AC_MSG_RESULT(yes) ],
471 [
472 AC_MSG_RESULT(no)
473 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
474 ]
475)
476
Tim Rice4cec93f2002-02-26 08:40:48 -0800477# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000478AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000479 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800480 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000481 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000482 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000483 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
484 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
Ben Lindstrom4b0f1ad2003-02-01 04:43:34 +0000485 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
Tim Rice81ed5182002-09-25 17:38:46 -0700486 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
Damien Miller5c3a5582003-09-23 22:12:38 +1000487 util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800488
Damien Millera22ba012000-03-02 23:09:20 +1100489# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700490AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
491AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000492
Damien Millerdf288022001-02-18 13:07:07 +1100493dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700494if test "x$with_tcp_wrappers" != "xno" ; then
495 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
496 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
497 fi
498fi
Damien Millerdf288022001-02-18 13:07:07 +1100499
Tim Rice1e1ef642003-09-11 22:19:31 -0700500dnl IRIX and Solaris 2.5.1 have dirname() in libgen
501AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
502 AC_CHECK_LIB(gen, dirname,[
503 AC_CACHE_CHECK([for broken dirname],
504 ac_cv_have_broken_dirname, [
505 save_LIBS="$LIBS"
506 LIBS="$LIBS -lgen"
507 AC_TRY_RUN(
508 [
509#include <libgen.h>
510#include <string.h>
511
512int main(int argc, char **argv) {
513 char *s, buf[32];
514
515 strncpy(buf,"/etc", 32);
516 s = dirname(buf);
517 if (!s || strncmp(s, "/", 32) != 0) {
518 exit(1);
519 } else {
520 exit(0);
521 }
522}
523 ],
524 [ ac_cv_have_broken_dirname="no" ],
525 [ ac_cv_have_broken_dirname="yes" ]
526 )
527 LIBS="$save_LIBS"
528 ])
529 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
530 LIBS="$LIBS -lgen"
531 AC_DEFINE(HAVE_DIRNAME)
532 AC_CHECK_HEADERS(libgen.h)
533 fi
534 ])
535])
536
537AC_CHECK_FUNC(getspnam, ,
538 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
539AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
540
Damien Miller150c8b52002-02-13 23:06:56 +1100541AC_ARG_WITH(rpath,
542 [ --without-rpath Disable auto-added -R linker paths],
543 [
544 if test "x$withval" = "xno" ; then
545 need_dash_r=""
546 fi
547 if test "x$withval" = "xyes" ; then
548 need_dash_r=1
549 fi
550 ]
551)
552
Tim Rice13aae5e2001-10-21 17:53:58 -0700553dnl zlib is required
554AC_ARG_WITH(zlib,
555 [ --with-zlib=PATH Use zlib in PATH],
556 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000557 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100558 AC_MSG_ERROR([*** zlib is required ***])
559 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700560 if test -d "$withval/lib"; then
561 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700562 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700563 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700564 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700565 fi
566 else
567 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700568 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700569 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700570 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700571 fi
572 fi
573 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700574 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700575 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700576 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700577 fi
578 ]
579)
580
Tim Rice17b93e52001-10-23 22:36:54 -0700581AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100582
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000583dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100584AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000585 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
586)
Damien Millera8e06ce2003-11-21 23:48:55 +1100587AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700588 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
589 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000590)
Damien Millerab18c411999-11-11 10:40:23 +1100591
Tim Ricee589a292001-11-03 11:09:32 -0800592dnl Checks for libutil functions
593AC_CHECK_HEADERS(libutil.h)
594AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
595AC_CHECK_FUNCS(logout updwtmp logwtmp)
596
Ben Lindstrom8697e082001-02-24 21:41:10 +0000597AC_FUNC_STRFTIME
598
Damien Miller3c027682001-03-14 11:39:45 +1100599# Check for ALTDIRFUNC glob() extension
600AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
601AC_EGREP_CPP(FOUNDIT,
602 [
603 #include <glob.h>
604 #ifdef GLOB_ALTDIRFUNC
605 FOUNDIT
606 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100607 ],
Damien Miller3c027682001-03-14 11:39:45 +1100608 [
609 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
610 AC_MSG_RESULT(yes)
611 ],
612 [
613 AC_MSG_RESULT(no)
614 ]
615)
Damien Millerab18c411999-11-11 10:40:23 +1100616
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000617# Check for g.gl_matchc glob() extension
618AC_MSG_CHECKING(for gl_matchc field in glob_t)
619AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100620 [
621 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000622 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100623 ],
624 [
625 AC_DEFINE(GLOB_HAS_GL_MATCHC)
626 AC_MSG_RESULT(yes)
627 ],
628 [
629 AC_MSG_RESULT(no)
630 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000631)
632
Damien Miller18bb4732001-03-28 14:35:30 +1000633AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
634AC_TRY_RUN(
635 [
636#include <sys/types.h>
637#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700638int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000639 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100640 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000641 [
642 AC_MSG_RESULT(no)
643 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
644 ]
645)
646
Damien Millerc547bf12001-02-16 10:18:12 +1100647# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100648SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100649AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700650 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100651 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100652 [
653 if test "x$withval" != "xno" ; then
654
655 if test "x$withval" != "xyes" ; then
656 CPPFLAGS="$CPPFLAGS -I${withval}/include"
657 LDFLAGS="$LDFLAGS -L${withval}/lib"
658 fi
659
660 AC_DEFINE(SKEY)
661 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100662 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100663
Tim Rice4cec93f2002-02-26 08:40:48 -0800664 AC_MSG_CHECKING([for s/key support])
665 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100666 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800667#include <stdio.h>
668#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700669int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800670 ],
671 [AC_MSG_RESULT(yes)],
672 [
673 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100674 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
675 ])
676 fi
677 ]
678)
679
680# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700681TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100682AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700683 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100684 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100685 [
686 if test "x$withval" != "xno" ; then
687 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700688 saved_LDFLAGS="$LDFLAGS"
689 saved_CPPFLAGS="$CPPFLAGS"
690 if test -n "${withval}" -a "${withval}" != "yes"; then
691 if test -d "${withval}/lib"; then
692 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700693 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700694 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700695 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700696 fi
697 else
698 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700699 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700700 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700701 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700702 fi
703 fi
704 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700705 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700706 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700707 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700708 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700709 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800710 LIBWRAP="-lwrap"
711 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100712 AC_MSG_CHECKING(for libwrap)
713 AC_TRY_LINK(
714 [
715#include <tcpd.h>
716 int deny_severity = 0, allow_severity = 0;
717 ],
718 [hosts_access(0);],
719 [
720 AC_MSG_RESULT(yes)
721 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800722 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700723 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100724 ],
725 [
726 AC_MSG_ERROR([*** libwrap missing])
727 ]
728 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800729 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100730 fi
731 ]
732)
733
Damien Millerfe1f1432003-02-24 15:45:42 +1100734dnl Checks for library functions. Please keep in alphabetical order
735AC_CHECK_FUNCS(\
Damien Millerf09ad862003-09-19 16:41:01 +1000736 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
Damien Miller5fe46a42003-06-05 09:53:31 +1000737 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000738 getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000739 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100740 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000741 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
742 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
743 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Damien Miller5fe46a42003-06-05 09:53:31 +1000744 setproctitle setregid setresgid setresuid setreuid setrlimit \
745 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000746 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tuckerf38ea772003-08-13 20:48:07 +1000747 truncate utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100748)
Tim Rice13aae5e2001-10-21 17:53:58 -0700749
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000750# IRIX has a const char return value for gai_strerror()
751AC_CHECK_FUNCS(gai_strerror,[
752 AC_DEFINE(HAVE_GAI_STRERROR)
753 AC_TRY_COMPILE([
754#include <sys/types.h>
755#include <sys/socket.h>
756#include <netdb.h>
757
758const char *gai_strerror(int);],[
759char *str;
760
761str = gai_strerror(0);],[
762 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
763 [Define if gai_strerror() returns const char *])])])
764
Damien Millercd6853c2003-01-28 11:33:42 +1100765AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
766
Darren Tuckerf1159b52003-07-07 19:44:01 +1000767dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000768AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000769AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000770
Darren Tuckerb2427c82003-09-10 15:22:44 +1000771dnl tcsendbreak might be a macro
772AC_CHECK_DECL(tcsendbreak,
773 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100774 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000775 [#include <termios.h>]
776)
777
Damien Millerad833b32000-08-23 10:46:23 +1000778dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000779AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000780dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000781AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000782AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000783dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000784AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000785AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100786
Damien Millera8e06ce2003-11-21 23:48:55 +1100787AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100788 [AC_DEFINE(HAVE_DAEMON)],
789 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
790)
791
Damien Millera8e06ce2003-11-21 23:48:55 +1100792AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100793 [AC_DEFINE(HAVE_GETPAGESIZE)],
794 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
795)
796
Damien Millercb170cb2000-07-01 16:52:55 +1000797# Check for broken snprintf
798if test "x$ac_cv_func_snprintf" = "xyes" ; then
799 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
800 AC_TRY_RUN(
801 [
802#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700803int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000804 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100805 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000806 [
807 AC_MSG_RESULT(no)
808 AC_DEFINE(BROKEN_SNPRINTF)
809 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
810 ]
811 )
812fi
813
Damien Millere8328192003-01-07 15:18:32 +1100814dnl see whether mkstemp() requires XXXXXX
815if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
816AC_MSG_CHECKING([for (overly) strict mkstemp])
817AC_TRY_RUN(
818 [
819#include <stdlib.h>
820main() { char template[]="conftest.mkstemp-test";
821if (mkstemp(template) == -1)
822 exit(1);
823unlink(template); exit(0);
824}
825 ],
826 [
827 AC_MSG_RESULT(no)
828 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100829 [
Damien Millere8328192003-01-07 15:18:32 +1100830 AC_MSG_RESULT(yes)
831 AC_DEFINE(HAVE_STRICT_MKSTEMP)
832 ],
833 [
834 AC_MSG_RESULT(yes)
835 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +1100836 ]
Damien Millere8328192003-01-07 15:18:32 +1100837)
838fi
839
Darren Tucker70a3d552003-08-21 17:58:29 +1000840dnl make sure that openpty does not reacquire controlling terminal
841if test ! -z "$check_for_openpty_ctty_bug"; then
842 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
843 AC_TRY_RUN(
844 [
845#include <stdio.h>
846#include <sys/fcntl.h>
847#include <sys/types.h>
848#include <sys/wait.h>
849
850int
851main()
852{
853 pid_t pid;
854 int fd, ptyfd, ttyfd, status;
855
856 pid = fork();
857 if (pid < 0) { /* failed */
858 exit(1);
859 } else if (pid > 0) { /* parent */
860 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +1100861 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +1000862 exit(WEXITSTATUS(status));
863 else
864 exit(2);
865 } else { /* child */
866 close(0); close(1); close(2);
867 setsid();
868 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
869 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
870 if (fd >= 0)
871 exit(3); /* Acquired ctty: broken */
872 else
873 exit(0); /* Did not acquire ctty: OK */
874 }
875}
876 ],
877 [
878 AC_MSG_RESULT(yes)
879 ],
880 [
881 AC_MSG_RESULT(no)
882 AC_DEFINE(SSHD_ACQUIRES_CTTY)
883 ]
884 )
885fi
886
Damien Miller606f8802000-09-16 15:39:56 +1100887AC_FUNC_GETPGRP
888
Damien Millera64b57a2001-01-17 10:44:13 +1100889# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000890PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100891AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100892 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100893 [
Damien Millera64b57a2001-01-17 10:44:13 +1100894 if test "x$withval" != "xno" ; then
895 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
896 AC_MSG_ERROR([PAM headers not found])
897 fi
898
899 AC_CHECK_LIB(dl, dlopen, , )
900 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
901 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000902 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +1100903
Damien Millera64b57a2001-01-17 10:44:13 +1100904 PAM_MSG="yes"
905
906 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800907 if test $ac_cv_lib_dl_dlopen = yes; then
908 LIBPAM="-lpam -ldl"
909 else
910 LIBPAM="-lpam"
911 fi
912 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100913 fi
914 ]
915)
Damien Millera22ba012000-03-02 23:09:20 +1100916
Damien Millera64b57a2001-01-17 10:44:13 +1100917# Check for older PAM
918if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100919 # Check PAM strerror arguments (old PAM)
920 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
921 AC_TRY_COMPILE(
922 [
Damien Miller81171112000-04-23 11:14:01 +1000923#include <stdlib.h>
924#include <security/pam_appl.h>
Damien Millera8e06ce2003-11-21 23:48:55 +1100925 ],
926 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +1100927 [AC_MSG_RESULT(no)],
928 [
929 AC_DEFINE(HAVE_OLD_PAM)
930 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000931 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100932 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100933 )
Damien Millera22ba012000-03-02 23:09:20 +1100934fi
935
Damien Millerfc93d4b2002-09-04 23:26:29 +1000936# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
937# because the system crypt() is more featureful.
938if test "x$check_for_libcrypt_before" = "x1"; then
939 AC_CHECK_LIB(crypt, crypt)
940fi
941
Tim Riceaef73712002-05-11 13:17:42 -0700942# Search for OpenSSL
943saved_CPPFLAGS="$CPPFLAGS"
944saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100945AC_ARG_WITH(ssl-dir,
946 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
947 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000948 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700949 if test -d "$withval/lib"; then
950 if test -n "${need_dash_r}"; then
951 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
952 else
953 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
954 fi
955 else
956 if test -n "${need_dash_r}"; then
957 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
958 else
959 LDFLAGS="-L${withval} ${LDFLAGS}"
960 fi
961 fi
962 if test -d "$withval/include"; then
963 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
964 else
965 CPPFLAGS="-I${withval} ${CPPFLAGS}"
966 fi
Damien Millera22ba012000-03-02 23:09:20 +1100967 fi
968 ]
969)
Tim Riceaef73712002-05-11 13:17:42 -0700970LIBS="$LIBS -lcrypto"
971AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000972 [
Tim Riceaef73712002-05-11 13:17:42 -0700973 dnl Check default openssl install dir
974 if test -n "${need_dash_r}"; then
975 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000976 else
Tim Riceaef73712002-05-11 13:17:42 -0700977 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000978 fi
Tim Riceaef73712002-05-11 13:17:42 -0700979 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
980 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
981 [
982 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
983 ]
984 )
985 ]
986)
987
Tim Riced730b782002-08-13 18:52:10 -0700988# Determine OpenSSL header version
989AC_MSG_CHECKING([OpenSSL header version])
990AC_TRY_RUN(
991 [
992#include <stdio.h>
993#include <string.h>
994#include <openssl/opensslv.h>
995#define DATA "conftest.sslincver"
996int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +1100997 FILE *fd;
998 int rc;
Tim Riced730b782002-08-13 18:52:10 -0700999
Damien Millera8e06ce2003-11-21 23:48:55 +11001000 fd = fopen(DATA,"w");
1001 if(fd == NULL)
1002 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001003
1004 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1005 exit(1);
1006
1007 exit(0);
1008}
1009 ],
1010 [
1011 ssl_header_ver=`cat conftest.sslincver`
1012 AC_MSG_RESULT($ssl_header_ver)
1013 ],
1014 [
1015 AC_MSG_RESULT(not found)
1016 AC_MSG_ERROR(OpenSSL version header not found.)
1017 ]
1018)
1019
1020# Determine OpenSSL library version
1021AC_MSG_CHECKING([OpenSSL library version])
1022AC_TRY_RUN(
1023 [
1024#include <stdio.h>
1025#include <string.h>
1026#include <openssl/opensslv.h>
1027#include <openssl/crypto.h>
1028#define DATA "conftest.ssllibver"
1029int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001030 FILE *fd;
1031 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001032
Damien Millera8e06ce2003-11-21 23:48:55 +11001033 fd = fopen(DATA,"w");
1034 if(fd == NULL)
1035 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001036
1037 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1038 exit(1);
1039
1040 exit(0);
1041}
1042 ],
1043 [
1044 ssl_library_ver=`cat conftest.ssllibver`
1045 AC_MSG_RESULT($ssl_library_ver)
1046 ],
1047 [
1048 AC_MSG_RESULT(not found)
1049 AC_MSG_ERROR(OpenSSL library not found.)
1050 ]
1051)
Damien Millera22ba012000-03-02 23:09:20 +11001052
Damien Millerec932372002-01-22 22:16:03 +11001053# Sanity check OpenSSL headers
1054AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1055AC_TRY_RUN(
1056 [
1057#include <string.h>
1058#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001059int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001060 ],
1061 [
1062 AC_MSG_RESULT(yes)
1063 ],
1064 [
1065 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001066 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1067Check config.log for details.
1068Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001069 ]
1070)
1071
Damien Millera8e06ce2003-11-21 23:48:55 +11001072# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Damien Millera64b57a2001-01-17 10:44:13 +11001073# version in OpenSSL. Skip this for PAM
Damien Miller4f9f42a2003-05-10 19:28:02 +10001074if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001075 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001076fi
1077
Damien Miller6c21c512002-01-22 21:57:53 +11001078
1079### Configure cryptographic random number support
1080
1081# Check wheter OpenSSL seeds itself
1082AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1083AC_TRY_RUN(
1084 [
1085#include <string.h>
1086#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001087int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001088 ],
1089 [
1090 OPENSSL_SEEDS_ITSELF=yes
1091 AC_MSG_RESULT(yes)
1092 ],
1093 [
1094 AC_MSG_RESULT(no)
1095 # Default to use of the rand helper if OpenSSL doesn't
1096 # seed itself
1097 USE_RAND_HELPER=yes
1098 ]
1099)
1100
1101
1102# Do we want to force the use of the rand helper?
1103AC_ARG_WITH(rand-helper,
1104 [ --with-rand-helper Use subprocess to gather strong randomness ],
1105 [
1106 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001107 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001108 # the previous test showed it to be unseeded.
1109 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1110 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1111 OPENSSL_SEEDS_ITSELF=yes
1112 USE_RAND_HELPER=""
1113 fi
1114 else
1115 USE_RAND_HELPER=yes
1116 fi
1117 ],
1118)
1119
1120# Which randomness source do we use?
1121if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1122 # OpenSSL only
1123 AC_DEFINE(OPENSSL_PRNG_ONLY)
1124 RAND_MSG="OpenSSL internal ONLY"
1125 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001126elif test ! -z "$USE_RAND_HELPER" ; then
1127 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001128 RAND_MSG="ssh-rand-helper"
1129 INSTALL_SSH_RAND_HELPER="yes"
1130fi
1131AC_SUBST(INSTALL_SSH_RAND_HELPER)
1132
1133### Configuration of ssh-rand-helper
1134
1135# PRNGD TCP socket
1136AC_ARG_WITH(prngd-port,
1137 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1138 [
Damien Millere996d722002-01-23 11:20:59 +11001139 case "$withval" in
1140 no)
1141 withval=""
1142 ;;
1143 [[0-9]]*)
1144 ;;
1145 *)
1146 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1147 ;;
1148 esac
1149 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001150 PRNGD_PORT="$withval"
1151 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1152 fi
1153 ]
1154)
1155
1156# PRNGD Unix domain socket
1157AC_ARG_WITH(prngd-socket,
1158 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1159 [
Damien Millere996d722002-01-23 11:20:59 +11001160 case "$withval" in
1161 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001162 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001163 ;;
1164 no)
1165 withval=""
1166 ;;
1167 /*)
1168 ;;
1169 *)
1170 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1171 ;;
1172 esac
1173
1174 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001175 if test ! -z "$PRNGD_PORT" ; then
1176 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1177 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001178 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001179 AC_MSG_WARN(Entropy socket is not readable)
1180 fi
1181 PRNGD_SOCKET="$withval"
1182 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1183 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001184 ],
1185 [
1186 # Check for existing socket only if we don't have a random device already
1187 if test "$USE_RAND_HELPER" = yes ; then
1188 AC_MSG_CHECKING(for PRNGD/EGD socket)
1189 # Insert other locations here
1190 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1191 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1192 PRNGD_SOCKET="$sock"
1193 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1194 break;
1195 fi
1196 done
1197 if test ! -z "$PRNGD_SOCKET" ; then
1198 AC_MSG_RESULT($PRNGD_SOCKET)
1199 else
1200 AC_MSG_RESULT(not found)
1201 fi
1202 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001203 ]
1204)
1205
1206# Change default command timeout for hashing entropy source
1207entropy_timeout=200
1208AC_ARG_WITH(entropy-timeout,
1209 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1210 [
1211 if test "x$withval" != "xno" ; then
1212 entropy_timeout=$withval
1213 fi
1214 ]
1215)
Damien Miller6c21c512002-01-22 21:57:53 +11001216AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1217
Damien Millerd3f6ad22002-06-25 10:24:47 +10001218SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001219AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001220 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001221 [
1222 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001223 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001224 fi
1225 ]
1226)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001227AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1228AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001229
Tim Rice88f2ab52002-03-17 12:17:34 -08001230# We do this little dance with the search path to insure
1231# that programs that we select for use by installed programs
1232# (which may be run by the super-user) come from trusted
1233# locations before they come from the user's private area.
1234# This should help avoid accidentally configuring some
1235# random version of a program in someone's personal bin.
1236
1237OPATH=$PATH
1238PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001239test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001240test -d /sbin && PATH=$PATH:/sbin
1241test -d /usr/sbin && PATH=$PATH:/usr/sbin
1242PATH=$PATH:/etc:$OPATH
1243
Damien Millera8e06ce2003-11-21 23:48:55 +11001244# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001245OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1246OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1247OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1248OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1249OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1250OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1251OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1252OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1253OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1254OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1255OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1256OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1257OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1258OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1259OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1260OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001261# restore PATH
1262PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001263
1264# Where does ssh-rand-helper get its randomness from?
1265INSTALL_SSH_PRNG_CMDS=""
1266if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1267 if test ! -z "$PRNGD_PORT" ; then
1268 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1269 elif test ! -z "$PRNGD_SOCKET" ; then
1270 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1271 else
1272 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1273 RAND_HELPER_CMDHASH=yes
1274 INSTALL_SSH_PRNG_CMDS="yes"
1275 fi
1276fi
1277AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1278
1279
Ben Lindstromb5628642000-10-18 00:02:25 +00001280# Cheap hack to ensure NEWS-OS libraries are arranged right.
1281if test ! -z "$SONY" ; then
1282 LIBS="$LIBS -liberty";
1283fi
1284
Damien Millera22ba012000-03-02 23:09:20 +11001285# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001286AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001287AC_CHECK_SIZEOF(short int, 2)
1288AC_CHECK_SIZEOF(int, 4)
1289AC_CHECK_SIZEOF(long int, 4)
1290AC_CHECK_SIZEOF(long long int, 8)
1291
Damien Millerfa2bb692002-04-23 23:22:25 +10001292# Sanity check long long for some platforms (AIX)
1293if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1294 ac_cv_sizeof_long_long_int=0
1295fi
1296
Damien Millera22ba012000-03-02 23:09:20 +11001297# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001298AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1299 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001300 [ #include <sys/types.h> ],
1301 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001302 [ ac_cv_have_u_int="yes" ],
1303 [ ac_cv_have_u_int="no" ]
1304 )
1305])
1306if test "x$ac_cv_have_u_int" = "xyes" ; then
1307 AC_DEFINE(HAVE_U_INT)
1308 have_u_int=1
1309fi
1310
Damien Miller61e50f12000-05-08 20:49:37 +10001311AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1312 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001313 [ #include <sys/types.h> ],
1314 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001315 [ ac_cv_have_intxx_t="yes" ],
1316 [ ac_cv_have_intxx_t="no" ]
1317 )
1318])
1319if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1320 AC_DEFINE(HAVE_INTXX_T)
1321 have_intxx_t=1
1322fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001323
1324if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001325 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001326then
1327 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1328 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001329 [ #include <stdint.h> ],
1330 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001331 [
1332 AC_DEFINE(HAVE_INTXX_T)
1333 AC_MSG_RESULT(yes)
1334 ],
1335 [ AC_MSG_RESULT(no) ]
1336 )
1337fi
1338
Damien Miller578783e2000-09-23 14:12:24 +11001339AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1340 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001341 [
1342#include <sys/types.h>
1343#ifdef HAVE_STDINT_H
1344# include <stdint.h>
1345#endif
1346#include <sys/socket.h>
1347#ifdef HAVE_SYS_BITYPES_H
1348# include <sys/bitypes.h>
1349#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001350 ],
1351 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001352 [ ac_cv_have_int64_t="yes" ],
1353 [ ac_cv_have_int64_t="no" ]
1354 )
1355])
1356if test "x$ac_cv_have_int64_t" = "xyes" ; then
1357 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001358fi
1359
Damien Miller61e50f12000-05-08 20:49:37 +10001360AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1361 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001362 [ #include <sys/types.h> ],
1363 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001364 [ ac_cv_have_u_intxx_t="yes" ],
1365 [ ac_cv_have_u_intxx_t="no" ]
1366 )
1367])
1368if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1369 AC_DEFINE(HAVE_U_INTXX_T)
1370 have_u_intxx_t=1
1371fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001372
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001373if test -z "$have_u_intxx_t" ; then
1374 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1375 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001376 [ #include <sys/socket.h> ],
1377 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001378 [
1379 AC_DEFINE(HAVE_U_INTXX_T)
1380 AC_MSG_RESULT(yes)
1381 ],
1382 [ AC_MSG_RESULT(no) ]
1383 )
1384fi
1385
Damien Miller578783e2000-09-23 14:12:24 +11001386AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1387 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001388 [ #include <sys/types.h> ],
1389 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001390 [ ac_cv_have_u_int64_t="yes" ],
1391 [ ac_cv_have_u_int64_t="no" ]
1392 )
1393])
1394if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1395 AC_DEFINE(HAVE_U_INT64_T)
1396 have_u_int64_t=1
1397fi
1398
Tim Rice4cec93f2002-02-26 08:40:48 -08001399if test -z "$have_u_int64_t" ; then
1400 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1401 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001402 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001403 [ u_int64_t a; a = 1],
1404 [
1405 AC_DEFINE(HAVE_U_INT64_T)
1406 AC_MSG_RESULT(yes)
1407 ],
1408 [ AC_MSG_RESULT(no) ]
1409 )
1410fi
1411
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001412if test -z "$have_u_intxx_t" ; then
1413 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1414 AC_TRY_COMPILE(
1415 [
1416#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001417 ],
1418 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001419 [ ac_cv_have_uintxx_t="yes" ],
1420 [ ac_cv_have_uintxx_t="no" ]
1421 )
1422 ])
1423 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1424 AC_DEFINE(HAVE_UINTXX_T)
1425 fi
1426fi
1427
1428if test -z "$have_uintxx_t" ; then
1429 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1430 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001431 [ #include <stdint.h> ],
1432 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001433 [
1434 AC_DEFINE(HAVE_UINTXX_T)
1435 AC_MSG_RESULT(yes)
1436 ],
1437 [ AC_MSG_RESULT(no) ]
1438 )
1439fi
1440
Damien Milleredb82922000-06-20 13:25:52 +10001441if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001442 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001443then
1444 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1445 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001446 [
1447#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001448 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001449 [
Damien Miller70494d12000-04-03 15:57:06 +10001450 int8_t a; int16_t b; int32_t c;
1451 u_int8_t e; u_int16_t f; u_int32_t g;
1452 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001453 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001454 [
1455 AC_DEFINE(HAVE_U_INTXX_T)
1456 AC_DEFINE(HAVE_INTXX_T)
1457 AC_MSG_RESULT(yes)
1458 ],
1459 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001460 )
Damien Millerb29ea912000-01-15 14:12:03 +11001461fi
1462
Damien Miller58be7382001-09-15 21:31:54 +10001463
1464AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1465 AC_TRY_COMPILE(
1466 [
1467#include <sys/types.h>
1468 ],
1469 [ u_char foo; foo = 125; ],
1470 [ ac_cv_have_u_char="yes" ],
1471 [ ac_cv_have_u_char="no" ]
1472 )
1473])
1474if test "x$ac_cv_have_u_char" = "xyes" ; then
1475 AC_DEFINE(HAVE_U_CHAR)
1476fi
1477
Tim Rice13aae5e2001-10-21 17:53:58 -07001478TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001479
Tim Rice200a5c02002-02-26 22:12:34 -08001480AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001481
Damien Miller61e50f12000-05-08 20:49:37 +10001482AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1483 AC_TRY_COMPILE(
1484 [
1485#include <sys/types.h>
1486 ],
1487 [ size_t foo; foo = 1235; ],
1488 [ ac_cv_have_size_t="yes" ],
1489 [ ac_cv_have_size_t="no" ]
1490 )
1491])
1492if test "x$ac_cv_have_size_t" = "xyes" ; then
1493 AC_DEFINE(HAVE_SIZE_T)
1494fi
Damien Miller95058511999-12-29 10:36:45 +11001495
Damien Miller615f9392000-05-17 22:53:33 +10001496AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1497 AC_TRY_COMPILE(
1498 [
1499#include <sys/types.h>
1500 ],
1501 [ ssize_t foo; foo = 1235; ],
1502 [ ac_cv_have_ssize_t="yes" ],
1503 [ ac_cv_have_ssize_t="no" ]
1504 )
1505])
1506if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1507 AC_DEFINE(HAVE_SSIZE_T)
1508fi
1509
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001510AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1511 AC_TRY_COMPILE(
1512 [
1513#include <time.h>
1514 ],
1515 [ clock_t foo; foo = 1235; ],
1516 [ ac_cv_have_clock_t="yes" ],
1517 [ ac_cv_have_clock_t="no" ]
1518 )
1519])
1520if test "x$ac_cv_have_clock_t" = "xyes" ; then
1521 AC_DEFINE(HAVE_CLOCK_T)
1522fi
1523
Damien Millerb54b40e2000-06-23 08:23:34 +10001524AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1525 AC_TRY_COMPILE(
1526 [
1527#include <sys/types.h>
1528#include <sys/socket.h>
1529 ],
1530 [ sa_family_t foo; foo = 1235; ],
1531 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001532 [ AC_TRY_COMPILE(
1533 [
1534#include <sys/types.h>
1535#include <sys/socket.h>
1536#include <netinet/in.h>
1537 ],
1538 [ sa_family_t foo; foo = 1235; ],
1539 [ ac_cv_have_sa_family_t="yes" ],
1540
Damien Millerb54b40e2000-06-23 08:23:34 +10001541 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001542 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001543 )
1544])
1545if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1546 AC_DEFINE(HAVE_SA_FAMILY_T)
1547fi
1548
Damien Miller0f91b4e2000-06-18 15:43:25 +10001549AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1550 AC_TRY_COMPILE(
1551 [
1552#include <sys/types.h>
1553 ],
1554 [ pid_t foo; foo = 1235; ],
1555 [ ac_cv_have_pid_t="yes" ],
1556 [ ac_cv_have_pid_t="no" ]
1557 )
1558])
1559if test "x$ac_cv_have_pid_t" = "xyes" ; then
1560 AC_DEFINE(HAVE_PID_T)
1561fi
1562
1563AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1564 AC_TRY_COMPILE(
1565 [
1566#include <sys/types.h>
1567 ],
1568 [ mode_t foo; foo = 1235; ],
1569 [ ac_cv_have_mode_t="yes" ],
1570 [ ac_cv_have_mode_t="no" ]
1571 )
1572])
1573if test "x$ac_cv_have_mode_t" = "xyes" ; then
1574 AC_DEFINE(HAVE_MODE_T)
1575fi
1576
Damien Miller61e50f12000-05-08 20:49:37 +10001577
1578AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1579 AC_TRY_COMPILE(
1580 [
Damien Miller81171112000-04-23 11:14:01 +10001581#include <sys/types.h>
1582#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001583 ],
1584 [ struct sockaddr_storage s; ],
1585 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1586 [ ac_cv_have_struct_sockaddr_storage="no" ]
1587 )
1588])
1589if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1590 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1591fi
Damien Miller34132e52000-01-14 15:45:46 +11001592
Damien Miller61e50f12000-05-08 20:49:37 +10001593AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1594 AC_TRY_COMPILE(
1595 [
Damien Miller7b22d652000-06-18 14:07:04 +10001596#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001597#include <netinet/in.h>
1598 ],
1599 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1600 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1601 [ ac_cv_have_struct_sockaddr_in6="no" ]
1602 )
1603])
1604if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1605 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1606fi
Damien Miller34132e52000-01-14 15:45:46 +11001607
Damien Miller61e50f12000-05-08 20:49:37 +10001608AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1609 AC_TRY_COMPILE(
1610 [
Damien Miller7b22d652000-06-18 14:07:04 +10001611#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001612#include <netinet/in.h>
1613 ],
1614 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1615 [ ac_cv_have_struct_in6_addr="yes" ],
1616 [ ac_cv_have_struct_in6_addr="no" ]
1617 )
1618])
1619if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1620 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1621fi
Damien Miller34132e52000-01-14 15:45:46 +11001622
Damien Miller61e50f12000-05-08 20:49:37 +10001623AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1624 AC_TRY_COMPILE(
1625 [
Damien Miller81171112000-04-23 11:14:01 +10001626#include <sys/types.h>
1627#include <sys/socket.h>
1628#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001629 ],
1630 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1631 [ ac_cv_have_struct_addrinfo="yes" ],
1632 [ ac_cv_have_struct_addrinfo="no" ]
1633 )
1634])
1635if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1636 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1637fi
1638
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001639AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1640 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001641 [ #include <sys/time.h> ],
1642 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001643 [ ac_cv_have_struct_timeval="yes" ],
1644 [ ac_cv_have_struct_timeval="no" ]
1645 )
1646])
1647if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1648 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1649 have_struct_timeval=1
1650fi
1651
Tim Rice4e4dc562003-03-18 10:21:40 -08001652AC_CHECK_TYPES(struct timespec)
1653
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001654# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001655if test "x$ac_cv_have_int64_t" = "xno" -a \
1656 "x$ac_cv_sizeof_long_int" != "x8" -a \
1657 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001658 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1659 echo "an alternative compiler (I.E., GCC) before continuing."
1660 echo ""
1661 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001662else
1663dnl test snprintf (broken on SCO w/gcc)
1664 AC_TRY_RUN(
1665 [
1666#include <stdio.h>
1667#include <string.h>
1668#ifdef HAVE_SNPRINTF
1669main()
1670{
1671 char buf[50];
1672 char expected_out[50];
1673 int mazsize = 50 ;
1674#if (SIZEOF_LONG_INT == 8)
1675 long int num = 0x7fffffffffffffff;
1676#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001677 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001678#endif
1679 strcpy(expected_out, "9223372036854775807");
1680 snprintf(buf, mazsize, "%lld", num);
1681 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001682 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001683 exit(0);
1684}
1685#else
1686main() { exit(0); }
1687#endif
1688 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1689 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001690fi
1691
Damien Miller78315eb2000-09-29 23:01:36 +11001692dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001693OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1694OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1695OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1696OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1697OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001698OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001699OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1700OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001701OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001702OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1703OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1704OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1705OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001706OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1707OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1708OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1709OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001710
1711AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001712
Damien Miller61e50f12000-05-08 20:49:37 +10001713AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1714 ac_cv_have_ss_family_in_struct_ss, [
1715 AC_TRY_COMPILE(
1716 [
Damien Miller81171112000-04-23 11:14:01 +10001717#include <sys/types.h>
1718#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001719 ],
1720 [ struct sockaddr_storage s; s.ss_family = 1; ],
1721 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1722 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1723 )
1724])
1725if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1726 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1727fi
1728
Damien Miller61e50f12000-05-08 20:49:37 +10001729AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1730 ac_cv_have___ss_family_in_struct_ss, [
1731 AC_TRY_COMPILE(
1732 [
Damien Miller81171112000-04-23 11:14:01 +10001733#include <sys/types.h>
1734#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001735 ],
1736 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1737 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1738 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1739 )
1740])
1741if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1742 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1743fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001744
Damien Millerad833b32000-08-23 10:46:23 +10001745AC_CACHE_CHECK([for pw_class field in struct passwd],
1746 ac_cv_have_pw_class_in_struct_passwd, [
1747 AC_TRY_COMPILE(
1748 [
Damien Millerad833b32000-08-23 10:46:23 +10001749#include <pwd.h>
1750 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001751 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001752 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1753 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1754 )
1755])
1756if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1757 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1758fi
1759
Kevin Steves82456952001-06-22 21:14:18 +00001760AC_CACHE_CHECK([for pw_expire field in struct passwd],
1761 ac_cv_have_pw_expire_in_struct_passwd, [
1762 AC_TRY_COMPILE(
1763 [
1764#include <pwd.h>
1765 ],
1766 [ struct passwd p; p.pw_expire = 0; ],
1767 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1768 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1769 )
1770])
1771if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1772 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1773fi
1774
1775AC_CACHE_CHECK([for pw_change field in struct passwd],
1776 ac_cv_have_pw_change_in_struct_passwd, [
1777 AC_TRY_COMPILE(
1778 [
1779#include <pwd.h>
1780 ],
1781 [ struct passwd p; p.pw_change = 0; ],
1782 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1783 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1784 )
1785])
1786if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1787 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1788fi
Damien Miller61e50f12000-05-08 20:49:37 +10001789
Tim Rice28bbb0c2002-05-27 17:37:32 -07001790dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001791AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1792 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001793 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001794 [
Tim Riceae49fe62002-04-12 10:26:21 -07001795#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001796#include <sys/socket.h>
1797#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001798int main() {
1799#ifdef msg_accrights
1800exit(1);
1801#endif
1802struct msghdr m;
1803m.msg_accrights = 0;
1804exit(0);
1805}
Kevin Steves939c9db2002-03-22 17:23:25 +00001806 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001807 [ ac_cv_have_accrights_in_msghdr="yes" ],
1808 [ ac_cv_have_accrights_in_msghdr="no" ]
1809 )
1810])
1811if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1812 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1813fi
1814
Kevin Stevesa44e0352002-04-07 16:18:03 +00001815AC_CACHE_CHECK([for msg_control field in struct msghdr],
1816 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001817 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001818 [
Tim Riceae49fe62002-04-12 10:26:21 -07001819#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001820#include <sys/socket.h>
1821#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001822int main() {
1823#ifdef msg_control
1824exit(1);
1825#endif
1826struct msghdr m;
1827m.msg_control = 0;
1828exit(0);
1829}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001830 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001831 [ ac_cv_have_control_in_msghdr="yes" ],
1832 [ ac_cv_have_control_in_msghdr="no" ]
1833 )
1834])
1835if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1836 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1837fi
1838
Damien Miller61e50f12000-05-08 20:49:37 +10001839AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11001840 AC_TRY_LINK([],
1841 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10001842 [ ac_cv_libc_defines___progname="yes" ],
1843 [ ac_cv_libc_defines___progname="no" ]
1844 )
1845])
1846if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1847 AC_DEFINE(HAVE___PROGNAME)
1848fi
1849
Kevin Steves4846f4a2002-03-22 18:19:53 +00001850AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1851 AC_TRY_LINK([
1852#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001853],
1854 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00001855 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1856 [ ac_cv_cc_implements___FUNCTION__="no" ]
1857 )
1858])
1859if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1860 AC_DEFINE(HAVE___FUNCTION__)
1861fi
1862
1863AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1864 AC_TRY_LINK([
1865#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001866],
1867 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00001868 [ ac_cv_cc_implements___func__="yes" ],
1869 [ ac_cv_cc_implements___func__="no" ]
1870 )
1871])
1872if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1873 AC_DEFINE(HAVE___func__)
1874fi
1875
Damien Miller4f8e6692001-07-14 13:22:53 +10001876AC_CACHE_CHECK([whether getopt has optreset support],
1877 ac_cv_have_getopt_optreset, [
1878 AC_TRY_LINK(
1879 [
1880#include <getopt.h>
1881 ],
1882 [ extern int optreset; optreset = 0; ],
1883 [ ac_cv_have_getopt_optreset="yes" ],
1884 [ ac_cv_have_getopt_optreset="no" ]
1885 )
1886])
1887if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1888 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1889fi
Damien Millera22ba012000-03-02 23:09:20 +11001890
Damien Millerecbb26d2000-07-15 14:59:14 +10001891AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11001892 AC_TRY_LINK([],
1893 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10001894 [ ac_cv_libc_defines_sys_errlist="yes" ],
1895 [ ac_cv_libc_defines_sys_errlist="no" ]
1896 )
1897])
1898if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1899 AC_DEFINE(HAVE_SYS_ERRLIST)
1900fi
1901
1902
Damien Miller11fa2cc2000-08-16 10:35:58 +10001903AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11001904 AC_TRY_LINK([],
1905 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10001906 [ ac_cv_libc_defines_sys_nerr="yes" ],
1907 [ ac_cv_libc_defines_sys_nerr="no" ]
1908 )
1909])
1910if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1911 AC_DEFINE(HAVE_SYS_NERR)
1912fi
1913
Damien Millera8e06ce2003-11-21 23:48:55 +11001914SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001915# Check whether user wants sectok support
1916AC_ARG_WITH(sectok,
1917 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001918 [
1919 if test "x$withval" != "xno" ; then
1920 if test "x$withval" != "xyes" ; then
1921 CPPFLAGS="$CPPFLAGS -I${withval}"
1922 LDFLAGS="$LDFLAGS -L${withval}"
1923 if test ! -z "$need_dash_r" ; then
1924 LDFLAGS="$LDFLAGS -R${withval}"
1925 fi
1926 if test ! -z "$blibpath" ; then
1927 blibpath="$blibpath:${withval}"
1928 fi
1929 fi
1930 AC_CHECK_HEADERS(sectok.h)
1931 if test "$ac_cv_header_sectok_h" != yes; then
1932 AC_MSG_ERROR(Can't find sectok.h)
1933 fi
1934 AC_CHECK_LIB(sectok, sectok_open)
1935 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1936 AC_MSG_ERROR(Can't find libsectok)
1937 fi
1938 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001939 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11001940 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001941 fi
1942 ]
1943)
1944
1945# Check whether user wants OpenSC support
1946AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001947 AC_HELP_STRING([--with-opensc=PFX],
1948 [Enable smartcard support using OpenSC]),
1949 opensc_config_prefix="$withval", opensc_config_prefix="")
1950if test x$opensc_config_prefix != x ; then
1951 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1952 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1953 if test "$OPENSC_CONFIG" != "no"; then
1954 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1955 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1956 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1957 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1958 AC_DEFINE(SMARTCARD)
1959 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11001960 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10001961 fi
1962fi
Damien Miller85de5802001-09-18 14:01:11 +10001963
Darren Tucker5f88d342003-10-15 16:57:57 +10001964# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11001965AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10001966 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10001967 [
Darren Tucker5f88d342003-10-15 16:57:57 +10001968 # Needed by our getrrsetbyname()
1969 AC_SEARCH_LIBS(res_query, resolv)
1970 AC_SEARCH_LIBS(dn_expand, resolv)
1971 AC_CHECK_FUNCS(_getshort _getlong)
1972 AC_CHECK_MEMBER(HEADER.ad,
1973 [AC_DEFINE(HAVE_HEADER_AD)],,
1974 [#include <arpa/nameser.h>])
1975 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10001976
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001977# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11001978KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001979AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11001980 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1981 [
1982 if test "x$withval" != "xno" ; then
1983 if test "x$withval" = "xyes" ; then
1984 KRB5ROOT="/usr/local"
1985 else
1986 KRB5ROOT=${withval}
1987 fi
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001988 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11001989 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1990 AC_DEFINE(KRB5)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001991 KRB5_MSG="yes"
Damien Millera8e06ce2003-11-21 23:48:55 +11001992 AC_MSG_CHECKING(whether we are using Heimdal)
1993 AC_TRY_COMPILE([ #include <krb5.h> ],
1994 [ char *tmp = heimdal_version; ],
1995 [ AC_MSG_RESULT(yes)
1996 AC_DEFINE(HEIMDAL)
1997 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1998 ],
1999 [ AC_MSG_RESULT(no)
2000 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2001 ]
2002 )
2003 if test ! -z "$need_dash_r" ; then
2004 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2005 fi
2006 if test ! -z "$blibpath" ; then
2007 blibpath="$blibpath:${KRB5ROOT}/lib"
2008 fi
Damien Miller200d0a72003-06-30 19:21:36 +10002009 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002010
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002011 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2012 [ AC_DEFINE(GSSAPI)
2013 K5LIBS="-lgssapi $K5LIBS" ],
2014 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2015 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002016 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002017 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2018 $K5LIBS)
2019 ],
2020 $K5LIBS)
2021
2022 AC_CHECK_HEADER(gssapi.h, ,
2023 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002024 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002025 AC_CHECK_HEADERS(gssapi.h, ,
2026 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002027 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002028 ]
2029 )
2030
2031 oldCPP="$CPPFLAGS"
2032 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2033 AC_CHECK_HEADER(gssapi_krb5.h, ,
2034 [ CPPFLAGS="$oldCPP" ])
2035
Damien Millera8e06ce2003-11-21 23:48:55 +11002036 KRB5=yes
2037 fi
2038 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002039)
Darren Tucker6aaa58c2003-08-02 22:24:49 +10002040LIBS="$LIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10002041
Damien Millera22ba012000-03-02 23:09:20 +11002042# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002043
Damien Millerf58c6722002-05-13 13:15:42 +10002044PRIVSEP_PATH=/var/empty
2045AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002046 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002047 [
2048 if test "x$withval" != "$no" ; then
2049 PRIVSEP_PATH=$withval
2050 fi
2051 ]
2052)
2053AC_SUBST(PRIVSEP_PATH)
2054
Damien Millera22ba012000-03-02 23:09:20 +11002055AC_ARG_WITH(xauth,
2056 [ --with-xauth=PATH Specify path to xauth program ],
2057 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002058 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002059 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002060 fi
2061 ],
2062 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002063 TestPath="$PATH"
2064 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2065 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2066 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2067 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2068 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002069 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002070 xauth_path="/usr/openwin/bin/xauth"
2071 fi
2072 ]
2073)
2074
Damien Miller7d901272003-01-13 16:55:22 +11002075STRIP_OPT=-s
2076AC_ARG_ENABLE(strip,
2077 [ --disable-strip Disable calling strip(1) on install],
2078 [
2079 if test "x$enableval" = "xno" ; then
2080 STRIP_OPT=
2081 fi
2082 ]
2083)
2084AC_SUBST(STRIP_OPT)
2085
Damien Millera19cf472000-11-29 13:28:50 +11002086if test -z "$xauth_path" ; then
2087 XAUTH_PATH="undefined"
2088 AC_SUBST(XAUTH_PATH)
2089else
Damien Millera22ba012000-03-02 23:09:20 +11002090 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002091 XAUTH_PATH=$xauth_path
2092 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002093fi
Damien Millera22ba012000-03-02 23:09:20 +11002094
2095# Check for mail directory (last resort if we cannot get it from headers)
2096if test ! -z "$MAIL" ; then
2097 maildir=`dirname $MAIL`
2098 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2099fi
2100
Damien Millera22ba012000-03-02 23:09:20 +11002101if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002102 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002103 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002104 [
2105 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2106 have_dev_ptmx=1
2107 ]
2108 )
2109 fi
Damien Millera22ba012000-03-02 23:09:20 +11002110fi
Damien Millera8e06ce2003-11-21 23:48:55 +11002111AC_CHECK_FILE("/dev/ptc",
Damien Miller204ad072000-03-02 23:56:12 +11002112 [
2113 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2114 have_dev_ptc=1
2115 ]
2116)
2117
Damien Millera22ba012000-03-02 23:09:20 +11002118# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002119AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002120 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002121 [
Damien Miller897741e2001-04-16 10:41:46 +10002122 case "$withval" in
2123 man|cat|doc)
2124 MANTYPE=$withval
2125 ;;
2126 *)
2127 AC_MSG_ERROR(invalid man type: $withval)
2128 ;;
2129 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002130 ]
2131)
Ben Lindstrombc709922001-04-18 18:04:21 +00002132if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002133 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2134 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002135 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2136 MANTYPE=doc
2137 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2138 MANTYPE=man
2139 else
2140 MANTYPE=cat
2141 fi
2142fi
Damien Miller670a4b82000-01-22 13:53:11 +11002143AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002144if test "$MANTYPE" = "doc"; then
2145 mansubdir=man;
2146else
2147 mansubdir=$MANTYPE;
2148fi
2149AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002150
Damien Millera22ba012000-03-02 23:09:20 +11002151# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002152MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002153AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002154 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002155 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002156 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002157 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002158 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002159 fi
2160 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002161)
2162
Damien Millera22ba012000-03-02 23:09:20 +11002163# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002164AC_ARG_WITH(shadow,
2165 [ --without-shadow Disable shadow password support],
2166 [
2167 if test "x$withval" = "xno" ; then
2168 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002169 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002170 fi
2171 ]
2172)
2173
Damien Miller1f335fb2000-06-26 11:31:33 +10002174if test -z "$disable_shadow" ; then
2175 AC_MSG_CHECKING([if the systems has expire shadow information])
2176 AC_TRY_COMPILE(
2177 [
2178#include <sys/types.h>
2179#include <shadow.h>
2180 struct spwd sp;
2181 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2182 [ sp_expire_available=yes ], []
2183 )
2184
2185 if test "x$sp_expire_available" = "xyes" ; then
2186 AC_MSG_RESULT(yes)
2187 AC_DEFINE(HAS_SHADOW_EXPIRE)
2188 else
2189 AC_MSG_RESULT(no)
2190 fi
2191fi
2192
Damien Millera22ba012000-03-02 23:09:20 +11002193# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002194if test ! -z "$IPADDR_IN_DISPLAY" ; then
2195 DISPLAY_HACK_MSG="yes"
2196 AC_DEFINE(IPADDR_IN_DISPLAY)
2197else
Damien Millera8e06ce2003-11-21 23:48:55 +11002198 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002199 AC_ARG_WITH(ipaddr-display,
2200 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2201 [
2202 if test "x$withval" != "xno" ; then
2203 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002204 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002205 fi
2206 ]
2207 )
2208fi
Damien Miller76112de1999-12-21 11:18:08 +11002209
Darren Tuckere1a790d2003-09-16 11:52:19 +10002210# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002211AC_ARG_ENABLE(etc-default-login,
2212 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2213[
Darren Tuckere1a790d2003-09-16 11:52:19 +10002214AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2215
2216if test "x$external_path_file" = "x/etc/default/login"; then
2217 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2218fi
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002219])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002220
Tim Rice43a1c132002-04-17 21:19:14 -07002221dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2222if test $ac_cv_func_login_getcapbool = "yes" -a \
2223 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002224 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002225fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002226
Damien Millera22ba012000-03-02 23:09:20 +11002227# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002228SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002229AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002230 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002231 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002232 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002233 AC_MSG_WARN([
2234--with-default-path=PATH has no effect on this system.
2235Edit /etc/login.conf instead.])
2236 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002237 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002238 AC_MSG_WARN([
2239--with-default-path=PATH will only be used if PATH is not defined in
2240$external_path_file .])
2241 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002242 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002243 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002244 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002245 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002246 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2247 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002248 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002249 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002250 AC_MSG_WARN([
2251If PATH is defined in $external_path_file, ensure the path to scp is included,
2252otherwise scp will not work.])
2253 fi
2254 AC_TRY_RUN(
2255 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002256/* find out what STDPATH is */
2257#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002258#ifdef HAVE_PATHS_H
2259# include <paths.h>
2260#endif
2261#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002262# ifdef _PATH_USERPATH /* Irix */
2263# define _PATH_STDPATH _PATH_USERPATH
2264# else
2265# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2266# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002267#endif
2268#include <sys/types.h>
2269#include <sys/stat.h>
2270#include <fcntl.h>
2271#define DATA "conftest.stdpath"
2272
2273main()
2274{
2275 FILE *fd;
2276 int rc;
2277
2278 fd = fopen(DATA,"w");
2279 if(fd == NULL)
2280 exit(1);
2281
2282 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2283 exit(1);
2284
2285 exit(0);
2286}
2287 ], [ user_path=`cat conftest.stdpath` ],
2288 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2289 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2290 )
2291# make sure $bindir is in USER_PATH so scp will work
2292 t_bindir=`eval echo ${bindir}`
2293 case $t_bindir in
2294 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2295 esac
2296 case $t_bindir in
2297 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2298 esac
2299 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2300 if test $? -ne 0 ; then
2301 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2302 if test $? -ne 0 ; then
2303 user_path=$user_path:$t_bindir
2304 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2305 fi
2306 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002307 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002308)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002309if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002310 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2311 AC_SUBST(user_path)
2312fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002313
Damien Millera18bbd32002-05-13 10:48:57 +10002314# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002315AC_ARG_WITH(superuser-path,
2316 [ --with-superuser-path= Specify different path for super-user],
2317 [
2318 if test "x$withval" != "xno" ; then
2319 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2320 superuser_path=$withval
2321 fi
2322 ]
2323)
2324
2325
Damien Miller61e50f12000-05-08 20:49:37 +10002326AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002327IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002328AC_ARG_WITH(4in6,
2329 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2330 [
2331 if test "x$withval" != "xno" ; then
2332 AC_MSG_RESULT(yes)
2333 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002334 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002335 else
2336 AC_MSG_RESULT(no)
2337 fi
2338 ],[
2339 if test "x$inet6_default_4in6" = "xyes"; then
2340 AC_MSG_RESULT([yes (default)])
2341 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002342 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002343 else
2344 AC_MSG_RESULT([no (default)])
2345 fi
2346 ]
2347)
2348
Damien Miller60396b02001-02-18 17:01:00 +11002349# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002350BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002351AC_ARG_WITH(bsd-auth,
2352 [ --with-bsd-auth Enable BSD auth support],
2353 [
2354 if test "x$withval" != "xno" ; then
2355 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002356 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002357 fi
2358 ]
2359)
2360
Damien Millera22ba012000-03-02 23:09:20 +11002361# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002362piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002363# make sure the directory exists
2364if test ! -d $piddir ; then
2365 piddir=`eval echo ${sysconfdir}`
2366 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002367 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002368 esac
2369fi
2370
Tim Rice88f2ab52002-03-17 12:17:34 -08002371AC_ARG_WITH(pid-dir,
2372 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2373 [
2374 if test "x$withval" != "xno" ; then
2375 piddir=$withval
2376 if test ! -d $piddir ; then
2377 AC_MSG_WARN([** no $piddir directory on this system **])
2378 fi
2379 fi
2380 ]
2381)
2382
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002383AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002384AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002385
andre2ff7b5d2000-06-03 14:57:40 +00002386dnl allow user to disable some login recording features
2387AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002388 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002389 [
2390 if test "x$enableval" = "xno" ; then
2391 AC_DEFINE(DISABLE_LASTLOG)
2392 fi
2393 ]
andre2ff7b5d2000-06-03 14:57:40 +00002394)
2395AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002396 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002397 [
2398 if test "x$enableval" = "xno" ; then
2399 AC_DEFINE(DISABLE_UTMP)
2400 fi
2401 ]
andre2ff7b5d2000-06-03 14:57:40 +00002402)
2403AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002404 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002405 [
2406 if test "x$enableval" = "xno" ; then
2407 AC_DEFINE(DISABLE_UTMPX)
2408 fi
2409 ]
andre2ff7b5d2000-06-03 14:57:40 +00002410)
2411AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002412 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002413 [
2414 if test "x$enableval" = "xno" ; then
2415 AC_DEFINE(DISABLE_WTMP)
2416 fi
2417 ]
andre2ff7b5d2000-06-03 14:57:40 +00002418)
2419AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002420 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002421 [
2422 if test "x$enableval" = "xno" ; then
2423 AC_DEFINE(DISABLE_WTMPX)
2424 fi
2425 ]
andre2ff7b5d2000-06-03 14:57:40 +00002426)
2427AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002428 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002429 [
2430 if test "x$enableval" = "xno" ; then
2431 AC_DEFINE(DISABLE_LOGIN)
2432 fi
2433 ]
andre2ff7b5d2000-06-03 14:57:40 +00002434)
2435AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002436 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002437 [
2438 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002439 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002440 fi
2441 ]
andre2ff7b5d2000-06-03 14:57:40 +00002442)
2443AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002444 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002445 [
2446 if test "x$enableval" = "xno" ; then
2447 AC_DEFINE(DISABLE_PUTUTXLINE)
2448 fi
2449 ]
andre2ff7b5d2000-06-03 14:57:40 +00002450)
2451AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002452 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002453 [
2454 if test "x$withval" = "xno" ; then
2455 AC_DEFINE(DISABLE_LASTLOG)
2456 else
2457 conf_lastlog_location=$withval
2458 fi
2459 ]
2460)
andre2ff7b5d2000-06-03 14:57:40 +00002461
2462dnl lastlog, [uw]tmpx? detection
2463dnl NOTE: set the paths in the platform section to avoid the
2464dnl need for command-line parameters
2465dnl lastlog and [uw]tmp are subject to a file search if all else fails
2466
2467dnl lastlog detection
2468dnl NOTE: the code itself will detect if lastlog is a directory
2469AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2470AC_TRY_COMPILE([
2471#include <sys/types.h>
2472#include <utmp.h>
2473#ifdef HAVE_LASTLOG_H
2474# include <lastlog.h>
2475#endif
Damien Miller2994e082000-06-04 15:51:47 +10002476#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002477# include <paths.h>
2478#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002479#ifdef HAVE_LOGIN_H
2480# include <login.h>
2481#endif
andre2ff7b5d2000-06-03 14:57:40 +00002482 ],
2483 [ char *lastlog = LASTLOG_FILE; ],
2484 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002485 [
2486 AC_MSG_RESULT(no)
2487 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2488 AC_TRY_COMPILE([
2489#include <sys/types.h>
2490#include <utmp.h>
2491#ifdef HAVE_LASTLOG_H
2492# include <lastlog.h>
2493#endif
2494#ifdef HAVE_PATHS_H
2495# include <paths.h>
2496#endif
2497 ],
2498 [ char *lastlog = _PATH_LASTLOG; ],
2499 [ AC_MSG_RESULT(yes) ],
2500 [
andree441aa32000-06-12 22:34:38 +00002501 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002502 system_lastlog_path=no
2503 ])
2504 ]
andre2ff7b5d2000-06-03 14:57:40 +00002505)
Damien Miller2994e082000-06-04 15:51:47 +10002506
andre2ff7b5d2000-06-03 14:57:40 +00002507if test -z "$conf_lastlog_location"; then
2508 if test x"$system_lastlog_path" = x"no" ; then
2509 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002510 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002511 conf_lastlog_location=$f
2512 fi
2513 done
2514 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002515 AC_MSG_WARN([** Cannot find lastlog **])
2516 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002517 fi
2518 fi
2519fi
2520
2521if test -n "$conf_lastlog_location"; then
2522 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2523fi
2524
2525dnl utmp detection
2526AC_MSG_CHECKING([if your system defines UTMP_FILE])
2527AC_TRY_COMPILE([
2528#include <sys/types.h>
2529#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002530#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002531# include <paths.h>
2532#endif
2533 ],
2534 [ char *utmp = UTMP_FILE; ],
2535 [ AC_MSG_RESULT(yes) ],
2536 [ AC_MSG_RESULT(no)
2537 system_utmp_path=no ]
2538)
2539if test -z "$conf_utmp_location"; then
2540 if test x"$system_utmp_path" = x"no" ; then
2541 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2542 if test -f $f ; then
2543 conf_utmp_location=$f
2544 fi
2545 done
2546 if test -z "$conf_utmp_location"; then
2547 AC_DEFINE(DISABLE_UTMP)
2548 fi
2549 fi
2550fi
2551if test -n "$conf_utmp_location"; then
2552 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2553fi
2554
2555dnl wtmp detection
2556AC_MSG_CHECKING([if your system defines WTMP_FILE])
2557AC_TRY_COMPILE([
2558#include <sys/types.h>
2559#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002560#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002561# include <paths.h>
2562#endif
2563 ],
2564 [ char *wtmp = WTMP_FILE; ],
2565 [ AC_MSG_RESULT(yes) ],
2566 [ AC_MSG_RESULT(no)
2567 system_wtmp_path=no ]
2568)
2569if test -z "$conf_wtmp_location"; then
2570 if test x"$system_wtmp_path" = x"no" ; then
2571 for f in /usr/adm/wtmp /var/log/wtmp; do
2572 if test -f $f ; then
2573 conf_wtmp_location=$f
2574 fi
2575 done
2576 if test -z "$conf_wtmp_location"; then
2577 AC_DEFINE(DISABLE_WTMP)
2578 fi
2579 fi
2580fi
2581if test -n "$conf_wtmp_location"; then
2582 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2583fi
2584
2585
2586dnl utmpx detection - I don't know any system so perverse as to require
2587dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2588dnl there, though.
2589AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2590AC_TRY_COMPILE([
2591#include <sys/types.h>
2592#include <utmp.h>
2593#ifdef HAVE_UTMPX_H
2594#include <utmpx.h>
2595#endif
Damien Miller2994e082000-06-04 15:51:47 +10002596#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002597# include <paths.h>
2598#endif
2599 ],
2600 [ char *utmpx = UTMPX_FILE; ],
2601 [ AC_MSG_RESULT(yes) ],
2602 [ AC_MSG_RESULT(no)
2603 system_utmpx_path=no ]
2604)
2605if test -z "$conf_utmpx_location"; then
2606 if test x"$system_utmpx_path" = x"no" ; then
2607 AC_DEFINE(DISABLE_UTMPX)
2608 fi
2609else
2610 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2611fi
2612
2613dnl wtmpx detection
2614AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2615AC_TRY_COMPILE([
2616#include <sys/types.h>
2617#include <utmp.h>
2618#ifdef HAVE_UTMPX_H
2619#include <utmpx.h>
2620#endif
Damien Miller2994e082000-06-04 15:51:47 +10002621#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002622# include <paths.h>
2623#endif
2624 ],
2625 [ char *wtmpx = WTMPX_FILE; ],
2626 [ AC_MSG_RESULT(yes) ],
2627 [ AC_MSG_RESULT(no)
2628 system_wtmpx_path=no ]
2629)
2630if test -z "$conf_wtmpx_location"; then
2631 if test x"$system_wtmpx_path" = x"no" ; then
2632 AC_DEFINE(DISABLE_WTMPX)
2633 fi
2634else
2635 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2636fi
2637
Damien Miller4018c192000-04-30 09:30:44 +10002638
Damien Miller29ea30d2000-03-17 10:54:15 +11002639if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002640 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2641 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002642fi
2643
Tim Rice4cec93f2002-02-26 08:40:48 -08002644dnl remove pam and dl because they are in $LIBPAM
2645if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002646 LIBS=`echo $LIBS | sed 's/-lpam //'`
2647fi
2648if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2649 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002650fi
2651
Damien Millerbac2d8a2000-09-05 16:13:06 +11002652AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002653AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2654AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002655
Damien Miller7b22d652000-06-18 14:07:04 +10002656# Print summary of options
2657
Damien Miller7b22d652000-06-18 14:07:04 +10002658# Someone please show me a better way :)
2659A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2660B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2661C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2662D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002663E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002664F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002665G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002666H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2667I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2668J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002669
2670echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002671echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002672echo " User binaries: $B"
2673echo " System binaries: $C"
2674echo " Configuration files: $D"
2675echo " Askpass program: $E"
2676echo " Manual pages: $F"
2677echo " PID file: $G"
2678echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002679if test "x$external_path_file" = "x/etc/login.conf" ; then
2680echo " At runtime, sshd will use the path defined in $external_path_file"
2681echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002682else
Damien Millerf58c6722002-05-13 13:15:42 +10002683echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002684 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002685echo " (If PATH is set in $external_path_file it will be used instead. If"
2686echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2687 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002688fi
Damien Millera18bbd32002-05-13 10:48:57 +10002689if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002690echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002691fi
Damien Millerf58c6722002-05-13 13:15:42 +10002692echo " Manpage format: $MANTYPE"
Damien Miller9d2be482003-05-15 11:12:19 +10002693echo " DNS support: $DNS_MSG"
Damien Miller7abe09b2003-05-15 10:53:49 +10002694echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002695echo " KerberosV support: $KRB5_MSG"
2696echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002697echo " S/KEY support: $SKEY_MSG"
2698echo " TCP Wrappers support: $TCPW_MSG"
2699echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002700echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002701echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2702echo " BSD Auth support: $BSD_AUTH_MSG"
2703echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002704if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002705echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002706fi
2707
Damien Miller7b22d652000-06-18 14:07:04 +10002708echo ""
2709
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002710echo " Host: ${host}"
2711echo " Compiler: ${CC}"
2712echo " Compiler flags: ${CFLAGS}"
2713echo "Preprocessor flags: ${CPPFLAGS}"
2714echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002715echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002716
2717echo ""
2718
Damien Miller82cf0ce2000-12-20 13:34:48 +11002719if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002720 echo "PAM is enabled. You may need to install a PAM control file "
2721 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11002722 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11002723 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002724 echo ""
2725fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002726
Damien Miller6c21c512002-01-22 21:57:53 +11002727if test ! -z "$RAND_HELPER_CMDHASH" ; then
2728 echo "WARNING: you are using the builtin random number collection "
2729 echo "service. Please read WARNING.RNG and request that your OS "
2730 echo "vendor includes kernel-based random number collection in "
2731 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002732 echo ""
2733fi
Damien Miller60396b02001-02-18 17:01:00 +11002734