blob: a9654cbde99fe0426c2771f4b6898655919637cb [file] [log] [blame]
Damien Millerbd4e4102006-01-01 21:03:30 +11001# $Id: configure.ac,v 1.321 2006/01/01 10:03:30 djm Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070060 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
61 [If your header files don't define LOGIN_PROGRAM,
62 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100063else
64 # Search for login
65 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
66 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
67 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
68 fi
69fi
70
Darren Tucker23bc8d02004-02-06 16:24:31 +110071AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
72if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070073 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
74 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110075fi
76
Damien Miller166bd442000-03-16 10:48:25 +110077if test -z "$LD" ; then
78 LD=$CC
79fi
80AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080081
Damien Miller166bd442000-03-16 10:48:25 +110082AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100083
84AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
85
Damien Millera8e06ce2003-11-21 23:48:55 +110086if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100087 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Darren Tucker3f9545e2005-11-12 15:20:52 +110088 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -070089 case $GCC_VER in
90 1.*) ;;
91 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
92 2.*) ;;
Darren Tuckerb0288092005-11-10 14:46:48 +110093 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
Darren Tuckerf0324352005-11-10 21:30:36 +110094 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
95 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -070096 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +100097
Darren Tucker67b37032005-06-03 17:58:31 +100098 if test -z "$have_llong_max"; then
99 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
100 unset ac_cv_have_decl_LLONG_MAX
101 saved_CFLAGS="$CFLAGS"
102 CFLAGS="$CFLAGS -std=gnu99"
103 AC_CHECK_DECL(LLONG_MAX,
104 [have_llong_max=1],
105 [CFLAGS="$saved_CFLAGS"],
106 [#include <limits.h>]
107 )
108 fi
Damien Miller166bd442000-03-16 10:48:25 +1100109fi
110
Tim Rice88368a32003-12-08 12:35:59 -0800111AC_ARG_WITH(rpath,
112 [ --without-rpath Disable auto-added -R linker paths],
113 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800114 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800115 need_dash_r=""
116 fi
117 if test "x$withval" = "xyes" ; then
118 need_dash_r=1
119 fi
120 ]
121)
122
Damien Millera22ba012000-03-02 23:09:20 +1100123# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100124case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100125*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100126 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000127 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800128 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100129 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000130 saved_LDFLAGS="$LDFLAGS"
131 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
132 if (test -z "$blibflags"); then
133 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
134 AC_TRY_LINK([], [], [blibflags=$tryflags])
135 fi
136 done
137 if (test -z "$blibflags"); then
138 AC_MSG_RESULT(not found)
139 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
140 else
141 AC_MSG_RESULT($blibflags)
142 fi
143 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000144 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700145 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
146 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700147 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000148 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700149 LIBS="$LIBS -ls"
150 ])
151 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100152 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100153 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100154 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000155 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100156 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000157 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
158 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000159 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000160 [(void)loginfailed("user","host","tty",0);],
161 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700162 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
163 [Define if your AIX loginfailed() function
164 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000165 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000166 )],
167 [],
168 [#include <usersec.h>]
169 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000170 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100171 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700172 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
173 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
174 [Define if your platform breaks doing a seteuid before a setuid])
175 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
176 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000177 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700178 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
179 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
180 [Some systems need a utmpx entry for /bin/login to work])
181 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
182 [Define to a Set Process Title type if your system is
183 supported by bsd-setproctitle.c])
Darren Tucker91d25a02005-11-26 22:24:09 +1100184 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
185 [AIX 5.2 and 5.3 (and presumably newer) require this])
Damien Miller75b1d102000-01-07 14:01:41 +1100186 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100187*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100188 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800189 LIBS="$LIBS /usr/lib/textmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700190 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
191 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
192 AC_DEFINE(DISABLE_SHADOW, 1,
193 [Define if you want to disable shadow passwords])
194 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
195 [Define if your system choked on IP TOS setting])
196 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
197 [Define if X11 doesn't support AF_UNIX sockets on that system])
198 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
199 [Define if the concept of ports only accessible to
200 superusers isn't known])
201 AC_DEFINE(DISABLE_FD_PASSING, 1,
202 [Define if your platform needs to skip post auth
203 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100204 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000205*-*-dgux*)
206 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100207 AC_DEFINE(SETEUID_BREAKS_SETUID)
208 AC_DEFINE(BROKEN_SETREUID)
209 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000210 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000211*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000212 AC_MSG_CHECKING(if we have working getaddrinfo)
213 AC_TRY_RUN([#include <mach-o/dyld.h>
214main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
215 exit(0);
216 else
217 exit(1);
218}], [AC_MSG_RESULT(working)],
219 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700220 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700221 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000222 AC_DEFINE(SETEUID_BREAKS_SETUID)
223 AC_DEFINE(BROKEN_SETREUID)
224 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700225 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
226 [Define if your resolver libs need this for getrrsetbyname])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000227 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000228*-*-hpux*)
229 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000230 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100231 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000232 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700233 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
234 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000235 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700236 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
237 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000238 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000239 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700240 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000241 AC_CHECK_LIB(xnet, t_error, ,
242 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
243
244 # next, we define all of the options specific to major releases
245 case "$host" in
246 *-*-hpux10*)
247 if test -z "$GCC"; then
248 CFLAGS="$CFLAGS -Ae"
249 fi
250 ;;
251 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700252 AC_DEFINE(PAM_SUN_CODEBASE, 1,
253 [Define if you are using Solaris-derived PAM which
254 passes pam_messages to the conversation function
255 with an extra level of indirection])
256 AC_DEFINE(DISABLE_UTMP, 1,
257 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000258 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
259 check_for_hpux_broken_getaddrinfo=1
260 check_for_conflicting_getspnam=1
261 ;;
262 esac
263
264 # lastly, we define options specific to minor releases
265 case "$host" in
266 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700267 AC_DEFINE(HAVE_SECUREWARE, 1,
268 [Define if you have SecureWare-based
269 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000270 disable_ptmx_check=yes
271 LIBS="$LIBS -lsecpw"
272 ;;
273 esac
Damien Miller1bead332000-04-30 00:47:29 +1000274 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100275*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100276 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700277 AC_DEFINE(BROKEN_INET_NTOA, 1,
278 [Define if you system's inet_ntoa is busted
279 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000280 AC_DEFINE(SETEUID_BREAKS_SETUID)
281 AC_DEFINE(BROKEN_SETREUID)
282 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700283 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
284 [Define if you shouldn't strip 'tty' from your
285 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000286 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100287 ;;
288*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100289 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700290 AC_DEFINE(WITH_IRIX_ARRAY, 1,
291 [Define if you have/want arrays
292 (cluster-wide session managment, not C arrays)])
293 AC_DEFINE(WITH_IRIX_PROJECT, 1,
294 [Define if you want IRIX project management])
295 AC_DEFINE(WITH_IRIX_AUDIT, 1,
296 [Define if you want IRIX audit trails])
297 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
298 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000299 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000300 AC_DEFINE(SETEUID_BREAKS_SETUID)
301 AC_DEFINE(BROKEN_SETREUID)
302 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700303 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000304 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000305 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100306 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100307*-*-linux*)
308 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100309 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000310 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700311 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
312 AC_DEFINE(PAM_TTY_KLUDGE, 1,
313 [Work around problematic Linux PAM modules handling of PAM_TTY])
314 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
315 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000316 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700317 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
318 [Define to whatever link() returns for "not supported"
319 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100320 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700321 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100322 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000323 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000324 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700325 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
326 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000327 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000328 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100329 # tun(4) forwarding compat code
Damien Millerc4bcc912005-12-31 17:05:58 +1100330 AC_CHECK_HEADERS(linux/if_tun.h)
Damien Millerbd4e4102006-01-01 21:03:30 +1100331 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Damien Miller89e03ba2005-12-31 16:42:03 +1100332 AC_DEFINE(SSH_TUN_LINUX, 1,
333 [Open tunnel devices the Linux tun/tap way])
334 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
335 [Use tunnel device compatibility to OpenBSD])
336 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
337 [Prepend the address family to IP tunnel traffic])
338 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100339 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000340mips-sony-bsd|mips-sony-newsos4)
Tim Rice7df8d392005-09-19 09:33:39 -0700341 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000342 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000343 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100344*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000345 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800346 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800347 need_dash_r=1
348 fi
Damien Miller2dcddbf2006-01-01 19:47:05 +1100349 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
350 AC_CHECK_HEADER([net/if_tap.h], ,
351 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
352 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
353 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100354 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100355*-*-freebsd*)
356 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000357 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100358 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
359 AC_CHECK_HEADER([net/if_tap.h], ,
360 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
Damien Millerfbd884a2001-02-27 08:39:07 +1100361 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000362*-*-bsdi*)
363 AC_DEFINE(SETEUID_BREAKS_SETUID)
364 AC_DEFINE(BROKEN_SETREUID)
365 AC_DEFINE(BROKEN_SETREGID)
366 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000367*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000368 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100369 conf_utmp_location=/etc/utmp
370 conf_wtmp_location=/usr/adm/wtmp
371 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700372 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000373 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000374 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700375 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000376 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000377*-*-openbsd*)
378 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000379 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100380 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
Darren Tucker4a422572005-07-14 17:22:11 +1000381 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100382*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800383 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800384 need_dash_r=1
385 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100386 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000387 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700388 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
389 [Some versions of /bin/login need the TERM supplied
390 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000391 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700392 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
393 [Define if pam_chauthtok wants real uid set
394 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000395 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000396 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700397 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
398 [Define if sshd somehow reacquires a controlling TTY
399 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000400 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000401 # hardwire lastlog location (can't detect it on some versions)
402 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000403 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
404 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
405 if test "$sol2ver" -ge 8; then
406 AC_MSG_RESULT(yes)
407 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700408 AC_DEFINE(DISABLE_WTMP, 1,
409 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000410 else
411 AC_MSG_RESULT(no)
412 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100413 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000414*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000415 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000416 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100417 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000418 conf_utmp_location=/etc/utmp
419 conf_wtmp_location=/var/adm/wtmp
420 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000421 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000422 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000423*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700424 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000425 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000426 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000427 AC_DEFINE(SETEUID_BREAKS_SETUID)
428 AC_DEFINE(BROKEN_SETREUID)
429 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000430 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000431*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700432 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000433 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100434 # -lresolv needs to be at the end of LIBS or DNS lookups break
435 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100436 IPADDR_IN_DISPLAY=yes
437 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000438 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000439 AC_DEFINE(SETEUID_BREAKS_SETUID)
440 AC_DEFINE(BROKEN_SETREUID)
441 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000442 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000443 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700444 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
445 # Attention: always take care to bind libsocket and libnsl before libc,
446 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000447 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800448# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100449*-*-sysv4.2*)
Damien Miller57f39152005-11-24 19:58:19 +1100450 CFLAGS="$CFLAGS -Dva_list=_VA_LIST"
Damien Miller5dfe9762001-02-16 12:05:39 +1100451 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700452 AC_DEFINE(SETEUID_BREAKS_SETUID)
453 AC_DEFINE(BROKEN_SETREUID)
454 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700455 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800456 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100457 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800458# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100459*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700460 check_for_libcrypt_later=1
461 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100462 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700463 AC_DEFINE(SETEUID_BREAKS_SETUID)
464 AC_DEFINE(BROKEN_SETREUID)
465 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700466 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700467 case "$host" in
468 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
469 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700470 AC_DEFINE(BROKEN_LIBIAF, 1,
471 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700472 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800473 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
474 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700475 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100476 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100477*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100478 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800479# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100480*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800481 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100482 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800483# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100484*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800485 if test -z "$GCC"; then
486 CFLAGS="$CFLAGS -belf"
487 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100488 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000489 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100490 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000491 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000492 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700493 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700494 AC_DEFINE(SETEUID_BREAKS_SETUID)
495 AC_DEFINE(BROKEN_SETREUID)
496 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700497 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700498 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700499 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100500 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700501 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700502 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000503 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000504*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700505 AC_DEFINE(NO_SSH_LASTLOG, 1,
506 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100507 AC_DEFINE(SETEUID_BREAKS_SETUID)
508 AC_DEFINE(BROKEN_SETREUID)
509 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000510 AC_DEFINE(USE_PIPES)
511 AC_DEFINE(DISABLE_FD_PASSING)
512 LDFLAGS="$LDFLAGS"
513 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
514 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000515 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000516*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100517 AC_DEFINE(SETEUID_BREAKS_SETUID)
518 AC_DEFINE(BROKEN_SETREUID)
519 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000520 AC_DEFINE(WITH_ABBREV_NO_TTY)
521 AC_DEFINE(USE_PIPES)
522 AC_DEFINE(DISABLE_FD_PASSING)
523 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100524 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000525 MANTYPE=cat
526 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000527*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100528 AC_DEFINE(SETEUID_BREAKS_SETUID)
529 AC_DEFINE(BROKEN_SETREUID)
530 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000531 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700532 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700533 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000534 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
535 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
536 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700537 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000538*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000539 AC_MSG_CHECKING(for Digital Unix SIA)
540 no_osfsia=""
541 AC_ARG_WITH(osfsia,
542 [ --with-osfsia Enable Digital Unix SIA],
543 [
544 if test "x$withval" = "xno" ; then
545 AC_MSG_RESULT(disabled)
546 no_osfsia=1
547 fi
548 ],
549 )
550 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000551 if test -f /etc/sia/matrix.conf; then
552 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700553 AC_DEFINE(HAVE_OSF_SIA, 1,
554 [Define if you have Digital Unix Security
555 Integration Architecture])
556 AC_DEFINE(DISABLE_LOGIN, 1,
557 [Define if you don't want to use your
558 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000559 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000560 LIBS="$LIBS -lsecurity -ldb -lm -laud"
561 else
562 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700563 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
564 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000565 fi
566 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000567 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700568 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000569 AC_DEFINE(BROKEN_SETREUID)
570 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000571 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000572
573*-*-nto-qnx)
574 AC_DEFINE(USE_PIPES)
575 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700576 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
577 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
578 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000579 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000580
581*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700582 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
583 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
584 AC_DEFINE(NEED_SETPRGP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700585 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
586 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000587
588*-*-lynxos)
589 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700590 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000591 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
592 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100593esac
594
Damien Millere37bfc12000-06-05 09:37:43 +1000595# Allow user to specify flags
596AC_ARG_WITH(cflags,
597 [ --with-cflags Specify additional flags to pass to compiler],
598 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800599 if test -n "$withval" && test "x$withval" != "xno" && \
600 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000601 CFLAGS="$CFLAGS $withval"
602 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800603 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000604)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000605AC_ARG_WITH(cppflags,
606 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
607 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800608 if test -n "$withval" && test "x$withval" != "xno" && \
609 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000610 CPPFLAGS="$CPPFLAGS $withval"
611 fi
612 ]
613)
Damien Millere37bfc12000-06-05 09:37:43 +1000614AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000615 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000616 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800617 if test -n "$withval" && test "x$withval" != "xno" && \
618 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000619 LDFLAGS="$LDFLAGS $withval"
620 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800621 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000622)
623AC_ARG_WITH(libs,
624 [ --with-libs Specify additional libraries to link with],
625 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800626 if test -n "$withval" && test "x$withval" != "xno" && \
627 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000628 LIBS="$LIBS $withval"
629 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800630 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000631)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000632AC_ARG_WITH(Werror,
633 [ --with-Werror Build main code with -Werror],
634 [
635 if test -n "$withval" && test "x$withval" != "xno"; then
636 werror_flags="-Werror"
Damien Millere04ec6f2005-10-08 16:21:19 +1000637 if test "x${withval}" != "xyes"; then
Darren Tucker7da23cb2005-08-03 00:20:15 +1000638 werror_flags="$withval"
639 fi
640 fi
641 ]
642)
Damien Millere37bfc12000-06-05 09:37:43 +1000643
Darren Tucker6eb93042003-06-29 21:30:41 +1000644AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000645AC_RUN_IFELSE(
646 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000647#include <stdio.h>
648int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000649 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000650 [ AC_MSG_RESULT(yes) ],
651 [
652 AC_MSG_RESULT(no)
653 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000654 ],
655 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000656)
657
Darren Tucker0c9653f2005-05-28 15:58:14 +1000658dnl Checks for header files.
659AC_CHECK_HEADERS( \
660 bstring.h \
661 crypt.h \
662 dirent.h \
663 endian.h \
664 features.h \
665 floatingpoint.h \
666 getopt.h \
667 glob.h \
668 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700669 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000670 lastlog.h \
671 limits.h \
672 login.h \
673 login_cap.h \
674 maillock.h \
675 ndir.h \
Damien Miller7b58e802005-12-13 19:33:19 +1100676 net/if.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000677 netdb.h \
678 netgroup.h \
679 netinet/in_systm.h \
680 pam/pam_appl.h \
681 paths.h \
682 pty.h \
683 readpassphrase.h \
684 rpc/types.h \
685 security/pam_appl.h \
686 shadow.h \
687 stddef.h \
688 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000689 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000690 strings.h \
691 sys/audit.h \
692 sys/bitypes.h \
693 sys/bsdtty.h \
694 sys/cdefs.h \
695 sys/dir.h \
696 sys/mman.h \
697 sys/ndir.h \
698 sys/prctl.h \
699 sys/pstat.h \
700 sys/select.h \
701 sys/stat.h \
702 sys/stream.h \
703 sys/stropts.h \
704 sys/strtio.h \
705 sys/sysmacros.h \
706 sys/time.h \
707 sys/timers.h \
708 sys/un.h \
709 time.h \
710 tmpdir.h \
711 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000712 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000713 usersec.h \
714 util.h \
715 utime.h \
716 utmp.h \
717 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000718 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000719)
Tim Rice4cec93f2002-02-26 08:40:48 -0800720
Darren Tucker48d99d32004-08-29 17:04:50 +1000721# sys/ptms.h requires sys/stream.h to be included first on Solaris
722AC_CHECK_HEADERS(sys/ptms.h, [], [], [
723#ifdef HAVE_SYS_STREAM_H
724# include <sys/stream.h>
725#endif
726])
727
Damien Millera22ba012000-03-02 23:09:20 +1100728# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700729AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
730AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000731
Tim Rice1e1ef642003-09-11 22:19:31 -0700732dnl IRIX and Solaris 2.5.1 have dirname() in libgen
733AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
734 AC_CHECK_LIB(gen, dirname,[
735 AC_CACHE_CHECK([for broken dirname],
736 ac_cv_have_broken_dirname, [
737 save_LIBS="$LIBS"
738 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000739 AC_RUN_IFELSE(
740 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700741#include <libgen.h>
742#include <string.h>
743
744int main(int argc, char **argv) {
745 char *s, buf[32];
746
747 strncpy(buf,"/etc", 32);
748 s = dirname(buf);
749 if (!s || strncmp(s, "/", 32) != 0) {
750 exit(1);
751 } else {
752 exit(0);
753 }
754}
Darren Tucker314d89e2005-10-17 23:29:23 +1000755 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700756 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000757 [ ac_cv_have_broken_dirname="yes" ],
758 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700759 )
760 LIBS="$save_LIBS"
761 ])
762 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
763 LIBS="$LIBS -lgen"
764 AC_DEFINE(HAVE_DIRNAME)
765 AC_CHECK_HEADERS(libgen.h)
766 fi
767 ])
768])
769
770AC_CHECK_FUNC(getspnam, ,
771 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700772AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
773 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700774
Tim Rice13aae5e2001-10-21 17:53:58 -0700775dnl zlib is required
776AC_ARG_WITH(zlib,
777 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100778 [ if test "x$withval" = "xno" ; then
779 AC_MSG_ERROR([*** zlib is required ***])
780 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700781 if test -d "$withval/lib"; then
782 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700783 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700784 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700785 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700786 fi
787 else
788 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700789 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700790 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700791 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700792 fi
793 fi
794 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700795 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700796 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700797 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700798 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100799 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700800)
801
Tim Ricefcb62202004-01-23 18:35:16 -0800802AC_CHECK_LIB(z, deflate, ,
803 [
804 saved_CPPFLAGS="$CPPFLAGS"
805 saved_LDFLAGS="$LDFLAGS"
806 save_LIBS="$LIBS"
807 dnl Check default zlib install dir
808 if test -n "${need_dash_r}"; then
809 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
810 else
811 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
812 fi
813 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
814 LIBS="$LIBS -lz"
815 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
816 [
817 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
818 ]
819 )
820 ]
821)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100822AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100823
824AC_ARG_WITH(zlib-version-check,
825 [ --without-zlib-version-check Disable zlib version check],
826 [ if test "x$withval" = "xno" ; then
827 zlib_check_nonfatal=1
828 fi
829 ]
830)
831
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000832AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000833AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000834#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100835#include <zlib.h>
836int main()
837{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000838 int a=0, b=0, c=0, d=0, n, v;
839 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
840 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100841 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000842 v = a*1000000 + b*10000 + c*100 + d;
843 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
844
845 /* 1.1.4 is OK */
846 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100847 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000848
Darren Tucker41097ed2005-07-25 15:24:21 +1000849 /* 1.2.3 and up are OK */
850 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000851 exit(0);
852
Darren Tucker2dcd2392004-01-23 17:13:33 +1100853 exit(2);
854}
Darren Tucker623d92f2004-09-12 22:36:15 +1000855 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000856 AC_MSG_RESULT(no),
857 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100858 if test -z "$zlib_check_nonfatal" ; then
859 AC_MSG_ERROR([*** zlib too old - check config.log ***
860Your reported zlib version has known security problems. It's possible your
861vendor has fixed these problems without changing the version number. If you
862are sure this is the case, you can disable the check by running
863"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000864If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000865See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100866 else
867 AC_MSG_WARN([zlib version may have security problems])
868 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000869 ],
870 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100871)
Damien Miller6f9c3372000-10-25 10:06:04 +1100872
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000873dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100874AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000875 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
876)
Darren Tucker5bfe1682005-11-12 18:42:36 +1100877AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700878 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
879 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000880)
Damien Millerab18c411999-11-11 10:40:23 +1100881
Tim Ricee589a292001-11-03 11:09:32 -0800882dnl Checks for libutil functions
883AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700884AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
885 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800886AC_CHECK_FUNCS(logout updwtmp logwtmp)
887
Ben Lindstrom8697e082001-02-24 21:41:10 +0000888AC_FUNC_STRFTIME
889
Damien Miller3c027682001-03-14 11:39:45 +1100890# Check for ALTDIRFUNC glob() extension
891AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
892AC_EGREP_CPP(FOUNDIT,
893 [
894 #include <glob.h>
895 #ifdef GLOB_ALTDIRFUNC
896 FOUNDIT
897 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100898 ],
Damien Miller3c027682001-03-14 11:39:45 +1100899 [
Tim Rice7df8d392005-09-19 09:33:39 -0700900 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
901 [Define if your system glob() function has
902 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100903 AC_MSG_RESULT(yes)
904 ],
905 [
906 AC_MSG_RESULT(no)
907 ]
908)
Damien Millerab18c411999-11-11 10:40:23 +1100909
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000910# Check for g.gl_matchc glob() extension
911AC_MSG_CHECKING(for gl_matchc field in glob_t)
912AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100913 [
914 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000915 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100916 ],
917 [
Tim Rice7df8d392005-09-19 09:33:39 -0700918 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
919 [Define if your system glob() function has
920 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100921 AC_MSG_RESULT(yes)
922 ],
923 [
924 AC_MSG_RESULT(no)
925 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000926)
927
Damien Miller18bb4732001-03-28 14:35:30 +1000928AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000929AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000930 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000931#include <sys/types.h>
932#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700933int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000934 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100935 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000936 [
937 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700938 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +1100939 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -0700940 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000941 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800942 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000943 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
944 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000945 ]
946)
947
Damien Miller36f49652004-08-15 18:40:59 +1000948AC_MSG_CHECKING([for /proc/pid/fd directory])
949if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700950 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000951 AC_MSG_RESULT(yes)
952else
953 AC_MSG_RESULT(no)
954fi
955
Damien Millerc547bf12001-02-16 10:18:12 +1100956# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100957SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100958AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100959 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100960 [
961 if test "x$withval" != "xno" ; then
962
963 if test "x$withval" != "xyes" ; then
964 CPPFLAGS="$CPPFLAGS -I${withval}/include"
965 LDFLAGS="$LDFLAGS -L${withval}/lib"
966 fi
967
Tim Rice7df8d392005-09-19 09:33:39 -0700968 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +1100969 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100970 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800971
Tim Rice4cec93f2002-02-26 08:40:48 -0800972 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +1000973 AC_LINK_IFELSE(
974 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -0800975#include <stdio.h>
976#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700977int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +1000978 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -0800979 [AC_MSG_RESULT(yes)],
980 [
981 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100982 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
983 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000984 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
985 AC_TRY_COMPILE(
986 [#include <stdio.h>
987 #include <skey.h>],
988 [(void)skeychallenge(NULL,"name","",0);],
989 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700990 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
991 [Define if your skeychallenge()
992 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +1000993 [AC_MSG_RESULT(no)]
994 )
Damien Millerc547bf12001-02-16 10:18:12 +1100995 fi
996 ]
997)
998
999# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001000TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001001AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001002 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001003 [
1004 if test "x$withval" != "xno" ; then
1005 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001006 saved_LDFLAGS="$LDFLAGS"
1007 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001008 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001009 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001010 if test -d "${withval}/lib"; then
1011 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001012 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001013 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001014 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001015 fi
1016 else
1017 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001018 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001019 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001020 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001021 fi
1022 fi
1023 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001024 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001025 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001026 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001027 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001028 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001029 LIBWRAP="-lwrap"
1030 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001031 AC_MSG_CHECKING(for libwrap)
1032 AC_TRY_LINK(
1033 [
Damien Miller0ac45002004-04-14 20:14:26 +10001034#include <sys/types.h>
1035#include <sys/socket.h>
1036#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001037#include <tcpd.h>
1038 int deny_severity = 0, allow_severity = 0;
1039 ],
1040 [hosts_access(0);],
1041 [
1042 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001043 AC_DEFINE(LIBWRAP, 1,
1044 [Define if you want
1045 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001046 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001047 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001048 ],
1049 [
1050 AC_MSG_ERROR([*** libwrap missing])
1051 ]
1052 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001053 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001054 fi
1055 ]
1056)
1057
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001058# Check whether user wants libedit support
1059LIBEDIT_MSG="no"
1060AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001061 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001062 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001063 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001064 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1065 if test -n "${need_dash_r}"; then
1066 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1067 else
1068 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1069 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001070 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001071 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001072 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001073 LIBEDIT="-ledit -lcurses"
1074 LIBEDIT_MSG="yes"
1075 AC_SUBST(LIBEDIT)
1076 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001077 [ AC_MSG_ERROR(libedit not found) ],
1078 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001079 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001080 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001081 AC_COMPILE_IFELSE(
1082 [AC_LANG_SOURCE([[
1083#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001084int main(void)
1085{
1086 int i = H_SETSIZE;
1087 el_init("", NULL, NULL, NULL);
1088 exit(0);
1089}
Tim Ricec1819c82005-08-15 17:48:40 -07001090 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001091 [ AC_MSG_RESULT(yes) ],
1092 [ AC_MSG_RESULT(no)
1093 AC_MSG_ERROR(libedit version is not compatible) ]
1094 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001095 fi ]
1096)
1097
Darren Tuckerd9f88912005-02-20 21:01:48 +11001098AUDIT_MODULE=none
1099AC_ARG_WITH(audit,
1100 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1101 [
1102 AC_MSG_CHECKING(for supported audit module)
1103 case "$withval" in
1104 bsm)
1105 AC_MSG_RESULT(bsm)
1106 AUDIT_MODULE=bsm
1107 dnl Checks for headers, libs and functions
1108 AC_CHECK_HEADERS(bsm/audit.h, [],
1109 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1110 AC_CHECK_LIB(bsm, getaudit, [],
1111 [AC_MSG_ERROR(BSM enabled and required library not found)])
1112 AC_CHECK_FUNCS(getaudit, [],
1113 [AC_MSG_ERROR(BSM enabled and required function not found)])
1114 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001115 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001116 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001117 ;;
1118 debug)
1119 AUDIT_MODULE=debug
1120 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001121 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001122 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001123 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001124 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001125 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001126 *)
1127 AC_MSG_ERROR([Unknown audit module $withval])
1128 ;;
1129 esac ]
1130)
1131
Damien Millerfe1f1432003-02-24 15:45:42 +11001132dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001133AC_CHECK_FUNCS( \
1134 arc4random \
Damien Miller57f39152005-11-24 19:58:19 +11001135 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001136 b64_ntop \
1137 __b64_ntop \
1138 b64_pton \
1139 __b64_pton \
1140 bcopy \
1141 bindresvport_sa \
1142 clock \
1143 closefrom \
1144 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001145 fchmod \
1146 fchown \
1147 freeaddrinfo \
1148 futimes \
1149 getaddrinfo \
1150 getcwd \
1151 getgrouplist \
1152 getnameinfo \
1153 getopt \
1154 getpeereid \
1155 _getpty \
1156 getrlimit \
1157 getttyent \
1158 glob \
1159 inet_aton \
1160 inet_ntoa \
1161 inet_ntop \
1162 innetgr \
1163 login_getcapbool \
1164 md5_crypt \
1165 memmove \
1166 mkdtemp \
1167 mmap \
1168 ngetaddrinfo \
1169 nsleep \
1170 ogetaddrinfo \
1171 openlog_r \
1172 openpty \
1173 prctl \
1174 pstat \
1175 readpassphrase \
1176 realpath \
1177 recvmsg \
1178 rresvport_af \
1179 sendmsg \
1180 setdtablesize \
1181 setegid \
1182 setenv \
1183 seteuid \
1184 setgroups \
1185 setlogin \
1186 setpcred \
1187 setproctitle \
1188 setregid \
1189 setreuid \
1190 setrlimit \
1191 setsid \
1192 setvbuf \
1193 sigaction \
1194 sigvec \
1195 snprintf \
1196 socketpair \
1197 strdup \
1198 strerror \
1199 strlcat \
1200 strlcpy \
1201 strmode \
1202 strnvis \
1203 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001204 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001205 strtoul \
1206 sysconf \
1207 tcgetpgrp \
1208 truncate \
1209 unsetenv \
1210 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001211 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001212 vhangup \
1213 vsnprintf \
1214 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001215)
Tim Rice13aae5e2001-10-21 17:53:58 -07001216
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001217# IRIX has a const char return value for gai_strerror()
1218AC_CHECK_FUNCS(gai_strerror,[
1219 AC_DEFINE(HAVE_GAI_STRERROR)
1220 AC_TRY_COMPILE([
1221#include <sys/types.h>
1222#include <sys/socket.h>
1223#include <netdb.h>
1224
1225const char *gai_strerror(int);],[
1226char *str;
1227
1228str = gai_strerror(0);],[
1229 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1230 [Define if gai_strerror() returns const char *])])])
1231
Tim Rice7df8d392005-09-19 09:33:39 -07001232AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1233 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001234
Darren Tuckerf1159b52003-07-07 19:44:01 +10001235dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001236AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001237AC_CHECK_DECL(strsep,
1238 [AC_CHECK_FUNCS(strsep)],
1239 [],
1240 [
1241#ifdef HAVE_STRING_H
1242# include <string.h>
1243#endif
1244 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001245
Darren Tuckerb2427c82003-09-10 15:22:44 +10001246dnl tcsendbreak might be a macro
1247AC_CHECK_DECL(tcsendbreak,
1248 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001249 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001250 [#include <termios.h>]
1251)
1252
Darren Tucker5bb14002004-04-23 18:53:10 +10001253AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1254
Darren Tucker2a6b0292003-12-31 14:59:17 +11001255AC_CHECK_FUNCS(setresuid, [
1256 dnl Some platorms have setresuid that isn't implemented, test for this
1257 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001258 AC_RUN_IFELSE(
1259 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001260#include <stdlib.h>
1261#include <errno.h>
1262int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001263 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001264 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001265 [AC_DEFINE(BROKEN_SETRESUID, 1,
1266 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001267 AC_MSG_RESULT(not implemented)],
1268 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001269 )
1270])
Darren Tuckere937be32003-12-17 18:53:26 +11001271
Darren Tucker2a6b0292003-12-31 14:59:17 +11001272AC_CHECK_FUNCS(setresgid, [
1273 dnl Some platorms have setresgid that isn't implemented, test for this
1274 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001275 AC_RUN_IFELSE(
1276 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001277#include <stdlib.h>
1278#include <errno.h>
1279int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001280 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001281 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001282 [AC_DEFINE(BROKEN_SETRESGID, 1,
1283 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001284 AC_MSG_RESULT(not implemented)],
1285 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001286 )
1287])
Darren Tuckere937be32003-12-17 18:53:26 +11001288
Damien Millerad833b32000-08-23 10:46:23 +10001289dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001290AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001291dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001292AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001293AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001294dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001295AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001296AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001297
Damien Millera8e06ce2003-11-21 23:48:55 +11001298AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001299 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1300 [AC_CHECK_LIB(bsd, daemon,
1301 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001302)
1303
Damien Millera8e06ce2003-11-21 23:48:55 +11001304AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001305 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1306 [Define if your libraries define getpagesize()])],
1307 [AC_CHECK_LIB(ucb, getpagesize,
1308 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001309)
1310
Damien Millercb170cb2000-07-01 16:52:55 +10001311# Check for broken snprintf
1312if test "x$ac_cv_func_snprintf" = "xyes" ; then
1313 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001314 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001315 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001316#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001317int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001318 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001319 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001320 [
1321 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001322 AC_DEFINE(BROKEN_SNPRINTF, 1,
1323 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001324 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001325 ],
1326 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001327 )
1328fi
1329
Damien Miller57f39152005-11-24 19:58:19 +11001330# If we don't have a working asprintf, then we strongly depend on vsnprintf
1331# returning the right thing on overflow: the number of characters it tried to
1332# create (as per SUSv3)
1333if test "x$ac_cv_func_asprintf" != "xyes" && \
1334 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1335 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1336 AC_RUN_IFELSE(
1337 [AC_LANG_SOURCE([[
1338#include <sys/types.h>
1339#include <stdio.h>
1340#include <stdarg.h>
1341
1342int x_snprintf(char *str,size_t count,const char *fmt,...)
1343{
1344 size_t ret; va_list ap;
1345 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1346 return ret;
1347}
1348int main(void)
1349{
1350 char x[1];
1351 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1352} ]])],
1353 [AC_MSG_RESULT(yes)],
1354 [
1355 AC_MSG_RESULT(no)
1356 AC_DEFINE(BROKEN_SNPRINTF, 1,
1357 [Define if your snprintf is busted])
1358 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1359 ],
1360 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1361 )
1362fi
1363
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001364# On systems where [v]snprintf is broken, but is declared in stdio,
1365# check that the fmt argument is const char * or just char *.
1366# This is only useful for when BROKEN_SNPRINTF
1367AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1368AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1369 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1370 int main(void) { snprintf(0, 0, 0); }
1371 ]])],
1372 [AC_MSG_RESULT(yes)
1373 AC_DEFINE(SNPRINTF_CONST, [const],
1374 [Define as const if snprintf() can declare const char *fmt])],
1375 [AC_MSG_RESULT(no)
1376 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1377
Damien Millerb4097182004-05-23 14:09:40 +10001378# Check for missing getpeereid (or equiv) support
1379NO_PEERCHECK=""
1380if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1381 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1382 AC_TRY_COMPILE(
1383 [#include <sys/types.h>
1384 #include <sys/socket.h>],
1385 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001386 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001387 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001388 ],
Damien Millerb4097182004-05-23 14:09:40 +10001389 [AC_MSG_RESULT(no)
1390 NO_PEERCHECK=1]
1391 )
1392fi
1393
Damien Millere8328192003-01-07 15:18:32 +11001394dnl see whether mkstemp() requires XXXXXX
1395if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1396AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001397AC_RUN_IFELSE(
1398 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001399#include <stdlib.h>
1400main() { char template[]="conftest.mkstemp-test";
1401if (mkstemp(template) == -1)
1402 exit(1);
1403unlink(template); exit(0);
1404}
Darren Tucker314d89e2005-10-17 23:29:23 +10001405 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001406 [
1407 AC_MSG_RESULT(no)
1408 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001409 [
Damien Millere8328192003-01-07 15:18:32 +11001410 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001411 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001412 ],
1413 [
1414 AC_MSG_RESULT(yes)
1415 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001416 ]
Damien Millere8328192003-01-07 15:18:32 +11001417)
1418fi
1419
Darren Tucker70a3d552003-08-21 17:58:29 +10001420dnl make sure that openpty does not reacquire controlling terminal
1421if test ! -z "$check_for_openpty_ctty_bug"; then
1422 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001423 AC_RUN_IFELSE(
1424 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001425#include <stdio.h>
1426#include <sys/fcntl.h>
1427#include <sys/types.h>
1428#include <sys/wait.h>
1429
1430int
1431main()
1432{
1433 pid_t pid;
1434 int fd, ptyfd, ttyfd, status;
1435
1436 pid = fork();
1437 if (pid < 0) { /* failed */
1438 exit(1);
1439 } else if (pid > 0) { /* parent */
1440 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001441 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001442 exit(WEXITSTATUS(status));
1443 else
1444 exit(2);
1445 } else { /* child */
1446 close(0); close(1); close(2);
1447 setsid();
1448 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1449 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1450 if (fd >= 0)
1451 exit(3); /* Acquired ctty: broken */
1452 else
1453 exit(0); /* Did not acquire ctty: OK */
1454 }
1455}
Darren Tucker314d89e2005-10-17 23:29:23 +10001456 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001457 [
1458 AC_MSG_RESULT(yes)
1459 ],
1460 [
1461 AC_MSG_RESULT(no)
1462 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001463 ],
1464 [
1465 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001466 ]
1467 )
1468fi
1469
Tim Rice8bb561b2005-03-17 16:23:19 -08001470if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1471 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001472 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001473 AC_RUN_IFELSE(
1474 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001475#include <stdio.h>
1476#include <sys/socket.h>
1477#include <netdb.h>
1478#include <errno.h>
1479#include <netinet/in.h>
1480
1481#define TEST_PORT "2222"
1482
1483int
1484main(void)
1485{
1486 int err, sock;
1487 struct addrinfo *gai_ai, *ai, hints;
1488 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1489
1490 memset(&hints, 0, sizeof(hints));
1491 hints.ai_family = PF_UNSPEC;
1492 hints.ai_socktype = SOCK_STREAM;
1493 hints.ai_flags = AI_PASSIVE;
1494
1495 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1496 if (err != 0) {
1497 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1498 exit(1);
1499 }
1500
1501 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1502 if (ai->ai_family != AF_INET6)
1503 continue;
1504
1505 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1506 sizeof(ntop), strport, sizeof(strport),
1507 NI_NUMERICHOST|NI_NUMERICSERV);
1508
1509 if (err != 0) {
1510 if (err == EAI_SYSTEM)
1511 perror("getnameinfo EAI_SYSTEM");
1512 else
1513 fprintf(stderr, "getnameinfo failed: %s\n",
1514 gai_strerror(err));
1515 exit(2);
1516 }
1517
1518 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1519 if (sock < 0)
1520 perror("socket");
1521 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1522 if (errno == EBADF)
1523 exit(3);
1524 }
1525 }
1526 exit(0);
1527}
Darren Tucker314d89e2005-10-17 23:29:23 +10001528 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001529 [
1530 AC_MSG_RESULT(yes)
1531 ],
1532 [
1533 AC_MSG_RESULT(no)
1534 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001535 ],
1536 [
1537 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001538 ]
1539 )
1540fi
1541
Tim Rice8bb561b2005-03-17 16:23:19 -08001542if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1543 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001544 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001545 AC_RUN_IFELSE(
1546 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001547#include <stdio.h>
1548#include <sys/socket.h>
1549#include <netdb.h>
1550#include <errno.h>
1551#include <netinet/in.h>
1552
1553#define TEST_PORT "2222"
1554
1555int
1556main(void)
1557{
1558 int err, sock;
1559 struct addrinfo *gai_ai, *ai, hints;
1560 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1561
1562 memset(&hints, 0, sizeof(hints));
1563 hints.ai_family = PF_UNSPEC;
1564 hints.ai_socktype = SOCK_STREAM;
1565 hints.ai_flags = AI_PASSIVE;
1566
1567 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1568 if (err != 0) {
1569 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1570 exit(1);
1571 }
1572
1573 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1574 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1575 continue;
1576
1577 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1578 sizeof(ntop), strport, sizeof(strport),
1579 NI_NUMERICHOST|NI_NUMERICSERV);
1580
1581 if (ai->ai_family == AF_INET && err != 0) {
1582 perror("getnameinfo");
1583 exit(2);
1584 }
1585 }
1586 exit(0);
1587}
Darren Tucker314d89e2005-10-17 23:29:23 +10001588 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001589 [
1590 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001591 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1592 [Define if you have a getaddrinfo that fails
1593 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001594 ],
1595 [
1596 AC_MSG_RESULT(no)
1597 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001598 ],
1599 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001600 ]
1601 )
1602fi
1603
Darren Tuckera56f1912004-11-02 20:30:54 +11001604if test "x$check_for_conflicting_getspnam" = "x1"; then
1605 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1606 AC_COMPILE_IFELSE(
1607 [
1608#include <shadow.h>
1609int main(void) {exit(0);}
1610 ],
1611 [
1612 AC_MSG_RESULT(no)
1613 ],
1614 [
1615 AC_MSG_RESULT(yes)
1616 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1617 [Conflicting defs for getspnam])
1618 ]
1619 )
1620fi
1621
Damien Miller606f8802000-09-16 15:39:56 +11001622AC_FUNC_GETPGRP
1623
Damien Millera64b57a2001-01-17 10:44:13 +11001624# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001625PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001626AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001627 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001628 [
Damien Millera64b57a2001-01-17 10:44:13 +11001629 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001630 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1631 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001632 AC_MSG_ERROR([PAM headers not found])
1633 fi
1634
1635 AC_CHECK_LIB(dl, dlopen, , )
1636 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1637 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001638 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001639
Damien Millera64b57a2001-01-17 10:44:13 +11001640 PAM_MSG="yes"
1641
Tim Rice7df8d392005-09-19 09:33:39 -07001642 AC_DEFINE(USE_PAM, 1,
1643 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001644 if test $ac_cv_lib_dl_dlopen = yes; then
1645 LIBPAM="-lpam -ldl"
1646 else
1647 LIBPAM="-lpam"
1648 fi
1649 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001650 fi
1651 ]
1652)
Damien Millera22ba012000-03-02 23:09:20 +11001653
Damien Millera64b57a2001-01-17 10:44:13 +11001654# Check for older PAM
1655if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001656 # Check PAM strerror arguments (old PAM)
1657 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1658 AC_TRY_COMPILE(
1659 [
Damien Miller81171112000-04-23 11:14:01 +10001660#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001661#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001662#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001663#elif defined (HAVE_PAM_PAM_APPL_H)
1664#include <pam/pam_appl.h>
1665#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001666 ],
1667 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001668 [AC_MSG_RESULT(no)],
1669 [
Tim Rice7df8d392005-09-19 09:33:39 -07001670 AC_DEFINE(HAVE_OLD_PAM, 1,
1671 [Define if you have an old version of PAM
1672 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001673 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001674 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001675 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001676 )
Damien Millera22ba012000-03-02 23:09:20 +11001677fi
1678
Tim Riceaef73712002-05-11 13:17:42 -07001679# Search for OpenSSL
1680saved_CPPFLAGS="$CPPFLAGS"
1681saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001682AC_ARG_WITH(ssl-dir,
1683 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1684 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001685 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001686 case "$withval" in
1687 # Relative paths
1688 ./*|../*) withval="`pwd`/$withval"
1689 esac
Tim Riceaef73712002-05-11 13:17:42 -07001690 if test -d "$withval/lib"; then
1691 if test -n "${need_dash_r}"; then
1692 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1693 else
1694 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1695 fi
1696 else
1697 if test -n "${need_dash_r}"; then
1698 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1699 else
1700 LDFLAGS="-L${withval} ${LDFLAGS}"
1701 fi
1702 fi
1703 if test -d "$withval/include"; then
1704 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1705 else
1706 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1707 fi
Damien Millera22ba012000-03-02 23:09:20 +11001708 fi
1709 ]
1710)
Tim Rice3d5352e2004-02-12 09:27:21 -08001711LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001712AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1713 [Define if your ssl headers are included
1714 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001715 [
Tim Riceaef73712002-05-11 13:17:42 -07001716 dnl Check default openssl install dir
1717 if test -n "${need_dash_r}"; then
1718 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001719 else
Tim Riceaef73712002-05-11 13:17:42 -07001720 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001721 fi
Tim Riceaef73712002-05-11 13:17:42 -07001722 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1723 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1724 [
1725 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1726 ]
1727 )
1728 ]
1729)
1730
Tim Riced730b782002-08-13 18:52:10 -07001731# Determine OpenSSL header version
1732AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001733AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001734 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001735#include <stdio.h>
1736#include <string.h>
1737#include <openssl/opensslv.h>
1738#define DATA "conftest.sslincver"
1739int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001740 FILE *fd;
1741 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001742
Damien Millera8e06ce2003-11-21 23:48:55 +11001743 fd = fopen(DATA,"w");
1744 if(fd == NULL)
1745 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001746
1747 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1748 exit(1);
1749
1750 exit(0);
1751}
Darren Tucker623d92f2004-09-12 22:36:15 +10001752 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001753 [
1754 ssl_header_ver=`cat conftest.sslincver`
1755 AC_MSG_RESULT($ssl_header_ver)
1756 ],
1757 [
1758 AC_MSG_RESULT(not found)
1759 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001760 ],
1761 [
1762 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001763 ]
1764)
1765
1766# Determine OpenSSL library version
1767AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001768AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001769 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001770#include <stdio.h>
1771#include <string.h>
1772#include <openssl/opensslv.h>
1773#include <openssl/crypto.h>
1774#define DATA "conftest.ssllibver"
1775int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001776 FILE *fd;
1777 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001778
Damien Millera8e06ce2003-11-21 23:48:55 +11001779 fd = fopen(DATA,"w");
1780 if(fd == NULL)
1781 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001782
1783 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1784 exit(1);
1785
1786 exit(0);
1787}
Darren Tucker623d92f2004-09-12 22:36:15 +10001788 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001789 [
1790 ssl_library_ver=`cat conftest.ssllibver`
1791 AC_MSG_RESULT($ssl_library_ver)
1792 ],
1793 [
1794 AC_MSG_RESULT(not found)
1795 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001796 ],
1797 [
1798 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001799 ]
1800)
Damien Millera22ba012000-03-02 23:09:20 +11001801
Damien Millerec932372002-01-22 22:16:03 +11001802# Sanity check OpenSSL headers
1803AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001804AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001805 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001806#include <string.h>
1807#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001808int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001809 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001810 [
1811 AC_MSG_RESULT(yes)
1812 ],
1813 [
1814 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001815 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1816Check config.log for details.
1817Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001818 ],
1819 [
1820 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001821 ]
1822)
1823
Darren Tucker129d0bb2005-12-19 17:40:40 +11001824# Check for OpenSSL without EVP_aes_{192,256}_cbc
1825AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
1826AC_COMPILE_IFELSE(
1827 [AC_LANG_SOURCE([[
1828#include <string.h>
1829#include <openssl/evp.h>
1830int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL)}
1831 ]])],
1832 [
1833 AC_MSG_RESULT(no)
1834 ],
1835 [
1836 AC_MSG_RESULT(yes)
1837 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
1838 [libcrypto is missing AES 192 and 256 bit functions])
1839 ]
1840)
1841
Tim Rice3d5352e2004-02-12 09:27:21 -08001842# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1843# because the system crypt() is more featureful.
1844if test "x$check_for_libcrypt_before" = "x1"; then
1845 AC_CHECK_LIB(crypt, crypt)
1846fi
1847
Damien Millera8e06ce2003-11-21 23:48:55 +11001848# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001849# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001850if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001851 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001852fi
1853
Tim Rice2291c002005-08-26 13:15:19 -07001854AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001855
1856### Configure cryptographic random number support
1857
1858# Check wheter OpenSSL seeds itself
1859AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001860AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001861 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001862#include <string.h>
1863#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001864int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001865 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001866 [
1867 OPENSSL_SEEDS_ITSELF=yes
1868 AC_MSG_RESULT(yes)
1869 ],
1870 [
1871 AC_MSG_RESULT(no)
1872 # Default to use of the rand helper if OpenSSL doesn't
1873 # seed itself
1874 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001875 ],
1876 [
1877 AC_MSG_WARN([cross compiling: assuming yes])
1878 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001879 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001880 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001881 ]
1882)
1883
1884
1885# Do we want to force the use of the rand helper?
1886AC_ARG_WITH(rand-helper,
1887 [ --with-rand-helper Use subprocess to gather strong randomness ],
1888 [
1889 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001890 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001891 # the previous test showed it to be unseeded.
1892 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1893 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1894 OPENSSL_SEEDS_ITSELF=yes
1895 USE_RAND_HELPER=""
1896 fi
1897 else
1898 USE_RAND_HELPER=yes
1899 fi
1900 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001901)
Damien Miller6c21c512002-01-22 21:57:53 +11001902
1903# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001904if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001905 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001906 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1907 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001908 RAND_MSG="OpenSSL internal ONLY"
1909 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001910elif test ! -z "$USE_RAND_HELPER" ; then
1911 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001912 RAND_MSG="ssh-rand-helper"
1913 INSTALL_SSH_RAND_HELPER="yes"
1914fi
1915AC_SUBST(INSTALL_SSH_RAND_HELPER)
1916
1917### Configuration of ssh-rand-helper
1918
1919# PRNGD TCP socket
1920AC_ARG_WITH(prngd-port,
1921 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1922 [
Damien Millere996d722002-01-23 11:20:59 +11001923 case "$withval" in
1924 no)
1925 withval=""
1926 ;;
1927 [[0-9]]*)
1928 ;;
1929 *)
1930 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1931 ;;
1932 esac
1933 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001934 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001935 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1936 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001937 fi
1938 ]
1939)
1940
1941# PRNGD Unix domain socket
1942AC_ARG_WITH(prngd-socket,
1943 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1944 [
Damien Millere996d722002-01-23 11:20:59 +11001945 case "$withval" in
1946 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001947 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001948 ;;
1949 no)
1950 withval=""
1951 ;;
1952 /*)
1953 ;;
1954 *)
1955 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1956 ;;
1957 esac
1958
1959 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001960 if test ! -z "$PRNGD_PORT" ; then
1961 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1962 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001963 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001964 AC_MSG_WARN(Entropy socket is not readable)
1965 fi
1966 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001967 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1968 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001969 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001970 ],
1971 [
1972 # Check for existing socket only if we don't have a random device already
1973 if test "$USE_RAND_HELPER" = yes ; then
1974 AC_MSG_CHECKING(for PRNGD/EGD socket)
1975 # Insert other locations here
1976 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1977 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1978 PRNGD_SOCKET="$sock"
1979 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1980 break;
1981 fi
1982 done
1983 if test ! -z "$PRNGD_SOCKET" ; then
1984 AC_MSG_RESULT($PRNGD_SOCKET)
1985 else
1986 AC_MSG_RESULT(not found)
1987 fi
1988 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001989 ]
1990)
1991
1992# Change default command timeout for hashing entropy source
1993entropy_timeout=200
1994AC_ARG_WITH(entropy-timeout,
1995 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1996 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001997 if test -n "$withval" && test "x$withval" != "xno" && \
1998 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001999 entropy_timeout=$withval
2000 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002001 ]
Damien Miller6c21c512002-01-22 21:57:53 +11002002)
Tim Rice7df8d392005-09-19 09:33:39 -07002003AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2004 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11002005
Damien Millerd3f6ad22002-06-25 10:24:47 +10002006SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00002007AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00002008 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002009 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002010 if test -n "$withval" && test "x$withval" != "xno" && \
2011 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002012 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002013 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002014 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002015)
Tim Rice7df8d392005-09-19 09:33:39 -07002016AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2017 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002018AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002019
Tim Rice88f2ab52002-03-17 12:17:34 -08002020# We do this little dance with the search path to insure
2021# that programs that we select for use by installed programs
2022# (which may be run by the super-user) come from trusted
2023# locations before they come from the user's private area.
2024# This should help avoid accidentally configuring some
2025# random version of a program in someone's personal bin.
2026
2027OPATH=$PATH
2028PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002029test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002030test -d /sbin && PATH=$PATH:/sbin
2031test -d /usr/sbin && PATH=$PATH:/usr/sbin
2032PATH=$PATH:/etc:$OPATH
2033
Damien Millera8e06ce2003-11-21 23:48:55 +11002034# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002035OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2036OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2037OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2038OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2039OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2040OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2041OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2042OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2043OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2044OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2045OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2046OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2047OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2048OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2049OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2050OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002051# restore PATH
2052PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002053
2054# Where does ssh-rand-helper get its randomness from?
2055INSTALL_SSH_PRNG_CMDS=""
2056if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2057 if test ! -z "$PRNGD_PORT" ; then
2058 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2059 elif test ! -z "$PRNGD_SOCKET" ; then
2060 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2061 else
2062 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2063 RAND_HELPER_CMDHASH=yes
2064 INSTALL_SSH_PRNG_CMDS="yes"
2065 fi
2066fi
2067AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2068
2069
Ben Lindstromb5628642000-10-18 00:02:25 +00002070# Cheap hack to ensure NEWS-OS libraries are arranged right.
2071if test ! -z "$SONY" ; then
2072 LIBS="$LIBS -liberty";
2073fi
2074
Damien Miller57f39152005-11-24 19:58:19 +11002075# Check for long long datatypes
2076AC_CHECK_TYPES([long long, unsigned long long, long double])
2077
2078# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002079AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002080AC_CHECK_SIZEOF(short int, 2)
2081AC_CHECK_SIZEOF(int, 4)
2082AC_CHECK_SIZEOF(long int, 4)
2083AC_CHECK_SIZEOF(long long int, 8)
2084
Damien Millerfa2bb692002-04-23 23:22:25 +10002085# Sanity check long long for some platforms (AIX)
2086if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2087 ac_cv_sizeof_long_long_int=0
2088fi
2089
Darren Tucker537f1ed2005-10-25 18:38:33 +10002090# compute LLONG_MIN and LLONG_MAX if we don't know them.
2091if test -z "$have_llong_max"; then
2092 AC_MSG_CHECKING([for max value of long long])
2093 AC_RUN_IFELSE(
2094 [AC_LANG_SOURCE([[
2095#include <stdio.h>
2096/* Why is this so damn hard? */
2097#ifdef __GNUC__
2098# undef __GNUC__
2099#endif
2100#define __USE_ISOC99
2101#include <limits.h>
2102#define DATA "conftest.llminmax"
2103int main(void) {
2104 FILE *f;
2105 long long i, llmin, llmax = 0;
2106
2107 if((f = fopen(DATA,"w")) == NULL)
2108 exit(1);
2109
2110#if defined(LLONG_MIN) && defined(LLONG_MAX)
2111 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2112 llmin = LLONG_MIN;
2113 llmax = LLONG_MAX;
2114#else
2115 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2116 /* This will work on one's complement and two's complement */
2117 for (i = 1; i > llmax; i <<= 1, i++)
2118 llmax = i;
2119 llmin = llmax + 1LL; /* wrap */
2120#endif
2121
2122 /* Sanity check */
2123 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2124 || llmax - 1 > llmax) {
2125 fprintf(f, "unknown unknown\n");
2126 exit(2);
2127 }
2128
2129 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2130 exit(3);
2131
2132 exit(0);
2133}
2134 ]])],
2135 [
2136 llong_min=`$AWK '{print $1}' conftest.llminmax`
2137 llong_max=`$AWK '{print $2}' conftest.llminmax`
2138
2139 # snprintf on some Tru64s doesn't understand "%lld"
2140 case "$host" in
2141 alpha-dec-osf*)
2142 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2143 test "x$llong_max" = "xld"; then
2144 llong_min="-9223372036854775808"
2145 llong_max="9223372036854775807"
2146 fi
2147 ;;
2148 esac
2149
2150 AC_MSG_RESULT($llong_max)
2151 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2152 [max value of long long calculated by configure])
2153 AC_MSG_CHECKING([for min value of long long])
2154 AC_MSG_RESULT($llong_min)
2155 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2156 [min value of long long calculated by configure])
2157 ],
2158 [
2159 AC_MSG_RESULT(not found)
2160 ],
2161 [
2162 AC_MSG_WARN([cross compiling: not checking])
2163 ]
2164 )
2165fi
2166
2167
Damien Millera22ba012000-03-02 23:09:20 +11002168# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002169AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2170 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002171 [ #include <sys/types.h> ],
2172 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002173 [ ac_cv_have_u_int="yes" ],
2174 [ ac_cv_have_u_int="no" ]
2175 )
2176])
2177if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002178 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002179 have_u_int=1
2180fi
2181
Damien Miller61e50f12000-05-08 20:49:37 +10002182AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2183 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002184 [ #include <sys/types.h> ],
2185 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002186 [ ac_cv_have_intxx_t="yes" ],
2187 [ ac_cv_have_intxx_t="no" ]
2188 )
2189])
2190if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002191 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002192 have_intxx_t=1
2193fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002194
2195if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002196 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002197then
2198 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2199 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002200 [ #include <stdint.h> ],
2201 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002202 [
2203 AC_DEFINE(HAVE_INTXX_T)
2204 AC_MSG_RESULT(yes)
2205 ],
2206 [ AC_MSG_RESULT(no) ]
2207 )
2208fi
2209
Damien Miller578783e2000-09-23 14:12:24 +11002210AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2211 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002212 [
2213#include <sys/types.h>
2214#ifdef HAVE_STDINT_H
2215# include <stdint.h>
2216#endif
2217#include <sys/socket.h>
2218#ifdef HAVE_SYS_BITYPES_H
2219# include <sys/bitypes.h>
2220#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002221 ],
2222 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002223 [ ac_cv_have_int64_t="yes" ],
2224 [ ac_cv_have_int64_t="no" ]
2225 )
2226])
2227if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002228 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002229fi
2230
Damien Miller61e50f12000-05-08 20:49:37 +10002231AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2232 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002233 [ #include <sys/types.h> ],
2234 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002235 [ ac_cv_have_u_intxx_t="yes" ],
2236 [ ac_cv_have_u_intxx_t="no" ]
2237 )
2238])
2239if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002240 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002241 have_u_intxx_t=1
2242fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002243
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002244if test -z "$have_u_intxx_t" ; then
2245 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2246 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002247 [ #include <sys/socket.h> ],
2248 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002249 [
2250 AC_DEFINE(HAVE_U_INTXX_T)
2251 AC_MSG_RESULT(yes)
2252 ],
2253 [ AC_MSG_RESULT(no) ]
2254 )
2255fi
2256
Damien Miller578783e2000-09-23 14:12:24 +11002257AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2258 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002259 [ #include <sys/types.h> ],
2260 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002261 [ ac_cv_have_u_int64_t="yes" ],
2262 [ ac_cv_have_u_int64_t="no" ]
2263 )
2264])
2265if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002266 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002267 have_u_int64_t=1
2268fi
2269
Tim Rice4cec93f2002-02-26 08:40:48 -08002270if test -z "$have_u_int64_t" ; then
2271 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2272 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002273 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002274 [ u_int64_t a; a = 1],
2275 [
2276 AC_DEFINE(HAVE_U_INT64_T)
2277 AC_MSG_RESULT(yes)
2278 ],
2279 [ AC_MSG_RESULT(no) ]
2280 )
2281fi
2282
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002283if test -z "$have_u_intxx_t" ; then
2284 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2285 AC_TRY_COMPILE(
2286 [
2287#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002288 ],
2289 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002290 [ ac_cv_have_uintxx_t="yes" ],
2291 [ ac_cv_have_uintxx_t="no" ]
2292 )
2293 ])
2294 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002295 AC_DEFINE(HAVE_UINTXX_T, 1,
2296 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002297 fi
2298fi
2299
2300if test -z "$have_uintxx_t" ; then
2301 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2302 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002303 [ #include <stdint.h> ],
2304 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002305 [
2306 AC_DEFINE(HAVE_UINTXX_T)
2307 AC_MSG_RESULT(yes)
2308 ],
2309 [ AC_MSG_RESULT(no) ]
2310 )
2311fi
2312
Damien Milleredb82922000-06-20 13:25:52 +10002313if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002314 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002315then
2316 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2317 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002318 [
2319#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002320 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002321 [
Damien Miller70494d12000-04-03 15:57:06 +10002322 int8_t a; int16_t b; int32_t c;
2323 u_int8_t e; u_int16_t f; u_int32_t g;
2324 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002325 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002326 [
2327 AC_DEFINE(HAVE_U_INTXX_T)
2328 AC_DEFINE(HAVE_INTXX_T)
2329 AC_MSG_RESULT(yes)
2330 ],
2331 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002332 )
Damien Millerb29ea912000-01-15 14:12:03 +11002333fi
2334
Damien Miller58be7382001-09-15 21:31:54 +10002335
2336AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2337 AC_TRY_COMPILE(
2338 [
2339#include <sys/types.h>
2340 ],
2341 [ u_char foo; foo = 125; ],
2342 [ ac_cv_have_u_char="yes" ],
2343 [ ac_cv_have_u_char="no" ]
2344 )
2345])
2346if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002347 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002348fi
2349
Tim Rice13aae5e2001-10-21 17:53:58 -07002350TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002351
Tim Rice200a5c02002-02-26 22:12:34 -08002352AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002353
Damien Miller848b9932005-02-24 12:12:34 +11002354AC_CHECK_TYPES(in_addr_t,,,
2355[#include <sys/types.h>
2356#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002357
Damien Miller61e50f12000-05-08 20:49:37 +10002358AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2359 AC_TRY_COMPILE(
2360 [
2361#include <sys/types.h>
2362 ],
2363 [ size_t foo; foo = 1235; ],
2364 [ ac_cv_have_size_t="yes" ],
2365 [ ac_cv_have_size_t="no" ]
2366 )
2367])
2368if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002369 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002370fi
Damien Miller95058511999-12-29 10:36:45 +11002371
Damien Miller615f9392000-05-17 22:53:33 +10002372AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2373 AC_TRY_COMPILE(
2374 [
2375#include <sys/types.h>
2376 ],
2377 [ ssize_t foo; foo = 1235; ],
2378 [ ac_cv_have_ssize_t="yes" ],
2379 [ ac_cv_have_ssize_t="no" ]
2380 )
2381])
2382if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002383 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002384fi
2385
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002386AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2387 AC_TRY_COMPILE(
2388 [
2389#include <time.h>
2390 ],
2391 [ clock_t foo; foo = 1235; ],
2392 [ ac_cv_have_clock_t="yes" ],
2393 [ ac_cv_have_clock_t="no" ]
2394 )
2395])
2396if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002397 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002398fi
2399
Damien Millerb54b40e2000-06-23 08:23:34 +10002400AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2401 AC_TRY_COMPILE(
2402 [
2403#include <sys/types.h>
2404#include <sys/socket.h>
2405 ],
2406 [ sa_family_t foo; foo = 1235; ],
2407 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002408 [ AC_TRY_COMPILE(
2409 [
2410#include <sys/types.h>
2411#include <sys/socket.h>
2412#include <netinet/in.h>
2413 ],
2414 [ sa_family_t foo; foo = 1235; ],
2415 [ ac_cv_have_sa_family_t="yes" ],
2416
Damien Millerb54b40e2000-06-23 08:23:34 +10002417 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002418 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002419 )
2420])
2421if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002422 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2423 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002424fi
2425
Damien Miller0f91b4e2000-06-18 15:43:25 +10002426AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2427 AC_TRY_COMPILE(
2428 [
2429#include <sys/types.h>
2430 ],
2431 [ pid_t foo; foo = 1235; ],
2432 [ ac_cv_have_pid_t="yes" ],
2433 [ ac_cv_have_pid_t="no" ]
2434 )
2435])
2436if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002437 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002438fi
2439
2440AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2441 AC_TRY_COMPILE(
2442 [
2443#include <sys/types.h>
2444 ],
2445 [ mode_t foo; foo = 1235; ],
2446 [ ac_cv_have_mode_t="yes" ],
2447 [ ac_cv_have_mode_t="no" ]
2448 )
2449])
2450if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002451 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002452fi
2453
Damien Miller61e50f12000-05-08 20:49:37 +10002454
2455AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2456 AC_TRY_COMPILE(
2457 [
Damien Miller81171112000-04-23 11:14:01 +10002458#include <sys/types.h>
2459#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002460 ],
2461 [ struct sockaddr_storage s; ],
2462 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2463 [ ac_cv_have_struct_sockaddr_storage="no" ]
2464 )
2465])
2466if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002467 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2468 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002469fi
Damien Miller34132e52000-01-14 15:45:46 +11002470
Damien Miller61e50f12000-05-08 20:49:37 +10002471AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2472 AC_TRY_COMPILE(
2473 [
Damien Miller7b22d652000-06-18 14:07:04 +10002474#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002475#include <netinet/in.h>
2476 ],
2477 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2478 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2479 [ ac_cv_have_struct_sockaddr_in6="no" ]
2480 )
2481])
2482if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002483 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2484 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002485fi
Damien Miller34132e52000-01-14 15:45:46 +11002486
Damien Miller61e50f12000-05-08 20:49:37 +10002487AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2488 AC_TRY_COMPILE(
2489 [
Damien Miller7b22d652000-06-18 14:07:04 +10002490#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002491#include <netinet/in.h>
2492 ],
2493 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2494 [ ac_cv_have_struct_in6_addr="yes" ],
2495 [ ac_cv_have_struct_in6_addr="no" ]
2496 )
2497])
2498if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002499 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2500 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002501fi
Damien Miller34132e52000-01-14 15:45:46 +11002502
Damien Miller61e50f12000-05-08 20:49:37 +10002503AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2504 AC_TRY_COMPILE(
2505 [
Damien Miller81171112000-04-23 11:14:01 +10002506#include <sys/types.h>
2507#include <sys/socket.h>
2508#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002509 ],
2510 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2511 [ ac_cv_have_struct_addrinfo="yes" ],
2512 [ ac_cv_have_struct_addrinfo="no" ]
2513 )
2514])
2515if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002516 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2517 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002518fi
2519
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002520AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2521 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002522 [ #include <sys/time.h> ],
2523 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002524 [ ac_cv_have_struct_timeval="yes" ],
2525 [ ac_cv_have_struct_timeval="no" ]
2526 )
2527])
2528if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002529 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002530 have_struct_timeval=1
2531fi
2532
Tim Rice4e4dc562003-03-18 10:21:40 -08002533AC_CHECK_TYPES(struct timespec)
2534
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002535# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002536if test "x$ac_cv_have_int64_t" = "xno" && \
2537 test "x$ac_cv_sizeof_long_int" != "x8" && \
2538 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002539 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2540 echo "an alternative compiler (I.E., GCC) before continuing."
2541 echo ""
2542 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002543else
2544dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002545 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002546 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002547#include <stdio.h>
2548#include <string.h>
2549#ifdef HAVE_SNPRINTF
2550main()
2551{
2552 char buf[50];
2553 char expected_out[50];
2554 int mazsize = 50 ;
2555#if (SIZEOF_LONG_INT == 8)
2556 long int num = 0x7fffffffffffffff;
2557#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002558 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002559#endif
2560 strcpy(expected_out, "9223372036854775807");
2561 snprintf(buf, mazsize, "%lld", num);
2562 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002563 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002564 exit(0);
2565}
2566#else
2567main() { exit(0); }
2568#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002569 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002570 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002571 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002572fi
2573
Damien Miller78315eb2000-09-29 23:01:36 +11002574dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002575OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2576OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2577OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2578OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2579OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002580OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002581OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2582OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002583OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002584OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2585OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2586OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2587OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002588OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2589OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2590OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2591OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002592
2593AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002594AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2595 [Define if we don't have struct __res_state in resolv.h])],
2596[
2597#include <stdio.h>
2598#if HAVE_SYS_TYPES_H
2599# include <sys/types.h>
2600#endif
2601#include <netinet/in.h>
2602#include <arpa/nameser.h>
2603#include <resolv.h>
2604])
andre2ff7b5d2000-06-03 14:57:40 +00002605
Damien Miller61e50f12000-05-08 20:49:37 +10002606AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2607 ac_cv_have_ss_family_in_struct_ss, [
2608 AC_TRY_COMPILE(
2609 [
Damien Miller81171112000-04-23 11:14:01 +10002610#include <sys/types.h>
2611#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002612 ],
2613 [ struct sockaddr_storage s; s.ss_family = 1; ],
2614 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2615 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2616 )
2617])
2618if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002619 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002620fi
2621
Damien Miller61e50f12000-05-08 20:49:37 +10002622AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2623 ac_cv_have___ss_family_in_struct_ss, [
2624 AC_TRY_COMPILE(
2625 [
Damien Miller81171112000-04-23 11:14:01 +10002626#include <sys/types.h>
2627#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002628 ],
2629 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2630 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2631 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2632 )
2633])
2634if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002635 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2636 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002637fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002638
Damien Millerad833b32000-08-23 10:46:23 +10002639AC_CACHE_CHECK([for pw_class field in struct passwd],
2640 ac_cv_have_pw_class_in_struct_passwd, [
2641 AC_TRY_COMPILE(
2642 [
Damien Millerad833b32000-08-23 10:46:23 +10002643#include <pwd.h>
2644 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002645 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002646 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2647 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2648 )
2649])
2650if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002651 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2652 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002653fi
2654
Kevin Steves82456952001-06-22 21:14:18 +00002655AC_CACHE_CHECK([for pw_expire field in struct passwd],
2656 ac_cv_have_pw_expire_in_struct_passwd, [
2657 AC_TRY_COMPILE(
2658 [
2659#include <pwd.h>
2660 ],
2661 [ struct passwd p; p.pw_expire = 0; ],
2662 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2663 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2664 )
2665])
2666if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002667 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2668 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002669fi
2670
2671AC_CACHE_CHECK([for pw_change field in struct passwd],
2672 ac_cv_have_pw_change_in_struct_passwd, [
2673 AC_TRY_COMPILE(
2674 [
2675#include <pwd.h>
2676 ],
2677 [ struct passwd p; p.pw_change = 0; ],
2678 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2679 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2680 )
2681])
2682if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002683 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2684 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002685fi
Damien Miller61e50f12000-05-08 20:49:37 +10002686
Tim Rice28bbb0c2002-05-27 17:37:32 -07002687dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002688AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2689 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002690 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002691 [
Tim Riceae49fe62002-04-12 10:26:21 -07002692#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002693#include <sys/socket.h>
2694#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002695int main() {
2696#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002697#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002698exit(1);
2699#endif
2700struct msghdr m;
2701m.msg_accrights = 0;
2702exit(0);
2703}
Kevin Steves939c9db2002-03-22 17:23:25 +00002704 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002705 [ ac_cv_have_accrights_in_msghdr="yes" ],
2706 [ ac_cv_have_accrights_in_msghdr="no" ]
2707 )
2708])
2709if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002710 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2711 [Define if your system uses access rights style
2712 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002713fi
2714
Kevin Stevesa44e0352002-04-07 16:18:03 +00002715AC_CACHE_CHECK([for msg_control field in struct msghdr],
2716 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002717 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002718 [
Tim Riceae49fe62002-04-12 10:26:21 -07002719#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002720#include <sys/socket.h>
2721#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002722int main() {
2723#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002724#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002725exit(1);
2726#endif
2727struct msghdr m;
2728m.msg_control = 0;
2729exit(0);
2730}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002731 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002732 [ ac_cv_have_control_in_msghdr="yes" ],
2733 [ ac_cv_have_control_in_msghdr="no" ]
2734 )
2735])
2736if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002737 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2738 [Define if your system uses ancillary data style
2739 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002740fi
2741
Damien Miller61e50f12000-05-08 20:49:37 +10002742AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002743 AC_TRY_LINK([],
2744 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002745 [ ac_cv_libc_defines___progname="yes" ],
2746 [ ac_cv_libc_defines___progname="no" ]
2747 )
2748])
2749if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002750 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002751fi
2752
Kevin Steves4846f4a2002-03-22 18:19:53 +00002753AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2754 AC_TRY_LINK([
2755#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002756],
2757 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002758 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2759 [ ac_cv_cc_implements___FUNCTION__="no" ]
2760 )
2761])
2762if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002763 AC_DEFINE(HAVE___FUNCTION__, 1,
2764 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002765fi
2766
2767AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2768 AC_TRY_LINK([
2769#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002770],
2771 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002772 [ ac_cv_cc_implements___func__="yes" ],
2773 [ ac_cv_cc_implements___func__="no" ]
2774 )
2775])
2776if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002777 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002778fi
2779
Damien Miller57f39152005-11-24 19:58:19 +11002780AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
2781 AC_TRY_LINK(
2782 [#include <stdarg.h>
2783 va_list x,y;],
2784 [va_copy(x,y);],
2785 [ ac_cv_have_va_copy="yes" ],
2786 [ ac_cv_have_va_copy="no" ]
2787 )
2788])
2789if test "x$ac_cv_have_va_copy" = "xyes" ; then
2790 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
2791fi
2792
2793AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
2794 AC_TRY_LINK(
2795 [#include <stdarg.h>
2796 va_list x,y;],
2797 [__va_copy(x,y);],
2798 [ ac_cv_have___va_copy="yes" ],
2799 [ ac_cv_have___va_copy="no" ]
2800 )
2801])
2802if test "x$ac_cv_have___va_copy" = "xyes" ; then
2803 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2804fi
2805
Damien Miller4f8e6692001-07-14 13:22:53 +10002806AC_CACHE_CHECK([whether getopt has optreset support],
2807 ac_cv_have_getopt_optreset, [
2808 AC_TRY_LINK(
2809 [
2810#include <getopt.h>
2811 ],
2812 [ extern int optreset; optreset = 0; ],
2813 [ ac_cv_have_getopt_optreset="yes" ],
2814 [ ac_cv_have_getopt_optreset="no" ]
2815 )
2816])
2817if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002818 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2819 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002820fi
Damien Millera22ba012000-03-02 23:09:20 +11002821
Damien Millerecbb26d2000-07-15 14:59:14 +10002822AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002823 AC_TRY_LINK([],
2824 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002825 [ ac_cv_libc_defines_sys_errlist="yes" ],
2826 [ ac_cv_libc_defines_sys_errlist="no" ]
2827 )
2828])
2829if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002830 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2831 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002832fi
2833
2834
Damien Miller11fa2cc2000-08-16 10:35:58 +10002835AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002836 AC_TRY_LINK([],
2837 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002838 [ ac_cv_libc_defines_sys_nerr="yes" ],
2839 [ ac_cv_libc_defines_sys_nerr="no" ]
2840 )
2841])
2842if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002843 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002844fi
2845
Damien Millera8e06ce2003-11-21 23:48:55 +11002846SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002847# Check whether user wants sectok support
2848AC_ARG_WITH(sectok,
2849 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002850 [
2851 if test "x$withval" != "xno" ; then
2852 if test "x$withval" != "xyes" ; then
2853 CPPFLAGS="$CPPFLAGS -I${withval}"
2854 LDFLAGS="$LDFLAGS -L${withval}"
2855 if test ! -z "$need_dash_r" ; then
2856 LDFLAGS="$LDFLAGS -R${withval}"
2857 fi
2858 if test ! -z "$blibpath" ; then
2859 blibpath="$blibpath:${withval}"
2860 fi
2861 fi
2862 AC_CHECK_HEADERS(sectok.h)
2863 if test "$ac_cv_header_sectok_h" != yes; then
2864 AC_MSG_ERROR(Can't find sectok.h)
2865 fi
2866 AC_CHECK_LIB(sectok, sectok_open)
2867 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2868 AC_MSG_ERROR(Can't find libsectok)
2869 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002870 AC_DEFINE(SMARTCARD, 1,
2871 [Define if you want smartcard support])
2872 AC_DEFINE(USE_SECTOK, 1,
2873 [Define if you want smartcard support
2874 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002875 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002876 fi
2877 ]
2878)
2879
2880# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002881OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002882AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10002883 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08002884 [
2885 if test "x$withval" != "xno" ; then
2886 if test "x$withval" != "xyes" ; then
2887 OPENSC_CONFIG=$withval/bin/opensc-config
2888 else
2889 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2890 fi
2891 if test "$OPENSC_CONFIG" != "no"; then
2892 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2893 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2894 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2895 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2896 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002897 AC_DEFINE(USE_OPENSC, 1,
2898 [Define if you want smartcard support
2899 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002900 SCARD_MSG="yes, using OpenSC"
2901 fi
2902 fi
2903 ]
2904)
Damien Miller85de5802001-09-18 14:01:11 +10002905
Darren Tucker5f88d342003-10-15 16:57:57 +10002906# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002907AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002908 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2909 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002910 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002911 # Needed by our getrrsetbyname()
2912 AC_SEARCH_LIBS(res_query, resolv)
2913 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002914 AC_MSG_CHECKING(if res_query will link)
2915 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2916 [AC_MSG_RESULT(no)
2917 saved_LIBS="$LIBS"
2918 LIBS="$LIBS -lresolv"
2919 AC_MSG_CHECKING(for res_query in -lresolv)
2920 AC_LINK_IFELSE([
2921#include <resolv.h>
2922int main()
2923{
2924 res_query (0, 0, 0, 0, 0);
2925 return 0;
2926}
2927 ],
2928 [LIBS="$LIBS -lresolv"
2929 AC_MSG_RESULT(yes)],
2930 [LIBS="$saved_LIBS"
2931 AC_MSG_RESULT(no)])
2932 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002933 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002934 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002935 [#include <sys/types.h>
2936 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002937 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07002938 [AC_DEFINE(HAVE_HEADER_AD, 1,
2939 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10002940 [#include <arpa/nameser.h>])
2941 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002942
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002943# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002944KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002945AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002946 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002947 [ if test "x$withval" != "xno" ; then
2948 if test "x$withval" = "xyes" ; then
2949 KRB5ROOT="/usr/local"
2950 else
2951 KRB5ROOT=${withval}
2952 fi
2953
Tim Rice7df8d392005-09-19 09:33:39 -07002954 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11002955 KRB5_MSG="yes"
2956
2957 AC_MSG_CHECKING(for krb5-config)
2958 if test -x $KRB5ROOT/bin/krb5-config ; then
2959 KRB5CONF=$KRB5ROOT/bin/krb5-config
2960 AC_MSG_RESULT($KRB5CONF)
2961
2962 AC_MSG_CHECKING(for gssapi support)
2963 if $KRB5CONF | grep gssapi >/dev/null ; then
2964 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002965 AC_DEFINE(GSSAPI, 1,
2966 [Define this if you want GSSAPI
2967 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11002968 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002969 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002970 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002971 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002972 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002973 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2974 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002975 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002976 AC_MSG_CHECKING(whether we are using Heimdal)
2977 AC_TRY_COMPILE([ #include <krb5.h> ],
2978 [ char *tmp = heimdal_version; ],
2979 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002980 AC_DEFINE(HEIMDAL, 1,
2981 [Define this if you are using the
2982 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002983 AC_MSG_RESULT(no)
2984 )
2985 else
2986 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002987 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002988 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002989 AC_MSG_CHECKING(whether we are using Heimdal)
2990 AC_TRY_COMPILE([ #include <krb5.h> ],
2991 [ char *tmp = heimdal_version; ],
2992 [ AC_MSG_RESULT(yes)
2993 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002994 K5LIBS="-lkrb5 -ldes"
2995 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002996 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002997 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002998 ],
2999 [ AC_MSG_RESULT(no)
3000 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3001 ]
3002 )
Damien Miller200d0a72003-06-30 19:21:36 +10003003 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003004
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003005 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3006 [ AC_DEFINE(GSSAPI)
3007 K5LIBS="-lgssapi $K5LIBS" ],
3008 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3009 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11003010 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003011 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3012 $K5LIBS)
3013 ],
3014 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003015
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003016 AC_CHECK_HEADER(gssapi.h, ,
3017 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003018 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003019 AC_CHECK_HEADERS(gssapi.h, ,
3020 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003021 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003022 ]
3023 )
3024
3025 oldCPP="$CPPFLAGS"
3026 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3027 AC_CHECK_HEADER(gssapi_krb5.h, ,
3028 [ CPPFLAGS="$oldCPP" ])
3029
Damien Millera8e06ce2003-11-21 23:48:55 +11003030 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003031 if test ! -z "$need_dash_r" ; then
3032 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3033 fi
3034 if test ! -z "$blibpath" ; then
3035 blibpath="$blibpath:${KRB5ROOT}/lib"
3036 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003037
3038 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3039 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3040 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3041
3042 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003043 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3044 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003045 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003046 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003047)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003048
Damien Millera22ba012000-03-02 23:09:20 +11003049# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003050
Damien Millerf58c6722002-05-13 13:15:42 +10003051PRIVSEP_PATH=/var/empty
3052AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003053 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003054 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003055 if test -n "$withval" && test "x$withval" != "xno" && \
3056 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003057 PRIVSEP_PATH=$withval
3058 fi
3059 ]
3060)
3061AC_SUBST(PRIVSEP_PATH)
3062
Damien Millera22ba012000-03-02 23:09:20 +11003063AC_ARG_WITH(xauth,
3064 [ --with-xauth=PATH Specify path to xauth program ],
3065 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003066 if test -n "$withval" && test "x$withval" != "xno" && \
3067 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003068 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003069 fi
3070 ],
3071 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003072 TestPath="$PATH"
3073 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3074 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3075 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3076 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3077 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003078 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003079 xauth_path="/usr/openwin/bin/xauth"
3080 fi
3081 ]
3082)
3083
Damien Miller7d901272003-01-13 16:55:22 +11003084STRIP_OPT=-s
3085AC_ARG_ENABLE(strip,
3086 [ --disable-strip Disable calling strip(1) on install],
3087 [
3088 if test "x$enableval" = "xno" ; then
3089 STRIP_OPT=
3090 fi
3091 ]
3092)
3093AC_SUBST(STRIP_OPT)
3094
Damien Millera19cf472000-11-29 13:28:50 +11003095if test -z "$xauth_path" ; then
3096 XAUTH_PATH="undefined"
3097 AC_SUBST(XAUTH_PATH)
3098else
Tim Rice7df8d392005-09-19 09:33:39 -07003099 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3100 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003101 XAUTH_PATH=$xauth_path
3102 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003103fi
Damien Millera22ba012000-03-02 23:09:20 +11003104
3105# Check for mail directory (last resort if we cannot get it from headers)
3106if test ! -z "$MAIL" ; then
3107 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003108 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3109 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003110fi
3111
Darren Tucker623d92f2004-09-12 22:36:15 +10003112if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003113 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3114 disable_ptmx_check=yes
3115fi
Damien Millera22ba012000-03-02 23:09:20 +11003116if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003117 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003118 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003119 [
Tim Rice7df8d392005-09-19 09:33:39 -07003120 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3121 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003122 have_dev_ptmx=1
3123 ]
3124 )
3125 fi
Damien Millera22ba012000-03-02 23:09:20 +11003126fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003127
Darren Tucker623d92f2004-09-12 22:36:15 +10003128if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003129 AC_CHECK_FILE("/dev/ptc",
3130 [
Tim Rice7df8d392005-09-19 09:33:39 -07003131 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3132 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003133 have_dev_ptc=1
3134 ]
3135 )
3136else
3137 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3138fi
Damien Miller204ad072000-03-02 23:56:12 +11003139
Damien Millera22ba012000-03-02 23:09:20 +11003140# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003141AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003142 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003143 [
Damien Miller897741e2001-04-16 10:41:46 +10003144 case "$withval" in
3145 man|cat|doc)
3146 MANTYPE=$withval
3147 ;;
3148 *)
3149 AC_MSG_ERROR(invalid man type: $withval)
3150 ;;
3151 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003152 ]
3153)
Ben Lindstrombc709922001-04-18 18:04:21 +00003154if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003155 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3156 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003157 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3158 MANTYPE=doc
3159 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3160 MANTYPE=man
3161 else
3162 MANTYPE=cat
3163 fi
3164fi
Damien Miller670a4b82000-01-22 13:53:11 +11003165AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003166if test "$MANTYPE" = "doc"; then
3167 mansubdir=man;
3168else
3169 mansubdir=$MANTYPE;
3170fi
3171AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003172
Damien Millera22ba012000-03-02 23:09:20 +11003173# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003174MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003175AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003176 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003177 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003178 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003179 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3180 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003181 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003182 fi
3183 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003184)
3185
Damien Millera22ba012000-03-02 23:09:20 +11003186# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003187AC_ARG_WITH(shadow,
3188 [ --without-shadow Disable shadow password support],
3189 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003190 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003191 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003192 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003193 fi
3194 ]
3195)
3196
Damien Miller1f335fb2000-06-26 11:31:33 +10003197if test -z "$disable_shadow" ; then
3198 AC_MSG_CHECKING([if the systems has expire shadow information])
3199 AC_TRY_COMPILE(
3200 [
3201#include <sys/types.h>
3202#include <shadow.h>
3203 struct spwd sp;
3204 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3205 [ sp_expire_available=yes ], []
3206 )
3207
3208 if test "x$sp_expire_available" = "xyes" ; then
3209 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003210 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3211 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003212 else
3213 AC_MSG_RESULT(no)
3214 fi
3215fi
3216
Damien Millera22ba012000-03-02 23:09:20 +11003217# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003218if test ! -z "$IPADDR_IN_DISPLAY" ; then
3219 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003220 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3221 [Define if you need to use IP address
3222 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003223else
Damien Millera8e06ce2003-11-21 23:48:55 +11003224 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003225 AC_ARG_WITH(ipaddr-display,
3226 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3227 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003228 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003229 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003230 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003231 fi
3232 ]
3233 )
3234fi
Damien Miller76112de1999-12-21 11:18:08 +11003235
Darren Tuckere1a790d2003-09-16 11:52:19 +10003236# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003237AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003238 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003239 [ if test "x$enableval" = "xno"; then
3240 AC_MSG_NOTICE([/etc/default/login handling disabled])
3241 etc_default_login=no
3242 else
3243 etc_default_login=yes
3244 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003245 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3246 then
3247 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3248 etc_default_login=no
3249 else
3250 etc_default_login=yes
3251 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003252)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003253
Darren Tucker2f9573d2005-02-10 22:28:54 +11003254if test "x$etc_default_login" != "xno"; then
3255 AC_CHECK_FILE("/etc/default/login",
3256 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003257 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003258 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3259 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003260 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003261fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003262
Tim Rice43a1c132002-04-17 21:19:14 -07003263dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003264if test $ac_cv_func_login_getcapbool = "yes" && \
3265 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003266 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003267fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003268
Damien Millera22ba012000-03-02 23:09:20 +11003269# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003270SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003271AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003272 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003273 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003274 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003275 AC_MSG_WARN([
3276--with-default-path=PATH has no effect on this system.
3277Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003278 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003279 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003280 AC_MSG_WARN([
3281--with-default-path=PATH will only be used if PATH is not defined in
3282$external_path_file .])
3283 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003284 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003285 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003286 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003287 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003288 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3289 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003290 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003291 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003292 AC_MSG_WARN([
3293If PATH is defined in $external_path_file, ensure the path to scp is included,
3294otherwise scp will not work.])
3295 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003296 AC_RUN_IFELSE(
3297 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003298/* find out what STDPATH is */
3299#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003300#ifdef HAVE_PATHS_H
3301# include <paths.h>
3302#endif
3303#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003304# ifdef _PATH_USERPATH /* Irix */
3305# define _PATH_STDPATH _PATH_USERPATH
3306# else
3307# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3308# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003309#endif
3310#include <sys/types.h>
3311#include <sys/stat.h>
3312#include <fcntl.h>
3313#define DATA "conftest.stdpath"
3314
3315main()
3316{
3317 FILE *fd;
3318 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003319
Tim Rice59ea0a02001-03-10 13:50:45 -08003320 fd = fopen(DATA,"w");
3321 if(fd == NULL)
3322 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003323
Tim Rice59ea0a02001-03-10 13:50:45 -08003324 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3325 exit(1);
3326
3327 exit(0);
3328}
Darren Tucker314d89e2005-10-17 23:29:23 +10003329 ]])],
3330 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003331 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3332 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3333 )
3334# make sure $bindir is in USER_PATH so scp will work
3335 t_bindir=`eval echo ${bindir}`
3336 case $t_bindir in
3337 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3338 esac
3339 case $t_bindir in
3340 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3341 esac
3342 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3343 if test $? -ne 0 ; then
3344 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3345 if test $? -ne 0 ; then
3346 user_path=$user_path:$t_bindir
3347 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3348 fi
3349 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003350 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003351)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003352if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003353 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003354 AC_SUBST(user_path)
3355fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003356
Damien Millera18bbd32002-05-13 10:48:57 +10003357# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003358AC_ARG_WITH(superuser-path,
3359 [ --with-superuser-path= Specify different path for super-user],
3360 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003361 if test -n "$withval" && test "x$withval" != "xno" && \
3362 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003363 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3364 [Define if you want a different $PATH
3365 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003366 superuser_path=$withval
3367 fi
3368 ]
3369)
3370
3371
Damien Miller61e50f12000-05-08 20:49:37 +10003372AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003373IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003374AC_ARG_WITH(4in6,
3375 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3376 [
3377 if test "x$withval" != "xno" ; then
3378 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003379 AC_DEFINE(IPV4_IN_IPV6, 1,
3380 [Detect IPv4 in IPv6 mapped addresses
3381 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003382 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003383 else
3384 AC_MSG_RESULT(no)
3385 fi
3386 ],[
3387 if test "x$inet6_default_4in6" = "xyes"; then
3388 AC_MSG_RESULT([yes (default)])
3389 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003390 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003391 else
3392 AC_MSG_RESULT([no (default)])
3393 fi
3394 ]
3395)
3396
Damien Miller60396b02001-02-18 17:01:00 +11003397# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003398BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003399AC_ARG_WITH(bsd-auth,
3400 [ --with-bsd-auth Enable BSD auth support],
3401 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003402 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003403 AC_DEFINE(BSD_AUTH, 1,
3404 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003405 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003406 fi
3407 ]
3408)
3409
Damien Millera22ba012000-03-02 23:09:20 +11003410# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003411piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003412# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003413if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003414 piddir=`eval echo ${sysconfdir}`
3415 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003416 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003417 esac
3418fi
3419
Tim Rice88f2ab52002-03-17 12:17:34 -08003420AC_ARG_WITH(pid-dir,
3421 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3422 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003423 if test -n "$withval" && test "x$withval" != "xno" && \
3424 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003425 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003426 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003427 AC_MSG_WARN([** no $piddir directory on this system **])
3428 fi
3429 fi
3430 ]
3431)
3432
Tim Rice7df8d392005-09-19 09:33:39 -07003433AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003434AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003435
andre2ff7b5d2000-06-03 14:57:40 +00003436dnl allow user to disable some login recording features
3437AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003438 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003439 [
3440 if test "x$enableval" = "xno" ; then
3441 AC_DEFINE(DISABLE_LASTLOG)
3442 fi
3443 ]
andre2ff7b5d2000-06-03 14:57:40 +00003444)
3445AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003446 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003447 [
3448 if test "x$enableval" = "xno" ; then
3449 AC_DEFINE(DISABLE_UTMP)
3450 fi
3451 ]
andre2ff7b5d2000-06-03 14:57:40 +00003452)
3453AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003454 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003455 [
3456 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003457 AC_DEFINE(DISABLE_UTMPX, 1,
3458 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003459 fi
3460 ]
andre2ff7b5d2000-06-03 14:57:40 +00003461)
3462AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003463 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003464 [
3465 if test "x$enableval" = "xno" ; then
3466 AC_DEFINE(DISABLE_WTMP)
3467 fi
3468 ]
andre2ff7b5d2000-06-03 14:57:40 +00003469)
3470AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003471 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003472 [
3473 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003474 AC_DEFINE(DISABLE_WTMPX, 1,
3475 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003476 fi
3477 ]
andre2ff7b5d2000-06-03 14:57:40 +00003478)
3479AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003480 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003481 [
3482 if test "x$enableval" = "xno" ; then
3483 AC_DEFINE(DISABLE_LOGIN)
3484 fi
3485 ]
andre2ff7b5d2000-06-03 14:57:40 +00003486)
3487AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003488 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003489 [
3490 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003491 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3492 [Define if you don't want to use pututline()
3493 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003494 fi
3495 ]
andre2ff7b5d2000-06-03 14:57:40 +00003496)
3497AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003498 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003499 [
3500 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003501 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3502 [Define if you don't want to use pututxline()
3503 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003504 fi
3505 ]
andre2ff7b5d2000-06-03 14:57:40 +00003506)
3507AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003508 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003509 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003510 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003511 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003512 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003513 conf_lastlog_location=$withval
3514 fi
3515 ]
3516)
andre2ff7b5d2000-06-03 14:57:40 +00003517
3518dnl lastlog, [uw]tmpx? detection
3519dnl NOTE: set the paths in the platform section to avoid the
3520dnl need for command-line parameters
3521dnl lastlog and [uw]tmp are subject to a file search if all else fails
3522
3523dnl lastlog detection
3524dnl NOTE: the code itself will detect if lastlog is a directory
3525AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3526AC_TRY_COMPILE([
3527#include <sys/types.h>
3528#include <utmp.h>
3529#ifdef HAVE_LASTLOG_H
3530# include <lastlog.h>
3531#endif
Damien Miller2994e082000-06-04 15:51:47 +10003532#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003533# include <paths.h>
3534#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003535#ifdef HAVE_LOGIN_H
3536# include <login.h>
3537#endif
andre2ff7b5d2000-06-03 14:57:40 +00003538 ],
3539 [ char *lastlog = LASTLOG_FILE; ],
3540 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003541 [
3542 AC_MSG_RESULT(no)
3543 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3544 AC_TRY_COMPILE([
3545#include <sys/types.h>
3546#include <utmp.h>
3547#ifdef HAVE_LASTLOG_H
3548# include <lastlog.h>
3549#endif
3550#ifdef HAVE_PATHS_H
3551# include <paths.h>
3552#endif
3553 ],
3554 [ char *lastlog = _PATH_LASTLOG; ],
3555 [ AC_MSG_RESULT(yes) ],
3556 [
andree441aa32000-06-12 22:34:38 +00003557 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003558 system_lastlog_path=no
3559 ])
3560 ]
andre2ff7b5d2000-06-03 14:57:40 +00003561)
Damien Miller2994e082000-06-04 15:51:47 +10003562
andre2ff7b5d2000-06-03 14:57:40 +00003563if test -z "$conf_lastlog_location"; then
3564 if test x"$system_lastlog_path" = x"no" ; then
3565 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003566 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003567 conf_lastlog_location=$f
3568 fi
3569 done
3570 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003571 AC_MSG_WARN([** Cannot find lastlog **])
3572 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003573 fi
3574 fi
3575fi
3576
3577if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003578 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3579 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003580fi
andre2ff7b5d2000-06-03 14:57:40 +00003581
3582dnl utmp detection
3583AC_MSG_CHECKING([if your system defines UTMP_FILE])
3584AC_TRY_COMPILE([
3585#include <sys/types.h>
3586#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003587#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003588# include <paths.h>
3589#endif
3590 ],
3591 [ char *utmp = UTMP_FILE; ],
3592 [ AC_MSG_RESULT(yes) ],
3593 [ AC_MSG_RESULT(no)
3594 system_utmp_path=no ]
3595)
3596if test -z "$conf_utmp_location"; then
3597 if test x"$system_utmp_path" = x"no" ; then
3598 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3599 if test -f $f ; then
3600 conf_utmp_location=$f
3601 fi
3602 done
3603 if test -z "$conf_utmp_location"; then
3604 AC_DEFINE(DISABLE_UTMP)
3605 fi
3606 fi
3607fi
3608if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003609 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3610 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003611fi
andre2ff7b5d2000-06-03 14:57:40 +00003612
3613dnl wtmp detection
3614AC_MSG_CHECKING([if your system defines WTMP_FILE])
3615AC_TRY_COMPILE([
3616#include <sys/types.h>
3617#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003618#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003619# include <paths.h>
3620#endif
3621 ],
3622 [ char *wtmp = WTMP_FILE; ],
3623 [ AC_MSG_RESULT(yes) ],
3624 [ AC_MSG_RESULT(no)
3625 system_wtmp_path=no ]
3626)
3627if test -z "$conf_wtmp_location"; then
3628 if test x"$system_wtmp_path" = x"no" ; then
3629 for f in /usr/adm/wtmp /var/log/wtmp; do
3630 if test -f $f ; then
3631 conf_wtmp_location=$f
3632 fi
3633 done
3634 if test -z "$conf_wtmp_location"; then
3635 AC_DEFINE(DISABLE_WTMP)
3636 fi
3637 fi
3638fi
3639if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003640 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3641 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003642fi
andre2ff7b5d2000-06-03 14:57:40 +00003643
3644
3645dnl utmpx detection - I don't know any system so perverse as to require
3646dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3647dnl there, though.
3648AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3649AC_TRY_COMPILE([
3650#include <sys/types.h>
3651#include <utmp.h>
3652#ifdef HAVE_UTMPX_H
3653#include <utmpx.h>
3654#endif
Damien Miller2994e082000-06-04 15:51:47 +10003655#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003656# include <paths.h>
3657#endif
3658 ],
3659 [ char *utmpx = UTMPX_FILE; ],
3660 [ AC_MSG_RESULT(yes) ],
3661 [ AC_MSG_RESULT(no)
3662 system_utmpx_path=no ]
3663)
3664if test -z "$conf_utmpx_location"; then
3665 if test x"$system_utmpx_path" = x"no" ; then
3666 AC_DEFINE(DISABLE_UTMPX)
3667 fi
3668else
Tim Rice7df8d392005-09-19 09:33:39 -07003669 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3670 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003671fi
andre2ff7b5d2000-06-03 14:57:40 +00003672
3673dnl wtmpx detection
3674AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3675AC_TRY_COMPILE([
3676#include <sys/types.h>
3677#include <utmp.h>
3678#ifdef HAVE_UTMPX_H
3679#include <utmpx.h>
3680#endif
Damien Miller2994e082000-06-04 15:51:47 +10003681#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003682# include <paths.h>
3683#endif
3684 ],
3685 [ char *wtmpx = WTMPX_FILE; ],
3686 [ AC_MSG_RESULT(yes) ],
3687 [ AC_MSG_RESULT(no)
3688 system_wtmpx_path=no ]
3689)
3690if test -z "$conf_wtmpx_location"; then
3691 if test x"$system_wtmpx_path" = x"no" ; then
3692 AC_DEFINE(DISABLE_WTMPX)
3693 fi
3694else
Tim Rice7df8d392005-09-19 09:33:39 -07003695 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3696 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003697fi
andre2ff7b5d2000-06-03 14:57:40 +00003698
Damien Miller4018c192000-04-30 09:30:44 +10003699
Damien Miller29ea30d2000-03-17 10:54:15 +11003700if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003701 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3702 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003703fi
3704
Tim Rice4cec93f2002-02-26 08:40:48 -08003705dnl remove pam and dl because they are in $LIBPAM
3706if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003707 LIBS=`echo $LIBS | sed 's/-lpam //'`
3708fi
3709if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3710 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003711fi
3712
Darren Tucker7da23cb2005-08-03 00:20:15 +10003713dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3714dnl Add now.
3715CFLAGS="$CFLAGS $werror_flags"
3716
Damien Millerbac2d8a2000-09-05 16:13:06 +11003717AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003718AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3719 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003720AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003721
Damien Miller7b22d652000-06-18 14:07:04 +10003722# Print summary of options
3723
Damien Miller7b22d652000-06-18 14:07:04 +10003724# Someone please show me a better way :)
3725A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3726B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3727C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3728D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003729E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003730F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003731G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003732H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3733I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3734J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003735
3736echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003737echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003738echo " User binaries: $B"
3739echo " System binaries: $C"
3740echo " Configuration files: $D"
3741echo " Askpass program: $E"
3742echo " Manual pages: $F"
3743echo " PID file: $G"
3744echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003745if test "x$external_path_file" = "x/etc/login.conf" ; then
3746echo " At runtime, sshd will use the path defined in $external_path_file"
3747echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003748else
Damien Millerf58c6722002-05-13 13:15:42 +10003749echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003750 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003751echo " (If PATH is set in $external_path_file it will be used instead. If"
3752echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3753 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003754fi
Damien Millera18bbd32002-05-13 10:48:57 +10003755if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003756echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003757fi
Damien Millerf58c6722002-05-13 13:15:42 +10003758echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003759echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003760echo " KerberosV support: $KRB5_MSG"
3761echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003762echo " S/KEY support: $SKEY_MSG"
3763echo " TCP Wrappers support: $TCPW_MSG"
3764echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003765echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003766echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003767echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3768echo " BSD Auth support: $BSD_AUTH_MSG"
3769echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003770if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003771echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003772fi
3773
Damien Miller7b22d652000-06-18 14:07:04 +10003774echo ""
3775
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003776echo " Host: ${host}"
3777echo " Compiler: ${CC}"
3778echo " Compiler flags: ${CFLAGS}"
3779echo "Preprocessor flags: ${CPPFLAGS}"
3780echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003781echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003782
3783echo ""
3784
Tim Rice6f1f7582004-05-30 21:38:51 -07003785if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003786 echo "SVR4 style packages are supported with \"make package\""
3787 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003788fi
3789
Damien Miller82cf0ce2000-12-20 13:34:48 +11003790if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003791 echo "PAM is enabled. You may need to install a PAM control file "
3792 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003793 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003794 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003795 echo ""
3796fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003797
Damien Miller6c21c512002-01-22 21:57:53 +11003798if test ! -z "$RAND_HELPER_CMDHASH" ; then
3799 echo "WARNING: you are using the builtin random number collection "
3800 echo "service. Please read WARNING.RNG and request that your OS "
3801 echo "vendor includes kernel-based random number collection in "
3802 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003803 echo ""
3804fi
Damien Miller60396b02001-02-18 17:01:00 +11003805
Damien Millerb4097182004-05-23 14:09:40 +10003806if test ! -z "$NO_PEERCHECK" ; then
3807 echo "WARNING: the operating system that you are using does not "
3808 echo "appear to support either the getpeereid() API nor the "
3809 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3810 echo "enforce security checks to prevent unauthorised connections to "
3811 echo "ssh-agent. Their absence increases the risk that a malicious "
3812 echo "user can connect to your agent. "
3813 echo ""
3814fi
3815
Darren Tuckerd9f88912005-02-20 21:01:48 +11003816if test "$AUDIT_MODULE" = "bsm" ; then
3817 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3818 echo "See the Solaris section in README.platform for details."
3819fi