blob: 6b5ec863689207f63b3d3eceea495617869542f3 [file] [log] [blame]
Darren Tuckercc7c2122006-02-02 18:44:19 +11001# $Id: configure.ac,v 1.323 2006/02/02 07:44:19 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)
Darren Tuckerfbea7642006-01-30 00:22:39 +110050if test -x /sbin/sh; then
51 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
52else
53 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
54fi
Tim Rice6f1f7582004-05-30 21:38:51 -070055
Damien Millere8bb4502001-09-25 16:39:35 +100056# System features
57AC_SYS_LARGEFILE
58
Damien Miller3f62aba2000-11-29 11:56:35 +110059if test -z "$AR" ; then
60 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
61fi
62
Damien Millerad833b32000-08-23 10:46:23 +100063# Use LOGIN_PROGRAM from environment if possible
64if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070065 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
66 [If your header files don't define LOGIN_PROGRAM,
67 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100068else
69 # Search for login
70 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
71 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
72 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
73 fi
74fi
75
Darren Tucker23bc8d02004-02-06 16:24:31 +110076AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
77if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070078 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
79 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110080fi
81
Damien Miller166bd442000-03-16 10:48:25 +110082if test -z "$LD" ; then
83 LD=$CC
84fi
85AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080086
Damien Miller166bd442000-03-16 10:48:25 +110087AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100088
89AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
90
Damien Millera8e06ce2003-11-21 23:48:55 +110091if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100092 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Darren Tucker3f9545e2005-11-12 15:20:52 +110093 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -070094 case $GCC_VER in
95 1.*) ;;
96 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
97 2.*) ;;
Darren Tuckerb0288092005-11-10 14:46:48 +110098 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
Darren Tuckerf0324352005-11-10 21:30:36 +110099 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
100 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700101 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +1000102
Darren Tucker67b37032005-06-03 17:58:31 +1000103 if test -z "$have_llong_max"; then
104 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
105 unset ac_cv_have_decl_LLONG_MAX
106 saved_CFLAGS="$CFLAGS"
107 CFLAGS="$CFLAGS -std=gnu99"
108 AC_CHECK_DECL(LLONG_MAX,
109 [have_llong_max=1],
110 [CFLAGS="$saved_CFLAGS"],
111 [#include <limits.h>]
112 )
113 fi
Damien Miller166bd442000-03-16 10:48:25 +1100114fi
115
Tim Rice88368a32003-12-08 12:35:59 -0800116AC_ARG_WITH(rpath,
117 [ --without-rpath Disable auto-added -R linker paths],
118 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800119 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800120 need_dash_r=""
121 fi
122 if test "x$withval" = "xyes" ; then
123 need_dash_r=1
124 fi
125 ]
126)
127
Damien Millera22ba012000-03-02 23:09:20 +1100128# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100129case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100130*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100131 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000132 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800133 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100134 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000135 saved_LDFLAGS="$LDFLAGS"
136 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
137 if (test -z "$blibflags"); then
138 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
139 AC_TRY_LINK([], [], [blibflags=$tryflags])
140 fi
141 done
142 if (test -z "$blibflags"); then
143 AC_MSG_RESULT(not found)
144 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
145 else
146 AC_MSG_RESULT($blibflags)
147 fi
148 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000149 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700150 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
151 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700152 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000153 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700154 LIBS="$LIBS -ls"
155 ])
156 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100157 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100158 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100159 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000160 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100161 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000162 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
163 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000164 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000165 [(void)loginfailed("user","host","tty",0);],
166 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700167 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
168 [Define if your AIX loginfailed() function
169 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000170 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000171 )],
172 [],
173 [#include <usersec.h>]
174 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000175 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100176 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700177 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
178 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
179 [Define if your platform breaks doing a seteuid before a setuid])
180 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
181 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000182 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700183 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
184 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
185 [Some systems need a utmpx entry for /bin/login to work])
186 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
187 [Define to a Set Process Title type if your system is
188 supported by bsd-setproctitle.c])
Darren Tucker91d25a02005-11-26 22:24:09 +1100189 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
190 [AIX 5.2 and 5.3 (and presumably newer) require this])
Damien Miller75b1d102000-01-07 14:01:41 +1100191 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100192*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100193 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800194 LIBS="$LIBS /usr/lib/textmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700195 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
196 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
197 AC_DEFINE(DISABLE_SHADOW, 1,
198 [Define if you want to disable shadow passwords])
199 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
200 [Define if your system choked on IP TOS setting])
201 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
202 [Define if X11 doesn't support AF_UNIX sockets on that system])
203 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
204 [Define if the concept of ports only accessible to
205 superusers isn't known])
206 AC_DEFINE(DISABLE_FD_PASSING, 1,
207 [Define if your platform needs to skip post auth
208 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100209 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000210*-*-dgux*)
211 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100212 AC_DEFINE(SETEUID_BREAKS_SETUID)
213 AC_DEFINE(BROKEN_SETREUID)
214 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000215 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000216*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000217 AC_MSG_CHECKING(if we have working getaddrinfo)
218 AC_TRY_RUN([#include <mach-o/dyld.h>
219main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
220 exit(0);
221 else
222 exit(1);
223}], [AC_MSG_RESULT(working)],
224 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700225 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700226 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000227 AC_DEFINE(SETEUID_BREAKS_SETUID)
228 AC_DEFINE(BROKEN_SETREUID)
229 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700230 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
231 [Define if your resolver libs need this for getrrsetbyname])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000232 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000233*-*-hpux*)
234 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000235 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100236 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000237 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700238 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
239 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000240 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700241 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
242 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000243 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000244 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700245 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000246 AC_CHECK_LIB(xnet, t_error, ,
247 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
248
249 # next, we define all of the options specific to major releases
250 case "$host" in
251 *-*-hpux10*)
252 if test -z "$GCC"; then
253 CFLAGS="$CFLAGS -Ae"
254 fi
255 ;;
256 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700257 AC_DEFINE(PAM_SUN_CODEBASE, 1,
258 [Define if you are using Solaris-derived PAM which
259 passes pam_messages to the conversation function
260 with an extra level of indirection])
261 AC_DEFINE(DISABLE_UTMP, 1,
262 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000263 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
264 check_for_hpux_broken_getaddrinfo=1
265 check_for_conflicting_getspnam=1
266 ;;
267 esac
268
269 # lastly, we define options specific to minor releases
270 case "$host" in
271 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700272 AC_DEFINE(HAVE_SECUREWARE, 1,
273 [Define if you have SecureWare-based
274 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000275 disable_ptmx_check=yes
276 LIBS="$LIBS -lsecpw"
277 ;;
278 esac
Damien Miller1bead332000-04-30 00:47:29 +1000279 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100280*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100281 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700282 AC_DEFINE(BROKEN_INET_NTOA, 1,
283 [Define if you system's inet_ntoa is busted
284 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000285 AC_DEFINE(SETEUID_BREAKS_SETUID)
286 AC_DEFINE(BROKEN_SETREUID)
287 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700288 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
289 [Define if you shouldn't strip 'tty' from your
290 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000291 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100292 ;;
293*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100294 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700295 AC_DEFINE(WITH_IRIX_ARRAY, 1,
296 [Define if you have/want arrays
297 (cluster-wide session managment, not C arrays)])
298 AC_DEFINE(WITH_IRIX_PROJECT, 1,
299 [Define if you want IRIX project management])
300 AC_DEFINE(WITH_IRIX_AUDIT, 1,
301 [Define if you want IRIX audit trails])
302 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
303 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000304 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000305 AC_DEFINE(SETEUID_BREAKS_SETUID)
306 AC_DEFINE(BROKEN_SETREUID)
307 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700308 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000309 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000310 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100311 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100312*-*-linux*)
313 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100314 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000315 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700316 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
317 AC_DEFINE(PAM_TTY_KLUDGE, 1,
318 [Work around problematic Linux PAM modules handling of PAM_TTY])
319 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
320 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000321 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700322 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
323 [Define to whatever link() returns for "not supported"
324 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100325 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700326 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100327 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000328 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000329 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700330 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
331 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000332 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000333 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100334 # tun(4) forwarding compat code
Damien Millerc4bcc912005-12-31 17:05:58 +1100335 AC_CHECK_HEADERS(linux/if_tun.h)
Damien Millerbd4e4102006-01-01 21:03:30 +1100336 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Damien Miller89e03ba2005-12-31 16:42:03 +1100337 AC_DEFINE(SSH_TUN_LINUX, 1,
338 [Open tunnel devices the Linux tun/tap way])
339 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
340 [Use tunnel device compatibility to OpenBSD])
341 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
342 [Prepend the address family to IP tunnel traffic])
343 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100344 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000345mips-sony-bsd|mips-sony-newsos4)
Tim Rice7df8d392005-09-19 09:33:39 -0700346 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000347 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000348 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100349*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000350 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800351 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800352 need_dash_r=1
353 fi
Damien Miller2dcddbf2006-01-01 19:47:05 +1100354 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
355 AC_CHECK_HEADER([net/if_tap.h], ,
356 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
357 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
358 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100359 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100360*-*-freebsd*)
361 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000362 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100363 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
364 AC_CHECK_HEADER([net/if_tap.h], ,
365 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
Damien Millerfbd884a2001-02-27 08:39:07 +1100366 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000367*-*-bsdi*)
368 AC_DEFINE(SETEUID_BREAKS_SETUID)
369 AC_DEFINE(BROKEN_SETREUID)
370 AC_DEFINE(BROKEN_SETREGID)
371 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000372*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000373 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100374 conf_utmp_location=/etc/utmp
375 conf_wtmp_location=/usr/adm/wtmp
376 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700377 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000378 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000379 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700380 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000381 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000382*-*-openbsd*)
383 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000384 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100385 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
Darren Tucker4a422572005-07-14 17:22:11 +1000386 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100387*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800388 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800389 need_dash_r=1
390 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100391 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000392 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700393 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
394 [Some versions of /bin/login need the TERM supplied
395 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000396 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700397 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
398 [Define if pam_chauthtok wants real uid set
399 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000400 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000401 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700402 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
403 [Define if sshd somehow reacquires a controlling TTY
404 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000405 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000406 # hardwire lastlog location (can't detect it on some versions)
407 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000408 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
409 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
410 if test "$sol2ver" -ge 8; then
411 AC_MSG_RESULT(yes)
412 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700413 AC_DEFINE(DISABLE_WTMP, 1,
414 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000415 else
416 AC_MSG_RESULT(no)
417 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100418 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000419*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000420 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000421 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100422 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000423 conf_utmp_location=/etc/utmp
424 conf_wtmp_location=/var/adm/wtmp
425 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000426 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000427 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000428*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700429 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000430 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000431 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000432 AC_DEFINE(SETEUID_BREAKS_SETUID)
433 AC_DEFINE(BROKEN_SETREUID)
434 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000435 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000436*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700437 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000438 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100439 # -lresolv needs to be at the end of LIBS or DNS lookups break
440 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100441 IPADDR_IN_DISPLAY=yes
442 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000443 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000444 AC_DEFINE(SETEUID_BREAKS_SETUID)
445 AC_DEFINE(BROKEN_SETREUID)
446 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000447 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000448 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700449 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
450 # Attention: always take care to bind libsocket and libnsl before libc,
451 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000452 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800453# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100454*-*-sysv4.2*)
Damien Miller57f39152005-11-24 19:58:19 +1100455 CFLAGS="$CFLAGS -Dva_list=_VA_LIST"
Damien Miller5dfe9762001-02-16 12:05:39 +1100456 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700457 AC_DEFINE(SETEUID_BREAKS_SETUID)
458 AC_DEFINE(BROKEN_SETREUID)
459 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700460 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800461 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100462 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800463# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100464*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700465 check_for_libcrypt_later=1
466 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100467 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700468 AC_DEFINE(SETEUID_BREAKS_SETUID)
469 AC_DEFINE(BROKEN_SETREUID)
470 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700471 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700472 case "$host" in
473 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
474 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700475 AC_DEFINE(BROKEN_LIBIAF, 1,
476 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700477 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800478 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
479 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700480 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100481 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100482*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100483 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800484# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100485*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800486 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100487 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800488# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100489*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800490 if test -z "$GCC"; then
491 CFLAGS="$CFLAGS -belf"
492 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100493 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000494 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100495 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000496 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000497 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700498 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700499 AC_DEFINE(SETEUID_BREAKS_SETUID)
500 AC_DEFINE(BROKEN_SETREUID)
501 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700502 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700503 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700504 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100505 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700506 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700507 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000508 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000509*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700510 AC_DEFINE(NO_SSH_LASTLOG, 1,
511 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100512 AC_DEFINE(SETEUID_BREAKS_SETUID)
513 AC_DEFINE(BROKEN_SETREUID)
514 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000515 AC_DEFINE(USE_PIPES)
516 AC_DEFINE(DISABLE_FD_PASSING)
517 LDFLAGS="$LDFLAGS"
518 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
519 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000520 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000521*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100522 AC_DEFINE(SETEUID_BREAKS_SETUID)
523 AC_DEFINE(BROKEN_SETREUID)
524 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000525 AC_DEFINE(WITH_ABBREV_NO_TTY)
526 AC_DEFINE(USE_PIPES)
527 AC_DEFINE(DISABLE_FD_PASSING)
528 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100529 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000530 MANTYPE=cat
531 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000532*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100533 AC_DEFINE(SETEUID_BREAKS_SETUID)
534 AC_DEFINE(BROKEN_SETREUID)
535 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000536 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700537 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700538 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000539 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
540 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
541 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700542 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000543*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000544 AC_MSG_CHECKING(for Digital Unix SIA)
545 no_osfsia=""
546 AC_ARG_WITH(osfsia,
547 [ --with-osfsia Enable Digital Unix SIA],
548 [
549 if test "x$withval" = "xno" ; then
550 AC_MSG_RESULT(disabled)
551 no_osfsia=1
552 fi
553 ],
554 )
555 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000556 if test -f /etc/sia/matrix.conf; then
557 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700558 AC_DEFINE(HAVE_OSF_SIA, 1,
559 [Define if you have Digital Unix Security
560 Integration Architecture])
561 AC_DEFINE(DISABLE_LOGIN, 1,
562 [Define if you don't want to use your
563 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000564 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000565 LIBS="$LIBS -lsecurity -ldb -lm -laud"
566 else
567 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700568 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
569 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000570 fi
571 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000572 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700573 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000574 AC_DEFINE(BROKEN_SETREUID)
575 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000576 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000577
578*-*-nto-qnx)
579 AC_DEFINE(USE_PIPES)
580 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700581 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
582 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
583 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000584 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000585
586*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700587 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
588 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
589 AC_DEFINE(NEED_SETPRGP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700590 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
591 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000592
593*-*-lynxos)
594 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700595 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000596 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
597 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100598esac
599
Damien Millere37bfc12000-06-05 09:37:43 +1000600# Allow user to specify flags
601AC_ARG_WITH(cflags,
602 [ --with-cflags Specify additional flags to pass to compiler],
603 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800604 if test -n "$withval" && test "x$withval" != "xno" && \
605 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000606 CFLAGS="$CFLAGS $withval"
607 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800608 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000609)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000610AC_ARG_WITH(cppflags,
611 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
612 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800613 if test -n "$withval" && test "x$withval" != "xno" && \
614 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000615 CPPFLAGS="$CPPFLAGS $withval"
616 fi
617 ]
618)
Damien Millere37bfc12000-06-05 09:37:43 +1000619AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000620 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000621 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800622 if test -n "$withval" && test "x$withval" != "xno" && \
623 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000624 LDFLAGS="$LDFLAGS $withval"
625 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800626 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000627)
628AC_ARG_WITH(libs,
629 [ --with-libs Specify additional libraries to link with],
630 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800631 if test -n "$withval" && test "x$withval" != "xno" && \
632 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000633 LIBS="$LIBS $withval"
634 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800635 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000636)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000637AC_ARG_WITH(Werror,
638 [ --with-Werror Build main code with -Werror],
639 [
640 if test -n "$withval" && test "x$withval" != "xno"; then
641 werror_flags="-Werror"
Damien Millere04ec6f2005-10-08 16:21:19 +1000642 if test "x${withval}" != "xyes"; then
Darren Tucker7da23cb2005-08-03 00:20:15 +1000643 werror_flags="$withval"
644 fi
645 fi
646 ]
647)
Damien Millere37bfc12000-06-05 09:37:43 +1000648
Darren Tucker6eb93042003-06-29 21:30:41 +1000649AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000650AC_RUN_IFELSE(
651 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000652#include <stdio.h>
653int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000654 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000655 [ AC_MSG_RESULT(yes) ],
656 [
657 AC_MSG_RESULT(no)
658 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000659 ],
660 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000661)
662
Darren Tucker0c9653f2005-05-28 15:58:14 +1000663dnl Checks for header files.
664AC_CHECK_HEADERS( \
665 bstring.h \
666 crypt.h \
667 dirent.h \
668 endian.h \
669 features.h \
670 floatingpoint.h \
671 getopt.h \
672 glob.h \
673 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700674 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000675 lastlog.h \
676 limits.h \
677 login.h \
678 login_cap.h \
679 maillock.h \
680 ndir.h \
Damien Miller7b58e802005-12-13 19:33:19 +1100681 net/if.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000682 netdb.h \
683 netgroup.h \
684 netinet/in_systm.h \
685 pam/pam_appl.h \
686 paths.h \
687 pty.h \
688 readpassphrase.h \
689 rpc/types.h \
690 security/pam_appl.h \
691 shadow.h \
692 stddef.h \
693 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000694 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000695 strings.h \
696 sys/audit.h \
697 sys/bitypes.h \
698 sys/bsdtty.h \
699 sys/cdefs.h \
700 sys/dir.h \
701 sys/mman.h \
702 sys/ndir.h \
703 sys/prctl.h \
704 sys/pstat.h \
705 sys/select.h \
706 sys/stat.h \
707 sys/stream.h \
708 sys/stropts.h \
709 sys/strtio.h \
710 sys/sysmacros.h \
711 sys/time.h \
712 sys/timers.h \
713 sys/un.h \
714 time.h \
715 tmpdir.h \
716 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000717 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000718 usersec.h \
719 util.h \
720 utime.h \
721 utmp.h \
722 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000723 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000724)
Tim Rice4cec93f2002-02-26 08:40:48 -0800725
Darren Tucker48d99d32004-08-29 17:04:50 +1000726# sys/ptms.h requires sys/stream.h to be included first on Solaris
727AC_CHECK_HEADERS(sys/ptms.h, [], [], [
728#ifdef HAVE_SYS_STREAM_H
729# include <sys/stream.h>
730#endif
731])
732
Damien Millera22ba012000-03-02 23:09:20 +1100733# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700734AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
735AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000736
Tim Rice1e1ef642003-09-11 22:19:31 -0700737dnl IRIX and Solaris 2.5.1 have dirname() in libgen
738AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
739 AC_CHECK_LIB(gen, dirname,[
740 AC_CACHE_CHECK([for broken dirname],
741 ac_cv_have_broken_dirname, [
742 save_LIBS="$LIBS"
743 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000744 AC_RUN_IFELSE(
745 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700746#include <libgen.h>
747#include <string.h>
748
749int main(int argc, char **argv) {
750 char *s, buf[32];
751
752 strncpy(buf,"/etc", 32);
753 s = dirname(buf);
754 if (!s || strncmp(s, "/", 32) != 0) {
755 exit(1);
756 } else {
757 exit(0);
758 }
759}
Darren Tucker314d89e2005-10-17 23:29:23 +1000760 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700761 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000762 [ ac_cv_have_broken_dirname="yes" ],
763 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700764 )
765 LIBS="$save_LIBS"
766 ])
767 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
768 LIBS="$LIBS -lgen"
769 AC_DEFINE(HAVE_DIRNAME)
770 AC_CHECK_HEADERS(libgen.h)
771 fi
772 ])
773])
774
775AC_CHECK_FUNC(getspnam, ,
776 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700777AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
778 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700779
Tim Rice13aae5e2001-10-21 17:53:58 -0700780dnl zlib is required
781AC_ARG_WITH(zlib,
782 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100783 [ if test "x$withval" = "xno" ; then
784 AC_MSG_ERROR([*** zlib is required ***])
785 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700786 if test -d "$withval/lib"; then
787 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700788 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700789 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700790 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700791 fi
792 else
793 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700794 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700795 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700796 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700797 fi
798 fi
799 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700800 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700801 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700802 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700803 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100804 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700805)
806
Tim Ricefcb62202004-01-23 18:35:16 -0800807AC_CHECK_LIB(z, deflate, ,
808 [
809 saved_CPPFLAGS="$CPPFLAGS"
810 saved_LDFLAGS="$LDFLAGS"
811 save_LIBS="$LIBS"
812 dnl Check default zlib install dir
813 if test -n "${need_dash_r}"; then
814 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
815 else
816 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
817 fi
818 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
819 LIBS="$LIBS -lz"
820 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
821 [
822 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
823 ]
824 )
825 ]
826)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100827AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100828
829AC_ARG_WITH(zlib-version-check,
830 [ --without-zlib-version-check Disable zlib version check],
831 [ if test "x$withval" = "xno" ; then
832 zlib_check_nonfatal=1
833 fi
834 ]
835)
836
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000837AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000838AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000839#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100840#include <zlib.h>
841int main()
842{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000843 int a=0, b=0, c=0, d=0, n, v;
844 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
845 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100846 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000847 v = a*1000000 + b*10000 + c*100 + d;
848 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
849
850 /* 1.1.4 is OK */
851 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100852 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000853
Darren Tucker41097ed2005-07-25 15:24:21 +1000854 /* 1.2.3 and up are OK */
855 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000856 exit(0);
857
Darren Tucker2dcd2392004-01-23 17:13:33 +1100858 exit(2);
859}
Darren Tucker623d92f2004-09-12 22:36:15 +1000860 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000861 AC_MSG_RESULT(no),
862 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100863 if test -z "$zlib_check_nonfatal" ; then
864 AC_MSG_ERROR([*** zlib too old - check config.log ***
865Your reported zlib version has known security problems. It's possible your
866vendor has fixed these problems without changing the version number. If you
867are sure this is the case, you can disable the check by running
868"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000869If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000870See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100871 else
872 AC_MSG_WARN([zlib version may have security problems])
873 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000874 ],
875 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100876)
Damien Miller6f9c3372000-10-25 10:06:04 +1100877
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000878dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100879AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000880 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
881)
Darren Tucker5bfe1682005-11-12 18:42:36 +1100882AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700883 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
884 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000885)
Damien Millerab18c411999-11-11 10:40:23 +1100886
Tim Ricee589a292001-11-03 11:09:32 -0800887dnl Checks for libutil functions
888AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700889AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
890 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800891AC_CHECK_FUNCS(logout updwtmp logwtmp)
892
Ben Lindstrom8697e082001-02-24 21:41:10 +0000893AC_FUNC_STRFTIME
894
Damien Miller3c027682001-03-14 11:39:45 +1100895# Check for ALTDIRFUNC glob() extension
896AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
897AC_EGREP_CPP(FOUNDIT,
898 [
899 #include <glob.h>
900 #ifdef GLOB_ALTDIRFUNC
901 FOUNDIT
902 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100903 ],
Damien Miller3c027682001-03-14 11:39:45 +1100904 [
Tim Rice7df8d392005-09-19 09:33:39 -0700905 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
906 [Define if your system glob() function has
907 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100908 AC_MSG_RESULT(yes)
909 ],
910 [
911 AC_MSG_RESULT(no)
912 ]
913)
Damien Millerab18c411999-11-11 10:40:23 +1100914
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000915# Check for g.gl_matchc glob() extension
916AC_MSG_CHECKING(for gl_matchc field in glob_t)
917AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100918 [
919 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000920 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100921 ],
922 [
Tim Rice7df8d392005-09-19 09:33:39 -0700923 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
924 [Define if your system glob() function has
925 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100926 AC_MSG_RESULT(yes)
927 ],
928 [
929 AC_MSG_RESULT(no)
930 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000931)
932
Damien Miller18bb4732001-03-28 14:35:30 +1000933AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000934AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000935 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000936#include <sys/types.h>
937#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700938int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000939 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100940 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000941 [
942 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700943 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +1100944 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -0700945 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000946 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800947 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000948 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
949 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000950 ]
951)
952
Damien Miller36f49652004-08-15 18:40:59 +1000953AC_MSG_CHECKING([for /proc/pid/fd directory])
954if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700955 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000956 AC_MSG_RESULT(yes)
957else
958 AC_MSG_RESULT(no)
959fi
960
Damien Millerc547bf12001-02-16 10:18:12 +1100961# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100962SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100963AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100964 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100965 [
966 if test "x$withval" != "xno" ; then
967
968 if test "x$withval" != "xyes" ; then
969 CPPFLAGS="$CPPFLAGS -I${withval}/include"
970 LDFLAGS="$LDFLAGS -L${withval}/lib"
971 fi
972
Tim Rice7df8d392005-09-19 09:33:39 -0700973 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +1100974 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100975 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800976
Tim Rice4cec93f2002-02-26 08:40:48 -0800977 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +1000978 AC_LINK_IFELSE(
979 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -0800980#include <stdio.h>
981#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700982int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +1000983 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -0800984 [AC_MSG_RESULT(yes)],
985 [
986 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100987 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
988 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000989 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
990 AC_TRY_COMPILE(
991 [#include <stdio.h>
992 #include <skey.h>],
993 [(void)skeychallenge(NULL,"name","",0);],
994 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700995 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
996 [Define if your skeychallenge()
997 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +1000998 [AC_MSG_RESULT(no)]
999 )
Damien Millerc547bf12001-02-16 10:18:12 +11001000 fi
1001 ]
1002)
1003
1004# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001005TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001006AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001007 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001008 [
1009 if test "x$withval" != "xno" ; then
1010 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001011 saved_LDFLAGS="$LDFLAGS"
1012 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001013 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001014 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001015 if test -d "${withval}/lib"; then
1016 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001017 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001018 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001019 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001020 fi
1021 else
1022 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001023 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001024 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001025 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001026 fi
1027 fi
1028 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001029 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001030 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001031 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001032 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001033 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001034 LIBWRAP="-lwrap"
1035 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001036 AC_MSG_CHECKING(for libwrap)
1037 AC_TRY_LINK(
1038 [
Damien Miller0ac45002004-04-14 20:14:26 +10001039#include <sys/types.h>
1040#include <sys/socket.h>
1041#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001042#include <tcpd.h>
1043 int deny_severity = 0, allow_severity = 0;
1044 ],
1045 [hosts_access(0);],
1046 [
1047 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001048 AC_DEFINE(LIBWRAP, 1,
1049 [Define if you want
1050 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001051 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001052 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001053 ],
1054 [
1055 AC_MSG_ERROR([*** libwrap missing])
1056 ]
1057 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001058 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001059 fi
1060 ]
1061)
1062
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001063# Check whether user wants libedit support
1064LIBEDIT_MSG="no"
1065AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001066 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001067 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001068 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001069 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1070 if test -n "${need_dash_r}"; then
1071 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1072 else
1073 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1074 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001075 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001076 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001077 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001078 LIBEDIT="-ledit -lcurses"
1079 LIBEDIT_MSG="yes"
1080 AC_SUBST(LIBEDIT)
1081 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001082 [ AC_MSG_ERROR(libedit not found) ],
1083 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001084 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001085 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001086 AC_COMPILE_IFELSE(
1087 [AC_LANG_SOURCE([[
1088#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001089int main(void)
1090{
1091 int i = H_SETSIZE;
1092 el_init("", NULL, NULL, NULL);
1093 exit(0);
1094}
Tim Ricec1819c82005-08-15 17:48:40 -07001095 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001096 [ AC_MSG_RESULT(yes) ],
1097 [ AC_MSG_RESULT(no)
1098 AC_MSG_ERROR(libedit version is not compatible) ]
1099 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001100 fi ]
1101)
1102
Darren Tuckerd9f88912005-02-20 21:01:48 +11001103AUDIT_MODULE=none
1104AC_ARG_WITH(audit,
1105 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1106 [
1107 AC_MSG_CHECKING(for supported audit module)
1108 case "$withval" in
1109 bsm)
1110 AC_MSG_RESULT(bsm)
1111 AUDIT_MODULE=bsm
1112 dnl Checks for headers, libs and functions
1113 AC_CHECK_HEADERS(bsm/audit.h, [],
1114 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1115 AC_CHECK_LIB(bsm, getaudit, [],
1116 [AC_MSG_ERROR(BSM enabled and required library not found)])
1117 AC_CHECK_FUNCS(getaudit, [],
1118 [AC_MSG_ERROR(BSM enabled and required function not found)])
1119 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001120 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001121 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001122 ;;
1123 debug)
1124 AUDIT_MODULE=debug
1125 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001126 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001127 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001128 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001129 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001130 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001131 *)
1132 AC_MSG_ERROR([Unknown audit module $withval])
1133 ;;
1134 esac ]
1135)
1136
Damien Millerfe1f1432003-02-24 15:45:42 +11001137dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001138AC_CHECK_FUNCS( \
1139 arc4random \
Damien Miller57f39152005-11-24 19:58:19 +11001140 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001141 b64_ntop \
1142 __b64_ntop \
1143 b64_pton \
1144 __b64_pton \
1145 bcopy \
1146 bindresvport_sa \
1147 clock \
1148 closefrom \
1149 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001150 fchmod \
1151 fchown \
1152 freeaddrinfo \
1153 futimes \
1154 getaddrinfo \
1155 getcwd \
1156 getgrouplist \
1157 getnameinfo \
1158 getopt \
1159 getpeereid \
1160 _getpty \
1161 getrlimit \
1162 getttyent \
1163 glob \
1164 inet_aton \
1165 inet_ntoa \
1166 inet_ntop \
1167 innetgr \
1168 login_getcapbool \
1169 md5_crypt \
1170 memmove \
1171 mkdtemp \
1172 mmap \
1173 ngetaddrinfo \
1174 nsleep \
1175 ogetaddrinfo \
1176 openlog_r \
1177 openpty \
1178 prctl \
1179 pstat \
1180 readpassphrase \
1181 realpath \
1182 recvmsg \
1183 rresvport_af \
1184 sendmsg \
1185 setdtablesize \
1186 setegid \
1187 setenv \
1188 seteuid \
1189 setgroups \
1190 setlogin \
1191 setpcred \
1192 setproctitle \
1193 setregid \
1194 setreuid \
1195 setrlimit \
1196 setsid \
1197 setvbuf \
1198 sigaction \
1199 sigvec \
1200 snprintf \
1201 socketpair \
1202 strdup \
1203 strerror \
1204 strlcat \
1205 strlcpy \
1206 strmode \
1207 strnvis \
1208 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001209 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001210 strtoul \
1211 sysconf \
1212 tcgetpgrp \
1213 truncate \
1214 unsetenv \
1215 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001216 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001217 vhangup \
1218 vsnprintf \
1219 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001220)
Tim Rice13aae5e2001-10-21 17:53:58 -07001221
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001222# IRIX has a const char return value for gai_strerror()
1223AC_CHECK_FUNCS(gai_strerror,[
1224 AC_DEFINE(HAVE_GAI_STRERROR)
1225 AC_TRY_COMPILE([
1226#include <sys/types.h>
1227#include <sys/socket.h>
1228#include <netdb.h>
1229
1230const char *gai_strerror(int);],[
1231char *str;
1232
1233str = gai_strerror(0);],[
1234 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1235 [Define if gai_strerror() returns const char *])])])
1236
Tim Rice7df8d392005-09-19 09:33:39 -07001237AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1238 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001239
Darren Tuckerf1159b52003-07-07 19:44:01 +10001240dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001241AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001242AC_CHECK_DECL(strsep,
1243 [AC_CHECK_FUNCS(strsep)],
1244 [],
1245 [
1246#ifdef HAVE_STRING_H
1247# include <string.h>
1248#endif
1249 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001250
Darren Tuckerb2427c82003-09-10 15:22:44 +10001251dnl tcsendbreak might be a macro
1252AC_CHECK_DECL(tcsendbreak,
1253 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001254 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001255 [#include <termios.h>]
1256)
1257
Darren Tucker5bb14002004-04-23 18:53:10 +10001258AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1259
Darren Tucker2a6b0292003-12-31 14:59:17 +11001260AC_CHECK_FUNCS(setresuid, [
1261 dnl Some platorms have setresuid that isn't implemented, test for this
1262 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001263 AC_RUN_IFELSE(
1264 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001265#include <stdlib.h>
1266#include <errno.h>
1267int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001268 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001269 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001270 [AC_DEFINE(BROKEN_SETRESUID, 1,
1271 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001272 AC_MSG_RESULT(not implemented)],
1273 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001274 )
1275])
Darren Tuckere937be32003-12-17 18:53:26 +11001276
Darren Tucker2a6b0292003-12-31 14:59:17 +11001277AC_CHECK_FUNCS(setresgid, [
1278 dnl Some platorms have setresgid that isn't implemented, test for this
1279 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001280 AC_RUN_IFELSE(
1281 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001282#include <stdlib.h>
1283#include <errno.h>
1284int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001285 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001286 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001287 [AC_DEFINE(BROKEN_SETRESGID, 1,
1288 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001289 AC_MSG_RESULT(not implemented)],
1290 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001291 )
1292])
Darren Tuckere937be32003-12-17 18:53:26 +11001293
Damien Millerad833b32000-08-23 10:46:23 +10001294dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001295AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001296dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001297AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001298AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001299dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001300AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001301AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001302
Damien Millera8e06ce2003-11-21 23:48:55 +11001303AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001304 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1305 [AC_CHECK_LIB(bsd, daemon,
1306 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001307)
1308
Damien Millera8e06ce2003-11-21 23:48:55 +11001309AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001310 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1311 [Define if your libraries define getpagesize()])],
1312 [AC_CHECK_LIB(ucb, getpagesize,
1313 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001314)
1315
Damien Millercb170cb2000-07-01 16:52:55 +10001316# Check for broken snprintf
1317if test "x$ac_cv_func_snprintf" = "xyes" ; then
1318 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001319 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001320 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001321#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001322int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001323 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001324 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001325 [
1326 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001327 AC_DEFINE(BROKEN_SNPRINTF, 1,
1328 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001329 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001330 ],
1331 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001332 )
1333fi
1334
Damien Miller57f39152005-11-24 19:58:19 +11001335# If we don't have a working asprintf, then we strongly depend on vsnprintf
1336# returning the right thing on overflow: the number of characters it tried to
1337# create (as per SUSv3)
1338if test "x$ac_cv_func_asprintf" != "xyes" && \
1339 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1340 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1341 AC_RUN_IFELSE(
1342 [AC_LANG_SOURCE([[
1343#include <sys/types.h>
1344#include <stdio.h>
1345#include <stdarg.h>
1346
1347int x_snprintf(char *str,size_t count,const char *fmt,...)
1348{
1349 size_t ret; va_list ap;
1350 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1351 return ret;
1352}
1353int main(void)
1354{
1355 char x[1];
1356 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1357} ]])],
1358 [AC_MSG_RESULT(yes)],
1359 [
1360 AC_MSG_RESULT(no)
1361 AC_DEFINE(BROKEN_SNPRINTF, 1,
1362 [Define if your snprintf is busted])
1363 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1364 ],
1365 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1366 )
1367fi
1368
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001369# On systems where [v]snprintf is broken, but is declared in stdio,
1370# check that the fmt argument is const char * or just char *.
1371# This is only useful for when BROKEN_SNPRINTF
1372AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1373AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1374 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1375 int main(void) { snprintf(0, 0, 0); }
1376 ]])],
1377 [AC_MSG_RESULT(yes)
1378 AC_DEFINE(SNPRINTF_CONST, [const],
1379 [Define as const if snprintf() can declare const char *fmt])],
1380 [AC_MSG_RESULT(no)
1381 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1382
Damien Millerb4097182004-05-23 14:09:40 +10001383# Check for missing getpeereid (or equiv) support
1384NO_PEERCHECK=""
1385if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1386 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1387 AC_TRY_COMPILE(
1388 [#include <sys/types.h>
1389 #include <sys/socket.h>],
1390 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001391 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001392 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001393 ],
Damien Millerb4097182004-05-23 14:09:40 +10001394 [AC_MSG_RESULT(no)
1395 NO_PEERCHECK=1]
1396 )
1397fi
1398
Damien Millere8328192003-01-07 15:18:32 +11001399dnl see whether mkstemp() requires XXXXXX
1400if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1401AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001402AC_RUN_IFELSE(
1403 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001404#include <stdlib.h>
1405main() { char template[]="conftest.mkstemp-test";
1406if (mkstemp(template) == -1)
1407 exit(1);
1408unlink(template); exit(0);
1409}
Darren Tucker314d89e2005-10-17 23:29:23 +10001410 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001411 [
1412 AC_MSG_RESULT(no)
1413 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001414 [
Damien Millere8328192003-01-07 15:18:32 +11001415 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001416 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001417 ],
1418 [
1419 AC_MSG_RESULT(yes)
1420 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001421 ]
Damien Millere8328192003-01-07 15:18:32 +11001422)
1423fi
1424
Darren Tucker70a3d552003-08-21 17:58:29 +10001425dnl make sure that openpty does not reacquire controlling terminal
1426if test ! -z "$check_for_openpty_ctty_bug"; then
1427 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001428 AC_RUN_IFELSE(
1429 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001430#include <stdio.h>
1431#include <sys/fcntl.h>
1432#include <sys/types.h>
1433#include <sys/wait.h>
1434
1435int
1436main()
1437{
1438 pid_t pid;
1439 int fd, ptyfd, ttyfd, status;
1440
1441 pid = fork();
1442 if (pid < 0) { /* failed */
1443 exit(1);
1444 } else if (pid > 0) { /* parent */
1445 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001446 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001447 exit(WEXITSTATUS(status));
1448 else
1449 exit(2);
1450 } else { /* child */
1451 close(0); close(1); close(2);
1452 setsid();
1453 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1454 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1455 if (fd >= 0)
1456 exit(3); /* Acquired ctty: broken */
1457 else
1458 exit(0); /* Did not acquire ctty: OK */
1459 }
1460}
Darren Tucker314d89e2005-10-17 23:29:23 +10001461 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001462 [
1463 AC_MSG_RESULT(yes)
1464 ],
1465 [
1466 AC_MSG_RESULT(no)
1467 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001468 ],
1469 [
1470 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001471 ]
1472 )
1473fi
1474
Tim Rice8bb561b2005-03-17 16:23:19 -08001475if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1476 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001477 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001478 AC_RUN_IFELSE(
1479 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001480#include <stdio.h>
1481#include <sys/socket.h>
1482#include <netdb.h>
1483#include <errno.h>
1484#include <netinet/in.h>
1485
1486#define TEST_PORT "2222"
1487
1488int
1489main(void)
1490{
1491 int err, sock;
1492 struct addrinfo *gai_ai, *ai, hints;
1493 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1494
1495 memset(&hints, 0, sizeof(hints));
1496 hints.ai_family = PF_UNSPEC;
1497 hints.ai_socktype = SOCK_STREAM;
1498 hints.ai_flags = AI_PASSIVE;
1499
1500 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1501 if (err != 0) {
1502 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1503 exit(1);
1504 }
1505
1506 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1507 if (ai->ai_family != AF_INET6)
1508 continue;
1509
1510 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1511 sizeof(ntop), strport, sizeof(strport),
1512 NI_NUMERICHOST|NI_NUMERICSERV);
1513
1514 if (err != 0) {
1515 if (err == EAI_SYSTEM)
1516 perror("getnameinfo EAI_SYSTEM");
1517 else
1518 fprintf(stderr, "getnameinfo failed: %s\n",
1519 gai_strerror(err));
1520 exit(2);
1521 }
1522
1523 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1524 if (sock < 0)
1525 perror("socket");
1526 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1527 if (errno == EBADF)
1528 exit(3);
1529 }
1530 }
1531 exit(0);
1532}
Darren Tucker314d89e2005-10-17 23:29:23 +10001533 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001534 [
1535 AC_MSG_RESULT(yes)
1536 ],
1537 [
1538 AC_MSG_RESULT(no)
1539 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001540 ],
1541 [
1542 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001543 ]
1544 )
1545fi
1546
Tim Rice8bb561b2005-03-17 16:23:19 -08001547if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1548 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001549 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001550 AC_RUN_IFELSE(
1551 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001552#include <stdio.h>
1553#include <sys/socket.h>
1554#include <netdb.h>
1555#include <errno.h>
1556#include <netinet/in.h>
1557
1558#define TEST_PORT "2222"
1559
1560int
1561main(void)
1562{
1563 int err, sock;
1564 struct addrinfo *gai_ai, *ai, hints;
1565 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1566
1567 memset(&hints, 0, sizeof(hints));
1568 hints.ai_family = PF_UNSPEC;
1569 hints.ai_socktype = SOCK_STREAM;
1570 hints.ai_flags = AI_PASSIVE;
1571
1572 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1573 if (err != 0) {
1574 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1575 exit(1);
1576 }
1577
1578 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1579 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1580 continue;
1581
1582 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1583 sizeof(ntop), strport, sizeof(strport),
1584 NI_NUMERICHOST|NI_NUMERICSERV);
1585
1586 if (ai->ai_family == AF_INET && err != 0) {
1587 perror("getnameinfo");
1588 exit(2);
1589 }
1590 }
1591 exit(0);
1592}
Darren Tucker314d89e2005-10-17 23:29:23 +10001593 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001594 [
1595 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001596 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1597 [Define if you have a getaddrinfo that fails
1598 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001599 ],
1600 [
1601 AC_MSG_RESULT(no)
1602 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001603 ],
1604 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001605 ]
1606 )
1607fi
1608
Darren Tuckera56f1912004-11-02 20:30:54 +11001609if test "x$check_for_conflicting_getspnam" = "x1"; then
1610 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1611 AC_COMPILE_IFELSE(
1612 [
1613#include <shadow.h>
1614int main(void) {exit(0);}
1615 ],
1616 [
1617 AC_MSG_RESULT(no)
1618 ],
1619 [
1620 AC_MSG_RESULT(yes)
1621 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1622 [Conflicting defs for getspnam])
1623 ]
1624 )
1625fi
1626
Damien Miller606f8802000-09-16 15:39:56 +11001627AC_FUNC_GETPGRP
1628
Damien Millera64b57a2001-01-17 10:44:13 +11001629# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001630PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001631AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001632 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001633 [
Damien Millera64b57a2001-01-17 10:44:13 +11001634 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001635 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1636 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001637 AC_MSG_ERROR([PAM headers not found])
1638 fi
1639
1640 AC_CHECK_LIB(dl, dlopen, , )
1641 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1642 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001643 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001644
Damien Millera64b57a2001-01-17 10:44:13 +11001645 PAM_MSG="yes"
1646
Tim Rice7df8d392005-09-19 09:33:39 -07001647 AC_DEFINE(USE_PAM, 1,
1648 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001649 if test $ac_cv_lib_dl_dlopen = yes; then
1650 LIBPAM="-lpam -ldl"
1651 else
1652 LIBPAM="-lpam"
1653 fi
1654 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001655 fi
1656 ]
1657)
Damien Millera22ba012000-03-02 23:09:20 +11001658
Damien Millera64b57a2001-01-17 10:44:13 +11001659# Check for older PAM
1660if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001661 # Check PAM strerror arguments (old PAM)
1662 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1663 AC_TRY_COMPILE(
1664 [
Damien Miller81171112000-04-23 11:14:01 +10001665#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001666#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001667#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001668#elif defined (HAVE_PAM_PAM_APPL_H)
1669#include <pam/pam_appl.h>
1670#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001671 ],
1672 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001673 [AC_MSG_RESULT(no)],
1674 [
Tim Rice7df8d392005-09-19 09:33:39 -07001675 AC_DEFINE(HAVE_OLD_PAM, 1,
1676 [Define if you have an old version of PAM
1677 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001678 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001679 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001680 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001681 )
Damien Millera22ba012000-03-02 23:09:20 +11001682fi
1683
Tim Riceaef73712002-05-11 13:17:42 -07001684# Search for OpenSSL
1685saved_CPPFLAGS="$CPPFLAGS"
1686saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001687AC_ARG_WITH(ssl-dir,
1688 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1689 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001690 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001691 case "$withval" in
1692 # Relative paths
1693 ./*|../*) withval="`pwd`/$withval"
1694 esac
Tim Riceaef73712002-05-11 13:17:42 -07001695 if test -d "$withval/lib"; then
1696 if test -n "${need_dash_r}"; then
1697 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1698 else
1699 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1700 fi
1701 else
1702 if test -n "${need_dash_r}"; then
1703 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1704 else
1705 LDFLAGS="-L${withval} ${LDFLAGS}"
1706 fi
1707 fi
1708 if test -d "$withval/include"; then
1709 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1710 else
1711 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1712 fi
Damien Millera22ba012000-03-02 23:09:20 +11001713 fi
1714 ]
1715)
Tim Rice3d5352e2004-02-12 09:27:21 -08001716LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001717AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1718 [Define if your ssl headers are included
1719 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001720 [
Tim Riceaef73712002-05-11 13:17:42 -07001721 dnl Check default openssl install dir
1722 if test -n "${need_dash_r}"; then
1723 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001724 else
Tim Riceaef73712002-05-11 13:17:42 -07001725 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001726 fi
Tim Riceaef73712002-05-11 13:17:42 -07001727 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1728 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1729 [
1730 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1731 ]
1732 )
1733 ]
1734)
1735
Tim Riced730b782002-08-13 18:52:10 -07001736# Determine OpenSSL header version
1737AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001738AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001739 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001740#include <stdio.h>
1741#include <string.h>
1742#include <openssl/opensslv.h>
1743#define DATA "conftest.sslincver"
1744int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001745 FILE *fd;
1746 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001747
Damien Millera8e06ce2003-11-21 23:48:55 +11001748 fd = fopen(DATA,"w");
1749 if(fd == NULL)
1750 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001751
1752 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1753 exit(1);
1754
1755 exit(0);
1756}
Darren Tucker623d92f2004-09-12 22:36:15 +10001757 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001758 [
1759 ssl_header_ver=`cat conftest.sslincver`
1760 AC_MSG_RESULT($ssl_header_ver)
1761 ],
1762 [
1763 AC_MSG_RESULT(not found)
1764 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001765 ],
1766 [
1767 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001768 ]
1769)
1770
1771# Determine OpenSSL library version
1772AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001773AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001774 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001775#include <stdio.h>
1776#include <string.h>
1777#include <openssl/opensslv.h>
1778#include <openssl/crypto.h>
1779#define DATA "conftest.ssllibver"
1780int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001781 FILE *fd;
1782 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001783
Damien Millera8e06ce2003-11-21 23:48:55 +11001784 fd = fopen(DATA,"w");
1785 if(fd == NULL)
1786 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001787
1788 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1789 exit(1);
1790
1791 exit(0);
1792}
Darren Tucker623d92f2004-09-12 22:36:15 +10001793 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001794 [
1795 ssl_library_ver=`cat conftest.ssllibver`
1796 AC_MSG_RESULT($ssl_library_ver)
1797 ],
1798 [
1799 AC_MSG_RESULT(not found)
1800 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001801 ],
1802 [
1803 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001804 ]
1805)
Damien Millera22ba012000-03-02 23:09:20 +11001806
Damien Millerec932372002-01-22 22:16:03 +11001807# Sanity check OpenSSL headers
1808AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001809AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001810 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001811#include <string.h>
1812#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001813int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001814 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001815 [
1816 AC_MSG_RESULT(yes)
1817 ],
1818 [
1819 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001820 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1821Check config.log for details.
1822Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001823 ],
1824 [
1825 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001826 ]
1827)
1828
Darren Tucker129d0bb2005-12-19 17:40:40 +11001829# Check for OpenSSL without EVP_aes_{192,256}_cbc
1830AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
1831AC_COMPILE_IFELSE(
1832 [AC_LANG_SOURCE([[
1833#include <string.h>
1834#include <openssl/evp.h>
Darren Tuckercc7c2122006-02-02 18:44:19 +11001835int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
Darren Tucker129d0bb2005-12-19 17:40:40 +11001836 ]])],
1837 [
1838 AC_MSG_RESULT(no)
1839 ],
1840 [
1841 AC_MSG_RESULT(yes)
1842 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
1843 [libcrypto is missing AES 192 and 256 bit functions])
1844 ]
1845)
1846
Tim Rice3d5352e2004-02-12 09:27:21 -08001847# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1848# because the system crypt() is more featureful.
1849if test "x$check_for_libcrypt_before" = "x1"; then
1850 AC_CHECK_LIB(crypt, crypt)
1851fi
1852
Damien Millera8e06ce2003-11-21 23:48:55 +11001853# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001854# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001855if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001856 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001857fi
1858
Tim Rice2291c002005-08-26 13:15:19 -07001859AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001860
1861### Configure cryptographic random number support
1862
1863# Check wheter OpenSSL seeds itself
1864AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001865AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001866 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001867#include <string.h>
1868#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001869int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001870 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001871 [
1872 OPENSSL_SEEDS_ITSELF=yes
1873 AC_MSG_RESULT(yes)
1874 ],
1875 [
1876 AC_MSG_RESULT(no)
1877 # Default to use of the rand helper if OpenSSL doesn't
1878 # seed itself
1879 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001880 ],
1881 [
1882 AC_MSG_WARN([cross compiling: assuming yes])
1883 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001884 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001885 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001886 ]
1887)
1888
1889
1890# Do we want to force the use of the rand helper?
1891AC_ARG_WITH(rand-helper,
1892 [ --with-rand-helper Use subprocess to gather strong randomness ],
1893 [
1894 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001895 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001896 # the previous test showed it to be unseeded.
1897 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1898 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1899 OPENSSL_SEEDS_ITSELF=yes
1900 USE_RAND_HELPER=""
1901 fi
1902 else
1903 USE_RAND_HELPER=yes
1904 fi
1905 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001906)
Damien Miller6c21c512002-01-22 21:57:53 +11001907
1908# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001909if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001910 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001911 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1912 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001913 RAND_MSG="OpenSSL internal ONLY"
1914 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001915elif test ! -z "$USE_RAND_HELPER" ; then
1916 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001917 RAND_MSG="ssh-rand-helper"
1918 INSTALL_SSH_RAND_HELPER="yes"
1919fi
1920AC_SUBST(INSTALL_SSH_RAND_HELPER)
1921
1922### Configuration of ssh-rand-helper
1923
1924# PRNGD TCP socket
1925AC_ARG_WITH(prngd-port,
1926 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1927 [
Damien Millere996d722002-01-23 11:20:59 +11001928 case "$withval" in
1929 no)
1930 withval=""
1931 ;;
1932 [[0-9]]*)
1933 ;;
1934 *)
1935 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1936 ;;
1937 esac
1938 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001939 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001940 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1941 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001942 fi
1943 ]
1944)
1945
1946# PRNGD Unix domain socket
1947AC_ARG_WITH(prngd-socket,
1948 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1949 [
Damien Millere996d722002-01-23 11:20:59 +11001950 case "$withval" in
1951 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001952 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001953 ;;
1954 no)
1955 withval=""
1956 ;;
1957 /*)
1958 ;;
1959 *)
1960 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1961 ;;
1962 esac
1963
1964 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001965 if test ! -z "$PRNGD_PORT" ; then
1966 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1967 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001968 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001969 AC_MSG_WARN(Entropy socket is not readable)
1970 fi
1971 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001972 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1973 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001974 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001975 ],
1976 [
1977 # Check for existing socket only if we don't have a random device already
1978 if test "$USE_RAND_HELPER" = yes ; then
1979 AC_MSG_CHECKING(for PRNGD/EGD socket)
1980 # Insert other locations here
1981 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1982 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1983 PRNGD_SOCKET="$sock"
1984 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1985 break;
1986 fi
1987 done
1988 if test ! -z "$PRNGD_SOCKET" ; then
1989 AC_MSG_RESULT($PRNGD_SOCKET)
1990 else
1991 AC_MSG_RESULT(not found)
1992 fi
1993 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001994 ]
1995)
1996
1997# Change default command timeout for hashing entropy source
1998entropy_timeout=200
1999AC_ARG_WITH(entropy-timeout,
2000 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2001 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002002 if test -n "$withval" && test "x$withval" != "xno" && \
2003 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002004 entropy_timeout=$withval
2005 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002006 ]
Damien Miller6c21c512002-01-22 21:57:53 +11002007)
Tim Rice7df8d392005-09-19 09:33:39 -07002008AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2009 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11002010
Damien Millerd3f6ad22002-06-25 10:24:47 +10002011SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00002012AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00002013 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002014 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002015 if test -n "$withval" && test "x$withval" != "xno" && \
2016 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002017 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002018 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002019 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002020)
Tim Rice7df8d392005-09-19 09:33:39 -07002021AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2022 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002023AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002024
Tim Rice88f2ab52002-03-17 12:17:34 -08002025# We do this little dance with the search path to insure
2026# that programs that we select for use by installed programs
2027# (which may be run by the super-user) come from trusted
2028# locations before they come from the user's private area.
2029# This should help avoid accidentally configuring some
2030# random version of a program in someone's personal bin.
2031
2032OPATH=$PATH
2033PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002034test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002035test -d /sbin && PATH=$PATH:/sbin
2036test -d /usr/sbin && PATH=$PATH:/usr/sbin
2037PATH=$PATH:/etc:$OPATH
2038
Damien Millera8e06ce2003-11-21 23:48:55 +11002039# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002040OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2041OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2042OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2043OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2044OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2045OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2046OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2047OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2048OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2049OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2050OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2051OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2052OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2053OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2054OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2055OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002056# restore PATH
2057PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002058
2059# Where does ssh-rand-helper get its randomness from?
2060INSTALL_SSH_PRNG_CMDS=""
2061if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2062 if test ! -z "$PRNGD_PORT" ; then
2063 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2064 elif test ! -z "$PRNGD_SOCKET" ; then
2065 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2066 else
2067 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2068 RAND_HELPER_CMDHASH=yes
2069 INSTALL_SSH_PRNG_CMDS="yes"
2070 fi
2071fi
2072AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2073
2074
Ben Lindstromb5628642000-10-18 00:02:25 +00002075# Cheap hack to ensure NEWS-OS libraries are arranged right.
2076if test ! -z "$SONY" ; then
2077 LIBS="$LIBS -liberty";
2078fi
2079
Damien Miller57f39152005-11-24 19:58:19 +11002080# Check for long long datatypes
2081AC_CHECK_TYPES([long long, unsigned long long, long double])
2082
2083# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002084AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002085AC_CHECK_SIZEOF(short int, 2)
2086AC_CHECK_SIZEOF(int, 4)
2087AC_CHECK_SIZEOF(long int, 4)
2088AC_CHECK_SIZEOF(long long int, 8)
2089
Damien Millerfa2bb692002-04-23 23:22:25 +10002090# Sanity check long long for some platforms (AIX)
2091if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2092 ac_cv_sizeof_long_long_int=0
2093fi
2094
Darren Tucker537f1ed2005-10-25 18:38:33 +10002095# compute LLONG_MIN and LLONG_MAX if we don't know them.
2096if test -z "$have_llong_max"; then
2097 AC_MSG_CHECKING([for max value of long long])
2098 AC_RUN_IFELSE(
2099 [AC_LANG_SOURCE([[
2100#include <stdio.h>
2101/* Why is this so damn hard? */
2102#ifdef __GNUC__
2103# undef __GNUC__
2104#endif
2105#define __USE_ISOC99
2106#include <limits.h>
2107#define DATA "conftest.llminmax"
2108int main(void) {
2109 FILE *f;
2110 long long i, llmin, llmax = 0;
2111
2112 if((f = fopen(DATA,"w")) == NULL)
2113 exit(1);
2114
2115#if defined(LLONG_MIN) && defined(LLONG_MAX)
2116 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2117 llmin = LLONG_MIN;
2118 llmax = LLONG_MAX;
2119#else
2120 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2121 /* This will work on one's complement and two's complement */
2122 for (i = 1; i > llmax; i <<= 1, i++)
2123 llmax = i;
2124 llmin = llmax + 1LL; /* wrap */
2125#endif
2126
2127 /* Sanity check */
2128 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2129 || llmax - 1 > llmax) {
2130 fprintf(f, "unknown unknown\n");
2131 exit(2);
2132 }
2133
2134 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2135 exit(3);
2136
2137 exit(0);
2138}
2139 ]])],
2140 [
2141 llong_min=`$AWK '{print $1}' conftest.llminmax`
2142 llong_max=`$AWK '{print $2}' conftest.llminmax`
2143
2144 # snprintf on some Tru64s doesn't understand "%lld"
2145 case "$host" in
2146 alpha-dec-osf*)
2147 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2148 test "x$llong_max" = "xld"; then
2149 llong_min="-9223372036854775808"
2150 llong_max="9223372036854775807"
2151 fi
2152 ;;
2153 esac
2154
2155 AC_MSG_RESULT($llong_max)
2156 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2157 [max value of long long calculated by configure])
2158 AC_MSG_CHECKING([for min value of long long])
2159 AC_MSG_RESULT($llong_min)
2160 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2161 [min value of long long calculated by configure])
2162 ],
2163 [
2164 AC_MSG_RESULT(not found)
2165 ],
2166 [
2167 AC_MSG_WARN([cross compiling: not checking])
2168 ]
2169 )
2170fi
2171
2172
Damien Millera22ba012000-03-02 23:09:20 +11002173# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002174AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2175 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002176 [ #include <sys/types.h> ],
2177 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002178 [ ac_cv_have_u_int="yes" ],
2179 [ ac_cv_have_u_int="no" ]
2180 )
2181])
2182if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002183 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002184 have_u_int=1
2185fi
2186
Damien Miller61e50f12000-05-08 20:49:37 +10002187AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2188 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002189 [ #include <sys/types.h> ],
2190 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002191 [ ac_cv_have_intxx_t="yes" ],
2192 [ ac_cv_have_intxx_t="no" ]
2193 )
2194])
2195if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002196 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002197 have_intxx_t=1
2198fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002199
2200if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002201 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002202then
2203 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2204 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002205 [ #include <stdint.h> ],
2206 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002207 [
2208 AC_DEFINE(HAVE_INTXX_T)
2209 AC_MSG_RESULT(yes)
2210 ],
2211 [ AC_MSG_RESULT(no) ]
2212 )
2213fi
2214
Damien Miller578783e2000-09-23 14:12:24 +11002215AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2216 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002217 [
2218#include <sys/types.h>
2219#ifdef HAVE_STDINT_H
2220# include <stdint.h>
2221#endif
2222#include <sys/socket.h>
2223#ifdef HAVE_SYS_BITYPES_H
2224# include <sys/bitypes.h>
2225#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002226 ],
2227 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002228 [ ac_cv_have_int64_t="yes" ],
2229 [ ac_cv_have_int64_t="no" ]
2230 )
2231])
2232if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002233 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002234fi
2235
Damien Miller61e50f12000-05-08 20:49:37 +10002236AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2237 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002238 [ #include <sys/types.h> ],
2239 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002240 [ ac_cv_have_u_intxx_t="yes" ],
2241 [ ac_cv_have_u_intxx_t="no" ]
2242 )
2243])
2244if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002245 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002246 have_u_intxx_t=1
2247fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002248
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002249if test -z "$have_u_intxx_t" ; then
2250 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2251 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002252 [ #include <sys/socket.h> ],
2253 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002254 [
2255 AC_DEFINE(HAVE_U_INTXX_T)
2256 AC_MSG_RESULT(yes)
2257 ],
2258 [ AC_MSG_RESULT(no) ]
2259 )
2260fi
2261
Damien Miller578783e2000-09-23 14:12:24 +11002262AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2263 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002264 [ #include <sys/types.h> ],
2265 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002266 [ ac_cv_have_u_int64_t="yes" ],
2267 [ ac_cv_have_u_int64_t="no" ]
2268 )
2269])
2270if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002271 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002272 have_u_int64_t=1
2273fi
2274
Tim Rice4cec93f2002-02-26 08:40:48 -08002275if test -z "$have_u_int64_t" ; then
2276 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2277 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002278 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002279 [ u_int64_t a; a = 1],
2280 [
2281 AC_DEFINE(HAVE_U_INT64_T)
2282 AC_MSG_RESULT(yes)
2283 ],
2284 [ AC_MSG_RESULT(no) ]
2285 )
2286fi
2287
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002288if test -z "$have_u_intxx_t" ; then
2289 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2290 AC_TRY_COMPILE(
2291 [
2292#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002293 ],
2294 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002295 [ ac_cv_have_uintxx_t="yes" ],
2296 [ ac_cv_have_uintxx_t="no" ]
2297 )
2298 ])
2299 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002300 AC_DEFINE(HAVE_UINTXX_T, 1,
2301 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002302 fi
2303fi
2304
2305if test -z "$have_uintxx_t" ; then
2306 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2307 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002308 [ #include <stdint.h> ],
2309 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002310 [
2311 AC_DEFINE(HAVE_UINTXX_T)
2312 AC_MSG_RESULT(yes)
2313 ],
2314 [ AC_MSG_RESULT(no) ]
2315 )
2316fi
2317
Damien Milleredb82922000-06-20 13:25:52 +10002318if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002319 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002320then
2321 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2322 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002323 [
2324#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002325 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002326 [
Damien Miller70494d12000-04-03 15:57:06 +10002327 int8_t a; int16_t b; int32_t c;
2328 u_int8_t e; u_int16_t f; u_int32_t g;
2329 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002330 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002331 [
2332 AC_DEFINE(HAVE_U_INTXX_T)
2333 AC_DEFINE(HAVE_INTXX_T)
2334 AC_MSG_RESULT(yes)
2335 ],
2336 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002337 )
Damien Millerb29ea912000-01-15 14:12:03 +11002338fi
2339
Damien Miller58be7382001-09-15 21:31:54 +10002340
2341AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2342 AC_TRY_COMPILE(
2343 [
2344#include <sys/types.h>
2345 ],
2346 [ u_char foo; foo = 125; ],
2347 [ ac_cv_have_u_char="yes" ],
2348 [ ac_cv_have_u_char="no" ]
2349 )
2350])
2351if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002352 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002353fi
2354
Tim Rice13aae5e2001-10-21 17:53:58 -07002355TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002356
Tim Rice200a5c02002-02-26 22:12:34 -08002357AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002358
Damien Miller848b9932005-02-24 12:12:34 +11002359AC_CHECK_TYPES(in_addr_t,,,
2360[#include <sys/types.h>
2361#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002362
Damien Miller61e50f12000-05-08 20:49:37 +10002363AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2364 AC_TRY_COMPILE(
2365 [
2366#include <sys/types.h>
2367 ],
2368 [ size_t foo; foo = 1235; ],
2369 [ ac_cv_have_size_t="yes" ],
2370 [ ac_cv_have_size_t="no" ]
2371 )
2372])
2373if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002374 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002375fi
Damien Miller95058511999-12-29 10:36:45 +11002376
Damien Miller615f9392000-05-17 22:53:33 +10002377AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2378 AC_TRY_COMPILE(
2379 [
2380#include <sys/types.h>
2381 ],
2382 [ ssize_t foo; foo = 1235; ],
2383 [ ac_cv_have_ssize_t="yes" ],
2384 [ ac_cv_have_ssize_t="no" ]
2385 )
2386])
2387if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002388 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002389fi
2390
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002391AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2392 AC_TRY_COMPILE(
2393 [
2394#include <time.h>
2395 ],
2396 [ clock_t foo; foo = 1235; ],
2397 [ ac_cv_have_clock_t="yes" ],
2398 [ ac_cv_have_clock_t="no" ]
2399 )
2400])
2401if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002402 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002403fi
2404
Damien Millerb54b40e2000-06-23 08:23:34 +10002405AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2406 AC_TRY_COMPILE(
2407 [
2408#include <sys/types.h>
2409#include <sys/socket.h>
2410 ],
2411 [ sa_family_t foo; foo = 1235; ],
2412 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002413 [ AC_TRY_COMPILE(
2414 [
2415#include <sys/types.h>
2416#include <sys/socket.h>
2417#include <netinet/in.h>
2418 ],
2419 [ sa_family_t foo; foo = 1235; ],
2420 [ ac_cv_have_sa_family_t="yes" ],
2421
Damien Millerb54b40e2000-06-23 08:23:34 +10002422 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002423 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002424 )
2425])
2426if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002427 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2428 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002429fi
2430
Damien Miller0f91b4e2000-06-18 15:43:25 +10002431AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2432 AC_TRY_COMPILE(
2433 [
2434#include <sys/types.h>
2435 ],
2436 [ pid_t foo; foo = 1235; ],
2437 [ ac_cv_have_pid_t="yes" ],
2438 [ ac_cv_have_pid_t="no" ]
2439 )
2440])
2441if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002442 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002443fi
2444
2445AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2446 AC_TRY_COMPILE(
2447 [
2448#include <sys/types.h>
2449 ],
2450 [ mode_t foo; foo = 1235; ],
2451 [ ac_cv_have_mode_t="yes" ],
2452 [ ac_cv_have_mode_t="no" ]
2453 )
2454])
2455if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002456 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002457fi
2458
Damien Miller61e50f12000-05-08 20:49:37 +10002459
2460AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2461 AC_TRY_COMPILE(
2462 [
Damien Miller81171112000-04-23 11:14:01 +10002463#include <sys/types.h>
2464#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002465 ],
2466 [ struct sockaddr_storage s; ],
2467 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2468 [ ac_cv_have_struct_sockaddr_storage="no" ]
2469 )
2470])
2471if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002472 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2473 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002474fi
Damien Miller34132e52000-01-14 15:45:46 +11002475
Damien Miller61e50f12000-05-08 20:49:37 +10002476AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2477 AC_TRY_COMPILE(
2478 [
Damien Miller7b22d652000-06-18 14:07:04 +10002479#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002480#include <netinet/in.h>
2481 ],
2482 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2483 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2484 [ ac_cv_have_struct_sockaddr_in6="no" ]
2485 )
2486])
2487if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002488 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2489 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002490fi
Damien Miller34132e52000-01-14 15:45:46 +11002491
Damien Miller61e50f12000-05-08 20:49:37 +10002492AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2493 AC_TRY_COMPILE(
2494 [
Damien Miller7b22d652000-06-18 14:07:04 +10002495#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002496#include <netinet/in.h>
2497 ],
2498 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2499 [ ac_cv_have_struct_in6_addr="yes" ],
2500 [ ac_cv_have_struct_in6_addr="no" ]
2501 )
2502])
2503if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002504 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2505 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002506fi
Damien Miller34132e52000-01-14 15:45:46 +11002507
Damien Miller61e50f12000-05-08 20:49:37 +10002508AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2509 AC_TRY_COMPILE(
2510 [
Damien Miller81171112000-04-23 11:14:01 +10002511#include <sys/types.h>
2512#include <sys/socket.h>
2513#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002514 ],
2515 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2516 [ ac_cv_have_struct_addrinfo="yes" ],
2517 [ ac_cv_have_struct_addrinfo="no" ]
2518 )
2519])
2520if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002521 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2522 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002523fi
2524
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002525AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2526 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002527 [ #include <sys/time.h> ],
2528 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002529 [ ac_cv_have_struct_timeval="yes" ],
2530 [ ac_cv_have_struct_timeval="no" ]
2531 )
2532])
2533if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002534 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002535 have_struct_timeval=1
2536fi
2537
Tim Rice4e4dc562003-03-18 10:21:40 -08002538AC_CHECK_TYPES(struct timespec)
2539
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002540# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002541if test "x$ac_cv_have_int64_t" = "xno" && \
2542 test "x$ac_cv_sizeof_long_int" != "x8" && \
2543 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002544 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2545 echo "an alternative compiler (I.E., GCC) before continuing."
2546 echo ""
2547 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002548else
2549dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002550 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002551 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002552#include <stdio.h>
2553#include <string.h>
2554#ifdef HAVE_SNPRINTF
2555main()
2556{
2557 char buf[50];
2558 char expected_out[50];
2559 int mazsize = 50 ;
2560#if (SIZEOF_LONG_INT == 8)
2561 long int num = 0x7fffffffffffffff;
2562#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002563 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002564#endif
2565 strcpy(expected_out, "9223372036854775807");
2566 snprintf(buf, mazsize, "%lld", num);
2567 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002568 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002569 exit(0);
2570}
2571#else
2572main() { exit(0); }
2573#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002574 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002575 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002576 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002577fi
2578
Damien Miller78315eb2000-09-29 23:01:36 +11002579dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002580OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2581OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2582OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2583OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2584OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002585OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002586OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2587OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002588OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002589OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2590OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2591OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2592OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002593OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2594OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2595OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2596OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002597
2598AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002599AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2600 [Define if we don't have struct __res_state in resolv.h])],
2601[
2602#include <stdio.h>
2603#if HAVE_SYS_TYPES_H
2604# include <sys/types.h>
2605#endif
2606#include <netinet/in.h>
2607#include <arpa/nameser.h>
2608#include <resolv.h>
2609])
andre2ff7b5d2000-06-03 14:57:40 +00002610
Damien Miller61e50f12000-05-08 20:49:37 +10002611AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2612 ac_cv_have_ss_family_in_struct_ss, [
2613 AC_TRY_COMPILE(
2614 [
Damien Miller81171112000-04-23 11:14:01 +10002615#include <sys/types.h>
2616#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002617 ],
2618 [ struct sockaddr_storage s; s.ss_family = 1; ],
2619 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2620 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2621 )
2622])
2623if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002624 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002625fi
2626
Damien Miller61e50f12000-05-08 20:49:37 +10002627AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2628 ac_cv_have___ss_family_in_struct_ss, [
2629 AC_TRY_COMPILE(
2630 [
Damien Miller81171112000-04-23 11:14:01 +10002631#include <sys/types.h>
2632#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002633 ],
2634 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2635 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2636 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2637 )
2638])
2639if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002640 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2641 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002642fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002643
Damien Millerad833b32000-08-23 10:46:23 +10002644AC_CACHE_CHECK([for pw_class field in struct passwd],
2645 ac_cv_have_pw_class_in_struct_passwd, [
2646 AC_TRY_COMPILE(
2647 [
Damien Millerad833b32000-08-23 10:46:23 +10002648#include <pwd.h>
2649 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002650 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002651 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2652 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2653 )
2654])
2655if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002656 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2657 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002658fi
2659
Kevin Steves82456952001-06-22 21:14:18 +00002660AC_CACHE_CHECK([for pw_expire field in struct passwd],
2661 ac_cv_have_pw_expire_in_struct_passwd, [
2662 AC_TRY_COMPILE(
2663 [
2664#include <pwd.h>
2665 ],
2666 [ struct passwd p; p.pw_expire = 0; ],
2667 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2668 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2669 )
2670])
2671if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002672 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2673 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002674fi
2675
2676AC_CACHE_CHECK([for pw_change field in struct passwd],
2677 ac_cv_have_pw_change_in_struct_passwd, [
2678 AC_TRY_COMPILE(
2679 [
2680#include <pwd.h>
2681 ],
2682 [ struct passwd p; p.pw_change = 0; ],
2683 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2684 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2685 )
2686])
2687if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002688 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2689 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002690fi
Damien Miller61e50f12000-05-08 20:49:37 +10002691
Tim Rice28bbb0c2002-05-27 17:37:32 -07002692dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002693AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2694 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002695 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002696 [
Tim Riceae49fe62002-04-12 10:26:21 -07002697#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002698#include <sys/socket.h>
2699#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002700int main() {
2701#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002702#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002703exit(1);
2704#endif
2705struct msghdr m;
2706m.msg_accrights = 0;
2707exit(0);
2708}
Kevin Steves939c9db2002-03-22 17:23:25 +00002709 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002710 [ ac_cv_have_accrights_in_msghdr="yes" ],
2711 [ ac_cv_have_accrights_in_msghdr="no" ]
2712 )
2713])
2714if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002715 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2716 [Define if your system uses access rights style
2717 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002718fi
2719
Kevin Stevesa44e0352002-04-07 16:18:03 +00002720AC_CACHE_CHECK([for msg_control field in struct msghdr],
2721 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002722 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002723 [
Tim Riceae49fe62002-04-12 10:26:21 -07002724#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002725#include <sys/socket.h>
2726#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002727int main() {
2728#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002729#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002730exit(1);
2731#endif
2732struct msghdr m;
2733m.msg_control = 0;
2734exit(0);
2735}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002736 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002737 [ ac_cv_have_control_in_msghdr="yes" ],
2738 [ ac_cv_have_control_in_msghdr="no" ]
2739 )
2740])
2741if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002742 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2743 [Define if your system uses ancillary data style
2744 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002745fi
2746
Damien Miller61e50f12000-05-08 20:49:37 +10002747AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002748 AC_TRY_LINK([],
2749 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002750 [ ac_cv_libc_defines___progname="yes" ],
2751 [ ac_cv_libc_defines___progname="no" ]
2752 )
2753])
2754if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002755 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002756fi
2757
Kevin Steves4846f4a2002-03-22 18:19:53 +00002758AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2759 AC_TRY_LINK([
2760#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002761],
2762 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002763 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2764 [ ac_cv_cc_implements___FUNCTION__="no" ]
2765 )
2766])
2767if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002768 AC_DEFINE(HAVE___FUNCTION__, 1,
2769 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002770fi
2771
2772AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2773 AC_TRY_LINK([
2774#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002775],
2776 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002777 [ ac_cv_cc_implements___func__="yes" ],
2778 [ ac_cv_cc_implements___func__="no" ]
2779 )
2780])
2781if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002782 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002783fi
2784
Damien Miller57f39152005-11-24 19:58:19 +11002785AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
2786 AC_TRY_LINK(
2787 [#include <stdarg.h>
2788 va_list x,y;],
2789 [va_copy(x,y);],
2790 [ ac_cv_have_va_copy="yes" ],
2791 [ ac_cv_have_va_copy="no" ]
2792 )
2793])
2794if test "x$ac_cv_have_va_copy" = "xyes" ; then
2795 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
2796fi
2797
2798AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
2799 AC_TRY_LINK(
2800 [#include <stdarg.h>
2801 va_list x,y;],
2802 [__va_copy(x,y);],
2803 [ ac_cv_have___va_copy="yes" ],
2804 [ ac_cv_have___va_copy="no" ]
2805 )
2806])
2807if test "x$ac_cv_have___va_copy" = "xyes" ; then
2808 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2809fi
2810
Damien Miller4f8e6692001-07-14 13:22:53 +10002811AC_CACHE_CHECK([whether getopt has optreset support],
2812 ac_cv_have_getopt_optreset, [
2813 AC_TRY_LINK(
2814 [
2815#include <getopt.h>
2816 ],
2817 [ extern int optreset; optreset = 0; ],
2818 [ ac_cv_have_getopt_optreset="yes" ],
2819 [ ac_cv_have_getopt_optreset="no" ]
2820 )
2821])
2822if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002823 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2824 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002825fi
Damien Millera22ba012000-03-02 23:09:20 +11002826
Damien Millerecbb26d2000-07-15 14:59:14 +10002827AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002828 AC_TRY_LINK([],
2829 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002830 [ ac_cv_libc_defines_sys_errlist="yes" ],
2831 [ ac_cv_libc_defines_sys_errlist="no" ]
2832 )
2833])
2834if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002835 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2836 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002837fi
2838
2839
Damien Miller11fa2cc2000-08-16 10:35:58 +10002840AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002841 AC_TRY_LINK([],
2842 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002843 [ ac_cv_libc_defines_sys_nerr="yes" ],
2844 [ ac_cv_libc_defines_sys_nerr="no" ]
2845 )
2846])
2847if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002848 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002849fi
2850
Damien Millera8e06ce2003-11-21 23:48:55 +11002851SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002852# Check whether user wants sectok support
2853AC_ARG_WITH(sectok,
2854 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002855 [
2856 if test "x$withval" != "xno" ; then
2857 if test "x$withval" != "xyes" ; then
2858 CPPFLAGS="$CPPFLAGS -I${withval}"
2859 LDFLAGS="$LDFLAGS -L${withval}"
2860 if test ! -z "$need_dash_r" ; then
2861 LDFLAGS="$LDFLAGS -R${withval}"
2862 fi
2863 if test ! -z "$blibpath" ; then
2864 blibpath="$blibpath:${withval}"
2865 fi
2866 fi
2867 AC_CHECK_HEADERS(sectok.h)
2868 if test "$ac_cv_header_sectok_h" != yes; then
2869 AC_MSG_ERROR(Can't find sectok.h)
2870 fi
2871 AC_CHECK_LIB(sectok, sectok_open)
2872 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2873 AC_MSG_ERROR(Can't find libsectok)
2874 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002875 AC_DEFINE(SMARTCARD, 1,
2876 [Define if you want smartcard support])
2877 AC_DEFINE(USE_SECTOK, 1,
2878 [Define if you want smartcard support
2879 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002880 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002881 fi
2882 ]
2883)
2884
2885# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002886OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002887AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10002888 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08002889 [
2890 if test "x$withval" != "xno" ; then
2891 if test "x$withval" != "xyes" ; then
2892 OPENSC_CONFIG=$withval/bin/opensc-config
2893 else
2894 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2895 fi
2896 if test "$OPENSC_CONFIG" != "no"; then
2897 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2898 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2899 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2900 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2901 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002902 AC_DEFINE(USE_OPENSC, 1,
2903 [Define if you want smartcard support
2904 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002905 SCARD_MSG="yes, using OpenSC"
2906 fi
2907 fi
2908 ]
2909)
Damien Miller85de5802001-09-18 14:01:11 +10002910
Darren Tucker5f88d342003-10-15 16:57:57 +10002911# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002912AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002913 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2914 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002915 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002916 # Needed by our getrrsetbyname()
2917 AC_SEARCH_LIBS(res_query, resolv)
2918 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002919 AC_MSG_CHECKING(if res_query will link)
2920 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2921 [AC_MSG_RESULT(no)
2922 saved_LIBS="$LIBS"
2923 LIBS="$LIBS -lresolv"
2924 AC_MSG_CHECKING(for res_query in -lresolv)
2925 AC_LINK_IFELSE([
2926#include <resolv.h>
2927int main()
2928{
2929 res_query (0, 0, 0, 0, 0);
2930 return 0;
2931}
2932 ],
2933 [LIBS="$LIBS -lresolv"
2934 AC_MSG_RESULT(yes)],
2935 [LIBS="$saved_LIBS"
2936 AC_MSG_RESULT(no)])
2937 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002938 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002939 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002940 [#include <sys/types.h>
2941 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002942 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07002943 [AC_DEFINE(HAVE_HEADER_AD, 1,
2944 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10002945 [#include <arpa/nameser.h>])
2946 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002947
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002948# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002949KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002950AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002951 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002952 [ if test "x$withval" != "xno" ; then
2953 if test "x$withval" = "xyes" ; then
2954 KRB5ROOT="/usr/local"
2955 else
2956 KRB5ROOT=${withval}
2957 fi
2958
Tim Rice7df8d392005-09-19 09:33:39 -07002959 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11002960 KRB5_MSG="yes"
2961
2962 AC_MSG_CHECKING(for krb5-config)
2963 if test -x $KRB5ROOT/bin/krb5-config ; then
2964 KRB5CONF=$KRB5ROOT/bin/krb5-config
2965 AC_MSG_RESULT($KRB5CONF)
2966
2967 AC_MSG_CHECKING(for gssapi support)
2968 if $KRB5CONF | grep gssapi >/dev/null ; then
2969 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002970 AC_DEFINE(GSSAPI, 1,
2971 [Define this if you want GSSAPI
2972 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11002973 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002974 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002975 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002976 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002977 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002978 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2979 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002980 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002981 AC_MSG_CHECKING(whether we are using Heimdal)
2982 AC_TRY_COMPILE([ #include <krb5.h> ],
2983 [ char *tmp = heimdal_version; ],
2984 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002985 AC_DEFINE(HEIMDAL, 1,
2986 [Define this if you are using the
2987 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002988 AC_MSG_RESULT(no)
2989 )
2990 else
2991 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002992 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002993 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002994 AC_MSG_CHECKING(whether we are using Heimdal)
2995 AC_TRY_COMPILE([ #include <krb5.h> ],
2996 [ char *tmp = heimdal_version; ],
2997 [ AC_MSG_RESULT(yes)
2998 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002999 K5LIBS="-lkrb5 -ldes"
3000 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08003001 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10003002 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11003003 ],
3004 [ AC_MSG_RESULT(no)
3005 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3006 ]
3007 )
Damien Miller200d0a72003-06-30 19:21:36 +10003008 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003009
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003010 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3011 [ AC_DEFINE(GSSAPI)
3012 K5LIBS="-lgssapi $K5LIBS" ],
3013 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3014 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11003015 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003016 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3017 $K5LIBS)
3018 ],
3019 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003020
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003021 AC_CHECK_HEADER(gssapi.h, ,
3022 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003023 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003024 AC_CHECK_HEADERS(gssapi.h, ,
3025 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003026 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003027 ]
3028 )
3029
3030 oldCPP="$CPPFLAGS"
3031 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3032 AC_CHECK_HEADER(gssapi_krb5.h, ,
3033 [ CPPFLAGS="$oldCPP" ])
3034
Damien Millera8e06ce2003-11-21 23:48:55 +11003035 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003036 if test ! -z "$need_dash_r" ; then
3037 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3038 fi
3039 if test ! -z "$blibpath" ; then
3040 blibpath="$blibpath:${KRB5ROOT}/lib"
3041 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003042
3043 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3044 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3045 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3046
3047 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003048 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3049 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003050 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003051 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003052)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003053
Damien Millera22ba012000-03-02 23:09:20 +11003054# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003055
Damien Millerf58c6722002-05-13 13:15:42 +10003056PRIVSEP_PATH=/var/empty
3057AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003058 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003059 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003060 if test -n "$withval" && test "x$withval" != "xno" && \
3061 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003062 PRIVSEP_PATH=$withval
3063 fi
3064 ]
3065)
3066AC_SUBST(PRIVSEP_PATH)
3067
Damien Millera22ba012000-03-02 23:09:20 +11003068AC_ARG_WITH(xauth,
3069 [ --with-xauth=PATH Specify path to xauth program ],
3070 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003071 if test -n "$withval" && test "x$withval" != "xno" && \
3072 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003073 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003074 fi
3075 ],
3076 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003077 TestPath="$PATH"
3078 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3079 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3080 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3081 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3082 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003083 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003084 xauth_path="/usr/openwin/bin/xauth"
3085 fi
3086 ]
3087)
3088
Damien Miller7d901272003-01-13 16:55:22 +11003089STRIP_OPT=-s
3090AC_ARG_ENABLE(strip,
3091 [ --disable-strip Disable calling strip(1) on install],
3092 [
3093 if test "x$enableval" = "xno" ; then
3094 STRIP_OPT=
3095 fi
3096 ]
3097)
3098AC_SUBST(STRIP_OPT)
3099
Damien Millera19cf472000-11-29 13:28:50 +11003100if test -z "$xauth_path" ; then
3101 XAUTH_PATH="undefined"
3102 AC_SUBST(XAUTH_PATH)
3103else
Tim Rice7df8d392005-09-19 09:33:39 -07003104 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3105 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003106 XAUTH_PATH=$xauth_path
3107 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003108fi
Damien Millera22ba012000-03-02 23:09:20 +11003109
3110# Check for mail directory (last resort if we cannot get it from headers)
3111if test ! -z "$MAIL" ; then
3112 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003113 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3114 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003115fi
3116
Darren Tucker623d92f2004-09-12 22:36:15 +10003117if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003118 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3119 disable_ptmx_check=yes
3120fi
Damien Millera22ba012000-03-02 23:09:20 +11003121if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003122 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003123 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003124 [
Tim Rice7df8d392005-09-19 09:33:39 -07003125 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3126 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003127 have_dev_ptmx=1
3128 ]
3129 )
3130 fi
Damien Millera22ba012000-03-02 23:09:20 +11003131fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003132
Darren Tucker623d92f2004-09-12 22:36:15 +10003133if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003134 AC_CHECK_FILE("/dev/ptc",
3135 [
Tim Rice7df8d392005-09-19 09:33:39 -07003136 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3137 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003138 have_dev_ptc=1
3139 ]
3140 )
3141else
3142 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3143fi
Damien Miller204ad072000-03-02 23:56:12 +11003144
Damien Millera22ba012000-03-02 23:09:20 +11003145# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003146AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003147 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003148 [
Damien Miller897741e2001-04-16 10:41:46 +10003149 case "$withval" in
3150 man|cat|doc)
3151 MANTYPE=$withval
3152 ;;
3153 *)
3154 AC_MSG_ERROR(invalid man type: $withval)
3155 ;;
3156 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003157 ]
3158)
Ben Lindstrombc709922001-04-18 18:04:21 +00003159if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003160 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3161 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003162 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3163 MANTYPE=doc
3164 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3165 MANTYPE=man
3166 else
3167 MANTYPE=cat
3168 fi
3169fi
Damien Miller670a4b82000-01-22 13:53:11 +11003170AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003171if test "$MANTYPE" = "doc"; then
3172 mansubdir=man;
3173else
3174 mansubdir=$MANTYPE;
3175fi
3176AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003177
Damien Millera22ba012000-03-02 23:09:20 +11003178# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003179MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003180AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003181 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003182 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003183 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003184 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3185 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003186 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003187 fi
3188 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003189)
3190
Damien Millera22ba012000-03-02 23:09:20 +11003191# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003192AC_ARG_WITH(shadow,
3193 [ --without-shadow Disable shadow password support],
3194 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003195 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003196 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003197 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003198 fi
3199 ]
3200)
3201
Damien Miller1f335fb2000-06-26 11:31:33 +10003202if test -z "$disable_shadow" ; then
3203 AC_MSG_CHECKING([if the systems has expire shadow information])
3204 AC_TRY_COMPILE(
3205 [
3206#include <sys/types.h>
3207#include <shadow.h>
3208 struct spwd sp;
3209 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3210 [ sp_expire_available=yes ], []
3211 )
3212
3213 if test "x$sp_expire_available" = "xyes" ; then
3214 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003215 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3216 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003217 else
3218 AC_MSG_RESULT(no)
3219 fi
3220fi
3221
Damien Millera22ba012000-03-02 23:09:20 +11003222# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003223if test ! -z "$IPADDR_IN_DISPLAY" ; then
3224 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003225 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3226 [Define if you need to use IP address
3227 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003228else
Damien Millera8e06ce2003-11-21 23:48:55 +11003229 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003230 AC_ARG_WITH(ipaddr-display,
3231 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3232 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003233 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003234 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003235 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003236 fi
3237 ]
3238 )
3239fi
Damien Miller76112de1999-12-21 11:18:08 +11003240
Darren Tuckere1a790d2003-09-16 11:52:19 +10003241# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003242AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003243 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003244 [ if test "x$enableval" = "xno"; then
3245 AC_MSG_NOTICE([/etc/default/login handling disabled])
3246 etc_default_login=no
3247 else
3248 etc_default_login=yes
3249 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003250 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3251 then
3252 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3253 etc_default_login=no
3254 else
3255 etc_default_login=yes
3256 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003257)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003258
Darren Tucker2f9573d2005-02-10 22:28:54 +11003259if test "x$etc_default_login" != "xno"; then
3260 AC_CHECK_FILE("/etc/default/login",
3261 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003262 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003263 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3264 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003265 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003266fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003267
Tim Rice43a1c132002-04-17 21:19:14 -07003268dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003269if test $ac_cv_func_login_getcapbool = "yes" && \
3270 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003271 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003272fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003273
Damien Millera22ba012000-03-02 23:09:20 +11003274# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003275SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003276AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003277 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003278 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003279 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003280 AC_MSG_WARN([
3281--with-default-path=PATH has no effect on this system.
3282Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003283 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003284 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003285 AC_MSG_WARN([
3286--with-default-path=PATH will only be used if PATH is not defined in
3287$external_path_file .])
3288 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003289 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003290 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003291 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003292 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003293 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3294 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003295 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003296 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003297 AC_MSG_WARN([
3298If PATH is defined in $external_path_file, ensure the path to scp is included,
3299otherwise scp will not work.])
3300 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003301 AC_RUN_IFELSE(
3302 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003303/* find out what STDPATH is */
3304#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003305#ifdef HAVE_PATHS_H
3306# include <paths.h>
3307#endif
3308#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003309# ifdef _PATH_USERPATH /* Irix */
3310# define _PATH_STDPATH _PATH_USERPATH
3311# else
3312# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3313# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003314#endif
3315#include <sys/types.h>
3316#include <sys/stat.h>
3317#include <fcntl.h>
3318#define DATA "conftest.stdpath"
3319
3320main()
3321{
3322 FILE *fd;
3323 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003324
Tim Rice59ea0a02001-03-10 13:50:45 -08003325 fd = fopen(DATA,"w");
3326 if(fd == NULL)
3327 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003328
Tim Rice59ea0a02001-03-10 13:50:45 -08003329 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3330 exit(1);
3331
3332 exit(0);
3333}
Darren Tucker314d89e2005-10-17 23:29:23 +10003334 ]])],
3335 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003336 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3337 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3338 )
3339# make sure $bindir is in USER_PATH so scp will work
3340 t_bindir=`eval echo ${bindir}`
3341 case $t_bindir in
3342 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3343 esac
3344 case $t_bindir in
3345 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3346 esac
3347 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3348 if test $? -ne 0 ; then
3349 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3350 if test $? -ne 0 ; then
3351 user_path=$user_path:$t_bindir
3352 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3353 fi
3354 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003355 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003356)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003357if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003358 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003359 AC_SUBST(user_path)
3360fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003361
Damien Millera18bbd32002-05-13 10:48:57 +10003362# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003363AC_ARG_WITH(superuser-path,
3364 [ --with-superuser-path= Specify different path for super-user],
3365 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003366 if test -n "$withval" && test "x$withval" != "xno" && \
3367 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003368 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3369 [Define if you want a different $PATH
3370 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003371 superuser_path=$withval
3372 fi
3373 ]
3374)
3375
3376
Damien Miller61e50f12000-05-08 20:49:37 +10003377AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003378IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003379AC_ARG_WITH(4in6,
3380 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3381 [
3382 if test "x$withval" != "xno" ; then
3383 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003384 AC_DEFINE(IPV4_IN_IPV6, 1,
3385 [Detect IPv4 in IPv6 mapped addresses
3386 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003387 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003388 else
3389 AC_MSG_RESULT(no)
3390 fi
3391 ],[
3392 if test "x$inet6_default_4in6" = "xyes"; then
3393 AC_MSG_RESULT([yes (default)])
3394 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003395 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003396 else
3397 AC_MSG_RESULT([no (default)])
3398 fi
3399 ]
3400)
3401
Damien Miller60396b02001-02-18 17:01:00 +11003402# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003403BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003404AC_ARG_WITH(bsd-auth,
3405 [ --with-bsd-auth Enable BSD auth support],
3406 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003407 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003408 AC_DEFINE(BSD_AUTH, 1,
3409 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003410 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003411 fi
3412 ]
3413)
3414
Damien Millera22ba012000-03-02 23:09:20 +11003415# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003416piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003417# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003418if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003419 piddir=`eval echo ${sysconfdir}`
3420 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003421 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003422 esac
3423fi
3424
Tim Rice88f2ab52002-03-17 12:17:34 -08003425AC_ARG_WITH(pid-dir,
3426 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3427 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003428 if test -n "$withval" && test "x$withval" != "xno" && \
3429 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003430 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003431 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003432 AC_MSG_WARN([** no $piddir directory on this system **])
3433 fi
3434 fi
3435 ]
3436)
3437
Tim Rice7df8d392005-09-19 09:33:39 -07003438AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003439AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003440
andre2ff7b5d2000-06-03 14:57:40 +00003441dnl allow user to disable some login recording features
3442AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003443 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003444 [
3445 if test "x$enableval" = "xno" ; then
3446 AC_DEFINE(DISABLE_LASTLOG)
3447 fi
3448 ]
andre2ff7b5d2000-06-03 14:57:40 +00003449)
3450AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003451 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003452 [
3453 if test "x$enableval" = "xno" ; then
3454 AC_DEFINE(DISABLE_UTMP)
3455 fi
3456 ]
andre2ff7b5d2000-06-03 14:57:40 +00003457)
3458AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003459 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003460 [
3461 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003462 AC_DEFINE(DISABLE_UTMPX, 1,
3463 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003464 fi
3465 ]
andre2ff7b5d2000-06-03 14:57:40 +00003466)
3467AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003468 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003469 [
3470 if test "x$enableval" = "xno" ; then
3471 AC_DEFINE(DISABLE_WTMP)
3472 fi
3473 ]
andre2ff7b5d2000-06-03 14:57:40 +00003474)
3475AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003476 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003477 [
3478 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003479 AC_DEFINE(DISABLE_WTMPX, 1,
3480 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003481 fi
3482 ]
andre2ff7b5d2000-06-03 14:57:40 +00003483)
3484AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003485 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003486 [
3487 if test "x$enableval" = "xno" ; then
3488 AC_DEFINE(DISABLE_LOGIN)
3489 fi
3490 ]
andre2ff7b5d2000-06-03 14:57:40 +00003491)
3492AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003493 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003494 [
3495 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003496 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3497 [Define if you don't want to use pututline()
3498 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003499 fi
3500 ]
andre2ff7b5d2000-06-03 14:57:40 +00003501)
3502AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003503 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003504 [
3505 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003506 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3507 [Define if you don't want to use pututxline()
3508 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003509 fi
3510 ]
andre2ff7b5d2000-06-03 14:57:40 +00003511)
3512AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003513 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003514 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003515 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003516 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003517 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003518 conf_lastlog_location=$withval
3519 fi
3520 ]
3521)
andre2ff7b5d2000-06-03 14:57:40 +00003522
3523dnl lastlog, [uw]tmpx? detection
3524dnl NOTE: set the paths in the platform section to avoid the
3525dnl need for command-line parameters
3526dnl lastlog and [uw]tmp are subject to a file search if all else fails
3527
3528dnl lastlog detection
3529dnl NOTE: the code itself will detect if lastlog is a directory
3530AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3531AC_TRY_COMPILE([
3532#include <sys/types.h>
3533#include <utmp.h>
3534#ifdef HAVE_LASTLOG_H
3535# include <lastlog.h>
3536#endif
Damien Miller2994e082000-06-04 15:51:47 +10003537#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003538# include <paths.h>
3539#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003540#ifdef HAVE_LOGIN_H
3541# include <login.h>
3542#endif
andre2ff7b5d2000-06-03 14:57:40 +00003543 ],
3544 [ char *lastlog = LASTLOG_FILE; ],
3545 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003546 [
3547 AC_MSG_RESULT(no)
3548 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3549 AC_TRY_COMPILE([
3550#include <sys/types.h>
3551#include <utmp.h>
3552#ifdef HAVE_LASTLOG_H
3553# include <lastlog.h>
3554#endif
3555#ifdef HAVE_PATHS_H
3556# include <paths.h>
3557#endif
3558 ],
3559 [ char *lastlog = _PATH_LASTLOG; ],
3560 [ AC_MSG_RESULT(yes) ],
3561 [
andree441aa32000-06-12 22:34:38 +00003562 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003563 system_lastlog_path=no
3564 ])
3565 ]
andre2ff7b5d2000-06-03 14:57:40 +00003566)
Damien Miller2994e082000-06-04 15:51:47 +10003567
andre2ff7b5d2000-06-03 14:57:40 +00003568if test -z "$conf_lastlog_location"; then
3569 if test x"$system_lastlog_path" = x"no" ; then
3570 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003571 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003572 conf_lastlog_location=$f
3573 fi
3574 done
3575 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003576 AC_MSG_WARN([** Cannot find lastlog **])
3577 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003578 fi
3579 fi
3580fi
3581
3582if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003583 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3584 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003585fi
andre2ff7b5d2000-06-03 14:57:40 +00003586
3587dnl utmp detection
3588AC_MSG_CHECKING([if your system defines UTMP_FILE])
3589AC_TRY_COMPILE([
3590#include <sys/types.h>
3591#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003592#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003593# include <paths.h>
3594#endif
3595 ],
3596 [ char *utmp = UTMP_FILE; ],
3597 [ AC_MSG_RESULT(yes) ],
3598 [ AC_MSG_RESULT(no)
3599 system_utmp_path=no ]
3600)
3601if test -z "$conf_utmp_location"; then
3602 if test x"$system_utmp_path" = x"no" ; then
3603 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3604 if test -f $f ; then
3605 conf_utmp_location=$f
3606 fi
3607 done
3608 if test -z "$conf_utmp_location"; then
3609 AC_DEFINE(DISABLE_UTMP)
3610 fi
3611 fi
3612fi
3613if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003614 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3615 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003616fi
andre2ff7b5d2000-06-03 14:57:40 +00003617
3618dnl wtmp detection
3619AC_MSG_CHECKING([if your system defines WTMP_FILE])
3620AC_TRY_COMPILE([
3621#include <sys/types.h>
3622#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003623#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003624# include <paths.h>
3625#endif
3626 ],
3627 [ char *wtmp = WTMP_FILE; ],
3628 [ AC_MSG_RESULT(yes) ],
3629 [ AC_MSG_RESULT(no)
3630 system_wtmp_path=no ]
3631)
3632if test -z "$conf_wtmp_location"; then
3633 if test x"$system_wtmp_path" = x"no" ; then
3634 for f in /usr/adm/wtmp /var/log/wtmp; do
3635 if test -f $f ; then
3636 conf_wtmp_location=$f
3637 fi
3638 done
3639 if test -z "$conf_wtmp_location"; then
3640 AC_DEFINE(DISABLE_WTMP)
3641 fi
3642 fi
3643fi
3644if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003645 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3646 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003647fi
andre2ff7b5d2000-06-03 14:57:40 +00003648
3649
3650dnl utmpx detection - I don't know any system so perverse as to require
3651dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3652dnl there, though.
3653AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3654AC_TRY_COMPILE([
3655#include <sys/types.h>
3656#include <utmp.h>
3657#ifdef HAVE_UTMPX_H
3658#include <utmpx.h>
3659#endif
Damien Miller2994e082000-06-04 15:51:47 +10003660#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003661# include <paths.h>
3662#endif
3663 ],
3664 [ char *utmpx = UTMPX_FILE; ],
3665 [ AC_MSG_RESULT(yes) ],
3666 [ AC_MSG_RESULT(no)
3667 system_utmpx_path=no ]
3668)
3669if test -z "$conf_utmpx_location"; then
3670 if test x"$system_utmpx_path" = x"no" ; then
3671 AC_DEFINE(DISABLE_UTMPX)
3672 fi
3673else
Tim Rice7df8d392005-09-19 09:33:39 -07003674 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3675 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003676fi
andre2ff7b5d2000-06-03 14:57:40 +00003677
3678dnl wtmpx detection
3679AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3680AC_TRY_COMPILE([
3681#include <sys/types.h>
3682#include <utmp.h>
3683#ifdef HAVE_UTMPX_H
3684#include <utmpx.h>
3685#endif
Damien Miller2994e082000-06-04 15:51:47 +10003686#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003687# include <paths.h>
3688#endif
3689 ],
3690 [ char *wtmpx = WTMPX_FILE; ],
3691 [ AC_MSG_RESULT(yes) ],
3692 [ AC_MSG_RESULT(no)
3693 system_wtmpx_path=no ]
3694)
3695if test -z "$conf_wtmpx_location"; then
3696 if test x"$system_wtmpx_path" = x"no" ; then
3697 AC_DEFINE(DISABLE_WTMPX)
3698 fi
3699else
Tim Rice7df8d392005-09-19 09:33:39 -07003700 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3701 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003702fi
andre2ff7b5d2000-06-03 14:57:40 +00003703
Damien Miller4018c192000-04-30 09:30:44 +10003704
Damien Miller29ea30d2000-03-17 10:54:15 +11003705if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003706 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3707 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003708fi
3709
Tim Rice4cec93f2002-02-26 08:40:48 -08003710dnl remove pam and dl because they are in $LIBPAM
3711if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003712 LIBS=`echo $LIBS | sed 's/-lpam //'`
3713fi
3714if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3715 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003716fi
3717
Darren Tucker7da23cb2005-08-03 00:20:15 +10003718dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3719dnl Add now.
3720CFLAGS="$CFLAGS $werror_flags"
3721
Damien Millerbac2d8a2000-09-05 16:13:06 +11003722AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003723AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3724 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003725AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003726
Damien Miller7b22d652000-06-18 14:07:04 +10003727# Print summary of options
3728
Damien Miller7b22d652000-06-18 14:07:04 +10003729# Someone please show me a better way :)
3730A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3731B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3732C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3733D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003734E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003735F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003736G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003737H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3738I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3739J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003740
3741echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003742echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003743echo " User binaries: $B"
3744echo " System binaries: $C"
3745echo " Configuration files: $D"
3746echo " Askpass program: $E"
3747echo " Manual pages: $F"
3748echo " PID file: $G"
3749echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003750if test "x$external_path_file" = "x/etc/login.conf" ; then
3751echo " At runtime, sshd will use the path defined in $external_path_file"
3752echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003753else
Damien Millerf58c6722002-05-13 13:15:42 +10003754echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003755 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003756echo " (If PATH is set in $external_path_file it will be used instead. If"
3757echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3758 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003759fi
Damien Millera18bbd32002-05-13 10:48:57 +10003760if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003761echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003762fi
Damien Millerf58c6722002-05-13 13:15:42 +10003763echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003764echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003765echo " KerberosV support: $KRB5_MSG"
3766echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003767echo " S/KEY support: $SKEY_MSG"
3768echo " TCP Wrappers support: $TCPW_MSG"
3769echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003770echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003771echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003772echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3773echo " BSD Auth support: $BSD_AUTH_MSG"
3774echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003775if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003776echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003777fi
3778
Damien Miller7b22d652000-06-18 14:07:04 +10003779echo ""
3780
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003781echo " Host: ${host}"
3782echo " Compiler: ${CC}"
3783echo " Compiler flags: ${CFLAGS}"
3784echo "Preprocessor flags: ${CPPFLAGS}"
3785echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003786echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003787
3788echo ""
3789
Tim Rice6f1f7582004-05-30 21:38:51 -07003790if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003791 echo "SVR4 style packages are supported with \"make package\""
3792 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003793fi
3794
Damien Miller82cf0ce2000-12-20 13:34:48 +11003795if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003796 echo "PAM is enabled. You may need to install a PAM control file "
3797 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003798 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003799 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003800 echo ""
3801fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003802
Damien Miller6c21c512002-01-22 21:57:53 +11003803if test ! -z "$RAND_HELPER_CMDHASH" ; then
3804 echo "WARNING: you are using the builtin random number collection "
3805 echo "service. Please read WARNING.RNG and request that your OS "
3806 echo "vendor includes kernel-based random number collection in "
3807 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003808 echo ""
3809fi
Damien Miller60396b02001-02-18 17:01:00 +11003810
Damien Millerb4097182004-05-23 14:09:40 +10003811if test ! -z "$NO_PEERCHECK" ; then
3812 echo "WARNING: the operating system that you are using does not "
3813 echo "appear to support either the getpeereid() API nor the "
3814 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3815 echo "enforce security checks to prevent unauthorised connections to "
3816 echo "ssh-agent. Their absence increases the risk that a malicious "
3817 echo "user can connect to your agent. "
3818 echo ""
3819fi
3820
Darren Tuckerd9f88912005-02-20 21:01:48 +11003821if test "$AUDIT_MODULE" = "bsm" ; then
3822 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3823 echo "See the Solaris section in README.platform for details."
3824fi