blob: afcd8aff00cfcd72efd34ccc743b0f84b3a60d78 [file] [log] [blame]
Darren Tucker537f1ed2005-10-25 18:38:33 +10001# $Id: configure.ac,v 1.303 2005/10/25 08:38:34 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070060 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
61 [If your header files don't define LOGIN_PROGRAM,
62 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100063else
64 # Search for login
65 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
66 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
67 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
68 fi
69fi
70
Darren Tucker23bc8d02004-02-06 16:24:31 +110071AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
72if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070073 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
74 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110075fi
76
Damien Miller166bd442000-03-16 10:48:25 +110077if test -z "$LD" ; then
78 LD=$CC
79fi
80AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080081
Damien Miller166bd442000-03-16 10:48:25 +110082AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100083
84AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
85
Damien Millera8e06ce2003-11-21 23:48:55 +110086if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100087 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Tim Rice3db1e3f2005-08-23 17:11:26 -070088 GCC_VER=`$CC --version`
89 case $GCC_VER in
90 1.*) ;;
91 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
92 2.*) ;;
93 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
94 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +100095
Darren Tucker67b37032005-06-03 17:58:31 +100096 if test -z "$have_llong_max"; then
97 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
98 unset ac_cv_have_decl_LLONG_MAX
99 saved_CFLAGS="$CFLAGS"
100 CFLAGS="$CFLAGS -std=gnu99"
101 AC_CHECK_DECL(LLONG_MAX,
102 [have_llong_max=1],
103 [CFLAGS="$saved_CFLAGS"],
104 [#include <limits.h>]
105 )
106 fi
Damien Miller166bd442000-03-16 10:48:25 +1100107fi
108
Tim Rice88368a32003-12-08 12:35:59 -0800109AC_ARG_WITH(rpath,
110 [ --without-rpath Disable auto-added -R linker paths],
111 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800112 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800113 need_dash_r=""
114 fi
115 if test "x$withval" = "xyes" ; then
116 need_dash_r=1
117 fi
118 ]
119)
120
Damien Millera22ba012000-03-02 23:09:20 +1100121# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100122case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100123*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100124 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000125 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800126 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100127 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000128 saved_LDFLAGS="$LDFLAGS"
129 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
130 if (test -z "$blibflags"); then
131 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
132 AC_TRY_LINK([], [], [blibflags=$tryflags])
133 fi
134 done
135 if (test -z "$blibflags"); then
136 AC_MSG_RESULT(not found)
137 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
138 else
139 AC_MSG_RESULT($blibflags)
140 fi
141 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000142 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700143 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
144 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700145 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000146 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700147 LIBS="$LIBS -ls"
148 ])
149 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100150 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100151 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100152 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000153 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100154 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000155 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
156 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000157 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000158 [(void)loginfailed("user","host","tty",0);],
159 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700160 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
161 [Define if your AIX loginfailed() function
162 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000163 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000164 )],
165 [],
166 [#include <usersec.h>]
167 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000168 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100169 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700170 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
171 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
172 [Define if your platform breaks doing a seteuid before a setuid])
173 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
174 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000175 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700176 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
177 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
178 [Some systems need a utmpx entry for /bin/login to work])
179 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
180 [Define to a Set Process Title type if your system is
181 supported by bsd-setproctitle.c])
Damien Miller75b1d102000-01-07 14:01:41 +1100182 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100183*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100184 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800185 LIBS="$LIBS /usr/lib/textmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700186 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
187 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
188 AC_DEFINE(DISABLE_SHADOW, 1,
189 [Define if you want to disable shadow passwords])
190 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
191 [Define if your system choked on IP TOS setting])
192 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
193 [Define if X11 doesn't support AF_UNIX sockets on that system])
194 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
195 [Define if the concept of ports only accessible to
196 superusers isn't known])
197 AC_DEFINE(DISABLE_FD_PASSING, 1,
198 [Define if your platform needs to skip post auth
199 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100200 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000201*-*-dgux*)
202 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100203 AC_DEFINE(SETEUID_BREAKS_SETUID)
204 AC_DEFINE(BROKEN_SETREUID)
205 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000206 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000207*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000208 AC_MSG_CHECKING(if we have working getaddrinfo)
209 AC_TRY_RUN([#include <mach-o/dyld.h>
210main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
211 exit(0);
212 else
213 exit(1);
214}], [AC_MSG_RESULT(working)],
215 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700216 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700217 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000218 AC_DEFINE(SETEUID_BREAKS_SETUID)
219 AC_DEFINE(BROKEN_SETREUID)
220 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700221 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
222 [Define if your resolver libs need this for getrrsetbyname])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000223 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000224*-*-hpux*)
225 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000226 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100227 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000228 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700229 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
230 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000231 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700232 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
233 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000234 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000235 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700236 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000237 AC_CHECK_LIB(xnet, t_error, ,
238 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
239
240 # next, we define all of the options specific to major releases
241 case "$host" in
242 *-*-hpux10*)
243 if test -z "$GCC"; then
244 CFLAGS="$CFLAGS -Ae"
245 fi
246 ;;
247 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700248 AC_DEFINE(PAM_SUN_CODEBASE, 1,
249 [Define if you are using Solaris-derived PAM which
250 passes pam_messages to the conversation function
251 with an extra level of indirection])
252 AC_DEFINE(DISABLE_UTMP, 1,
253 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000254 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
255 check_for_hpux_broken_getaddrinfo=1
256 check_for_conflicting_getspnam=1
257 ;;
258 esac
259
260 # lastly, we define options specific to minor releases
261 case "$host" in
262 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700263 AC_DEFINE(HAVE_SECUREWARE, 1,
264 [Define if you have SecureWare-based
265 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000266 disable_ptmx_check=yes
267 LIBS="$LIBS -lsecpw"
268 ;;
269 esac
Damien Miller1bead332000-04-30 00:47:29 +1000270 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100271*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100272 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700273 AC_DEFINE(BROKEN_INET_NTOA, 1,
274 [Define if you system's inet_ntoa is busted
275 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000276 AC_DEFINE(SETEUID_BREAKS_SETUID)
277 AC_DEFINE(BROKEN_SETREUID)
278 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700279 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
280 [Define if you shouldn't strip 'tty' from your
281 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000282 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100283 ;;
284*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100285 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700286 AC_DEFINE(WITH_IRIX_ARRAY, 1,
287 [Define if you have/want arrays
288 (cluster-wide session managment, not C arrays)])
289 AC_DEFINE(WITH_IRIX_PROJECT, 1,
290 [Define if you want IRIX project management])
291 AC_DEFINE(WITH_IRIX_AUDIT, 1,
292 [Define if you want IRIX audit trails])
293 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
294 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000295 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000296 AC_DEFINE(SETEUID_BREAKS_SETUID)
297 AC_DEFINE(BROKEN_SETREUID)
298 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700299 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000300 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000301 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100302 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100303*-*-linux*)
304 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100305 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000306 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700307 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
308 AC_DEFINE(PAM_TTY_KLUDGE, 1,
309 [Work around problematic Linux PAM modules handling of PAM_TTY])
310 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
311 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000312 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700313 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
314 [Define to whatever link() returns for "not supported"
315 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100316 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700317 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100318 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000319 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000320 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700321 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
322 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000323 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000324 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100325 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000326mips-sony-bsd|mips-sony-newsos4)
Tim Rice7df8d392005-09-19 09:33:39 -0700327 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000328 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000329 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100330*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000331 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800332 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800333 need_dash_r=1
334 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100335 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100336*-*-freebsd*)
337 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000338 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Millerfbd884a2001-02-27 08:39:07 +1100339 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000340*-*-bsdi*)
341 AC_DEFINE(SETEUID_BREAKS_SETUID)
342 AC_DEFINE(BROKEN_SETREUID)
343 AC_DEFINE(BROKEN_SETREGID)
344 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000345*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000346 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100347 conf_utmp_location=/etc/utmp
348 conf_wtmp_location=/usr/adm/wtmp
349 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700350 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000351 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000352 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700353 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000354 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000355*-*-openbsd*)
356 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000357 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Darren Tucker4a422572005-07-14 17:22:11 +1000358 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100359*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800360 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800361 need_dash_r=1
362 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100363 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000364 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700365 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
366 [Some versions of /bin/login need the TERM supplied
367 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000368 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700369 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
370 [Define if pam_chauthtok wants real uid set
371 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000372 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000373 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700374 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
375 [Define if sshd somehow reacquires a controlling TTY
376 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000377 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000378 # hardwire lastlog location (can't detect it on some versions)
379 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000380 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
381 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
382 if test "$sol2ver" -ge 8; then
383 AC_MSG_RESULT(yes)
384 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700385 AC_DEFINE(DISABLE_WTMP, 1,
386 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000387 else
388 AC_MSG_RESULT(no)
389 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100390 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000391*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000392 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000393 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100394 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000395 conf_utmp_location=/etc/utmp
396 conf_wtmp_location=/var/adm/wtmp
397 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000398 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000399 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000400*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700401 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000402 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000403 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000404 AC_DEFINE(SETEUID_BREAKS_SETUID)
405 AC_DEFINE(BROKEN_SETREUID)
406 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000407 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000408*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700409 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000410 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100411 # -lresolv needs to be at then end of LIBS or DNS lookups break
412 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100413 IPADDR_IN_DISPLAY=yes
414 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000415 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000416 AC_DEFINE(SETEUID_BREAKS_SETUID)
417 AC_DEFINE(BROKEN_SETREUID)
418 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000419 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000420 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700421 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
422 # Attention: always take care to bind libsocket and libnsl before libc,
423 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000424 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800425# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100426*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100427 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700428 AC_DEFINE(SETEUID_BREAKS_SETUID)
429 AC_DEFINE(BROKEN_SETREUID)
430 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700431 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100432 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800433# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100434*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700435 check_for_libcrypt_later=1
436 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100437 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700438 AC_DEFINE(SETEUID_BREAKS_SETUID)
439 AC_DEFINE(BROKEN_SETREUID)
440 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700441 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700442 case "$host" in
443 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
444 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700445 AC_DEFINE(BROKEN_LIBIAF, 1,
446 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700447 ;;
448 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100449 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100450*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100451 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800452# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100453*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800454 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100455 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800456# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100457*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800458 if test -z "$GCC"; then
459 CFLAGS="$CFLAGS -belf"
460 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100461 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000462 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100463 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000464 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000465 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700466 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700467 AC_DEFINE(SETEUID_BREAKS_SETUID)
468 AC_DEFINE(BROKEN_SETREUID)
469 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700470 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700471 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700472 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100473 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700474 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700475 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000476 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000477*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700478 AC_DEFINE(NO_SSH_LASTLOG, 1,
479 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100480 AC_DEFINE(SETEUID_BREAKS_SETUID)
481 AC_DEFINE(BROKEN_SETREUID)
482 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000483 AC_DEFINE(USE_PIPES)
484 AC_DEFINE(DISABLE_FD_PASSING)
485 LDFLAGS="$LDFLAGS"
486 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
487 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000488 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000489*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100490 AC_DEFINE(SETEUID_BREAKS_SETUID)
491 AC_DEFINE(BROKEN_SETREUID)
492 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000493 AC_DEFINE(WITH_ABBREV_NO_TTY)
494 AC_DEFINE(USE_PIPES)
495 AC_DEFINE(DISABLE_FD_PASSING)
496 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100497 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000498 MANTYPE=cat
499 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000500*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100501 AC_DEFINE(SETEUID_BREAKS_SETUID)
502 AC_DEFINE(BROKEN_SETREUID)
503 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000504 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700505 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700506 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000507 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
508 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
509 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700510 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000511*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000512 AC_MSG_CHECKING(for Digital Unix SIA)
513 no_osfsia=""
514 AC_ARG_WITH(osfsia,
515 [ --with-osfsia Enable Digital Unix SIA],
516 [
517 if test "x$withval" = "xno" ; then
518 AC_MSG_RESULT(disabled)
519 no_osfsia=1
520 fi
521 ],
522 )
523 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000524 if test -f /etc/sia/matrix.conf; then
525 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700526 AC_DEFINE(HAVE_OSF_SIA, 1,
527 [Define if you have Digital Unix Security
528 Integration Architecture])
529 AC_DEFINE(DISABLE_LOGIN, 1,
530 [Define if you don't want to use your
531 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000532 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000533 LIBS="$LIBS -lsecurity -ldb -lm -laud"
534 else
535 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700536 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
537 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000538 fi
539 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000540 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700541 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000542 AC_DEFINE(BROKEN_SETREUID)
543 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000544 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000545
546*-*-nto-qnx)
547 AC_DEFINE(USE_PIPES)
548 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700549 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
550 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
551 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000552 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000553
554*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700555 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
556 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
557 AC_DEFINE(NEED_SETPRGP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700558 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
559 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000560
561*-*-lynxos)
562 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700563 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000564 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
565 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100566esac
567
Damien Millere37bfc12000-06-05 09:37:43 +1000568# Allow user to specify flags
569AC_ARG_WITH(cflags,
570 [ --with-cflags Specify additional flags to pass to compiler],
571 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800572 if test -n "$withval" && test "x$withval" != "xno" && \
573 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000574 CFLAGS="$CFLAGS $withval"
575 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800576 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000577)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000578AC_ARG_WITH(cppflags,
579 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
580 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800581 if test -n "$withval" && test "x$withval" != "xno" && \
582 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000583 CPPFLAGS="$CPPFLAGS $withval"
584 fi
585 ]
586)
Damien Millere37bfc12000-06-05 09:37:43 +1000587AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000588 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000589 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800590 if test -n "$withval" && test "x$withval" != "xno" && \
591 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000592 LDFLAGS="$LDFLAGS $withval"
593 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800594 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000595)
596AC_ARG_WITH(libs,
597 [ --with-libs Specify additional libraries to link with],
598 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800599 if test -n "$withval" && test "x$withval" != "xno" && \
600 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000601 LIBS="$LIBS $withval"
602 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800603 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000604)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000605AC_ARG_WITH(Werror,
606 [ --with-Werror Build main code with -Werror],
607 [
608 if test -n "$withval" && test "x$withval" != "xno"; then
609 werror_flags="-Werror"
Damien Millere04ec6f2005-10-08 16:21:19 +1000610 if test "x${withval}" != "xyes"; then
Darren Tucker7da23cb2005-08-03 00:20:15 +1000611 werror_flags="$withval"
612 fi
613 fi
614 ]
615)
Damien Millere37bfc12000-06-05 09:37:43 +1000616
Darren Tucker6eb93042003-06-29 21:30:41 +1000617AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000618AC_RUN_IFELSE(
619 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000620#include <stdio.h>
621int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000622 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000623 [ AC_MSG_RESULT(yes) ],
624 [
625 AC_MSG_RESULT(no)
626 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000627 ],
628 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000629)
630
Darren Tucker0c9653f2005-05-28 15:58:14 +1000631dnl Checks for header files.
632AC_CHECK_HEADERS( \
633 bstring.h \
634 crypt.h \
635 dirent.h \
636 endian.h \
637 features.h \
638 floatingpoint.h \
639 getopt.h \
640 glob.h \
641 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700642 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000643 lastlog.h \
644 limits.h \
645 login.h \
646 login_cap.h \
647 maillock.h \
648 ndir.h \
649 netdb.h \
650 netgroup.h \
651 netinet/in_systm.h \
652 pam/pam_appl.h \
653 paths.h \
654 pty.h \
655 readpassphrase.h \
656 rpc/types.h \
657 security/pam_appl.h \
658 shadow.h \
659 stddef.h \
660 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000661 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000662 strings.h \
663 sys/audit.h \
664 sys/bitypes.h \
665 sys/bsdtty.h \
666 sys/cdefs.h \
667 sys/dir.h \
668 sys/mman.h \
669 sys/ndir.h \
670 sys/prctl.h \
671 sys/pstat.h \
672 sys/select.h \
673 sys/stat.h \
674 sys/stream.h \
675 sys/stropts.h \
676 sys/strtio.h \
677 sys/sysmacros.h \
678 sys/time.h \
679 sys/timers.h \
680 sys/un.h \
681 time.h \
682 tmpdir.h \
683 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000684 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000685 usersec.h \
686 util.h \
687 utime.h \
688 utmp.h \
689 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000690 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000691)
Tim Rice4cec93f2002-02-26 08:40:48 -0800692
Darren Tucker48d99d32004-08-29 17:04:50 +1000693# sys/ptms.h requires sys/stream.h to be included first on Solaris
694AC_CHECK_HEADERS(sys/ptms.h, [], [], [
695#ifdef HAVE_SYS_STREAM_H
696# include <sys/stream.h>
697#endif
698])
699
Damien Millera22ba012000-03-02 23:09:20 +1100700# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700701AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
702AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000703
Tim Rice1e1ef642003-09-11 22:19:31 -0700704dnl IRIX and Solaris 2.5.1 have dirname() in libgen
705AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
706 AC_CHECK_LIB(gen, dirname,[
707 AC_CACHE_CHECK([for broken dirname],
708 ac_cv_have_broken_dirname, [
709 save_LIBS="$LIBS"
710 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000711 AC_RUN_IFELSE(
712 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700713#include <libgen.h>
714#include <string.h>
715
716int main(int argc, char **argv) {
717 char *s, buf[32];
718
719 strncpy(buf,"/etc", 32);
720 s = dirname(buf);
721 if (!s || strncmp(s, "/", 32) != 0) {
722 exit(1);
723 } else {
724 exit(0);
725 }
726}
Darren Tucker314d89e2005-10-17 23:29:23 +1000727 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700728 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000729 [ ac_cv_have_broken_dirname="yes" ],
730 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700731 )
732 LIBS="$save_LIBS"
733 ])
734 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
735 LIBS="$LIBS -lgen"
736 AC_DEFINE(HAVE_DIRNAME)
737 AC_CHECK_HEADERS(libgen.h)
738 fi
739 ])
740])
741
742AC_CHECK_FUNC(getspnam, ,
743 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700744AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
745 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700746
Tim Rice13aae5e2001-10-21 17:53:58 -0700747dnl zlib is required
748AC_ARG_WITH(zlib,
749 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100750 [ if test "x$withval" = "xno" ; then
751 AC_MSG_ERROR([*** zlib is required ***])
752 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700753 if test -d "$withval/lib"; then
754 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700755 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700756 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700757 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700758 fi
759 else
760 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700761 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700762 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700763 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700764 fi
765 fi
766 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700767 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700768 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700769 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700770 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100771 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700772)
773
Tim Ricefcb62202004-01-23 18:35:16 -0800774AC_CHECK_LIB(z, deflate, ,
775 [
776 saved_CPPFLAGS="$CPPFLAGS"
777 saved_LDFLAGS="$LDFLAGS"
778 save_LIBS="$LIBS"
779 dnl Check default zlib install dir
780 if test -n "${need_dash_r}"; then
781 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
782 else
783 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
784 fi
785 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
786 LIBS="$LIBS -lz"
787 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
788 [
789 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
790 ]
791 )
792 ]
793)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100794AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100795
796AC_ARG_WITH(zlib-version-check,
797 [ --without-zlib-version-check Disable zlib version check],
798 [ if test "x$withval" = "xno" ; then
799 zlib_check_nonfatal=1
800 fi
801 ]
802)
803
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000804AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000805AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000806#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100807#include <zlib.h>
808int main()
809{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000810 int a=0, b=0, c=0, d=0, n, v;
811 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
812 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100813 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000814 v = a*1000000 + b*10000 + c*100 + d;
815 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
816
817 /* 1.1.4 is OK */
818 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100819 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000820
Darren Tucker41097ed2005-07-25 15:24:21 +1000821 /* 1.2.3 and up are OK */
822 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000823 exit(0);
824
Darren Tucker2dcd2392004-01-23 17:13:33 +1100825 exit(2);
826}
Darren Tucker623d92f2004-09-12 22:36:15 +1000827 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000828 AC_MSG_RESULT(no),
829 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100830 if test -z "$zlib_check_nonfatal" ; then
831 AC_MSG_ERROR([*** zlib too old - check config.log ***
832Your reported zlib version has known security problems. It's possible your
833vendor has fixed these problems without changing the version number. If you
834are sure this is the case, you can disable the check by running
835"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000836If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000837See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100838 else
839 AC_MSG_WARN([zlib version may have security problems])
840 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000841 ],
842 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100843)
Damien Miller6f9c3372000-10-25 10:06:04 +1100844
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000845dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100846AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000847 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
848)
Damien Millera8e06ce2003-11-21 23:48:55 +1100849AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700850 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
851 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000852)
Damien Millerab18c411999-11-11 10:40:23 +1100853
Tim Ricee589a292001-11-03 11:09:32 -0800854dnl Checks for libutil functions
855AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700856AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
857 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800858AC_CHECK_FUNCS(logout updwtmp logwtmp)
859
Ben Lindstrom8697e082001-02-24 21:41:10 +0000860AC_FUNC_STRFTIME
861
Damien Miller3c027682001-03-14 11:39:45 +1100862# Check for ALTDIRFUNC glob() extension
863AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
864AC_EGREP_CPP(FOUNDIT,
865 [
866 #include <glob.h>
867 #ifdef GLOB_ALTDIRFUNC
868 FOUNDIT
869 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100870 ],
Damien Miller3c027682001-03-14 11:39:45 +1100871 [
Tim Rice7df8d392005-09-19 09:33:39 -0700872 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
873 [Define if your system glob() function has
874 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100875 AC_MSG_RESULT(yes)
876 ],
877 [
878 AC_MSG_RESULT(no)
879 ]
880)
Damien Millerab18c411999-11-11 10:40:23 +1100881
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000882# Check for g.gl_matchc glob() extension
883AC_MSG_CHECKING(for gl_matchc field in glob_t)
884AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100885 [
886 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000887 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100888 ],
889 [
Tim Rice7df8d392005-09-19 09:33:39 -0700890 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
891 [Define if your system glob() function has
892 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100893 AC_MSG_RESULT(yes)
894 ],
895 [
896 AC_MSG_RESULT(no)
897 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000898)
899
Damien Miller18bb4732001-03-28 14:35:30 +1000900AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000901AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000902 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000903#include <sys/types.h>
904#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700905int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000906 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100907 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000908 [
909 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700910 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
911 [Define in your struct dirent expects you to
912 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000913 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800914 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000915 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
916 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000917 ]
918)
919
Damien Miller36f49652004-08-15 18:40:59 +1000920AC_MSG_CHECKING([for /proc/pid/fd directory])
921if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700922 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000923 AC_MSG_RESULT(yes)
924else
925 AC_MSG_RESULT(no)
926fi
927
Damien Millerc547bf12001-02-16 10:18:12 +1100928# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100929SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100930AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100931 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100932 [
933 if test "x$withval" != "xno" ; then
934
935 if test "x$withval" != "xyes" ; then
936 CPPFLAGS="$CPPFLAGS -I${withval}/include"
937 LDFLAGS="$LDFLAGS -L${withval}/lib"
938 fi
939
Tim Rice7df8d392005-09-19 09:33:39 -0700940 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +1100941 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100942 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800943
Tim Rice4cec93f2002-02-26 08:40:48 -0800944 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +1000945 AC_LINK_IFELSE(
946 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -0800947#include <stdio.h>
948#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700949int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +1000950 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -0800951 [AC_MSG_RESULT(yes)],
952 [
953 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100954 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
955 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000956 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
957 AC_TRY_COMPILE(
958 [#include <stdio.h>
959 #include <skey.h>],
960 [(void)skeychallenge(NULL,"name","",0);],
961 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700962 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
963 [Define if your skeychallenge()
964 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +1000965 [AC_MSG_RESULT(no)]
966 )
Damien Millerc547bf12001-02-16 10:18:12 +1100967 fi
968 ]
969)
970
971# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700972TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100973AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100974 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100975 [
976 if test "x$withval" != "xno" ; then
977 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700978 saved_LDFLAGS="$LDFLAGS"
979 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800980 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800981 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700982 if test -d "${withval}/lib"; then
983 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700984 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700985 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700986 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700987 fi
988 else
989 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700990 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700991 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700992 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700993 fi
994 fi
995 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700996 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700997 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700998 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700999 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001000 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001001 LIBWRAP="-lwrap"
1002 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001003 AC_MSG_CHECKING(for libwrap)
1004 AC_TRY_LINK(
1005 [
Damien Miller0ac45002004-04-14 20:14:26 +10001006#include <sys/types.h>
1007#include <sys/socket.h>
1008#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001009#include <tcpd.h>
1010 int deny_severity = 0, allow_severity = 0;
1011 ],
1012 [hosts_access(0);],
1013 [
1014 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001015 AC_DEFINE(LIBWRAP, 1,
1016 [Define if you want
1017 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001018 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001019 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001020 ],
1021 [
1022 AC_MSG_ERROR([*** libwrap missing])
1023 ]
1024 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001025 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001026 fi
1027 ]
1028)
1029
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001030# Check whether user wants libedit support
1031LIBEDIT_MSG="no"
1032AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001033 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001034 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001035 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001036 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1037 if test -n "${need_dash_r}"; then
1038 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1039 else
1040 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1041 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001042 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001043 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001044 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001045 LIBEDIT="-ledit -lcurses"
1046 LIBEDIT_MSG="yes"
1047 AC_SUBST(LIBEDIT)
1048 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001049 [ AC_MSG_ERROR(libedit not found) ],
1050 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001051 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001052 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001053 AC_COMPILE_IFELSE(
1054 [AC_LANG_SOURCE([[
1055#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001056int main(void)
1057{
1058 int i = H_SETSIZE;
1059 el_init("", NULL, NULL, NULL);
1060 exit(0);
1061}
Tim Ricec1819c82005-08-15 17:48:40 -07001062 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001063 [ AC_MSG_RESULT(yes) ],
1064 [ AC_MSG_RESULT(no)
1065 AC_MSG_ERROR(libedit version is not compatible) ]
1066 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001067 fi ]
1068)
1069
Darren Tuckerd9f88912005-02-20 21:01:48 +11001070AUDIT_MODULE=none
1071AC_ARG_WITH(audit,
1072 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1073 [
1074 AC_MSG_CHECKING(for supported audit module)
1075 case "$withval" in
1076 bsm)
1077 AC_MSG_RESULT(bsm)
1078 AUDIT_MODULE=bsm
1079 dnl Checks for headers, libs and functions
1080 AC_CHECK_HEADERS(bsm/audit.h, [],
1081 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1082 AC_CHECK_LIB(bsm, getaudit, [],
1083 [AC_MSG_ERROR(BSM enabled and required library not found)])
1084 AC_CHECK_FUNCS(getaudit, [],
1085 [AC_MSG_ERROR(BSM enabled and required function not found)])
1086 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001087 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001088 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001089 ;;
1090 debug)
1091 AUDIT_MODULE=debug
1092 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001093 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001094 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001095 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001096 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001097 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001098 *)
1099 AC_MSG_ERROR([Unknown audit module $withval])
1100 ;;
1101 esac ]
1102)
1103
Damien Millerfe1f1432003-02-24 15:45:42 +11001104dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001105AC_CHECK_FUNCS( \
1106 arc4random \
1107 b64_ntop \
1108 __b64_ntop \
1109 b64_pton \
1110 __b64_pton \
1111 bcopy \
1112 bindresvport_sa \
1113 clock \
1114 closefrom \
1115 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001116 fchmod \
1117 fchown \
1118 freeaddrinfo \
1119 futimes \
1120 getaddrinfo \
1121 getcwd \
1122 getgrouplist \
1123 getnameinfo \
1124 getopt \
1125 getpeereid \
1126 _getpty \
1127 getrlimit \
1128 getttyent \
1129 glob \
1130 inet_aton \
1131 inet_ntoa \
1132 inet_ntop \
1133 innetgr \
1134 login_getcapbool \
1135 md5_crypt \
1136 memmove \
1137 mkdtemp \
1138 mmap \
1139 ngetaddrinfo \
1140 nsleep \
1141 ogetaddrinfo \
1142 openlog_r \
1143 openpty \
1144 prctl \
1145 pstat \
1146 readpassphrase \
1147 realpath \
1148 recvmsg \
1149 rresvport_af \
1150 sendmsg \
1151 setdtablesize \
1152 setegid \
1153 setenv \
1154 seteuid \
1155 setgroups \
1156 setlogin \
1157 setpcred \
1158 setproctitle \
1159 setregid \
1160 setreuid \
1161 setrlimit \
1162 setsid \
1163 setvbuf \
1164 sigaction \
1165 sigvec \
1166 snprintf \
1167 socketpair \
1168 strdup \
1169 strerror \
1170 strlcat \
1171 strlcpy \
1172 strmode \
1173 strnvis \
1174 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001175 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001176 strtoul \
1177 sysconf \
1178 tcgetpgrp \
1179 truncate \
1180 unsetenv \
1181 updwtmpx \
1182 utimes \
1183 vhangup \
1184 vsnprintf \
1185 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001186)
Tim Rice13aae5e2001-10-21 17:53:58 -07001187
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001188# IRIX has a const char return value for gai_strerror()
1189AC_CHECK_FUNCS(gai_strerror,[
1190 AC_DEFINE(HAVE_GAI_STRERROR)
1191 AC_TRY_COMPILE([
1192#include <sys/types.h>
1193#include <sys/socket.h>
1194#include <netdb.h>
1195
1196const char *gai_strerror(int);],[
1197char *str;
1198
1199str = gai_strerror(0);],[
1200 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1201 [Define if gai_strerror() returns const char *])])])
1202
Tim Rice7df8d392005-09-19 09:33:39 -07001203AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1204 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001205
Darren Tuckerf1159b52003-07-07 19:44:01 +10001206dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001207AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001208AC_CHECK_DECL(strsep,
1209 [AC_CHECK_FUNCS(strsep)],
1210 [],
1211 [
1212#ifdef HAVE_STRING_H
1213# include <string.h>
1214#endif
1215 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001216
Darren Tuckerb2427c82003-09-10 15:22:44 +10001217dnl tcsendbreak might be a macro
1218AC_CHECK_DECL(tcsendbreak,
1219 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001220 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001221 [#include <termios.h>]
1222)
1223
Darren Tucker5bb14002004-04-23 18:53:10 +10001224AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1225
Darren Tucker2a6b0292003-12-31 14:59:17 +11001226AC_CHECK_FUNCS(setresuid, [
1227 dnl Some platorms have setresuid that isn't implemented, test for this
1228 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001229 AC_RUN_IFELSE(
1230 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001231#include <stdlib.h>
1232#include <errno.h>
1233int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001234 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001235 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001236 [AC_DEFINE(BROKEN_SETRESUID, 1,
1237 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001238 AC_MSG_RESULT(not implemented)],
1239 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001240 )
1241])
Darren Tuckere937be32003-12-17 18:53:26 +11001242
Darren Tucker2a6b0292003-12-31 14:59:17 +11001243AC_CHECK_FUNCS(setresgid, [
1244 dnl Some platorms have setresgid that isn't implemented, test for this
1245 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001246 AC_RUN_IFELSE(
1247 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001248#include <stdlib.h>
1249#include <errno.h>
1250int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001251 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001252 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001253 [AC_DEFINE(BROKEN_SETRESGID, 1,
1254 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001255 AC_MSG_RESULT(not implemented)],
1256 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001257 )
1258])
Darren Tuckere937be32003-12-17 18:53:26 +11001259
Damien Millerad833b32000-08-23 10:46:23 +10001260dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001261AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001262dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001263AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001264AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001265dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001266AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001267AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001268
Damien Millera8e06ce2003-11-21 23:48:55 +11001269AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001270 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1271 [AC_CHECK_LIB(bsd, daemon,
1272 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001273)
1274
Damien Millera8e06ce2003-11-21 23:48:55 +11001275AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001276 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1277 [Define if your libraries define getpagesize()])],
1278 [AC_CHECK_LIB(ucb, getpagesize,
1279 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001280)
1281
Damien Millercb170cb2000-07-01 16:52:55 +10001282# Check for broken snprintf
1283if test "x$ac_cv_func_snprintf" = "xyes" ; then
1284 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001285 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001286 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001287#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001288int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001289 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001290 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001291 [
1292 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001293 AC_DEFINE(BROKEN_SNPRINTF, 1,
1294 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001295 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001296 ],
1297 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001298 )
1299fi
1300
Damien Millerb4097182004-05-23 14:09:40 +10001301# Check for missing getpeereid (or equiv) support
1302NO_PEERCHECK=""
1303if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1304 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1305 AC_TRY_COMPILE(
1306 [#include <sys/types.h>
1307 #include <sys/socket.h>],
1308 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001309 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001310 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001311 ],
Damien Millerb4097182004-05-23 14:09:40 +10001312 [AC_MSG_RESULT(no)
1313 NO_PEERCHECK=1]
1314 )
1315fi
1316
Damien Millere8328192003-01-07 15:18:32 +11001317dnl see whether mkstemp() requires XXXXXX
1318if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1319AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001320AC_RUN_IFELSE(
1321 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001322#include <stdlib.h>
1323main() { char template[]="conftest.mkstemp-test";
1324if (mkstemp(template) == -1)
1325 exit(1);
1326unlink(template); exit(0);
1327}
Darren Tucker314d89e2005-10-17 23:29:23 +10001328 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001329 [
1330 AC_MSG_RESULT(no)
1331 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001332 [
Damien Millere8328192003-01-07 15:18:32 +11001333 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001334 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001335 ],
1336 [
1337 AC_MSG_RESULT(yes)
1338 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001339 ]
Damien Millere8328192003-01-07 15:18:32 +11001340)
1341fi
1342
Darren Tucker70a3d552003-08-21 17:58:29 +10001343dnl make sure that openpty does not reacquire controlling terminal
1344if test ! -z "$check_for_openpty_ctty_bug"; then
1345 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001346 AC_RUN_IFELSE(
1347 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001348#include <stdio.h>
1349#include <sys/fcntl.h>
1350#include <sys/types.h>
1351#include <sys/wait.h>
1352
1353int
1354main()
1355{
1356 pid_t pid;
1357 int fd, ptyfd, ttyfd, status;
1358
1359 pid = fork();
1360 if (pid < 0) { /* failed */
1361 exit(1);
1362 } else if (pid > 0) { /* parent */
1363 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001364 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001365 exit(WEXITSTATUS(status));
1366 else
1367 exit(2);
1368 } else { /* child */
1369 close(0); close(1); close(2);
1370 setsid();
1371 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1372 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1373 if (fd >= 0)
1374 exit(3); /* Acquired ctty: broken */
1375 else
1376 exit(0); /* Did not acquire ctty: OK */
1377 }
1378}
Darren Tucker314d89e2005-10-17 23:29:23 +10001379 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001380 [
1381 AC_MSG_RESULT(yes)
1382 ],
1383 [
1384 AC_MSG_RESULT(no)
1385 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001386 ],
1387 [
1388 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001389 ]
1390 )
1391fi
1392
Tim Rice8bb561b2005-03-17 16:23:19 -08001393if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1394 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001395 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001396 AC_RUN_IFELSE(
1397 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001398#include <stdio.h>
1399#include <sys/socket.h>
1400#include <netdb.h>
1401#include <errno.h>
1402#include <netinet/in.h>
1403
1404#define TEST_PORT "2222"
1405
1406int
1407main(void)
1408{
1409 int err, sock;
1410 struct addrinfo *gai_ai, *ai, hints;
1411 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1412
1413 memset(&hints, 0, sizeof(hints));
1414 hints.ai_family = PF_UNSPEC;
1415 hints.ai_socktype = SOCK_STREAM;
1416 hints.ai_flags = AI_PASSIVE;
1417
1418 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1419 if (err != 0) {
1420 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1421 exit(1);
1422 }
1423
1424 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1425 if (ai->ai_family != AF_INET6)
1426 continue;
1427
1428 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1429 sizeof(ntop), strport, sizeof(strport),
1430 NI_NUMERICHOST|NI_NUMERICSERV);
1431
1432 if (err != 0) {
1433 if (err == EAI_SYSTEM)
1434 perror("getnameinfo EAI_SYSTEM");
1435 else
1436 fprintf(stderr, "getnameinfo failed: %s\n",
1437 gai_strerror(err));
1438 exit(2);
1439 }
1440
1441 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1442 if (sock < 0)
1443 perror("socket");
1444 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1445 if (errno == EBADF)
1446 exit(3);
1447 }
1448 }
1449 exit(0);
1450}
Darren Tucker314d89e2005-10-17 23:29:23 +10001451 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001452 [
1453 AC_MSG_RESULT(yes)
1454 ],
1455 [
1456 AC_MSG_RESULT(no)
1457 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001458 ],
1459 [
1460 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001461 ]
1462 )
1463fi
1464
Tim Rice8bb561b2005-03-17 16:23:19 -08001465if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1466 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001467 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001468 AC_RUN_IFELSE(
1469 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001470#include <stdio.h>
1471#include <sys/socket.h>
1472#include <netdb.h>
1473#include <errno.h>
1474#include <netinet/in.h>
1475
1476#define TEST_PORT "2222"
1477
1478int
1479main(void)
1480{
1481 int err, sock;
1482 struct addrinfo *gai_ai, *ai, hints;
1483 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1484
1485 memset(&hints, 0, sizeof(hints));
1486 hints.ai_family = PF_UNSPEC;
1487 hints.ai_socktype = SOCK_STREAM;
1488 hints.ai_flags = AI_PASSIVE;
1489
1490 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1491 if (err != 0) {
1492 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1493 exit(1);
1494 }
1495
1496 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1497 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1498 continue;
1499
1500 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1501 sizeof(ntop), strport, sizeof(strport),
1502 NI_NUMERICHOST|NI_NUMERICSERV);
1503
1504 if (ai->ai_family == AF_INET && err != 0) {
1505 perror("getnameinfo");
1506 exit(2);
1507 }
1508 }
1509 exit(0);
1510}
Darren Tucker314d89e2005-10-17 23:29:23 +10001511 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001512 [
1513 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001514 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1515 [Define if you have a getaddrinfo that fails
1516 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001517 ],
1518 [
1519 AC_MSG_RESULT(no)
1520 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001521 ],
1522 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001523 ]
1524 )
1525fi
1526
Darren Tuckera56f1912004-11-02 20:30:54 +11001527if test "x$check_for_conflicting_getspnam" = "x1"; then
1528 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1529 AC_COMPILE_IFELSE(
1530 [
1531#include <shadow.h>
1532int main(void) {exit(0);}
1533 ],
1534 [
1535 AC_MSG_RESULT(no)
1536 ],
1537 [
1538 AC_MSG_RESULT(yes)
1539 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1540 [Conflicting defs for getspnam])
1541 ]
1542 )
1543fi
1544
Damien Miller606f8802000-09-16 15:39:56 +11001545AC_FUNC_GETPGRP
1546
Damien Millera64b57a2001-01-17 10:44:13 +11001547# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001548PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001549AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001550 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001551 [
Damien Millera64b57a2001-01-17 10:44:13 +11001552 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001553 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1554 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001555 AC_MSG_ERROR([PAM headers not found])
1556 fi
1557
1558 AC_CHECK_LIB(dl, dlopen, , )
1559 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1560 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001561 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001562
Damien Millera64b57a2001-01-17 10:44:13 +11001563 PAM_MSG="yes"
1564
Tim Rice7df8d392005-09-19 09:33:39 -07001565 AC_DEFINE(USE_PAM, 1,
1566 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001567 if test $ac_cv_lib_dl_dlopen = yes; then
1568 LIBPAM="-lpam -ldl"
1569 else
1570 LIBPAM="-lpam"
1571 fi
1572 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001573 fi
1574 ]
1575)
Damien Millera22ba012000-03-02 23:09:20 +11001576
Damien Millera64b57a2001-01-17 10:44:13 +11001577# Check for older PAM
1578if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001579 # Check PAM strerror arguments (old PAM)
1580 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1581 AC_TRY_COMPILE(
1582 [
Damien Miller81171112000-04-23 11:14:01 +10001583#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001584#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001585#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001586#elif defined (HAVE_PAM_PAM_APPL_H)
1587#include <pam/pam_appl.h>
1588#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001589 ],
1590 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001591 [AC_MSG_RESULT(no)],
1592 [
Tim Rice7df8d392005-09-19 09:33:39 -07001593 AC_DEFINE(HAVE_OLD_PAM, 1,
1594 [Define if you have an old version of PAM
1595 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001596 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001597 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001598 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001599 )
Damien Millera22ba012000-03-02 23:09:20 +11001600fi
1601
Tim Riceaef73712002-05-11 13:17:42 -07001602# Search for OpenSSL
1603saved_CPPFLAGS="$CPPFLAGS"
1604saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001605AC_ARG_WITH(ssl-dir,
1606 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1607 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001608 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001609 case "$withval" in
1610 # Relative paths
1611 ./*|../*) withval="`pwd`/$withval"
1612 esac
Tim Riceaef73712002-05-11 13:17:42 -07001613 if test -d "$withval/lib"; then
1614 if test -n "${need_dash_r}"; then
1615 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1616 else
1617 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1618 fi
1619 else
1620 if test -n "${need_dash_r}"; then
1621 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1622 else
1623 LDFLAGS="-L${withval} ${LDFLAGS}"
1624 fi
1625 fi
1626 if test -d "$withval/include"; then
1627 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1628 else
1629 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1630 fi
Damien Millera22ba012000-03-02 23:09:20 +11001631 fi
1632 ]
1633)
Tim Rice3d5352e2004-02-12 09:27:21 -08001634LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001635AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1636 [Define if your ssl headers are included
1637 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001638 [
Tim Riceaef73712002-05-11 13:17:42 -07001639 dnl Check default openssl install dir
1640 if test -n "${need_dash_r}"; then
1641 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001642 else
Tim Riceaef73712002-05-11 13:17:42 -07001643 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001644 fi
Tim Riceaef73712002-05-11 13:17:42 -07001645 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1646 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1647 [
1648 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1649 ]
1650 )
1651 ]
1652)
1653
Tim Riced730b782002-08-13 18:52:10 -07001654# Determine OpenSSL header version
1655AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001656AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001657 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001658#include <stdio.h>
1659#include <string.h>
1660#include <openssl/opensslv.h>
1661#define DATA "conftest.sslincver"
1662int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001663 FILE *fd;
1664 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001665
Damien Millera8e06ce2003-11-21 23:48:55 +11001666 fd = fopen(DATA,"w");
1667 if(fd == NULL)
1668 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001669
1670 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1671 exit(1);
1672
1673 exit(0);
1674}
Darren Tucker623d92f2004-09-12 22:36:15 +10001675 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001676 [
1677 ssl_header_ver=`cat conftest.sslincver`
1678 AC_MSG_RESULT($ssl_header_ver)
1679 ],
1680 [
1681 AC_MSG_RESULT(not found)
1682 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001683 ],
1684 [
1685 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001686 ]
1687)
1688
1689# Determine OpenSSL library version
1690AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001691AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001692 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001693#include <stdio.h>
1694#include <string.h>
1695#include <openssl/opensslv.h>
1696#include <openssl/crypto.h>
1697#define DATA "conftest.ssllibver"
1698int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001699 FILE *fd;
1700 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001701
Damien Millera8e06ce2003-11-21 23:48:55 +11001702 fd = fopen(DATA,"w");
1703 if(fd == NULL)
1704 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001705
1706 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1707 exit(1);
1708
1709 exit(0);
1710}
Darren Tucker623d92f2004-09-12 22:36:15 +10001711 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001712 [
1713 ssl_library_ver=`cat conftest.ssllibver`
1714 AC_MSG_RESULT($ssl_library_ver)
1715 ],
1716 [
1717 AC_MSG_RESULT(not found)
1718 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001719 ],
1720 [
1721 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001722 ]
1723)
Damien Millera22ba012000-03-02 23:09:20 +11001724
Damien Millerec932372002-01-22 22:16:03 +11001725# Sanity check OpenSSL headers
1726AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001727AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001728 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001729#include <string.h>
1730#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001731int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001732 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001733 [
1734 AC_MSG_RESULT(yes)
1735 ],
1736 [
1737 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001738 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1739Check config.log for details.
1740Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001741 ],
1742 [
1743 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001744 ]
1745)
1746
Tim Rice3d5352e2004-02-12 09:27:21 -08001747# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1748# because the system crypt() is more featureful.
1749if test "x$check_for_libcrypt_before" = "x1"; then
1750 AC_CHECK_LIB(crypt, crypt)
1751fi
1752
Damien Millera8e06ce2003-11-21 23:48:55 +11001753# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001754# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001755if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001756 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001757fi
1758
Tim Rice2291c002005-08-26 13:15:19 -07001759AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001760
1761### Configure cryptographic random number support
1762
1763# Check wheter OpenSSL seeds itself
1764AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001765AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001766 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001767#include <string.h>
1768#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001769int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001770 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001771 [
1772 OPENSSL_SEEDS_ITSELF=yes
1773 AC_MSG_RESULT(yes)
1774 ],
1775 [
1776 AC_MSG_RESULT(no)
1777 # Default to use of the rand helper if OpenSSL doesn't
1778 # seed itself
1779 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001780 ],
1781 [
1782 AC_MSG_WARN([cross compiling: assuming yes])
1783 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001784 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001785 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001786 ]
1787)
1788
1789
1790# Do we want to force the use of the rand helper?
1791AC_ARG_WITH(rand-helper,
1792 [ --with-rand-helper Use subprocess to gather strong randomness ],
1793 [
1794 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001795 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001796 # the previous test showed it to be unseeded.
1797 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1798 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1799 OPENSSL_SEEDS_ITSELF=yes
1800 USE_RAND_HELPER=""
1801 fi
1802 else
1803 USE_RAND_HELPER=yes
1804 fi
1805 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001806)
Damien Miller6c21c512002-01-22 21:57:53 +11001807
1808# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001809if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001810 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001811 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1812 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001813 RAND_MSG="OpenSSL internal ONLY"
1814 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001815elif test ! -z "$USE_RAND_HELPER" ; then
1816 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001817 RAND_MSG="ssh-rand-helper"
1818 INSTALL_SSH_RAND_HELPER="yes"
1819fi
1820AC_SUBST(INSTALL_SSH_RAND_HELPER)
1821
1822### Configuration of ssh-rand-helper
1823
1824# PRNGD TCP socket
1825AC_ARG_WITH(prngd-port,
1826 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1827 [
Damien Millere996d722002-01-23 11:20:59 +11001828 case "$withval" in
1829 no)
1830 withval=""
1831 ;;
1832 [[0-9]]*)
1833 ;;
1834 *)
1835 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1836 ;;
1837 esac
1838 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001839 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001840 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1841 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001842 fi
1843 ]
1844)
1845
1846# PRNGD Unix domain socket
1847AC_ARG_WITH(prngd-socket,
1848 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1849 [
Damien Millere996d722002-01-23 11:20:59 +11001850 case "$withval" in
1851 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001852 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001853 ;;
1854 no)
1855 withval=""
1856 ;;
1857 /*)
1858 ;;
1859 *)
1860 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1861 ;;
1862 esac
1863
1864 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001865 if test ! -z "$PRNGD_PORT" ; then
1866 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1867 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001868 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001869 AC_MSG_WARN(Entropy socket is not readable)
1870 fi
1871 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001872 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1873 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001874 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001875 ],
1876 [
1877 # Check for existing socket only if we don't have a random device already
1878 if test "$USE_RAND_HELPER" = yes ; then
1879 AC_MSG_CHECKING(for PRNGD/EGD socket)
1880 # Insert other locations here
1881 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1882 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1883 PRNGD_SOCKET="$sock"
1884 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1885 break;
1886 fi
1887 done
1888 if test ! -z "$PRNGD_SOCKET" ; then
1889 AC_MSG_RESULT($PRNGD_SOCKET)
1890 else
1891 AC_MSG_RESULT(not found)
1892 fi
1893 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001894 ]
1895)
1896
1897# Change default command timeout for hashing entropy source
1898entropy_timeout=200
1899AC_ARG_WITH(entropy-timeout,
1900 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1901 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001902 if test -n "$withval" && test "x$withval" != "xno" && \
1903 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001904 entropy_timeout=$withval
1905 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001906 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001907)
Tim Rice7df8d392005-09-19 09:33:39 -07001908AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1909 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11001910
Damien Millerd3f6ad22002-06-25 10:24:47 +10001911SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001912AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001913 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001914 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001915 if test -n "$withval" && test "x$withval" != "xno" && \
1916 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001917 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001918 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001919 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001920)
Tim Rice7df8d392005-09-19 09:33:39 -07001921AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
1922 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10001923AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001924
Tim Rice88f2ab52002-03-17 12:17:34 -08001925# We do this little dance with the search path to insure
1926# that programs that we select for use by installed programs
1927# (which may be run by the super-user) come from trusted
1928# locations before they come from the user's private area.
1929# This should help avoid accidentally configuring some
1930# random version of a program in someone's personal bin.
1931
1932OPATH=$PATH
1933PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001934test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001935test -d /sbin && PATH=$PATH:/sbin
1936test -d /usr/sbin && PATH=$PATH:/usr/sbin
1937PATH=$PATH:/etc:$OPATH
1938
Damien Millera8e06ce2003-11-21 23:48:55 +11001939# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001940OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1941OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1942OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1943OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1944OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1945OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1946OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1947OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1948OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1949OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1950OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1951OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1952OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1953OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1954OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1955OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001956# restore PATH
1957PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001958
1959# Where does ssh-rand-helper get its randomness from?
1960INSTALL_SSH_PRNG_CMDS=""
1961if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1962 if test ! -z "$PRNGD_PORT" ; then
1963 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1964 elif test ! -z "$PRNGD_SOCKET" ; then
1965 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1966 else
1967 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1968 RAND_HELPER_CMDHASH=yes
1969 INSTALL_SSH_PRNG_CMDS="yes"
1970 fi
1971fi
1972AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1973
1974
Ben Lindstromb5628642000-10-18 00:02:25 +00001975# Cheap hack to ensure NEWS-OS libraries are arranged right.
1976if test ! -z "$SONY" ; then
1977 LIBS="$LIBS -liberty";
1978fi
1979
Damien Millera22ba012000-03-02 23:09:20 +11001980# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001981AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001982AC_CHECK_SIZEOF(short int, 2)
1983AC_CHECK_SIZEOF(int, 4)
1984AC_CHECK_SIZEOF(long int, 4)
1985AC_CHECK_SIZEOF(long long int, 8)
1986
Damien Millerfa2bb692002-04-23 23:22:25 +10001987# Sanity check long long for some platforms (AIX)
1988if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1989 ac_cv_sizeof_long_long_int=0
1990fi
1991
Darren Tucker537f1ed2005-10-25 18:38:33 +10001992# compute LLONG_MIN and LLONG_MAX if we don't know them.
1993if test -z "$have_llong_max"; then
1994 AC_MSG_CHECKING([for max value of long long])
1995 AC_RUN_IFELSE(
1996 [AC_LANG_SOURCE([[
1997#include <stdio.h>
1998/* Why is this so damn hard? */
1999#ifdef __GNUC__
2000# undef __GNUC__
2001#endif
2002#define __USE_ISOC99
2003#include <limits.h>
2004#define DATA "conftest.llminmax"
2005int main(void) {
2006 FILE *f;
2007 long long i, llmin, llmax = 0;
2008
2009 if((f = fopen(DATA,"w")) == NULL)
2010 exit(1);
2011
2012#if defined(LLONG_MIN) && defined(LLONG_MAX)
2013 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2014 llmin = LLONG_MIN;
2015 llmax = LLONG_MAX;
2016#else
2017 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2018 /* This will work on one's complement and two's complement */
2019 for (i = 1; i > llmax; i <<= 1, i++)
2020 llmax = i;
2021 llmin = llmax + 1LL; /* wrap */
2022#endif
2023
2024 /* Sanity check */
2025 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2026 || llmax - 1 > llmax) {
2027 fprintf(f, "unknown unknown\n");
2028 exit(2);
2029 }
2030
2031 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2032 exit(3);
2033
2034 exit(0);
2035}
2036 ]])],
2037 [
2038 llong_min=`$AWK '{print $1}' conftest.llminmax`
2039 llong_max=`$AWK '{print $2}' conftest.llminmax`
2040
2041 # snprintf on some Tru64s doesn't understand "%lld"
2042 case "$host" in
2043 alpha-dec-osf*)
2044 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2045 test "x$llong_max" = "xld"; then
2046 llong_min="-9223372036854775808"
2047 llong_max="9223372036854775807"
2048 fi
2049 ;;
2050 esac
2051
2052 AC_MSG_RESULT($llong_max)
2053 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2054 [max value of long long calculated by configure])
2055 AC_MSG_CHECKING([for min value of long long])
2056 AC_MSG_RESULT($llong_min)
2057 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2058 [min value of long long calculated by configure])
2059 ],
2060 [
2061 AC_MSG_RESULT(not found)
2062 ],
2063 [
2064 AC_MSG_WARN([cross compiling: not checking])
2065 ]
2066 )
2067fi
2068
2069
Damien Millera22ba012000-03-02 23:09:20 +11002070# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002071AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2072 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002073 [ #include <sys/types.h> ],
2074 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002075 [ ac_cv_have_u_int="yes" ],
2076 [ ac_cv_have_u_int="no" ]
2077 )
2078])
2079if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002080 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002081 have_u_int=1
2082fi
2083
Damien Miller61e50f12000-05-08 20:49:37 +10002084AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2085 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002086 [ #include <sys/types.h> ],
2087 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002088 [ ac_cv_have_intxx_t="yes" ],
2089 [ ac_cv_have_intxx_t="no" ]
2090 )
2091])
2092if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002093 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002094 have_intxx_t=1
2095fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002096
2097if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002098 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002099then
2100 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2101 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002102 [ #include <stdint.h> ],
2103 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002104 [
2105 AC_DEFINE(HAVE_INTXX_T)
2106 AC_MSG_RESULT(yes)
2107 ],
2108 [ AC_MSG_RESULT(no) ]
2109 )
2110fi
2111
Damien Miller578783e2000-09-23 14:12:24 +11002112AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2113 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002114 [
2115#include <sys/types.h>
2116#ifdef HAVE_STDINT_H
2117# include <stdint.h>
2118#endif
2119#include <sys/socket.h>
2120#ifdef HAVE_SYS_BITYPES_H
2121# include <sys/bitypes.h>
2122#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002123 ],
2124 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002125 [ ac_cv_have_int64_t="yes" ],
2126 [ ac_cv_have_int64_t="no" ]
2127 )
2128])
2129if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002130 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002131fi
2132
Damien Miller61e50f12000-05-08 20:49:37 +10002133AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2134 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002135 [ #include <sys/types.h> ],
2136 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002137 [ ac_cv_have_u_intxx_t="yes" ],
2138 [ ac_cv_have_u_intxx_t="no" ]
2139 )
2140])
2141if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002142 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002143 have_u_intxx_t=1
2144fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002145
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002146if test -z "$have_u_intxx_t" ; then
2147 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2148 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002149 [ #include <sys/socket.h> ],
2150 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002151 [
2152 AC_DEFINE(HAVE_U_INTXX_T)
2153 AC_MSG_RESULT(yes)
2154 ],
2155 [ AC_MSG_RESULT(no) ]
2156 )
2157fi
2158
Damien Miller578783e2000-09-23 14:12:24 +11002159AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2160 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002161 [ #include <sys/types.h> ],
2162 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002163 [ ac_cv_have_u_int64_t="yes" ],
2164 [ ac_cv_have_u_int64_t="no" ]
2165 )
2166])
2167if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002168 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002169 have_u_int64_t=1
2170fi
2171
Tim Rice4cec93f2002-02-26 08:40:48 -08002172if test -z "$have_u_int64_t" ; then
2173 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2174 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002175 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002176 [ u_int64_t a; a = 1],
2177 [
2178 AC_DEFINE(HAVE_U_INT64_T)
2179 AC_MSG_RESULT(yes)
2180 ],
2181 [ AC_MSG_RESULT(no) ]
2182 )
2183fi
2184
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002185if test -z "$have_u_intxx_t" ; then
2186 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2187 AC_TRY_COMPILE(
2188 [
2189#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002190 ],
2191 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002192 [ ac_cv_have_uintxx_t="yes" ],
2193 [ ac_cv_have_uintxx_t="no" ]
2194 )
2195 ])
2196 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002197 AC_DEFINE(HAVE_UINTXX_T, 1,
2198 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002199 fi
2200fi
2201
2202if test -z "$have_uintxx_t" ; then
2203 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2204 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002205 [ #include <stdint.h> ],
2206 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002207 [
2208 AC_DEFINE(HAVE_UINTXX_T)
2209 AC_MSG_RESULT(yes)
2210 ],
2211 [ AC_MSG_RESULT(no) ]
2212 )
2213fi
2214
Damien Milleredb82922000-06-20 13:25:52 +10002215if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002216 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002217then
2218 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2219 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002220 [
2221#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002222 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002223 [
Damien Miller70494d12000-04-03 15:57:06 +10002224 int8_t a; int16_t b; int32_t c;
2225 u_int8_t e; u_int16_t f; u_int32_t g;
2226 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002227 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002228 [
2229 AC_DEFINE(HAVE_U_INTXX_T)
2230 AC_DEFINE(HAVE_INTXX_T)
2231 AC_MSG_RESULT(yes)
2232 ],
2233 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002234 )
Damien Millerb29ea912000-01-15 14:12:03 +11002235fi
2236
Damien Miller58be7382001-09-15 21:31:54 +10002237
2238AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2239 AC_TRY_COMPILE(
2240 [
2241#include <sys/types.h>
2242 ],
2243 [ u_char foo; foo = 125; ],
2244 [ ac_cv_have_u_char="yes" ],
2245 [ ac_cv_have_u_char="no" ]
2246 )
2247])
2248if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002249 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002250fi
2251
Tim Rice13aae5e2001-10-21 17:53:58 -07002252TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002253
Tim Rice200a5c02002-02-26 22:12:34 -08002254AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002255
Damien Miller848b9932005-02-24 12:12:34 +11002256AC_CHECK_TYPES(in_addr_t,,,
2257[#include <sys/types.h>
2258#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002259
Damien Miller61e50f12000-05-08 20:49:37 +10002260AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2261 AC_TRY_COMPILE(
2262 [
2263#include <sys/types.h>
2264 ],
2265 [ size_t foo; foo = 1235; ],
2266 [ ac_cv_have_size_t="yes" ],
2267 [ ac_cv_have_size_t="no" ]
2268 )
2269])
2270if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002271 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002272fi
Damien Miller95058511999-12-29 10:36:45 +11002273
Damien Miller615f9392000-05-17 22:53:33 +10002274AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2275 AC_TRY_COMPILE(
2276 [
2277#include <sys/types.h>
2278 ],
2279 [ ssize_t foo; foo = 1235; ],
2280 [ ac_cv_have_ssize_t="yes" ],
2281 [ ac_cv_have_ssize_t="no" ]
2282 )
2283])
2284if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002285 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002286fi
2287
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002288AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2289 AC_TRY_COMPILE(
2290 [
2291#include <time.h>
2292 ],
2293 [ clock_t foo; foo = 1235; ],
2294 [ ac_cv_have_clock_t="yes" ],
2295 [ ac_cv_have_clock_t="no" ]
2296 )
2297])
2298if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002299 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002300fi
2301
Damien Millerb54b40e2000-06-23 08:23:34 +10002302AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2303 AC_TRY_COMPILE(
2304 [
2305#include <sys/types.h>
2306#include <sys/socket.h>
2307 ],
2308 [ sa_family_t foo; foo = 1235; ],
2309 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002310 [ AC_TRY_COMPILE(
2311 [
2312#include <sys/types.h>
2313#include <sys/socket.h>
2314#include <netinet/in.h>
2315 ],
2316 [ sa_family_t foo; foo = 1235; ],
2317 [ ac_cv_have_sa_family_t="yes" ],
2318
Damien Millerb54b40e2000-06-23 08:23:34 +10002319 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002320 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002321 )
2322])
2323if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002324 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2325 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002326fi
2327
Damien Miller0f91b4e2000-06-18 15:43:25 +10002328AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2329 AC_TRY_COMPILE(
2330 [
2331#include <sys/types.h>
2332 ],
2333 [ pid_t foo; foo = 1235; ],
2334 [ ac_cv_have_pid_t="yes" ],
2335 [ ac_cv_have_pid_t="no" ]
2336 )
2337])
2338if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002339 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002340fi
2341
2342AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2343 AC_TRY_COMPILE(
2344 [
2345#include <sys/types.h>
2346 ],
2347 [ mode_t foo; foo = 1235; ],
2348 [ ac_cv_have_mode_t="yes" ],
2349 [ ac_cv_have_mode_t="no" ]
2350 )
2351])
2352if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002353 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002354fi
2355
Damien Miller61e50f12000-05-08 20:49:37 +10002356
2357AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2358 AC_TRY_COMPILE(
2359 [
Damien Miller81171112000-04-23 11:14:01 +10002360#include <sys/types.h>
2361#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002362 ],
2363 [ struct sockaddr_storage s; ],
2364 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2365 [ ac_cv_have_struct_sockaddr_storage="no" ]
2366 )
2367])
2368if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002369 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2370 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002371fi
Damien Miller34132e52000-01-14 15:45:46 +11002372
Damien Miller61e50f12000-05-08 20:49:37 +10002373AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2374 AC_TRY_COMPILE(
2375 [
Damien Miller7b22d652000-06-18 14:07:04 +10002376#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002377#include <netinet/in.h>
2378 ],
2379 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2380 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2381 [ ac_cv_have_struct_sockaddr_in6="no" ]
2382 )
2383])
2384if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002385 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2386 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002387fi
Damien Miller34132e52000-01-14 15:45:46 +11002388
Damien Miller61e50f12000-05-08 20:49:37 +10002389AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2390 AC_TRY_COMPILE(
2391 [
Damien Miller7b22d652000-06-18 14:07:04 +10002392#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002393#include <netinet/in.h>
2394 ],
2395 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2396 [ ac_cv_have_struct_in6_addr="yes" ],
2397 [ ac_cv_have_struct_in6_addr="no" ]
2398 )
2399])
2400if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002401 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2402 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002403fi
Damien Miller34132e52000-01-14 15:45:46 +11002404
Damien Miller61e50f12000-05-08 20:49:37 +10002405AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2406 AC_TRY_COMPILE(
2407 [
Damien Miller81171112000-04-23 11:14:01 +10002408#include <sys/types.h>
2409#include <sys/socket.h>
2410#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002411 ],
2412 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2413 [ ac_cv_have_struct_addrinfo="yes" ],
2414 [ ac_cv_have_struct_addrinfo="no" ]
2415 )
2416])
2417if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002418 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2419 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002420fi
2421
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002422AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2423 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002424 [ #include <sys/time.h> ],
2425 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002426 [ ac_cv_have_struct_timeval="yes" ],
2427 [ ac_cv_have_struct_timeval="no" ]
2428 )
2429])
2430if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002431 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002432 have_struct_timeval=1
2433fi
2434
Tim Rice4e4dc562003-03-18 10:21:40 -08002435AC_CHECK_TYPES(struct timespec)
2436
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002437# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002438if test "x$ac_cv_have_int64_t" = "xno" && \
2439 test "x$ac_cv_sizeof_long_int" != "x8" && \
2440 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002441 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2442 echo "an alternative compiler (I.E., GCC) before continuing."
2443 echo ""
2444 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002445else
2446dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002447 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002448 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002449#include <stdio.h>
2450#include <string.h>
2451#ifdef HAVE_SNPRINTF
2452main()
2453{
2454 char buf[50];
2455 char expected_out[50];
2456 int mazsize = 50 ;
2457#if (SIZEOF_LONG_INT == 8)
2458 long int num = 0x7fffffffffffffff;
2459#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002460 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002461#endif
2462 strcpy(expected_out, "9223372036854775807");
2463 snprintf(buf, mazsize, "%lld", num);
2464 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002465 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002466 exit(0);
2467}
2468#else
2469main() { exit(0); }
2470#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002471 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002472 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002473 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002474fi
2475
Damien Miller78315eb2000-09-29 23:01:36 +11002476dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002477OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2478OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2479OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2480OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2481OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002482OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002483OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2484OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002485OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002486OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2487OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2488OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2489OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002490OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2491OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2492OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2493OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002494
2495AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002496
Damien Miller61e50f12000-05-08 20:49:37 +10002497AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2498 ac_cv_have_ss_family_in_struct_ss, [
2499 AC_TRY_COMPILE(
2500 [
Damien Miller81171112000-04-23 11:14:01 +10002501#include <sys/types.h>
2502#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002503 ],
2504 [ struct sockaddr_storage s; s.ss_family = 1; ],
2505 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2506 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2507 )
2508])
2509if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002510 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002511fi
2512
Damien Miller61e50f12000-05-08 20:49:37 +10002513AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2514 ac_cv_have___ss_family_in_struct_ss, [
2515 AC_TRY_COMPILE(
2516 [
Damien Miller81171112000-04-23 11:14:01 +10002517#include <sys/types.h>
2518#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002519 ],
2520 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2521 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2522 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2523 )
2524])
2525if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002526 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2527 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002528fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002529
Damien Millerad833b32000-08-23 10:46:23 +10002530AC_CACHE_CHECK([for pw_class field in struct passwd],
2531 ac_cv_have_pw_class_in_struct_passwd, [
2532 AC_TRY_COMPILE(
2533 [
Damien Millerad833b32000-08-23 10:46:23 +10002534#include <pwd.h>
2535 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002536 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002537 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2538 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2539 )
2540])
2541if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002542 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2543 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002544fi
2545
Kevin Steves82456952001-06-22 21:14:18 +00002546AC_CACHE_CHECK([for pw_expire field in struct passwd],
2547 ac_cv_have_pw_expire_in_struct_passwd, [
2548 AC_TRY_COMPILE(
2549 [
2550#include <pwd.h>
2551 ],
2552 [ struct passwd p; p.pw_expire = 0; ],
2553 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2554 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2555 )
2556])
2557if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002558 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2559 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002560fi
2561
2562AC_CACHE_CHECK([for pw_change field in struct passwd],
2563 ac_cv_have_pw_change_in_struct_passwd, [
2564 AC_TRY_COMPILE(
2565 [
2566#include <pwd.h>
2567 ],
2568 [ struct passwd p; p.pw_change = 0; ],
2569 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2570 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2571 )
2572])
2573if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002574 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2575 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002576fi
Damien Miller61e50f12000-05-08 20:49:37 +10002577
Tim Rice28bbb0c2002-05-27 17:37:32 -07002578dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002579AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2580 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002581 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002582 [
Tim Riceae49fe62002-04-12 10:26:21 -07002583#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002584#include <sys/socket.h>
2585#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002586int main() {
2587#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002588#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002589exit(1);
2590#endif
2591struct msghdr m;
2592m.msg_accrights = 0;
2593exit(0);
2594}
Kevin Steves939c9db2002-03-22 17:23:25 +00002595 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002596 [ ac_cv_have_accrights_in_msghdr="yes" ],
2597 [ ac_cv_have_accrights_in_msghdr="no" ]
2598 )
2599])
2600if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002601 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2602 [Define if your system uses access rights style
2603 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002604fi
2605
Kevin Stevesa44e0352002-04-07 16:18:03 +00002606AC_CACHE_CHECK([for msg_control field in struct msghdr],
2607 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002608 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002609 [
Tim Riceae49fe62002-04-12 10:26:21 -07002610#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002611#include <sys/socket.h>
2612#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002613int main() {
2614#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002615#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002616exit(1);
2617#endif
2618struct msghdr m;
2619m.msg_control = 0;
2620exit(0);
2621}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002622 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002623 [ ac_cv_have_control_in_msghdr="yes" ],
2624 [ ac_cv_have_control_in_msghdr="no" ]
2625 )
2626])
2627if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002628 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2629 [Define if your system uses ancillary data style
2630 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002631fi
2632
Damien Miller61e50f12000-05-08 20:49:37 +10002633AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002634 AC_TRY_LINK([],
2635 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002636 [ ac_cv_libc_defines___progname="yes" ],
2637 [ ac_cv_libc_defines___progname="no" ]
2638 )
2639])
2640if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002641 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002642fi
2643
Kevin Steves4846f4a2002-03-22 18:19:53 +00002644AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2645 AC_TRY_LINK([
2646#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002647],
2648 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002649 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2650 [ ac_cv_cc_implements___FUNCTION__="no" ]
2651 )
2652])
2653if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002654 AC_DEFINE(HAVE___FUNCTION__, 1,
2655 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002656fi
2657
2658AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2659 AC_TRY_LINK([
2660#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002661],
2662 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002663 [ ac_cv_cc_implements___func__="yes" ],
2664 [ ac_cv_cc_implements___func__="no" ]
2665 )
2666])
2667if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002668 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002669fi
2670
Damien Miller4f8e6692001-07-14 13:22:53 +10002671AC_CACHE_CHECK([whether getopt has optreset support],
2672 ac_cv_have_getopt_optreset, [
2673 AC_TRY_LINK(
2674 [
2675#include <getopt.h>
2676 ],
2677 [ extern int optreset; optreset = 0; ],
2678 [ ac_cv_have_getopt_optreset="yes" ],
2679 [ ac_cv_have_getopt_optreset="no" ]
2680 )
2681])
2682if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002683 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2684 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002685fi
Damien Millera22ba012000-03-02 23:09:20 +11002686
Damien Millerecbb26d2000-07-15 14:59:14 +10002687AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002688 AC_TRY_LINK([],
2689 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002690 [ ac_cv_libc_defines_sys_errlist="yes" ],
2691 [ ac_cv_libc_defines_sys_errlist="no" ]
2692 )
2693])
2694if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002695 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2696 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002697fi
2698
2699
Damien Miller11fa2cc2000-08-16 10:35:58 +10002700AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002701 AC_TRY_LINK([],
2702 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002703 [ ac_cv_libc_defines_sys_nerr="yes" ],
2704 [ ac_cv_libc_defines_sys_nerr="no" ]
2705 )
2706])
2707if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002708 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002709fi
2710
Damien Millera8e06ce2003-11-21 23:48:55 +11002711SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002712# Check whether user wants sectok support
2713AC_ARG_WITH(sectok,
2714 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002715 [
2716 if test "x$withval" != "xno" ; then
2717 if test "x$withval" != "xyes" ; then
2718 CPPFLAGS="$CPPFLAGS -I${withval}"
2719 LDFLAGS="$LDFLAGS -L${withval}"
2720 if test ! -z "$need_dash_r" ; then
2721 LDFLAGS="$LDFLAGS -R${withval}"
2722 fi
2723 if test ! -z "$blibpath" ; then
2724 blibpath="$blibpath:${withval}"
2725 fi
2726 fi
2727 AC_CHECK_HEADERS(sectok.h)
2728 if test "$ac_cv_header_sectok_h" != yes; then
2729 AC_MSG_ERROR(Can't find sectok.h)
2730 fi
2731 AC_CHECK_LIB(sectok, sectok_open)
2732 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2733 AC_MSG_ERROR(Can't find libsectok)
2734 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002735 AC_DEFINE(SMARTCARD, 1,
2736 [Define if you want smartcard support])
2737 AC_DEFINE(USE_SECTOK, 1,
2738 [Define if you want smartcard support
2739 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002740 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002741 fi
2742 ]
2743)
2744
2745# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002746OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002747AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10002748 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08002749 [
2750 if test "x$withval" != "xno" ; then
2751 if test "x$withval" != "xyes" ; then
2752 OPENSC_CONFIG=$withval/bin/opensc-config
2753 else
2754 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2755 fi
2756 if test "$OPENSC_CONFIG" != "no"; then
2757 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2758 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2759 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2760 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2761 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002762 AC_DEFINE(USE_OPENSC, 1,
2763 [Define if you want smartcard support
2764 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002765 SCARD_MSG="yes, using OpenSC"
2766 fi
2767 fi
2768 ]
2769)
Damien Miller85de5802001-09-18 14:01:11 +10002770
Darren Tucker5f88d342003-10-15 16:57:57 +10002771# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002772AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002773 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2774 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002775 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002776 # Needed by our getrrsetbyname()
2777 AC_SEARCH_LIBS(res_query, resolv)
2778 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002779 AC_MSG_CHECKING(if res_query will link)
2780 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2781 [AC_MSG_RESULT(no)
2782 saved_LIBS="$LIBS"
2783 LIBS="$LIBS -lresolv"
2784 AC_MSG_CHECKING(for res_query in -lresolv)
2785 AC_LINK_IFELSE([
2786#include <resolv.h>
2787int main()
2788{
2789 res_query (0, 0, 0, 0, 0);
2790 return 0;
2791}
2792 ],
2793 [LIBS="$LIBS -lresolv"
2794 AC_MSG_RESULT(yes)],
2795 [LIBS="$saved_LIBS"
2796 AC_MSG_RESULT(no)])
2797 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002798 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002799 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002800 [#include <sys/types.h>
2801 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002802 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07002803 [AC_DEFINE(HAVE_HEADER_AD, 1,
2804 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10002805 [#include <arpa/nameser.h>])
2806 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002807
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002808# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002809KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002810AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002811 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002812 [ if test "x$withval" != "xno" ; then
2813 if test "x$withval" = "xyes" ; then
2814 KRB5ROOT="/usr/local"
2815 else
2816 KRB5ROOT=${withval}
2817 fi
2818
Tim Rice7df8d392005-09-19 09:33:39 -07002819 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11002820 KRB5_MSG="yes"
2821
2822 AC_MSG_CHECKING(for krb5-config)
2823 if test -x $KRB5ROOT/bin/krb5-config ; then
2824 KRB5CONF=$KRB5ROOT/bin/krb5-config
2825 AC_MSG_RESULT($KRB5CONF)
2826
2827 AC_MSG_CHECKING(for gssapi support)
2828 if $KRB5CONF | grep gssapi >/dev/null ; then
2829 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002830 AC_DEFINE(GSSAPI, 1,
2831 [Define this if you want GSSAPI
2832 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11002833 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002834 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002835 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002836 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002837 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002838 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2839 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002840 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002841 AC_MSG_CHECKING(whether we are using Heimdal)
2842 AC_TRY_COMPILE([ #include <krb5.h> ],
2843 [ char *tmp = heimdal_version; ],
2844 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002845 AC_DEFINE(HEIMDAL, 1,
2846 [Define this if you are using the
2847 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002848 AC_MSG_RESULT(no)
2849 )
2850 else
2851 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002852 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002853 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002854 AC_MSG_CHECKING(whether we are using Heimdal)
2855 AC_TRY_COMPILE([ #include <krb5.h> ],
2856 [ char *tmp = heimdal_version; ],
2857 [ AC_MSG_RESULT(yes)
2858 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002859 K5LIBS="-lkrb5 -ldes"
2860 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002861 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002862 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002863 ],
2864 [ AC_MSG_RESULT(no)
2865 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2866 ]
2867 )
Damien Miller200d0a72003-06-30 19:21:36 +10002868 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002869
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002870 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2871 [ AC_DEFINE(GSSAPI)
2872 K5LIBS="-lgssapi $K5LIBS" ],
2873 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2874 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002875 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002876 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2877 $K5LIBS)
2878 ],
2879 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002880
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002881 AC_CHECK_HEADER(gssapi.h, ,
2882 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002883 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002884 AC_CHECK_HEADERS(gssapi.h, ,
2885 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002886 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002887 ]
2888 )
2889
2890 oldCPP="$CPPFLAGS"
2891 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2892 AC_CHECK_HEADER(gssapi_krb5.h, ,
2893 [ CPPFLAGS="$oldCPP" ])
2894
Damien Millera8e06ce2003-11-21 23:48:55 +11002895 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002896 if test ! -z "$need_dash_r" ; then
2897 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2898 fi
2899 if test ! -z "$blibpath" ; then
2900 blibpath="$blibpath:${KRB5ROOT}/lib"
2901 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07002902
2903 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2904 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2905 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2906
2907 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07002908 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
2909 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002910 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002911 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002912)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002913
Damien Millera22ba012000-03-02 23:09:20 +11002914# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002915
Damien Millerf58c6722002-05-13 13:15:42 +10002916PRIVSEP_PATH=/var/empty
2917AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002918 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002919 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002920 if test -n "$withval" && test "x$withval" != "xno" && \
2921 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002922 PRIVSEP_PATH=$withval
2923 fi
2924 ]
2925)
2926AC_SUBST(PRIVSEP_PATH)
2927
Damien Millera22ba012000-03-02 23:09:20 +11002928AC_ARG_WITH(xauth,
2929 [ --with-xauth=PATH Specify path to xauth program ],
2930 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002931 if test -n "$withval" && test "x$withval" != "xno" && \
2932 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002933 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002934 fi
2935 ],
2936 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002937 TestPath="$PATH"
2938 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2939 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2940 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2941 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2942 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002943 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002944 xauth_path="/usr/openwin/bin/xauth"
2945 fi
2946 ]
2947)
2948
Damien Miller7d901272003-01-13 16:55:22 +11002949STRIP_OPT=-s
2950AC_ARG_ENABLE(strip,
2951 [ --disable-strip Disable calling strip(1) on install],
2952 [
2953 if test "x$enableval" = "xno" ; then
2954 STRIP_OPT=
2955 fi
2956 ]
2957)
2958AC_SUBST(STRIP_OPT)
2959
Damien Millera19cf472000-11-29 13:28:50 +11002960if test -z "$xauth_path" ; then
2961 XAUTH_PATH="undefined"
2962 AC_SUBST(XAUTH_PATH)
2963else
Tim Rice7df8d392005-09-19 09:33:39 -07002964 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
2965 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11002966 XAUTH_PATH=$xauth_path
2967 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002968fi
Damien Millera22ba012000-03-02 23:09:20 +11002969
2970# Check for mail directory (last resort if we cannot get it from headers)
2971if test ! -z "$MAIL" ; then
2972 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07002973 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
2974 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11002975fi
2976
Darren Tucker623d92f2004-09-12 22:36:15 +10002977if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002978 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2979 disable_ptmx_check=yes
2980fi
Damien Millera22ba012000-03-02 23:09:20 +11002981if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002982 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002983 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002984 [
Tim Rice7df8d392005-09-19 09:33:39 -07002985 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
2986 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002987 have_dev_ptmx=1
2988 ]
2989 )
2990 fi
Damien Millera22ba012000-03-02 23:09:20 +11002991fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002992
Darren Tucker623d92f2004-09-12 22:36:15 +10002993if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002994 AC_CHECK_FILE("/dev/ptc",
2995 [
Tim Rice7df8d392005-09-19 09:33:39 -07002996 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
2997 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002998 have_dev_ptc=1
2999 ]
3000 )
3001else
3002 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3003fi
Damien Miller204ad072000-03-02 23:56:12 +11003004
Damien Millera22ba012000-03-02 23:09:20 +11003005# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003006AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003007 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003008 [
Damien Miller897741e2001-04-16 10:41:46 +10003009 case "$withval" in
3010 man|cat|doc)
3011 MANTYPE=$withval
3012 ;;
3013 *)
3014 AC_MSG_ERROR(invalid man type: $withval)
3015 ;;
3016 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003017 ]
3018)
Ben Lindstrombc709922001-04-18 18:04:21 +00003019if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003020 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3021 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003022 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3023 MANTYPE=doc
3024 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3025 MANTYPE=man
3026 else
3027 MANTYPE=cat
3028 fi
3029fi
Damien Miller670a4b82000-01-22 13:53:11 +11003030AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003031if test "$MANTYPE" = "doc"; then
3032 mansubdir=man;
3033else
3034 mansubdir=$MANTYPE;
3035fi
3036AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003037
Damien Millera22ba012000-03-02 23:09:20 +11003038# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003039MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003040AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003041 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003042 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003043 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003044 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3045 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003046 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003047 fi
3048 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003049)
3050
Damien Millera22ba012000-03-02 23:09:20 +11003051# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003052AC_ARG_WITH(shadow,
3053 [ --without-shadow Disable shadow password support],
3054 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003055 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003056 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003057 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003058 fi
3059 ]
3060)
3061
Damien Miller1f335fb2000-06-26 11:31:33 +10003062if test -z "$disable_shadow" ; then
3063 AC_MSG_CHECKING([if the systems has expire shadow information])
3064 AC_TRY_COMPILE(
3065 [
3066#include <sys/types.h>
3067#include <shadow.h>
3068 struct spwd sp;
3069 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3070 [ sp_expire_available=yes ], []
3071 )
3072
3073 if test "x$sp_expire_available" = "xyes" ; then
3074 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003075 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3076 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003077 else
3078 AC_MSG_RESULT(no)
3079 fi
3080fi
3081
Damien Millera22ba012000-03-02 23:09:20 +11003082# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003083if test ! -z "$IPADDR_IN_DISPLAY" ; then
3084 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003085 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3086 [Define if you need to use IP address
3087 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003088else
Damien Millera8e06ce2003-11-21 23:48:55 +11003089 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003090 AC_ARG_WITH(ipaddr-display,
3091 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3092 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003093 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003094 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003095 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003096 fi
3097 ]
3098 )
3099fi
Damien Miller76112de1999-12-21 11:18:08 +11003100
Darren Tuckere1a790d2003-09-16 11:52:19 +10003101# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003102AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003103 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003104 [ if test "x$enableval" = "xno"; then
3105 AC_MSG_NOTICE([/etc/default/login handling disabled])
3106 etc_default_login=no
3107 else
3108 etc_default_login=yes
3109 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003110 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3111 then
3112 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3113 etc_default_login=no
3114 else
3115 etc_default_login=yes
3116 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003117)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003118
Darren Tucker2f9573d2005-02-10 22:28:54 +11003119if test "x$etc_default_login" != "xno"; then
3120 AC_CHECK_FILE("/etc/default/login",
3121 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003122 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003123 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3124 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003125 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003126fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003127
Tim Rice43a1c132002-04-17 21:19:14 -07003128dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003129if test $ac_cv_func_login_getcapbool = "yes" && \
3130 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003131 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003132fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003133
Damien Millera22ba012000-03-02 23:09:20 +11003134# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003135SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003136AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003137 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003138 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003139 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003140 AC_MSG_WARN([
3141--with-default-path=PATH has no effect on this system.
3142Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003143 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003144 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003145 AC_MSG_WARN([
3146--with-default-path=PATH will only be used if PATH is not defined in
3147$external_path_file .])
3148 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003149 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003150 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003151 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003152 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003153 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3154 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003155 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003156 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003157 AC_MSG_WARN([
3158If PATH is defined in $external_path_file, ensure the path to scp is included,
3159otherwise scp will not work.])
3160 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003161 AC_RUN_IFELSE(
3162 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003163/* find out what STDPATH is */
3164#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003165#ifdef HAVE_PATHS_H
3166# include <paths.h>
3167#endif
3168#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003169# ifdef _PATH_USERPATH /* Irix */
3170# define _PATH_STDPATH _PATH_USERPATH
3171# else
3172# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3173# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003174#endif
3175#include <sys/types.h>
3176#include <sys/stat.h>
3177#include <fcntl.h>
3178#define DATA "conftest.stdpath"
3179
3180main()
3181{
3182 FILE *fd;
3183 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003184
Tim Rice59ea0a02001-03-10 13:50:45 -08003185 fd = fopen(DATA,"w");
3186 if(fd == NULL)
3187 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003188
Tim Rice59ea0a02001-03-10 13:50:45 -08003189 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3190 exit(1);
3191
3192 exit(0);
3193}
Darren Tucker314d89e2005-10-17 23:29:23 +10003194 ]])],
3195 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003196 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3197 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3198 )
3199# make sure $bindir is in USER_PATH so scp will work
3200 t_bindir=`eval echo ${bindir}`
3201 case $t_bindir in
3202 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3203 esac
3204 case $t_bindir in
3205 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3206 esac
3207 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3208 if test $? -ne 0 ; then
3209 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3210 if test $? -ne 0 ; then
3211 user_path=$user_path:$t_bindir
3212 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3213 fi
3214 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003215 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003216)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003217if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003218 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003219 AC_SUBST(user_path)
3220fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003221
Damien Millera18bbd32002-05-13 10:48:57 +10003222# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003223AC_ARG_WITH(superuser-path,
3224 [ --with-superuser-path= Specify different path for super-user],
3225 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003226 if test -n "$withval" && test "x$withval" != "xno" && \
3227 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003228 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3229 [Define if you want a different $PATH
3230 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003231 superuser_path=$withval
3232 fi
3233 ]
3234)
3235
3236
Damien Miller61e50f12000-05-08 20:49:37 +10003237AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003238IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003239AC_ARG_WITH(4in6,
3240 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3241 [
3242 if test "x$withval" != "xno" ; then
3243 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003244 AC_DEFINE(IPV4_IN_IPV6, 1,
3245 [Detect IPv4 in IPv6 mapped addresses
3246 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003247 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003248 else
3249 AC_MSG_RESULT(no)
3250 fi
3251 ],[
3252 if test "x$inet6_default_4in6" = "xyes"; then
3253 AC_MSG_RESULT([yes (default)])
3254 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003255 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003256 else
3257 AC_MSG_RESULT([no (default)])
3258 fi
3259 ]
3260)
3261
Damien Miller60396b02001-02-18 17:01:00 +11003262# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003263BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003264AC_ARG_WITH(bsd-auth,
3265 [ --with-bsd-auth Enable BSD auth support],
3266 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003267 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003268 AC_DEFINE(BSD_AUTH, 1,
3269 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003270 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003271 fi
3272 ]
3273)
3274
Damien Millera22ba012000-03-02 23:09:20 +11003275# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003276piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003277# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003278if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003279 piddir=`eval echo ${sysconfdir}`
3280 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003281 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003282 esac
3283fi
3284
Tim Rice88f2ab52002-03-17 12:17:34 -08003285AC_ARG_WITH(pid-dir,
3286 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3287 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003288 if test -n "$withval" && test "x$withval" != "xno" && \
3289 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003290 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003291 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003292 AC_MSG_WARN([** no $piddir directory on this system **])
3293 fi
3294 fi
3295 ]
3296)
3297
Tim Rice7df8d392005-09-19 09:33:39 -07003298AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003299AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003300
andre2ff7b5d2000-06-03 14:57:40 +00003301dnl allow user to disable some login recording features
3302AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003303 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003304 [
3305 if test "x$enableval" = "xno" ; then
3306 AC_DEFINE(DISABLE_LASTLOG)
3307 fi
3308 ]
andre2ff7b5d2000-06-03 14:57:40 +00003309)
3310AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003311 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003312 [
3313 if test "x$enableval" = "xno" ; then
3314 AC_DEFINE(DISABLE_UTMP)
3315 fi
3316 ]
andre2ff7b5d2000-06-03 14:57:40 +00003317)
3318AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003319 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003320 [
3321 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003322 AC_DEFINE(DISABLE_UTMPX, 1,
3323 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003324 fi
3325 ]
andre2ff7b5d2000-06-03 14:57:40 +00003326)
3327AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003328 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003329 [
3330 if test "x$enableval" = "xno" ; then
3331 AC_DEFINE(DISABLE_WTMP)
3332 fi
3333 ]
andre2ff7b5d2000-06-03 14:57:40 +00003334)
3335AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003336 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003337 [
3338 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003339 AC_DEFINE(DISABLE_WTMPX, 1,
3340 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003341 fi
3342 ]
andre2ff7b5d2000-06-03 14:57:40 +00003343)
3344AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003345 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003346 [
3347 if test "x$enableval" = "xno" ; then
3348 AC_DEFINE(DISABLE_LOGIN)
3349 fi
3350 ]
andre2ff7b5d2000-06-03 14:57:40 +00003351)
3352AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003353 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003354 [
3355 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003356 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3357 [Define if you don't want to use pututline()
3358 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003359 fi
3360 ]
andre2ff7b5d2000-06-03 14:57:40 +00003361)
3362AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003363 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003364 [
3365 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003366 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3367 [Define if you don't want to use pututxline()
3368 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003369 fi
3370 ]
andre2ff7b5d2000-06-03 14:57:40 +00003371)
3372AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003373 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003374 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003375 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003376 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003377 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003378 conf_lastlog_location=$withval
3379 fi
3380 ]
3381)
andre2ff7b5d2000-06-03 14:57:40 +00003382
3383dnl lastlog, [uw]tmpx? detection
3384dnl NOTE: set the paths in the platform section to avoid the
3385dnl need for command-line parameters
3386dnl lastlog and [uw]tmp are subject to a file search if all else fails
3387
3388dnl lastlog detection
3389dnl NOTE: the code itself will detect if lastlog is a directory
3390AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3391AC_TRY_COMPILE([
3392#include <sys/types.h>
3393#include <utmp.h>
3394#ifdef HAVE_LASTLOG_H
3395# include <lastlog.h>
3396#endif
Damien Miller2994e082000-06-04 15:51:47 +10003397#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003398# include <paths.h>
3399#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003400#ifdef HAVE_LOGIN_H
3401# include <login.h>
3402#endif
andre2ff7b5d2000-06-03 14:57:40 +00003403 ],
3404 [ char *lastlog = LASTLOG_FILE; ],
3405 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003406 [
3407 AC_MSG_RESULT(no)
3408 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3409 AC_TRY_COMPILE([
3410#include <sys/types.h>
3411#include <utmp.h>
3412#ifdef HAVE_LASTLOG_H
3413# include <lastlog.h>
3414#endif
3415#ifdef HAVE_PATHS_H
3416# include <paths.h>
3417#endif
3418 ],
3419 [ char *lastlog = _PATH_LASTLOG; ],
3420 [ AC_MSG_RESULT(yes) ],
3421 [
andree441aa32000-06-12 22:34:38 +00003422 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003423 system_lastlog_path=no
3424 ])
3425 ]
andre2ff7b5d2000-06-03 14:57:40 +00003426)
Damien Miller2994e082000-06-04 15:51:47 +10003427
andre2ff7b5d2000-06-03 14:57:40 +00003428if test -z "$conf_lastlog_location"; then
3429 if test x"$system_lastlog_path" = x"no" ; then
3430 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003431 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003432 conf_lastlog_location=$f
3433 fi
3434 done
3435 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003436 AC_MSG_WARN([** Cannot find lastlog **])
3437 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003438 fi
3439 fi
3440fi
3441
3442if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003443 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3444 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003445fi
andre2ff7b5d2000-06-03 14:57:40 +00003446
3447dnl utmp detection
3448AC_MSG_CHECKING([if your system defines UTMP_FILE])
3449AC_TRY_COMPILE([
3450#include <sys/types.h>
3451#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003452#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003453# include <paths.h>
3454#endif
3455 ],
3456 [ char *utmp = UTMP_FILE; ],
3457 [ AC_MSG_RESULT(yes) ],
3458 [ AC_MSG_RESULT(no)
3459 system_utmp_path=no ]
3460)
3461if test -z "$conf_utmp_location"; then
3462 if test x"$system_utmp_path" = x"no" ; then
3463 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3464 if test -f $f ; then
3465 conf_utmp_location=$f
3466 fi
3467 done
3468 if test -z "$conf_utmp_location"; then
3469 AC_DEFINE(DISABLE_UTMP)
3470 fi
3471 fi
3472fi
3473if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003474 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3475 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003476fi
andre2ff7b5d2000-06-03 14:57:40 +00003477
3478dnl wtmp detection
3479AC_MSG_CHECKING([if your system defines WTMP_FILE])
3480AC_TRY_COMPILE([
3481#include <sys/types.h>
3482#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003483#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003484# include <paths.h>
3485#endif
3486 ],
3487 [ char *wtmp = WTMP_FILE; ],
3488 [ AC_MSG_RESULT(yes) ],
3489 [ AC_MSG_RESULT(no)
3490 system_wtmp_path=no ]
3491)
3492if test -z "$conf_wtmp_location"; then
3493 if test x"$system_wtmp_path" = x"no" ; then
3494 for f in /usr/adm/wtmp /var/log/wtmp; do
3495 if test -f $f ; then
3496 conf_wtmp_location=$f
3497 fi
3498 done
3499 if test -z "$conf_wtmp_location"; then
3500 AC_DEFINE(DISABLE_WTMP)
3501 fi
3502 fi
3503fi
3504if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003505 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3506 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003507fi
andre2ff7b5d2000-06-03 14:57:40 +00003508
3509
3510dnl utmpx detection - I don't know any system so perverse as to require
3511dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3512dnl there, though.
3513AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3514AC_TRY_COMPILE([
3515#include <sys/types.h>
3516#include <utmp.h>
3517#ifdef HAVE_UTMPX_H
3518#include <utmpx.h>
3519#endif
Damien Miller2994e082000-06-04 15:51:47 +10003520#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003521# include <paths.h>
3522#endif
3523 ],
3524 [ char *utmpx = UTMPX_FILE; ],
3525 [ AC_MSG_RESULT(yes) ],
3526 [ AC_MSG_RESULT(no)
3527 system_utmpx_path=no ]
3528)
3529if test -z "$conf_utmpx_location"; then
3530 if test x"$system_utmpx_path" = x"no" ; then
3531 AC_DEFINE(DISABLE_UTMPX)
3532 fi
3533else
Tim Rice7df8d392005-09-19 09:33:39 -07003534 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3535 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003536fi
andre2ff7b5d2000-06-03 14:57:40 +00003537
3538dnl wtmpx detection
3539AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3540AC_TRY_COMPILE([
3541#include <sys/types.h>
3542#include <utmp.h>
3543#ifdef HAVE_UTMPX_H
3544#include <utmpx.h>
3545#endif
Damien Miller2994e082000-06-04 15:51:47 +10003546#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003547# include <paths.h>
3548#endif
3549 ],
3550 [ char *wtmpx = WTMPX_FILE; ],
3551 [ AC_MSG_RESULT(yes) ],
3552 [ AC_MSG_RESULT(no)
3553 system_wtmpx_path=no ]
3554)
3555if test -z "$conf_wtmpx_location"; then
3556 if test x"$system_wtmpx_path" = x"no" ; then
3557 AC_DEFINE(DISABLE_WTMPX)
3558 fi
3559else
Tim Rice7df8d392005-09-19 09:33:39 -07003560 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3561 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003562fi
andre2ff7b5d2000-06-03 14:57:40 +00003563
Damien Miller4018c192000-04-30 09:30:44 +10003564
Damien Miller29ea30d2000-03-17 10:54:15 +11003565if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003566 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3567 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003568fi
3569
Tim Rice4cec93f2002-02-26 08:40:48 -08003570dnl remove pam and dl because they are in $LIBPAM
3571if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003572 LIBS=`echo $LIBS | sed 's/-lpam //'`
3573fi
3574if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3575 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003576fi
3577
Darren Tucker7da23cb2005-08-03 00:20:15 +10003578dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3579dnl Add now.
3580CFLAGS="$CFLAGS $werror_flags"
3581
Damien Millerbac2d8a2000-09-05 16:13:06 +11003582AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003583AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3584 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003585AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003586
Damien Miller7b22d652000-06-18 14:07:04 +10003587# Print summary of options
3588
Damien Miller7b22d652000-06-18 14:07:04 +10003589# Someone please show me a better way :)
3590A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3591B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3592C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3593D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003594E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003595F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003596G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003597H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3598I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3599J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003600
3601echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003602echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003603echo " User binaries: $B"
3604echo " System binaries: $C"
3605echo " Configuration files: $D"
3606echo " Askpass program: $E"
3607echo " Manual pages: $F"
3608echo " PID file: $G"
3609echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003610if test "x$external_path_file" = "x/etc/login.conf" ; then
3611echo " At runtime, sshd will use the path defined in $external_path_file"
3612echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003613else
Damien Millerf58c6722002-05-13 13:15:42 +10003614echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003615 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003616echo " (If PATH is set in $external_path_file it will be used instead. If"
3617echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3618 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003619fi
Damien Millera18bbd32002-05-13 10:48:57 +10003620if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003621echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003622fi
Damien Millerf58c6722002-05-13 13:15:42 +10003623echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003624echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003625echo " KerberosV support: $KRB5_MSG"
3626echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003627echo " S/KEY support: $SKEY_MSG"
3628echo " TCP Wrappers support: $TCPW_MSG"
3629echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003630echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003631echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003632echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3633echo " BSD Auth support: $BSD_AUTH_MSG"
3634echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003635if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003636echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003637fi
3638
Damien Miller7b22d652000-06-18 14:07:04 +10003639echo ""
3640
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003641echo " Host: ${host}"
3642echo " Compiler: ${CC}"
3643echo " Compiler flags: ${CFLAGS}"
3644echo "Preprocessor flags: ${CPPFLAGS}"
3645echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003646echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003647
3648echo ""
3649
Tim Rice6f1f7582004-05-30 21:38:51 -07003650if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003651 echo "SVR4 style packages are supported with \"make package\""
3652 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003653fi
3654
Damien Miller82cf0ce2000-12-20 13:34:48 +11003655if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003656 echo "PAM is enabled. You may need to install a PAM control file "
3657 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003658 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003659 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003660 echo ""
3661fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003662
Damien Miller6c21c512002-01-22 21:57:53 +11003663if test ! -z "$RAND_HELPER_CMDHASH" ; then
3664 echo "WARNING: you are using the builtin random number collection "
3665 echo "service. Please read WARNING.RNG and request that your OS "
3666 echo "vendor includes kernel-based random number collection in "
3667 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003668 echo ""
3669fi
Damien Miller60396b02001-02-18 17:01:00 +11003670
Damien Millerb4097182004-05-23 14:09:40 +10003671if test ! -z "$NO_PEERCHECK" ; then
3672 echo "WARNING: the operating system that you are using does not "
3673 echo "appear to support either the getpeereid() API nor the "
3674 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3675 echo "enforce security checks to prevent unauthorised connections to "
3676 echo "ssh-agent. Their absence increases the risk that a malicious "
3677 echo "user can connect to your agent. "
3678 echo ""
3679fi
3680
Darren Tuckerd9f88912005-02-20 21:01:48 +11003681if test "$AUDIT_MODULE" = "bsm" ; then
3682 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3683 echo "See the Solaris section in README.platform for details."
3684fi