blob: 64046759ff6c31ca0ee7224e501e3b2ee5683cc7 [file] [log] [blame]
Damien Miller598bbc22005-12-31 16:33:36 +11001# $Id: configure.ac,v 1.317 2005/12/31 05:33:37 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 Miller598bbc22005-12-31 16:33:36 +1100329 AC_DEFINE(SSH_TUN_LINUX, 1, [Open tunnel devices the Linux tun/tap way])
330 AC_DEFINE(SSH_TUN_COMPAT_AF, 1, [Use tunnel device compatibility to OpenBSD])
331 AC_DEFINE(SSH_TUN_PREPEND_AF, 1, [Prepend the address family to IP tunnel traffic])
Damien Millerb29ea912000-01-15 14:12:03 +1100332 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000333mips-sony-bsd|mips-sony-newsos4)
Tim Rice7df8d392005-09-19 09:33:39 -0700334 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000335 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000336 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100337*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000338 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800339 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800340 need_dash_r=1
341 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100342 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100343*-*-freebsd*)
344 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000345 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Millerfbd884a2001-02-27 08:39:07 +1100346 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000347*-*-bsdi*)
348 AC_DEFINE(SETEUID_BREAKS_SETUID)
349 AC_DEFINE(BROKEN_SETREUID)
350 AC_DEFINE(BROKEN_SETREGID)
351 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000352*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000353 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100354 conf_utmp_location=/etc/utmp
355 conf_wtmp_location=/usr/adm/wtmp
356 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700357 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000358 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000359 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700360 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000361 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000362*-*-openbsd*)
363 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000364 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller62a31c92005-12-13 20:44:13 +1100365 AC_DEFINE(SSH_TUN_BSD, 1, [Open tunnel devices the BSD way])
Darren Tucker4a422572005-07-14 17:22:11 +1000366 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100367*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800368 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800369 need_dash_r=1
370 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100371 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000372 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700373 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
374 [Some versions of /bin/login need the TERM supplied
375 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000376 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700377 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
378 [Define if pam_chauthtok wants real uid set
379 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000380 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000381 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700382 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
383 [Define if sshd somehow reacquires a controlling TTY
384 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000385 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000386 # hardwire lastlog location (can't detect it on some versions)
387 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000388 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
389 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
390 if test "$sol2ver" -ge 8; then
391 AC_MSG_RESULT(yes)
392 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700393 AC_DEFINE(DISABLE_WTMP, 1,
394 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000395 else
396 AC_MSG_RESULT(no)
397 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100398 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000399*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000400 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000401 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100402 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000403 conf_utmp_location=/etc/utmp
404 conf_wtmp_location=/var/adm/wtmp
405 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000406 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000407 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000408*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700409 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000410 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000411 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000412 AC_DEFINE(SETEUID_BREAKS_SETUID)
413 AC_DEFINE(BROKEN_SETREUID)
414 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000415 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000416*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700417 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000418 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100419 # -lresolv needs to be at the end of LIBS or DNS lookups break
420 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100421 IPADDR_IN_DISPLAY=yes
422 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000423 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000424 AC_DEFINE(SETEUID_BREAKS_SETUID)
425 AC_DEFINE(BROKEN_SETREUID)
426 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000427 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000428 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700429 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
430 # Attention: always take care to bind libsocket and libnsl before libc,
431 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000432 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800433# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100434*-*-sysv4.2*)
Damien Miller57f39152005-11-24 19:58:19 +1100435 CFLAGS="$CFLAGS -Dva_list=_VA_LIST"
Damien Miller5dfe9762001-02-16 12:05:39 +1100436 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700437 AC_DEFINE(SETEUID_BREAKS_SETUID)
438 AC_DEFINE(BROKEN_SETREUID)
439 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700440 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800441 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100442 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800443# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100444*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700445 check_for_libcrypt_later=1
446 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100447 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700448 AC_DEFINE(SETEUID_BREAKS_SETUID)
449 AC_DEFINE(BROKEN_SETREUID)
450 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700451 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700452 case "$host" in
453 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
454 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700455 AC_DEFINE(BROKEN_LIBIAF, 1,
456 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700457 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800458 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
459 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700460 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100461 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100462*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100463 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800464# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100465*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800466 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100467 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800468# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100469*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800470 if test -z "$GCC"; then
471 CFLAGS="$CFLAGS -belf"
472 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100473 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000474 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100475 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000476 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000477 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700478 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700479 AC_DEFINE(SETEUID_BREAKS_SETUID)
480 AC_DEFINE(BROKEN_SETREUID)
481 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700482 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700483 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700484 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100485 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700486 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700487 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000488 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000489*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700490 AC_DEFINE(NO_SSH_LASTLOG, 1,
491 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100492 AC_DEFINE(SETEUID_BREAKS_SETUID)
493 AC_DEFINE(BROKEN_SETREUID)
494 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000495 AC_DEFINE(USE_PIPES)
496 AC_DEFINE(DISABLE_FD_PASSING)
497 LDFLAGS="$LDFLAGS"
498 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
499 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000500 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000501*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100502 AC_DEFINE(SETEUID_BREAKS_SETUID)
503 AC_DEFINE(BROKEN_SETREUID)
504 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000505 AC_DEFINE(WITH_ABBREV_NO_TTY)
506 AC_DEFINE(USE_PIPES)
507 AC_DEFINE(DISABLE_FD_PASSING)
508 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100509 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000510 MANTYPE=cat
511 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000512*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100513 AC_DEFINE(SETEUID_BREAKS_SETUID)
514 AC_DEFINE(BROKEN_SETREUID)
515 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000516 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700517 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700518 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000519 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
520 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
521 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700522 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000523*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000524 AC_MSG_CHECKING(for Digital Unix SIA)
525 no_osfsia=""
526 AC_ARG_WITH(osfsia,
527 [ --with-osfsia Enable Digital Unix SIA],
528 [
529 if test "x$withval" = "xno" ; then
530 AC_MSG_RESULT(disabled)
531 no_osfsia=1
532 fi
533 ],
534 )
535 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000536 if test -f /etc/sia/matrix.conf; then
537 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700538 AC_DEFINE(HAVE_OSF_SIA, 1,
539 [Define if you have Digital Unix Security
540 Integration Architecture])
541 AC_DEFINE(DISABLE_LOGIN, 1,
542 [Define if you don't want to use your
543 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000544 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000545 LIBS="$LIBS -lsecurity -ldb -lm -laud"
546 else
547 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700548 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
549 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000550 fi
551 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000552 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700553 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000554 AC_DEFINE(BROKEN_SETREUID)
555 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000556 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000557
558*-*-nto-qnx)
559 AC_DEFINE(USE_PIPES)
560 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700561 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
562 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
563 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000564 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000565
566*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700567 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
568 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
569 AC_DEFINE(NEED_SETPRGP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700570 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
571 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000572
573*-*-lynxos)
574 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700575 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000576 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
577 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100578esac
579
Damien Millere37bfc12000-06-05 09:37:43 +1000580# Allow user to specify flags
581AC_ARG_WITH(cflags,
582 [ --with-cflags Specify additional flags to pass to compiler],
583 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800584 if test -n "$withval" && test "x$withval" != "xno" && \
585 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000586 CFLAGS="$CFLAGS $withval"
587 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800588 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000589)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000590AC_ARG_WITH(cppflags,
591 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
592 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800593 if test -n "$withval" && test "x$withval" != "xno" && \
594 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000595 CPPFLAGS="$CPPFLAGS $withval"
596 fi
597 ]
598)
Damien Millere37bfc12000-06-05 09:37:43 +1000599AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000600 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000601 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800602 if test -n "$withval" && test "x$withval" != "xno" && \
603 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000604 LDFLAGS="$LDFLAGS $withval"
605 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800606 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000607)
608AC_ARG_WITH(libs,
609 [ --with-libs Specify additional libraries to link with],
610 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800611 if test -n "$withval" && test "x$withval" != "xno" && \
612 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000613 LIBS="$LIBS $withval"
614 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800615 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000616)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000617AC_ARG_WITH(Werror,
618 [ --with-Werror Build main code with -Werror],
619 [
620 if test -n "$withval" && test "x$withval" != "xno"; then
621 werror_flags="-Werror"
Damien Millere04ec6f2005-10-08 16:21:19 +1000622 if test "x${withval}" != "xyes"; then
Darren Tucker7da23cb2005-08-03 00:20:15 +1000623 werror_flags="$withval"
624 fi
625 fi
626 ]
627)
Damien Millere37bfc12000-06-05 09:37:43 +1000628
Darren Tucker6eb93042003-06-29 21:30:41 +1000629AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000630AC_RUN_IFELSE(
631 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000632#include <stdio.h>
633int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000634 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000635 [ AC_MSG_RESULT(yes) ],
636 [
637 AC_MSG_RESULT(no)
638 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000639 ],
640 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000641)
642
Darren Tucker0c9653f2005-05-28 15:58:14 +1000643dnl Checks for header files.
644AC_CHECK_HEADERS( \
645 bstring.h \
646 crypt.h \
647 dirent.h \
648 endian.h \
649 features.h \
650 floatingpoint.h \
651 getopt.h \
652 glob.h \
653 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700654 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000655 lastlog.h \
656 limits.h \
657 login.h \
658 login_cap.h \
659 maillock.h \
660 ndir.h \
Damien Miller7b58e802005-12-13 19:33:19 +1100661 net/if.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000662 netdb.h \
663 netgroup.h \
664 netinet/in_systm.h \
665 pam/pam_appl.h \
666 paths.h \
667 pty.h \
668 readpassphrase.h \
669 rpc/types.h \
670 security/pam_appl.h \
671 shadow.h \
672 stddef.h \
673 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000674 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000675 strings.h \
676 sys/audit.h \
677 sys/bitypes.h \
678 sys/bsdtty.h \
679 sys/cdefs.h \
680 sys/dir.h \
681 sys/mman.h \
682 sys/ndir.h \
683 sys/prctl.h \
684 sys/pstat.h \
685 sys/select.h \
686 sys/stat.h \
687 sys/stream.h \
688 sys/stropts.h \
689 sys/strtio.h \
690 sys/sysmacros.h \
691 sys/time.h \
692 sys/timers.h \
693 sys/un.h \
694 time.h \
695 tmpdir.h \
696 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000697 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000698 usersec.h \
699 util.h \
700 utime.h \
701 utmp.h \
702 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000703 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000704)
Tim Rice4cec93f2002-02-26 08:40:48 -0800705
Darren Tucker48d99d32004-08-29 17:04:50 +1000706# sys/ptms.h requires sys/stream.h to be included first on Solaris
707AC_CHECK_HEADERS(sys/ptms.h, [], [], [
708#ifdef HAVE_SYS_STREAM_H
709# include <sys/stream.h>
710#endif
711])
712
Damien Millera22ba012000-03-02 23:09:20 +1100713# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700714AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
715AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000716
Tim Rice1e1ef642003-09-11 22:19:31 -0700717dnl IRIX and Solaris 2.5.1 have dirname() in libgen
718AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
719 AC_CHECK_LIB(gen, dirname,[
720 AC_CACHE_CHECK([for broken dirname],
721 ac_cv_have_broken_dirname, [
722 save_LIBS="$LIBS"
723 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000724 AC_RUN_IFELSE(
725 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700726#include <libgen.h>
727#include <string.h>
728
729int main(int argc, char **argv) {
730 char *s, buf[32];
731
732 strncpy(buf,"/etc", 32);
733 s = dirname(buf);
734 if (!s || strncmp(s, "/", 32) != 0) {
735 exit(1);
736 } else {
737 exit(0);
738 }
739}
Darren Tucker314d89e2005-10-17 23:29:23 +1000740 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700741 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000742 [ ac_cv_have_broken_dirname="yes" ],
743 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700744 )
745 LIBS="$save_LIBS"
746 ])
747 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
748 LIBS="$LIBS -lgen"
749 AC_DEFINE(HAVE_DIRNAME)
750 AC_CHECK_HEADERS(libgen.h)
751 fi
752 ])
753])
754
755AC_CHECK_FUNC(getspnam, ,
756 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700757AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
758 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700759
Tim Rice13aae5e2001-10-21 17:53:58 -0700760dnl zlib is required
761AC_ARG_WITH(zlib,
762 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100763 [ if test "x$withval" = "xno" ; then
764 AC_MSG_ERROR([*** zlib is required ***])
765 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700766 if test -d "$withval/lib"; then
767 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700768 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700769 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700770 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700771 fi
772 else
773 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700774 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700775 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700776 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700777 fi
778 fi
779 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700780 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700781 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700782 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700783 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100784 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700785)
786
Tim Ricefcb62202004-01-23 18:35:16 -0800787AC_CHECK_LIB(z, deflate, ,
788 [
789 saved_CPPFLAGS="$CPPFLAGS"
790 saved_LDFLAGS="$LDFLAGS"
791 save_LIBS="$LIBS"
792 dnl Check default zlib install dir
793 if test -n "${need_dash_r}"; then
794 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
795 else
796 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
797 fi
798 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
799 LIBS="$LIBS -lz"
800 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
801 [
802 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
803 ]
804 )
805 ]
806)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100807AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100808
809AC_ARG_WITH(zlib-version-check,
810 [ --without-zlib-version-check Disable zlib version check],
811 [ if test "x$withval" = "xno" ; then
812 zlib_check_nonfatal=1
813 fi
814 ]
815)
816
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000817AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000818AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000819#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100820#include <zlib.h>
821int main()
822{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000823 int a=0, b=0, c=0, d=0, n, v;
824 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
825 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100826 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000827 v = a*1000000 + b*10000 + c*100 + d;
828 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
829
830 /* 1.1.4 is OK */
831 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100832 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000833
Darren Tucker41097ed2005-07-25 15:24:21 +1000834 /* 1.2.3 and up are OK */
835 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000836 exit(0);
837
Darren Tucker2dcd2392004-01-23 17:13:33 +1100838 exit(2);
839}
Darren Tucker623d92f2004-09-12 22:36:15 +1000840 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000841 AC_MSG_RESULT(no),
842 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100843 if test -z "$zlib_check_nonfatal" ; then
844 AC_MSG_ERROR([*** zlib too old - check config.log ***
845Your reported zlib version has known security problems. It's possible your
846vendor has fixed these problems without changing the version number. If you
847are sure this is the case, you can disable the check by running
848"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000849If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000850See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100851 else
852 AC_MSG_WARN([zlib version may have security problems])
853 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000854 ],
855 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100856)
Damien Miller6f9c3372000-10-25 10:06:04 +1100857
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000858dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100859AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000860 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
861)
Darren Tucker5bfe1682005-11-12 18:42:36 +1100862AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700863 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
864 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000865)
Damien Millerab18c411999-11-11 10:40:23 +1100866
Tim Ricee589a292001-11-03 11:09:32 -0800867dnl Checks for libutil functions
868AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700869AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
870 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800871AC_CHECK_FUNCS(logout updwtmp logwtmp)
872
Ben Lindstrom8697e082001-02-24 21:41:10 +0000873AC_FUNC_STRFTIME
874
Damien Miller3c027682001-03-14 11:39:45 +1100875# Check for ALTDIRFUNC glob() extension
876AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
877AC_EGREP_CPP(FOUNDIT,
878 [
879 #include <glob.h>
880 #ifdef GLOB_ALTDIRFUNC
881 FOUNDIT
882 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100883 ],
Damien Miller3c027682001-03-14 11:39:45 +1100884 [
Tim Rice7df8d392005-09-19 09:33:39 -0700885 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
886 [Define if your system glob() function has
887 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100888 AC_MSG_RESULT(yes)
889 ],
890 [
891 AC_MSG_RESULT(no)
892 ]
893)
Damien Millerab18c411999-11-11 10:40:23 +1100894
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000895# Check for g.gl_matchc glob() extension
896AC_MSG_CHECKING(for gl_matchc field in glob_t)
897AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100898 [
899 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000900 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100901 ],
902 [
Tim Rice7df8d392005-09-19 09:33:39 -0700903 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
904 [Define if your system glob() function has
905 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100906 AC_MSG_RESULT(yes)
907 ],
908 [
909 AC_MSG_RESULT(no)
910 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000911)
912
Damien Miller18bb4732001-03-28 14:35:30 +1000913AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000914AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000915 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000916#include <sys/types.h>
917#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700918int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000919 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100920 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000921 [
922 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700923 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +1100924 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -0700925 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000926 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800927 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000928 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
929 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000930 ]
931)
932
Damien Miller36f49652004-08-15 18:40:59 +1000933AC_MSG_CHECKING([for /proc/pid/fd directory])
934if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700935 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000936 AC_MSG_RESULT(yes)
937else
938 AC_MSG_RESULT(no)
939fi
940
Damien Millerc547bf12001-02-16 10:18:12 +1100941# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100942SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100943AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100944 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100945 [
946 if test "x$withval" != "xno" ; then
947
948 if test "x$withval" != "xyes" ; then
949 CPPFLAGS="$CPPFLAGS -I${withval}/include"
950 LDFLAGS="$LDFLAGS -L${withval}/lib"
951 fi
952
Tim Rice7df8d392005-09-19 09:33:39 -0700953 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +1100954 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100955 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800956
Tim Rice4cec93f2002-02-26 08:40:48 -0800957 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +1000958 AC_LINK_IFELSE(
959 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -0800960#include <stdio.h>
961#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700962int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +1000963 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -0800964 [AC_MSG_RESULT(yes)],
965 [
966 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100967 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
968 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000969 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
970 AC_TRY_COMPILE(
971 [#include <stdio.h>
972 #include <skey.h>],
973 [(void)skeychallenge(NULL,"name","",0);],
974 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700975 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
976 [Define if your skeychallenge()
977 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +1000978 [AC_MSG_RESULT(no)]
979 )
Damien Millerc547bf12001-02-16 10:18:12 +1100980 fi
981 ]
982)
983
984# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700985TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100986AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100987 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100988 [
989 if test "x$withval" != "xno" ; then
990 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700991 saved_LDFLAGS="$LDFLAGS"
992 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800993 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800994 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700995 if test -d "${withval}/lib"; then
996 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700997 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700998 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700999 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001000 fi
1001 else
1002 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001003 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001004 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001005 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001006 fi
1007 fi
1008 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001009 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001010 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001011 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001012 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001013 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001014 LIBWRAP="-lwrap"
1015 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001016 AC_MSG_CHECKING(for libwrap)
1017 AC_TRY_LINK(
1018 [
Damien Miller0ac45002004-04-14 20:14:26 +10001019#include <sys/types.h>
1020#include <sys/socket.h>
1021#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001022#include <tcpd.h>
1023 int deny_severity = 0, allow_severity = 0;
1024 ],
1025 [hosts_access(0);],
1026 [
1027 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001028 AC_DEFINE(LIBWRAP, 1,
1029 [Define if you want
1030 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001031 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001032 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001033 ],
1034 [
1035 AC_MSG_ERROR([*** libwrap missing])
1036 ]
1037 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001038 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001039 fi
1040 ]
1041)
1042
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001043# Check whether user wants libedit support
1044LIBEDIT_MSG="no"
1045AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001046 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001047 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001048 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001049 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1050 if test -n "${need_dash_r}"; then
1051 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1052 else
1053 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1054 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001055 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001056 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001057 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001058 LIBEDIT="-ledit -lcurses"
1059 LIBEDIT_MSG="yes"
1060 AC_SUBST(LIBEDIT)
1061 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001062 [ AC_MSG_ERROR(libedit not found) ],
1063 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001064 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001065 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001066 AC_COMPILE_IFELSE(
1067 [AC_LANG_SOURCE([[
1068#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001069int main(void)
1070{
1071 int i = H_SETSIZE;
1072 el_init("", NULL, NULL, NULL);
1073 exit(0);
1074}
Tim Ricec1819c82005-08-15 17:48:40 -07001075 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001076 [ AC_MSG_RESULT(yes) ],
1077 [ AC_MSG_RESULT(no)
1078 AC_MSG_ERROR(libedit version is not compatible) ]
1079 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001080 fi ]
1081)
1082
Darren Tuckerd9f88912005-02-20 21:01:48 +11001083AUDIT_MODULE=none
1084AC_ARG_WITH(audit,
1085 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1086 [
1087 AC_MSG_CHECKING(for supported audit module)
1088 case "$withval" in
1089 bsm)
1090 AC_MSG_RESULT(bsm)
1091 AUDIT_MODULE=bsm
1092 dnl Checks for headers, libs and functions
1093 AC_CHECK_HEADERS(bsm/audit.h, [],
1094 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1095 AC_CHECK_LIB(bsm, getaudit, [],
1096 [AC_MSG_ERROR(BSM enabled and required library not found)])
1097 AC_CHECK_FUNCS(getaudit, [],
1098 [AC_MSG_ERROR(BSM enabled and required function not found)])
1099 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001100 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001101 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001102 ;;
1103 debug)
1104 AUDIT_MODULE=debug
1105 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001106 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001107 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001108 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001109 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001110 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001111 *)
1112 AC_MSG_ERROR([Unknown audit module $withval])
1113 ;;
1114 esac ]
1115)
1116
Damien Millerfe1f1432003-02-24 15:45:42 +11001117dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001118AC_CHECK_FUNCS( \
1119 arc4random \
Damien Miller57f39152005-11-24 19:58:19 +11001120 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001121 b64_ntop \
1122 __b64_ntop \
1123 b64_pton \
1124 __b64_pton \
1125 bcopy \
1126 bindresvport_sa \
1127 clock \
1128 closefrom \
1129 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001130 fchmod \
1131 fchown \
1132 freeaddrinfo \
1133 futimes \
1134 getaddrinfo \
1135 getcwd \
1136 getgrouplist \
1137 getnameinfo \
1138 getopt \
1139 getpeereid \
1140 _getpty \
1141 getrlimit \
1142 getttyent \
1143 glob \
1144 inet_aton \
1145 inet_ntoa \
1146 inet_ntop \
1147 innetgr \
1148 login_getcapbool \
1149 md5_crypt \
1150 memmove \
1151 mkdtemp \
1152 mmap \
1153 ngetaddrinfo \
1154 nsleep \
1155 ogetaddrinfo \
1156 openlog_r \
1157 openpty \
1158 prctl \
1159 pstat \
1160 readpassphrase \
1161 realpath \
1162 recvmsg \
1163 rresvport_af \
1164 sendmsg \
1165 setdtablesize \
1166 setegid \
1167 setenv \
1168 seteuid \
1169 setgroups \
1170 setlogin \
1171 setpcred \
1172 setproctitle \
1173 setregid \
1174 setreuid \
1175 setrlimit \
1176 setsid \
1177 setvbuf \
1178 sigaction \
1179 sigvec \
1180 snprintf \
1181 socketpair \
1182 strdup \
1183 strerror \
1184 strlcat \
1185 strlcpy \
1186 strmode \
1187 strnvis \
1188 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001189 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001190 strtoul \
1191 sysconf \
1192 tcgetpgrp \
1193 truncate \
1194 unsetenv \
1195 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001196 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001197 vhangup \
1198 vsnprintf \
1199 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001200)
Tim Rice13aae5e2001-10-21 17:53:58 -07001201
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001202# IRIX has a const char return value for gai_strerror()
1203AC_CHECK_FUNCS(gai_strerror,[
1204 AC_DEFINE(HAVE_GAI_STRERROR)
1205 AC_TRY_COMPILE([
1206#include <sys/types.h>
1207#include <sys/socket.h>
1208#include <netdb.h>
1209
1210const char *gai_strerror(int);],[
1211char *str;
1212
1213str = gai_strerror(0);],[
1214 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1215 [Define if gai_strerror() returns const char *])])])
1216
Tim Rice7df8d392005-09-19 09:33:39 -07001217AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1218 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001219
Darren Tuckerf1159b52003-07-07 19:44:01 +10001220dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001221AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001222AC_CHECK_DECL(strsep,
1223 [AC_CHECK_FUNCS(strsep)],
1224 [],
1225 [
1226#ifdef HAVE_STRING_H
1227# include <string.h>
1228#endif
1229 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001230
Darren Tuckerb2427c82003-09-10 15:22:44 +10001231dnl tcsendbreak might be a macro
1232AC_CHECK_DECL(tcsendbreak,
1233 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001234 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001235 [#include <termios.h>]
1236)
1237
Darren Tucker5bb14002004-04-23 18:53:10 +10001238AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1239
Darren Tucker2a6b0292003-12-31 14:59:17 +11001240AC_CHECK_FUNCS(setresuid, [
1241 dnl Some platorms have setresuid that isn't implemented, test for this
1242 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001243 AC_RUN_IFELSE(
1244 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001245#include <stdlib.h>
1246#include <errno.h>
1247int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001248 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001249 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001250 [AC_DEFINE(BROKEN_SETRESUID, 1,
1251 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001252 AC_MSG_RESULT(not implemented)],
1253 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001254 )
1255])
Darren Tuckere937be32003-12-17 18:53:26 +11001256
Darren Tucker2a6b0292003-12-31 14:59:17 +11001257AC_CHECK_FUNCS(setresgid, [
1258 dnl Some platorms have setresgid that isn't implemented, test for this
1259 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001260 AC_RUN_IFELSE(
1261 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001262#include <stdlib.h>
1263#include <errno.h>
1264int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001265 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001266 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001267 [AC_DEFINE(BROKEN_SETRESGID, 1,
1268 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001269 AC_MSG_RESULT(not implemented)],
1270 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001271 )
1272])
Darren Tuckere937be32003-12-17 18:53:26 +11001273
Damien Millerad833b32000-08-23 10:46:23 +10001274dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001275AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001276dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001277AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001278AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001279dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001280AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001281AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001282
Damien Millera8e06ce2003-11-21 23:48:55 +11001283AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001284 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1285 [AC_CHECK_LIB(bsd, daemon,
1286 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001287)
1288
Damien Millera8e06ce2003-11-21 23:48:55 +11001289AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001290 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1291 [Define if your libraries define getpagesize()])],
1292 [AC_CHECK_LIB(ucb, getpagesize,
1293 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001294)
1295
Damien Millercb170cb2000-07-01 16:52:55 +10001296# Check for broken snprintf
1297if test "x$ac_cv_func_snprintf" = "xyes" ; then
1298 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001299 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001300 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001301#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001302int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001303 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001304 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001305 [
1306 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001307 AC_DEFINE(BROKEN_SNPRINTF, 1,
1308 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001309 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001310 ],
1311 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001312 )
1313fi
1314
Damien Miller57f39152005-11-24 19:58:19 +11001315# If we don't have a working asprintf, then we strongly depend on vsnprintf
1316# returning the right thing on overflow: the number of characters it tried to
1317# create (as per SUSv3)
1318if test "x$ac_cv_func_asprintf" != "xyes" && \
1319 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1320 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1321 AC_RUN_IFELSE(
1322 [AC_LANG_SOURCE([[
1323#include <sys/types.h>
1324#include <stdio.h>
1325#include <stdarg.h>
1326
1327int x_snprintf(char *str,size_t count,const char *fmt,...)
1328{
1329 size_t ret; va_list ap;
1330 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1331 return ret;
1332}
1333int main(void)
1334{
1335 char x[1];
1336 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1337} ]])],
1338 [AC_MSG_RESULT(yes)],
1339 [
1340 AC_MSG_RESULT(no)
1341 AC_DEFINE(BROKEN_SNPRINTF, 1,
1342 [Define if your snprintf is busted])
1343 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1344 ],
1345 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1346 )
1347fi
1348
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001349# On systems where [v]snprintf is broken, but is declared in stdio,
1350# check that the fmt argument is const char * or just char *.
1351# This is only useful for when BROKEN_SNPRINTF
1352AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1353AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1354 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1355 int main(void) { snprintf(0, 0, 0); }
1356 ]])],
1357 [AC_MSG_RESULT(yes)
1358 AC_DEFINE(SNPRINTF_CONST, [const],
1359 [Define as const if snprintf() can declare const char *fmt])],
1360 [AC_MSG_RESULT(no)
1361 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1362
Damien Millerb4097182004-05-23 14:09:40 +10001363# Check for missing getpeereid (or equiv) support
1364NO_PEERCHECK=""
1365if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1366 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1367 AC_TRY_COMPILE(
1368 [#include <sys/types.h>
1369 #include <sys/socket.h>],
1370 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001371 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001372 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001373 ],
Damien Millerb4097182004-05-23 14:09:40 +10001374 [AC_MSG_RESULT(no)
1375 NO_PEERCHECK=1]
1376 )
1377fi
1378
Damien Millere8328192003-01-07 15:18:32 +11001379dnl see whether mkstemp() requires XXXXXX
1380if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1381AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001382AC_RUN_IFELSE(
1383 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001384#include <stdlib.h>
1385main() { char template[]="conftest.mkstemp-test";
1386if (mkstemp(template) == -1)
1387 exit(1);
1388unlink(template); exit(0);
1389}
Darren Tucker314d89e2005-10-17 23:29:23 +10001390 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001391 [
1392 AC_MSG_RESULT(no)
1393 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001394 [
Damien Millere8328192003-01-07 15:18:32 +11001395 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001396 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001397 ],
1398 [
1399 AC_MSG_RESULT(yes)
1400 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001401 ]
Damien Millere8328192003-01-07 15:18:32 +11001402)
1403fi
1404
Darren Tucker70a3d552003-08-21 17:58:29 +10001405dnl make sure that openpty does not reacquire controlling terminal
1406if test ! -z "$check_for_openpty_ctty_bug"; then
1407 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001408 AC_RUN_IFELSE(
1409 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001410#include <stdio.h>
1411#include <sys/fcntl.h>
1412#include <sys/types.h>
1413#include <sys/wait.h>
1414
1415int
1416main()
1417{
1418 pid_t pid;
1419 int fd, ptyfd, ttyfd, status;
1420
1421 pid = fork();
1422 if (pid < 0) { /* failed */
1423 exit(1);
1424 } else if (pid > 0) { /* parent */
1425 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001426 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001427 exit(WEXITSTATUS(status));
1428 else
1429 exit(2);
1430 } else { /* child */
1431 close(0); close(1); close(2);
1432 setsid();
1433 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1434 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1435 if (fd >= 0)
1436 exit(3); /* Acquired ctty: broken */
1437 else
1438 exit(0); /* Did not acquire ctty: OK */
1439 }
1440}
Darren Tucker314d89e2005-10-17 23:29:23 +10001441 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001442 [
1443 AC_MSG_RESULT(yes)
1444 ],
1445 [
1446 AC_MSG_RESULT(no)
1447 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001448 ],
1449 [
1450 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001451 ]
1452 )
1453fi
1454
Tim Rice8bb561b2005-03-17 16:23:19 -08001455if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1456 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001457 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001458 AC_RUN_IFELSE(
1459 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001460#include <stdio.h>
1461#include <sys/socket.h>
1462#include <netdb.h>
1463#include <errno.h>
1464#include <netinet/in.h>
1465
1466#define TEST_PORT "2222"
1467
1468int
1469main(void)
1470{
1471 int err, sock;
1472 struct addrinfo *gai_ai, *ai, hints;
1473 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1474
1475 memset(&hints, 0, sizeof(hints));
1476 hints.ai_family = PF_UNSPEC;
1477 hints.ai_socktype = SOCK_STREAM;
1478 hints.ai_flags = AI_PASSIVE;
1479
1480 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1481 if (err != 0) {
1482 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1483 exit(1);
1484 }
1485
1486 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1487 if (ai->ai_family != AF_INET6)
1488 continue;
1489
1490 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1491 sizeof(ntop), strport, sizeof(strport),
1492 NI_NUMERICHOST|NI_NUMERICSERV);
1493
1494 if (err != 0) {
1495 if (err == EAI_SYSTEM)
1496 perror("getnameinfo EAI_SYSTEM");
1497 else
1498 fprintf(stderr, "getnameinfo failed: %s\n",
1499 gai_strerror(err));
1500 exit(2);
1501 }
1502
1503 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1504 if (sock < 0)
1505 perror("socket");
1506 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1507 if (errno == EBADF)
1508 exit(3);
1509 }
1510 }
1511 exit(0);
1512}
Darren Tucker314d89e2005-10-17 23:29:23 +10001513 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001514 [
1515 AC_MSG_RESULT(yes)
1516 ],
1517 [
1518 AC_MSG_RESULT(no)
1519 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001520 ],
1521 [
1522 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001523 ]
1524 )
1525fi
1526
Tim Rice8bb561b2005-03-17 16:23:19 -08001527if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1528 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001529 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001530 AC_RUN_IFELSE(
1531 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001532#include <stdio.h>
1533#include <sys/socket.h>
1534#include <netdb.h>
1535#include <errno.h>
1536#include <netinet/in.h>
1537
1538#define TEST_PORT "2222"
1539
1540int
1541main(void)
1542{
1543 int err, sock;
1544 struct addrinfo *gai_ai, *ai, hints;
1545 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1546
1547 memset(&hints, 0, sizeof(hints));
1548 hints.ai_family = PF_UNSPEC;
1549 hints.ai_socktype = SOCK_STREAM;
1550 hints.ai_flags = AI_PASSIVE;
1551
1552 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1553 if (err != 0) {
1554 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1555 exit(1);
1556 }
1557
1558 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1559 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1560 continue;
1561
1562 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1563 sizeof(ntop), strport, sizeof(strport),
1564 NI_NUMERICHOST|NI_NUMERICSERV);
1565
1566 if (ai->ai_family == AF_INET && err != 0) {
1567 perror("getnameinfo");
1568 exit(2);
1569 }
1570 }
1571 exit(0);
1572}
Darren Tucker314d89e2005-10-17 23:29:23 +10001573 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001574 [
1575 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001576 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1577 [Define if you have a getaddrinfo that fails
1578 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001579 ],
1580 [
1581 AC_MSG_RESULT(no)
1582 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001583 ],
1584 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001585 ]
1586 )
1587fi
1588
Darren Tuckera56f1912004-11-02 20:30:54 +11001589if test "x$check_for_conflicting_getspnam" = "x1"; then
1590 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1591 AC_COMPILE_IFELSE(
1592 [
1593#include <shadow.h>
1594int main(void) {exit(0);}
1595 ],
1596 [
1597 AC_MSG_RESULT(no)
1598 ],
1599 [
1600 AC_MSG_RESULT(yes)
1601 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1602 [Conflicting defs for getspnam])
1603 ]
1604 )
1605fi
1606
Damien Miller606f8802000-09-16 15:39:56 +11001607AC_FUNC_GETPGRP
1608
Damien Millera64b57a2001-01-17 10:44:13 +11001609# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001610PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001611AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001612 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001613 [
Damien Millera64b57a2001-01-17 10:44:13 +11001614 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001615 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1616 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001617 AC_MSG_ERROR([PAM headers not found])
1618 fi
1619
1620 AC_CHECK_LIB(dl, dlopen, , )
1621 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1622 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001623 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001624
Damien Millera64b57a2001-01-17 10:44:13 +11001625 PAM_MSG="yes"
1626
Tim Rice7df8d392005-09-19 09:33:39 -07001627 AC_DEFINE(USE_PAM, 1,
1628 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001629 if test $ac_cv_lib_dl_dlopen = yes; then
1630 LIBPAM="-lpam -ldl"
1631 else
1632 LIBPAM="-lpam"
1633 fi
1634 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001635 fi
1636 ]
1637)
Damien Millera22ba012000-03-02 23:09:20 +11001638
Damien Millera64b57a2001-01-17 10:44:13 +11001639# Check for older PAM
1640if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001641 # Check PAM strerror arguments (old PAM)
1642 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1643 AC_TRY_COMPILE(
1644 [
Damien Miller81171112000-04-23 11:14:01 +10001645#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001646#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001647#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001648#elif defined (HAVE_PAM_PAM_APPL_H)
1649#include <pam/pam_appl.h>
1650#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001651 ],
1652 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001653 [AC_MSG_RESULT(no)],
1654 [
Tim Rice7df8d392005-09-19 09:33:39 -07001655 AC_DEFINE(HAVE_OLD_PAM, 1,
1656 [Define if you have an old version of PAM
1657 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001658 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001659 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001660 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001661 )
Damien Millera22ba012000-03-02 23:09:20 +11001662fi
1663
Tim Riceaef73712002-05-11 13:17:42 -07001664# Search for OpenSSL
1665saved_CPPFLAGS="$CPPFLAGS"
1666saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001667AC_ARG_WITH(ssl-dir,
1668 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1669 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001670 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001671 case "$withval" in
1672 # Relative paths
1673 ./*|../*) withval="`pwd`/$withval"
1674 esac
Tim Riceaef73712002-05-11 13:17:42 -07001675 if test -d "$withval/lib"; then
1676 if test -n "${need_dash_r}"; then
1677 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1678 else
1679 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1680 fi
1681 else
1682 if test -n "${need_dash_r}"; then
1683 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1684 else
1685 LDFLAGS="-L${withval} ${LDFLAGS}"
1686 fi
1687 fi
1688 if test -d "$withval/include"; then
1689 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1690 else
1691 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1692 fi
Damien Millera22ba012000-03-02 23:09:20 +11001693 fi
1694 ]
1695)
Tim Rice3d5352e2004-02-12 09:27:21 -08001696LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001697AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1698 [Define if your ssl headers are included
1699 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001700 [
Tim Riceaef73712002-05-11 13:17:42 -07001701 dnl Check default openssl install dir
1702 if test -n "${need_dash_r}"; then
1703 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001704 else
Tim Riceaef73712002-05-11 13:17:42 -07001705 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001706 fi
Tim Riceaef73712002-05-11 13:17:42 -07001707 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1708 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1709 [
1710 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1711 ]
1712 )
1713 ]
1714)
1715
Tim Riced730b782002-08-13 18:52:10 -07001716# Determine OpenSSL header version
1717AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001718AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001719 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001720#include <stdio.h>
1721#include <string.h>
1722#include <openssl/opensslv.h>
1723#define DATA "conftest.sslincver"
1724int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001725 FILE *fd;
1726 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001727
Damien Millera8e06ce2003-11-21 23:48:55 +11001728 fd = fopen(DATA,"w");
1729 if(fd == NULL)
1730 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001731
1732 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1733 exit(1);
1734
1735 exit(0);
1736}
Darren Tucker623d92f2004-09-12 22:36:15 +10001737 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001738 [
1739 ssl_header_ver=`cat conftest.sslincver`
1740 AC_MSG_RESULT($ssl_header_ver)
1741 ],
1742 [
1743 AC_MSG_RESULT(not found)
1744 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001745 ],
1746 [
1747 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001748 ]
1749)
1750
1751# Determine OpenSSL library version
1752AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001753AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001754 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001755#include <stdio.h>
1756#include <string.h>
1757#include <openssl/opensslv.h>
1758#include <openssl/crypto.h>
1759#define DATA "conftest.ssllibver"
1760int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001761 FILE *fd;
1762 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001763
Damien Millera8e06ce2003-11-21 23:48:55 +11001764 fd = fopen(DATA,"w");
1765 if(fd == NULL)
1766 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001767
1768 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1769 exit(1);
1770
1771 exit(0);
1772}
Darren Tucker623d92f2004-09-12 22:36:15 +10001773 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001774 [
1775 ssl_library_ver=`cat conftest.ssllibver`
1776 AC_MSG_RESULT($ssl_library_ver)
1777 ],
1778 [
1779 AC_MSG_RESULT(not found)
1780 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001781 ],
1782 [
1783 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001784 ]
1785)
Damien Millera22ba012000-03-02 23:09:20 +11001786
Damien Millerec932372002-01-22 22:16:03 +11001787# Sanity check OpenSSL headers
1788AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001789AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001790 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001791#include <string.h>
1792#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001793int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001794 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001795 [
1796 AC_MSG_RESULT(yes)
1797 ],
1798 [
1799 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001800 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1801Check config.log for details.
1802Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001803 ],
1804 [
1805 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001806 ]
1807)
1808
Darren Tucker129d0bb2005-12-19 17:40:40 +11001809# Check for OpenSSL without EVP_aes_{192,256}_cbc
1810AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
1811AC_COMPILE_IFELSE(
1812 [AC_LANG_SOURCE([[
1813#include <string.h>
1814#include <openssl/evp.h>
1815int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL)}
1816 ]])],
1817 [
1818 AC_MSG_RESULT(no)
1819 ],
1820 [
1821 AC_MSG_RESULT(yes)
1822 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
1823 [libcrypto is missing AES 192 and 256 bit functions])
1824 ]
1825)
1826
Tim Rice3d5352e2004-02-12 09:27:21 -08001827# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1828# because the system crypt() is more featureful.
1829if test "x$check_for_libcrypt_before" = "x1"; then
1830 AC_CHECK_LIB(crypt, crypt)
1831fi
1832
Damien Millera8e06ce2003-11-21 23:48:55 +11001833# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001834# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001835if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001836 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001837fi
1838
Tim Rice2291c002005-08-26 13:15:19 -07001839AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001840
1841### Configure cryptographic random number support
1842
1843# Check wheter OpenSSL seeds itself
1844AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001845AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001846 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001847#include <string.h>
1848#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001849int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001850 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001851 [
1852 OPENSSL_SEEDS_ITSELF=yes
1853 AC_MSG_RESULT(yes)
1854 ],
1855 [
1856 AC_MSG_RESULT(no)
1857 # Default to use of the rand helper if OpenSSL doesn't
1858 # seed itself
1859 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001860 ],
1861 [
1862 AC_MSG_WARN([cross compiling: assuming yes])
1863 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001864 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001865 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001866 ]
1867)
1868
1869
1870# Do we want to force the use of the rand helper?
1871AC_ARG_WITH(rand-helper,
1872 [ --with-rand-helper Use subprocess to gather strong randomness ],
1873 [
1874 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001875 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001876 # the previous test showed it to be unseeded.
1877 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1878 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1879 OPENSSL_SEEDS_ITSELF=yes
1880 USE_RAND_HELPER=""
1881 fi
1882 else
1883 USE_RAND_HELPER=yes
1884 fi
1885 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001886)
Damien Miller6c21c512002-01-22 21:57:53 +11001887
1888# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001889if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001890 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001891 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1892 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001893 RAND_MSG="OpenSSL internal ONLY"
1894 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001895elif test ! -z "$USE_RAND_HELPER" ; then
1896 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001897 RAND_MSG="ssh-rand-helper"
1898 INSTALL_SSH_RAND_HELPER="yes"
1899fi
1900AC_SUBST(INSTALL_SSH_RAND_HELPER)
1901
1902### Configuration of ssh-rand-helper
1903
1904# PRNGD TCP socket
1905AC_ARG_WITH(prngd-port,
1906 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1907 [
Damien Millere996d722002-01-23 11:20:59 +11001908 case "$withval" in
1909 no)
1910 withval=""
1911 ;;
1912 [[0-9]]*)
1913 ;;
1914 *)
1915 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1916 ;;
1917 esac
1918 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001919 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001920 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1921 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001922 fi
1923 ]
1924)
1925
1926# PRNGD Unix domain socket
1927AC_ARG_WITH(prngd-socket,
1928 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1929 [
Damien Millere996d722002-01-23 11:20:59 +11001930 case "$withval" in
1931 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001932 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001933 ;;
1934 no)
1935 withval=""
1936 ;;
1937 /*)
1938 ;;
1939 *)
1940 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1941 ;;
1942 esac
1943
1944 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001945 if test ! -z "$PRNGD_PORT" ; then
1946 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1947 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001948 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001949 AC_MSG_WARN(Entropy socket is not readable)
1950 fi
1951 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001952 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1953 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001954 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001955 ],
1956 [
1957 # Check for existing socket only if we don't have a random device already
1958 if test "$USE_RAND_HELPER" = yes ; then
1959 AC_MSG_CHECKING(for PRNGD/EGD socket)
1960 # Insert other locations here
1961 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1962 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1963 PRNGD_SOCKET="$sock"
1964 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1965 break;
1966 fi
1967 done
1968 if test ! -z "$PRNGD_SOCKET" ; then
1969 AC_MSG_RESULT($PRNGD_SOCKET)
1970 else
1971 AC_MSG_RESULT(not found)
1972 fi
1973 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001974 ]
1975)
1976
1977# Change default command timeout for hashing entropy source
1978entropy_timeout=200
1979AC_ARG_WITH(entropy-timeout,
1980 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1981 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001982 if test -n "$withval" && test "x$withval" != "xno" && \
1983 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001984 entropy_timeout=$withval
1985 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001986 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001987)
Tim Rice7df8d392005-09-19 09:33:39 -07001988AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1989 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11001990
Damien Millerd3f6ad22002-06-25 10:24:47 +10001991SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001992AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001993 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001994 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001995 if test -n "$withval" && test "x$withval" != "xno" && \
1996 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001997 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001998 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001999 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002000)
Tim Rice7df8d392005-09-19 09:33:39 -07002001AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2002 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002003AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002004
Tim Rice88f2ab52002-03-17 12:17:34 -08002005# We do this little dance with the search path to insure
2006# that programs that we select for use by installed programs
2007# (which may be run by the super-user) come from trusted
2008# locations before they come from the user's private area.
2009# This should help avoid accidentally configuring some
2010# random version of a program in someone's personal bin.
2011
2012OPATH=$PATH
2013PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002014test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002015test -d /sbin && PATH=$PATH:/sbin
2016test -d /usr/sbin && PATH=$PATH:/usr/sbin
2017PATH=$PATH:/etc:$OPATH
2018
Damien Millera8e06ce2003-11-21 23:48:55 +11002019# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002020OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2021OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2022OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2023OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2024OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2025OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2026OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2027OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2028OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2029OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2030OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2031OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2032OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2033OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2034OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2035OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002036# restore PATH
2037PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002038
2039# Where does ssh-rand-helper get its randomness from?
2040INSTALL_SSH_PRNG_CMDS=""
2041if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2042 if test ! -z "$PRNGD_PORT" ; then
2043 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2044 elif test ! -z "$PRNGD_SOCKET" ; then
2045 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2046 else
2047 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2048 RAND_HELPER_CMDHASH=yes
2049 INSTALL_SSH_PRNG_CMDS="yes"
2050 fi
2051fi
2052AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2053
2054
Ben Lindstromb5628642000-10-18 00:02:25 +00002055# Cheap hack to ensure NEWS-OS libraries are arranged right.
2056if test ! -z "$SONY" ; then
2057 LIBS="$LIBS -liberty";
2058fi
2059
Damien Miller57f39152005-11-24 19:58:19 +11002060# Check for long long datatypes
2061AC_CHECK_TYPES([long long, unsigned long long, long double])
2062
2063# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002064AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002065AC_CHECK_SIZEOF(short int, 2)
2066AC_CHECK_SIZEOF(int, 4)
2067AC_CHECK_SIZEOF(long int, 4)
2068AC_CHECK_SIZEOF(long long int, 8)
2069
Damien Millerfa2bb692002-04-23 23:22:25 +10002070# Sanity check long long for some platforms (AIX)
2071if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2072 ac_cv_sizeof_long_long_int=0
2073fi
2074
Darren Tucker537f1ed2005-10-25 18:38:33 +10002075# compute LLONG_MIN and LLONG_MAX if we don't know them.
2076if test -z "$have_llong_max"; then
2077 AC_MSG_CHECKING([for max value of long long])
2078 AC_RUN_IFELSE(
2079 [AC_LANG_SOURCE([[
2080#include <stdio.h>
2081/* Why is this so damn hard? */
2082#ifdef __GNUC__
2083# undef __GNUC__
2084#endif
2085#define __USE_ISOC99
2086#include <limits.h>
2087#define DATA "conftest.llminmax"
2088int main(void) {
2089 FILE *f;
2090 long long i, llmin, llmax = 0;
2091
2092 if((f = fopen(DATA,"w")) == NULL)
2093 exit(1);
2094
2095#if defined(LLONG_MIN) && defined(LLONG_MAX)
2096 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2097 llmin = LLONG_MIN;
2098 llmax = LLONG_MAX;
2099#else
2100 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2101 /* This will work on one's complement and two's complement */
2102 for (i = 1; i > llmax; i <<= 1, i++)
2103 llmax = i;
2104 llmin = llmax + 1LL; /* wrap */
2105#endif
2106
2107 /* Sanity check */
2108 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2109 || llmax - 1 > llmax) {
2110 fprintf(f, "unknown unknown\n");
2111 exit(2);
2112 }
2113
2114 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2115 exit(3);
2116
2117 exit(0);
2118}
2119 ]])],
2120 [
2121 llong_min=`$AWK '{print $1}' conftest.llminmax`
2122 llong_max=`$AWK '{print $2}' conftest.llminmax`
2123
2124 # snprintf on some Tru64s doesn't understand "%lld"
2125 case "$host" in
2126 alpha-dec-osf*)
2127 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2128 test "x$llong_max" = "xld"; then
2129 llong_min="-9223372036854775808"
2130 llong_max="9223372036854775807"
2131 fi
2132 ;;
2133 esac
2134
2135 AC_MSG_RESULT($llong_max)
2136 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2137 [max value of long long calculated by configure])
2138 AC_MSG_CHECKING([for min value of long long])
2139 AC_MSG_RESULT($llong_min)
2140 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2141 [min value of long long calculated by configure])
2142 ],
2143 [
2144 AC_MSG_RESULT(not found)
2145 ],
2146 [
2147 AC_MSG_WARN([cross compiling: not checking])
2148 ]
2149 )
2150fi
2151
2152
Damien Millera22ba012000-03-02 23:09:20 +11002153# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002154AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2155 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002156 [ #include <sys/types.h> ],
2157 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002158 [ ac_cv_have_u_int="yes" ],
2159 [ ac_cv_have_u_int="no" ]
2160 )
2161])
2162if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002163 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002164 have_u_int=1
2165fi
2166
Damien Miller61e50f12000-05-08 20:49:37 +10002167AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2168 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002169 [ #include <sys/types.h> ],
2170 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002171 [ ac_cv_have_intxx_t="yes" ],
2172 [ ac_cv_have_intxx_t="no" ]
2173 )
2174])
2175if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002176 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002177 have_intxx_t=1
2178fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002179
2180if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002181 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002182then
2183 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2184 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002185 [ #include <stdint.h> ],
2186 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002187 [
2188 AC_DEFINE(HAVE_INTXX_T)
2189 AC_MSG_RESULT(yes)
2190 ],
2191 [ AC_MSG_RESULT(no) ]
2192 )
2193fi
2194
Damien Miller578783e2000-09-23 14:12:24 +11002195AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2196 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002197 [
2198#include <sys/types.h>
2199#ifdef HAVE_STDINT_H
2200# include <stdint.h>
2201#endif
2202#include <sys/socket.h>
2203#ifdef HAVE_SYS_BITYPES_H
2204# include <sys/bitypes.h>
2205#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002206 ],
2207 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002208 [ ac_cv_have_int64_t="yes" ],
2209 [ ac_cv_have_int64_t="no" ]
2210 )
2211])
2212if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002213 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002214fi
2215
Damien Miller61e50f12000-05-08 20:49:37 +10002216AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2217 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002218 [ #include <sys/types.h> ],
2219 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002220 [ ac_cv_have_u_intxx_t="yes" ],
2221 [ ac_cv_have_u_intxx_t="no" ]
2222 )
2223])
2224if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002225 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002226 have_u_intxx_t=1
2227fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002228
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002229if test -z "$have_u_intxx_t" ; then
2230 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2231 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002232 [ #include <sys/socket.h> ],
2233 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002234 [
2235 AC_DEFINE(HAVE_U_INTXX_T)
2236 AC_MSG_RESULT(yes)
2237 ],
2238 [ AC_MSG_RESULT(no) ]
2239 )
2240fi
2241
Damien Miller578783e2000-09-23 14:12:24 +11002242AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2243 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002244 [ #include <sys/types.h> ],
2245 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002246 [ ac_cv_have_u_int64_t="yes" ],
2247 [ ac_cv_have_u_int64_t="no" ]
2248 )
2249])
2250if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002251 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002252 have_u_int64_t=1
2253fi
2254
Tim Rice4cec93f2002-02-26 08:40:48 -08002255if test -z "$have_u_int64_t" ; then
2256 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2257 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002258 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002259 [ u_int64_t a; a = 1],
2260 [
2261 AC_DEFINE(HAVE_U_INT64_T)
2262 AC_MSG_RESULT(yes)
2263 ],
2264 [ AC_MSG_RESULT(no) ]
2265 )
2266fi
2267
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002268if test -z "$have_u_intxx_t" ; then
2269 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2270 AC_TRY_COMPILE(
2271 [
2272#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002273 ],
2274 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002275 [ ac_cv_have_uintxx_t="yes" ],
2276 [ ac_cv_have_uintxx_t="no" ]
2277 )
2278 ])
2279 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002280 AC_DEFINE(HAVE_UINTXX_T, 1,
2281 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002282 fi
2283fi
2284
2285if test -z "$have_uintxx_t" ; then
2286 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2287 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002288 [ #include <stdint.h> ],
2289 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002290 [
2291 AC_DEFINE(HAVE_UINTXX_T)
2292 AC_MSG_RESULT(yes)
2293 ],
2294 [ AC_MSG_RESULT(no) ]
2295 )
2296fi
2297
Damien Milleredb82922000-06-20 13:25:52 +10002298if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002299 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002300then
2301 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2302 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002303 [
2304#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002305 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002306 [
Damien Miller70494d12000-04-03 15:57:06 +10002307 int8_t a; int16_t b; int32_t c;
2308 u_int8_t e; u_int16_t f; u_int32_t g;
2309 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002310 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002311 [
2312 AC_DEFINE(HAVE_U_INTXX_T)
2313 AC_DEFINE(HAVE_INTXX_T)
2314 AC_MSG_RESULT(yes)
2315 ],
2316 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002317 )
Damien Millerb29ea912000-01-15 14:12:03 +11002318fi
2319
Damien Miller58be7382001-09-15 21:31:54 +10002320
2321AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2322 AC_TRY_COMPILE(
2323 [
2324#include <sys/types.h>
2325 ],
2326 [ u_char foo; foo = 125; ],
2327 [ ac_cv_have_u_char="yes" ],
2328 [ ac_cv_have_u_char="no" ]
2329 )
2330])
2331if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002332 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002333fi
2334
Tim Rice13aae5e2001-10-21 17:53:58 -07002335TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002336
Tim Rice200a5c02002-02-26 22:12:34 -08002337AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002338
Damien Miller848b9932005-02-24 12:12:34 +11002339AC_CHECK_TYPES(in_addr_t,,,
2340[#include <sys/types.h>
2341#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002342
Damien Miller61e50f12000-05-08 20:49:37 +10002343AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2344 AC_TRY_COMPILE(
2345 [
2346#include <sys/types.h>
2347 ],
2348 [ size_t foo; foo = 1235; ],
2349 [ ac_cv_have_size_t="yes" ],
2350 [ ac_cv_have_size_t="no" ]
2351 )
2352])
2353if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002354 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002355fi
Damien Miller95058511999-12-29 10:36:45 +11002356
Damien Miller615f9392000-05-17 22:53:33 +10002357AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2358 AC_TRY_COMPILE(
2359 [
2360#include <sys/types.h>
2361 ],
2362 [ ssize_t foo; foo = 1235; ],
2363 [ ac_cv_have_ssize_t="yes" ],
2364 [ ac_cv_have_ssize_t="no" ]
2365 )
2366])
2367if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002368 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002369fi
2370
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002371AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2372 AC_TRY_COMPILE(
2373 [
2374#include <time.h>
2375 ],
2376 [ clock_t foo; foo = 1235; ],
2377 [ ac_cv_have_clock_t="yes" ],
2378 [ ac_cv_have_clock_t="no" ]
2379 )
2380])
2381if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002382 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002383fi
2384
Damien Millerb54b40e2000-06-23 08:23:34 +10002385AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2386 AC_TRY_COMPILE(
2387 [
2388#include <sys/types.h>
2389#include <sys/socket.h>
2390 ],
2391 [ sa_family_t foo; foo = 1235; ],
2392 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002393 [ AC_TRY_COMPILE(
2394 [
2395#include <sys/types.h>
2396#include <sys/socket.h>
2397#include <netinet/in.h>
2398 ],
2399 [ sa_family_t foo; foo = 1235; ],
2400 [ ac_cv_have_sa_family_t="yes" ],
2401
Damien Millerb54b40e2000-06-23 08:23:34 +10002402 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002403 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002404 )
2405])
2406if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002407 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2408 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002409fi
2410
Damien Miller0f91b4e2000-06-18 15:43:25 +10002411AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2412 AC_TRY_COMPILE(
2413 [
2414#include <sys/types.h>
2415 ],
2416 [ pid_t foo; foo = 1235; ],
2417 [ ac_cv_have_pid_t="yes" ],
2418 [ ac_cv_have_pid_t="no" ]
2419 )
2420])
2421if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002422 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002423fi
2424
2425AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2426 AC_TRY_COMPILE(
2427 [
2428#include <sys/types.h>
2429 ],
2430 [ mode_t foo; foo = 1235; ],
2431 [ ac_cv_have_mode_t="yes" ],
2432 [ ac_cv_have_mode_t="no" ]
2433 )
2434])
2435if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002436 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002437fi
2438
Damien Miller61e50f12000-05-08 20:49:37 +10002439
2440AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2441 AC_TRY_COMPILE(
2442 [
Damien Miller81171112000-04-23 11:14:01 +10002443#include <sys/types.h>
2444#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002445 ],
2446 [ struct sockaddr_storage s; ],
2447 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2448 [ ac_cv_have_struct_sockaddr_storage="no" ]
2449 )
2450])
2451if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002452 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2453 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002454fi
Damien Miller34132e52000-01-14 15:45:46 +11002455
Damien Miller61e50f12000-05-08 20:49:37 +10002456AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2457 AC_TRY_COMPILE(
2458 [
Damien Miller7b22d652000-06-18 14:07:04 +10002459#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002460#include <netinet/in.h>
2461 ],
2462 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2463 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2464 [ ac_cv_have_struct_sockaddr_in6="no" ]
2465 )
2466])
2467if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002468 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2469 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002470fi
Damien Miller34132e52000-01-14 15:45:46 +11002471
Damien Miller61e50f12000-05-08 20:49:37 +10002472AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2473 AC_TRY_COMPILE(
2474 [
Damien Miller7b22d652000-06-18 14:07:04 +10002475#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002476#include <netinet/in.h>
2477 ],
2478 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2479 [ ac_cv_have_struct_in6_addr="yes" ],
2480 [ ac_cv_have_struct_in6_addr="no" ]
2481 )
2482])
2483if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002484 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2485 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002486fi
Damien Miller34132e52000-01-14 15:45:46 +11002487
Damien Miller61e50f12000-05-08 20:49:37 +10002488AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2489 AC_TRY_COMPILE(
2490 [
Damien Miller81171112000-04-23 11:14:01 +10002491#include <sys/types.h>
2492#include <sys/socket.h>
2493#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002494 ],
2495 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2496 [ ac_cv_have_struct_addrinfo="yes" ],
2497 [ ac_cv_have_struct_addrinfo="no" ]
2498 )
2499])
2500if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002501 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2502 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002503fi
2504
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002505AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2506 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002507 [ #include <sys/time.h> ],
2508 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002509 [ ac_cv_have_struct_timeval="yes" ],
2510 [ ac_cv_have_struct_timeval="no" ]
2511 )
2512])
2513if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002514 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002515 have_struct_timeval=1
2516fi
2517
Tim Rice4e4dc562003-03-18 10:21:40 -08002518AC_CHECK_TYPES(struct timespec)
2519
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002520# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002521if test "x$ac_cv_have_int64_t" = "xno" && \
2522 test "x$ac_cv_sizeof_long_int" != "x8" && \
2523 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002524 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2525 echo "an alternative compiler (I.E., GCC) before continuing."
2526 echo ""
2527 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002528else
2529dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002530 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002531 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002532#include <stdio.h>
2533#include <string.h>
2534#ifdef HAVE_SNPRINTF
2535main()
2536{
2537 char buf[50];
2538 char expected_out[50];
2539 int mazsize = 50 ;
2540#if (SIZEOF_LONG_INT == 8)
2541 long int num = 0x7fffffffffffffff;
2542#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002543 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002544#endif
2545 strcpy(expected_out, "9223372036854775807");
2546 snprintf(buf, mazsize, "%lld", num);
2547 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002548 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002549 exit(0);
2550}
2551#else
2552main() { exit(0); }
2553#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002554 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002555 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002556 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002557fi
2558
Damien Miller78315eb2000-09-29 23:01:36 +11002559dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002560OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2561OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2562OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2563OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2564OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002565OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002566OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2567OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002568OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002569OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2570OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2571OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2572OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002573OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2574OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2575OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2576OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002577
2578AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002579AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2580 [Define if we don't have struct __res_state in resolv.h])],
2581[
2582#include <stdio.h>
2583#if HAVE_SYS_TYPES_H
2584# include <sys/types.h>
2585#endif
2586#include <netinet/in.h>
2587#include <arpa/nameser.h>
2588#include <resolv.h>
2589])
andre2ff7b5d2000-06-03 14:57:40 +00002590
Damien Miller61e50f12000-05-08 20:49:37 +10002591AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2592 ac_cv_have_ss_family_in_struct_ss, [
2593 AC_TRY_COMPILE(
2594 [
Damien Miller81171112000-04-23 11:14:01 +10002595#include <sys/types.h>
2596#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002597 ],
2598 [ struct sockaddr_storage s; s.ss_family = 1; ],
2599 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2600 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2601 )
2602])
2603if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002604 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002605fi
2606
Damien Miller61e50f12000-05-08 20:49:37 +10002607AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2608 ac_cv_have___ss_family_in_struct_ss, [
2609 AC_TRY_COMPILE(
2610 [
Damien Miller81171112000-04-23 11:14:01 +10002611#include <sys/types.h>
2612#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002613 ],
2614 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2615 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2616 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2617 )
2618])
2619if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002620 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2621 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002622fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002623
Damien Millerad833b32000-08-23 10:46:23 +10002624AC_CACHE_CHECK([for pw_class field in struct passwd],
2625 ac_cv_have_pw_class_in_struct_passwd, [
2626 AC_TRY_COMPILE(
2627 [
Damien Millerad833b32000-08-23 10:46:23 +10002628#include <pwd.h>
2629 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002630 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002631 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2632 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2633 )
2634])
2635if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002636 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2637 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002638fi
2639
Kevin Steves82456952001-06-22 21:14:18 +00002640AC_CACHE_CHECK([for pw_expire field in struct passwd],
2641 ac_cv_have_pw_expire_in_struct_passwd, [
2642 AC_TRY_COMPILE(
2643 [
2644#include <pwd.h>
2645 ],
2646 [ struct passwd p; p.pw_expire = 0; ],
2647 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2648 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2649 )
2650])
2651if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002652 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2653 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002654fi
2655
2656AC_CACHE_CHECK([for pw_change field in struct passwd],
2657 ac_cv_have_pw_change_in_struct_passwd, [
2658 AC_TRY_COMPILE(
2659 [
2660#include <pwd.h>
2661 ],
2662 [ struct passwd p; p.pw_change = 0; ],
2663 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2664 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2665 )
2666])
2667if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002668 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2669 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002670fi
Damien Miller61e50f12000-05-08 20:49:37 +10002671
Tim Rice28bbb0c2002-05-27 17:37:32 -07002672dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002673AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2674 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002675 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002676 [
Tim Riceae49fe62002-04-12 10:26:21 -07002677#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002678#include <sys/socket.h>
2679#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002680int main() {
2681#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002682#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002683exit(1);
2684#endif
2685struct msghdr m;
2686m.msg_accrights = 0;
2687exit(0);
2688}
Kevin Steves939c9db2002-03-22 17:23:25 +00002689 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002690 [ ac_cv_have_accrights_in_msghdr="yes" ],
2691 [ ac_cv_have_accrights_in_msghdr="no" ]
2692 )
2693])
2694if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002695 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2696 [Define if your system uses access rights style
2697 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002698fi
2699
Kevin Stevesa44e0352002-04-07 16:18:03 +00002700AC_CACHE_CHECK([for msg_control field in struct msghdr],
2701 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002702 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002703 [
Tim Riceae49fe62002-04-12 10:26:21 -07002704#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002705#include <sys/socket.h>
2706#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002707int main() {
2708#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002709#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002710exit(1);
2711#endif
2712struct msghdr m;
2713m.msg_control = 0;
2714exit(0);
2715}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002716 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002717 [ ac_cv_have_control_in_msghdr="yes" ],
2718 [ ac_cv_have_control_in_msghdr="no" ]
2719 )
2720])
2721if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002722 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2723 [Define if your system uses ancillary data style
2724 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002725fi
2726
Damien Miller61e50f12000-05-08 20:49:37 +10002727AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002728 AC_TRY_LINK([],
2729 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002730 [ ac_cv_libc_defines___progname="yes" ],
2731 [ ac_cv_libc_defines___progname="no" ]
2732 )
2733])
2734if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002735 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002736fi
2737
Kevin Steves4846f4a2002-03-22 18:19:53 +00002738AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2739 AC_TRY_LINK([
2740#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002741],
2742 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002743 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2744 [ ac_cv_cc_implements___FUNCTION__="no" ]
2745 )
2746])
2747if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002748 AC_DEFINE(HAVE___FUNCTION__, 1,
2749 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002750fi
2751
2752AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2753 AC_TRY_LINK([
2754#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002755],
2756 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002757 [ ac_cv_cc_implements___func__="yes" ],
2758 [ ac_cv_cc_implements___func__="no" ]
2759 )
2760])
2761if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002762 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002763fi
2764
Damien Miller57f39152005-11-24 19:58:19 +11002765AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
2766 AC_TRY_LINK(
2767 [#include <stdarg.h>
2768 va_list x,y;],
2769 [va_copy(x,y);],
2770 [ ac_cv_have_va_copy="yes" ],
2771 [ ac_cv_have_va_copy="no" ]
2772 )
2773])
2774if test "x$ac_cv_have_va_copy" = "xyes" ; then
2775 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
2776fi
2777
2778AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
2779 AC_TRY_LINK(
2780 [#include <stdarg.h>
2781 va_list x,y;],
2782 [__va_copy(x,y);],
2783 [ ac_cv_have___va_copy="yes" ],
2784 [ ac_cv_have___va_copy="no" ]
2785 )
2786])
2787if test "x$ac_cv_have___va_copy" = "xyes" ; then
2788 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2789fi
2790
Damien Miller4f8e6692001-07-14 13:22:53 +10002791AC_CACHE_CHECK([whether getopt has optreset support],
2792 ac_cv_have_getopt_optreset, [
2793 AC_TRY_LINK(
2794 [
2795#include <getopt.h>
2796 ],
2797 [ extern int optreset; optreset = 0; ],
2798 [ ac_cv_have_getopt_optreset="yes" ],
2799 [ ac_cv_have_getopt_optreset="no" ]
2800 )
2801])
2802if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002803 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2804 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002805fi
Damien Millera22ba012000-03-02 23:09:20 +11002806
Damien Millerecbb26d2000-07-15 14:59:14 +10002807AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002808 AC_TRY_LINK([],
2809 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002810 [ ac_cv_libc_defines_sys_errlist="yes" ],
2811 [ ac_cv_libc_defines_sys_errlist="no" ]
2812 )
2813])
2814if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002815 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2816 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002817fi
2818
2819
Damien Miller11fa2cc2000-08-16 10:35:58 +10002820AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002821 AC_TRY_LINK([],
2822 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002823 [ ac_cv_libc_defines_sys_nerr="yes" ],
2824 [ ac_cv_libc_defines_sys_nerr="no" ]
2825 )
2826])
2827if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002828 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002829fi
2830
Damien Millera8e06ce2003-11-21 23:48:55 +11002831SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002832# Check whether user wants sectok support
2833AC_ARG_WITH(sectok,
2834 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002835 [
2836 if test "x$withval" != "xno" ; then
2837 if test "x$withval" != "xyes" ; then
2838 CPPFLAGS="$CPPFLAGS -I${withval}"
2839 LDFLAGS="$LDFLAGS -L${withval}"
2840 if test ! -z "$need_dash_r" ; then
2841 LDFLAGS="$LDFLAGS -R${withval}"
2842 fi
2843 if test ! -z "$blibpath" ; then
2844 blibpath="$blibpath:${withval}"
2845 fi
2846 fi
2847 AC_CHECK_HEADERS(sectok.h)
2848 if test "$ac_cv_header_sectok_h" != yes; then
2849 AC_MSG_ERROR(Can't find sectok.h)
2850 fi
2851 AC_CHECK_LIB(sectok, sectok_open)
2852 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2853 AC_MSG_ERROR(Can't find libsectok)
2854 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002855 AC_DEFINE(SMARTCARD, 1,
2856 [Define if you want smartcard support])
2857 AC_DEFINE(USE_SECTOK, 1,
2858 [Define if you want smartcard support
2859 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002860 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002861 fi
2862 ]
2863)
2864
2865# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002866OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002867AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10002868 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08002869 [
2870 if test "x$withval" != "xno" ; then
2871 if test "x$withval" != "xyes" ; then
2872 OPENSC_CONFIG=$withval/bin/opensc-config
2873 else
2874 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2875 fi
2876 if test "$OPENSC_CONFIG" != "no"; then
2877 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2878 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2879 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2880 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2881 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002882 AC_DEFINE(USE_OPENSC, 1,
2883 [Define if you want smartcard support
2884 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002885 SCARD_MSG="yes, using OpenSC"
2886 fi
2887 fi
2888 ]
2889)
Damien Miller85de5802001-09-18 14:01:11 +10002890
Darren Tucker5f88d342003-10-15 16:57:57 +10002891# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002892AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002893 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2894 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002895 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002896 # Needed by our getrrsetbyname()
2897 AC_SEARCH_LIBS(res_query, resolv)
2898 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002899 AC_MSG_CHECKING(if res_query will link)
2900 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2901 [AC_MSG_RESULT(no)
2902 saved_LIBS="$LIBS"
2903 LIBS="$LIBS -lresolv"
2904 AC_MSG_CHECKING(for res_query in -lresolv)
2905 AC_LINK_IFELSE([
2906#include <resolv.h>
2907int main()
2908{
2909 res_query (0, 0, 0, 0, 0);
2910 return 0;
2911}
2912 ],
2913 [LIBS="$LIBS -lresolv"
2914 AC_MSG_RESULT(yes)],
2915 [LIBS="$saved_LIBS"
2916 AC_MSG_RESULT(no)])
2917 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002918 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002919 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002920 [#include <sys/types.h>
2921 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002922 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07002923 [AC_DEFINE(HAVE_HEADER_AD, 1,
2924 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10002925 [#include <arpa/nameser.h>])
2926 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002927
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002928# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002929KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002930AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002931 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002932 [ if test "x$withval" != "xno" ; then
2933 if test "x$withval" = "xyes" ; then
2934 KRB5ROOT="/usr/local"
2935 else
2936 KRB5ROOT=${withval}
2937 fi
2938
Tim Rice7df8d392005-09-19 09:33:39 -07002939 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11002940 KRB5_MSG="yes"
2941
2942 AC_MSG_CHECKING(for krb5-config)
2943 if test -x $KRB5ROOT/bin/krb5-config ; then
2944 KRB5CONF=$KRB5ROOT/bin/krb5-config
2945 AC_MSG_RESULT($KRB5CONF)
2946
2947 AC_MSG_CHECKING(for gssapi support)
2948 if $KRB5CONF | grep gssapi >/dev/null ; then
2949 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002950 AC_DEFINE(GSSAPI, 1,
2951 [Define this if you want GSSAPI
2952 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11002953 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002954 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002955 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002956 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002957 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002958 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2959 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002960 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002961 AC_MSG_CHECKING(whether we are using Heimdal)
2962 AC_TRY_COMPILE([ #include <krb5.h> ],
2963 [ char *tmp = heimdal_version; ],
2964 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002965 AC_DEFINE(HEIMDAL, 1,
2966 [Define this if you are using the
2967 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002968 AC_MSG_RESULT(no)
2969 )
2970 else
2971 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002972 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002973 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002974 AC_MSG_CHECKING(whether we are using Heimdal)
2975 AC_TRY_COMPILE([ #include <krb5.h> ],
2976 [ char *tmp = heimdal_version; ],
2977 [ AC_MSG_RESULT(yes)
2978 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002979 K5LIBS="-lkrb5 -ldes"
2980 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002981 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002982 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002983 ],
2984 [ AC_MSG_RESULT(no)
2985 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2986 ]
2987 )
Damien Miller200d0a72003-06-30 19:21:36 +10002988 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002989
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002990 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2991 [ AC_DEFINE(GSSAPI)
2992 K5LIBS="-lgssapi $K5LIBS" ],
2993 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2994 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002995 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002996 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2997 $K5LIBS)
2998 ],
2999 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003000
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003001 AC_CHECK_HEADER(gssapi.h, ,
3002 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003003 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003004 AC_CHECK_HEADERS(gssapi.h, ,
3005 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003006 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003007 ]
3008 )
3009
3010 oldCPP="$CPPFLAGS"
3011 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3012 AC_CHECK_HEADER(gssapi_krb5.h, ,
3013 [ CPPFLAGS="$oldCPP" ])
3014
Damien Millera8e06ce2003-11-21 23:48:55 +11003015 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003016 if test ! -z "$need_dash_r" ; then
3017 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3018 fi
3019 if test ! -z "$blibpath" ; then
3020 blibpath="$blibpath:${KRB5ROOT}/lib"
3021 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003022
3023 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3024 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3025 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3026
3027 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003028 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3029 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003030 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003031 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003032)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003033
Damien Millera22ba012000-03-02 23:09:20 +11003034# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003035
Damien Millerf58c6722002-05-13 13:15:42 +10003036PRIVSEP_PATH=/var/empty
3037AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003038 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003039 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003040 if test -n "$withval" && test "x$withval" != "xno" && \
3041 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003042 PRIVSEP_PATH=$withval
3043 fi
3044 ]
3045)
3046AC_SUBST(PRIVSEP_PATH)
3047
Damien Millera22ba012000-03-02 23:09:20 +11003048AC_ARG_WITH(xauth,
3049 [ --with-xauth=PATH Specify path to xauth program ],
3050 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003051 if test -n "$withval" && test "x$withval" != "xno" && \
3052 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003053 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003054 fi
3055 ],
3056 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003057 TestPath="$PATH"
3058 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3059 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3060 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3061 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3062 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003063 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003064 xauth_path="/usr/openwin/bin/xauth"
3065 fi
3066 ]
3067)
3068
Damien Miller7d901272003-01-13 16:55:22 +11003069STRIP_OPT=-s
3070AC_ARG_ENABLE(strip,
3071 [ --disable-strip Disable calling strip(1) on install],
3072 [
3073 if test "x$enableval" = "xno" ; then
3074 STRIP_OPT=
3075 fi
3076 ]
3077)
3078AC_SUBST(STRIP_OPT)
3079
Damien Millera19cf472000-11-29 13:28:50 +11003080if test -z "$xauth_path" ; then
3081 XAUTH_PATH="undefined"
3082 AC_SUBST(XAUTH_PATH)
3083else
Tim Rice7df8d392005-09-19 09:33:39 -07003084 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3085 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003086 XAUTH_PATH=$xauth_path
3087 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003088fi
Damien Millera22ba012000-03-02 23:09:20 +11003089
3090# Check for mail directory (last resort if we cannot get it from headers)
3091if test ! -z "$MAIL" ; then
3092 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003093 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3094 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003095fi
3096
Darren Tucker623d92f2004-09-12 22:36:15 +10003097if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003098 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3099 disable_ptmx_check=yes
3100fi
Damien Millera22ba012000-03-02 23:09:20 +11003101if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003102 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003103 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003104 [
Tim Rice7df8d392005-09-19 09:33:39 -07003105 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3106 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003107 have_dev_ptmx=1
3108 ]
3109 )
3110 fi
Damien Millera22ba012000-03-02 23:09:20 +11003111fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003112
Darren Tucker623d92f2004-09-12 22:36:15 +10003113if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003114 AC_CHECK_FILE("/dev/ptc",
3115 [
Tim Rice7df8d392005-09-19 09:33:39 -07003116 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3117 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003118 have_dev_ptc=1
3119 ]
3120 )
3121else
3122 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3123fi
Damien Miller204ad072000-03-02 23:56:12 +11003124
Damien Millera22ba012000-03-02 23:09:20 +11003125# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003126AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003127 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003128 [
Damien Miller897741e2001-04-16 10:41:46 +10003129 case "$withval" in
3130 man|cat|doc)
3131 MANTYPE=$withval
3132 ;;
3133 *)
3134 AC_MSG_ERROR(invalid man type: $withval)
3135 ;;
3136 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003137 ]
3138)
Ben Lindstrombc709922001-04-18 18:04:21 +00003139if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003140 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3141 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003142 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3143 MANTYPE=doc
3144 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3145 MANTYPE=man
3146 else
3147 MANTYPE=cat
3148 fi
3149fi
Damien Miller670a4b82000-01-22 13:53:11 +11003150AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003151if test "$MANTYPE" = "doc"; then
3152 mansubdir=man;
3153else
3154 mansubdir=$MANTYPE;
3155fi
3156AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003157
Damien Millera22ba012000-03-02 23:09:20 +11003158# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003159MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003160AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003161 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003162 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003163 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003164 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3165 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003166 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003167 fi
3168 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003169)
3170
Damien Millera22ba012000-03-02 23:09:20 +11003171# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003172AC_ARG_WITH(shadow,
3173 [ --without-shadow Disable shadow password support],
3174 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003175 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003176 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003177 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003178 fi
3179 ]
3180)
3181
Damien Miller1f335fb2000-06-26 11:31:33 +10003182if test -z "$disable_shadow" ; then
3183 AC_MSG_CHECKING([if the systems has expire shadow information])
3184 AC_TRY_COMPILE(
3185 [
3186#include <sys/types.h>
3187#include <shadow.h>
3188 struct spwd sp;
3189 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3190 [ sp_expire_available=yes ], []
3191 )
3192
3193 if test "x$sp_expire_available" = "xyes" ; then
3194 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003195 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3196 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003197 else
3198 AC_MSG_RESULT(no)
3199 fi
3200fi
3201
Damien Millera22ba012000-03-02 23:09:20 +11003202# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003203if test ! -z "$IPADDR_IN_DISPLAY" ; then
3204 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003205 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3206 [Define if you need to use IP address
3207 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003208else
Damien Millera8e06ce2003-11-21 23:48:55 +11003209 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003210 AC_ARG_WITH(ipaddr-display,
3211 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3212 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003213 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003214 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003215 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003216 fi
3217 ]
3218 )
3219fi
Damien Miller76112de1999-12-21 11:18:08 +11003220
Darren Tuckere1a790d2003-09-16 11:52:19 +10003221# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003222AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003223 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003224 [ if test "x$enableval" = "xno"; then
3225 AC_MSG_NOTICE([/etc/default/login handling disabled])
3226 etc_default_login=no
3227 else
3228 etc_default_login=yes
3229 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003230 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3231 then
3232 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3233 etc_default_login=no
3234 else
3235 etc_default_login=yes
3236 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003237)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003238
Darren Tucker2f9573d2005-02-10 22:28:54 +11003239if test "x$etc_default_login" != "xno"; then
3240 AC_CHECK_FILE("/etc/default/login",
3241 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003242 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003243 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3244 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003245 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003246fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003247
Tim Rice43a1c132002-04-17 21:19:14 -07003248dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003249if test $ac_cv_func_login_getcapbool = "yes" && \
3250 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003251 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003252fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003253
Damien Millera22ba012000-03-02 23:09:20 +11003254# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003255SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003256AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003257 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003258 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003259 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003260 AC_MSG_WARN([
3261--with-default-path=PATH has no effect on this system.
3262Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003263 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003264 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003265 AC_MSG_WARN([
3266--with-default-path=PATH will only be used if PATH is not defined in
3267$external_path_file .])
3268 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003269 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003270 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003271 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003272 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003273 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3274 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003275 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003276 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003277 AC_MSG_WARN([
3278If PATH is defined in $external_path_file, ensure the path to scp is included,
3279otherwise scp will not work.])
3280 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003281 AC_RUN_IFELSE(
3282 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003283/* find out what STDPATH is */
3284#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003285#ifdef HAVE_PATHS_H
3286# include <paths.h>
3287#endif
3288#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003289# ifdef _PATH_USERPATH /* Irix */
3290# define _PATH_STDPATH _PATH_USERPATH
3291# else
3292# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3293# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003294#endif
3295#include <sys/types.h>
3296#include <sys/stat.h>
3297#include <fcntl.h>
3298#define DATA "conftest.stdpath"
3299
3300main()
3301{
3302 FILE *fd;
3303 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003304
Tim Rice59ea0a02001-03-10 13:50:45 -08003305 fd = fopen(DATA,"w");
3306 if(fd == NULL)
3307 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003308
Tim Rice59ea0a02001-03-10 13:50:45 -08003309 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3310 exit(1);
3311
3312 exit(0);
3313}
Darren Tucker314d89e2005-10-17 23:29:23 +10003314 ]])],
3315 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003316 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3317 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3318 )
3319# make sure $bindir is in USER_PATH so scp will work
3320 t_bindir=`eval echo ${bindir}`
3321 case $t_bindir in
3322 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3323 esac
3324 case $t_bindir in
3325 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3326 esac
3327 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3328 if test $? -ne 0 ; then
3329 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3330 if test $? -ne 0 ; then
3331 user_path=$user_path:$t_bindir
3332 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3333 fi
3334 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003335 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003336)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003337if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003338 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003339 AC_SUBST(user_path)
3340fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003341
Damien Millera18bbd32002-05-13 10:48:57 +10003342# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003343AC_ARG_WITH(superuser-path,
3344 [ --with-superuser-path= Specify different path for super-user],
3345 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003346 if test -n "$withval" && test "x$withval" != "xno" && \
3347 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003348 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3349 [Define if you want a different $PATH
3350 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003351 superuser_path=$withval
3352 fi
3353 ]
3354)
3355
3356
Damien Miller61e50f12000-05-08 20:49:37 +10003357AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003358IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003359AC_ARG_WITH(4in6,
3360 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3361 [
3362 if test "x$withval" != "xno" ; then
3363 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003364 AC_DEFINE(IPV4_IN_IPV6, 1,
3365 [Detect IPv4 in IPv6 mapped addresses
3366 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003367 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003368 else
3369 AC_MSG_RESULT(no)
3370 fi
3371 ],[
3372 if test "x$inet6_default_4in6" = "xyes"; then
3373 AC_MSG_RESULT([yes (default)])
3374 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003375 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003376 else
3377 AC_MSG_RESULT([no (default)])
3378 fi
3379 ]
3380)
3381
Damien Miller60396b02001-02-18 17:01:00 +11003382# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003383BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003384AC_ARG_WITH(bsd-auth,
3385 [ --with-bsd-auth Enable BSD auth support],
3386 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003387 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003388 AC_DEFINE(BSD_AUTH, 1,
3389 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003390 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003391 fi
3392 ]
3393)
3394
Damien Millera22ba012000-03-02 23:09:20 +11003395# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003396piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003397# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003398if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003399 piddir=`eval echo ${sysconfdir}`
3400 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003401 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003402 esac
3403fi
3404
Tim Rice88f2ab52002-03-17 12:17:34 -08003405AC_ARG_WITH(pid-dir,
3406 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3407 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003408 if test -n "$withval" && test "x$withval" != "xno" && \
3409 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003410 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003411 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003412 AC_MSG_WARN([** no $piddir directory on this system **])
3413 fi
3414 fi
3415 ]
3416)
3417
Tim Rice7df8d392005-09-19 09:33:39 -07003418AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003419AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003420
andre2ff7b5d2000-06-03 14:57:40 +00003421dnl allow user to disable some login recording features
3422AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003423 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003424 [
3425 if test "x$enableval" = "xno" ; then
3426 AC_DEFINE(DISABLE_LASTLOG)
3427 fi
3428 ]
andre2ff7b5d2000-06-03 14:57:40 +00003429)
3430AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003431 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003432 [
3433 if test "x$enableval" = "xno" ; then
3434 AC_DEFINE(DISABLE_UTMP)
3435 fi
3436 ]
andre2ff7b5d2000-06-03 14:57:40 +00003437)
3438AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003439 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003440 [
3441 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003442 AC_DEFINE(DISABLE_UTMPX, 1,
3443 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003444 fi
3445 ]
andre2ff7b5d2000-06-03 14:57:40 +00003446)
3447AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003448 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003449 [
3450 if test "x$enableval" = "xno" ; then
3451 AC_DEFINE(DISABLE_WTMP)
3452 fi
3453 ]
andre2ff7b5d2000-06-03 14:57:40 +00003454)
3455AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003456 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003457 [
3458 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003459 AC_DEFINE(DISABLE_WTMPX, 1,
3460 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003461 fi
3462 ]
andre2ff7b5d2000-06-03 14:57:40 +00003463)
3464AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003465 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003466 [
3467 if test "x$enableval" = "xno" ; then
3468 AC_DEFINE(DISABLE_LOGIN)
3469 fi
3470 ]
andre2ff7b5d2000-06-03 14:57:40 +00003471)
3472AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003473 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003474 [
3475 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003476 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3477 [Define if you don't want to use pututline()
3478 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003479 fi
3480 ]
andre2ff7b5d2000-06-03 14:57:40 +00003481)
3482AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003483 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003484 [
3485 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003486 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3487 [Define if you don't want to use pututxline()
3488 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003489 fi
3490 ]
andre2ff7b5d2000-06-03 14:57:40 +00003491)
3492AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003493 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003494 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003495 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003496 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003497 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003498 conf_lastlog_location=$withval
3499 fi
3500 ]
3501)
andre2ff7b5d2000-06-03 14:57:40 +00003502
3503dnl lastlog, [uw]tmpx? detection
3504dnl NOTE: set the paths in the platform section to avoid the
3505dnl need for command-line parameters
3506dnl lastlog and [uw]tmp are subject to a file search if all else fails
3507
3508dnl lastlog detection
3509dnl NOTE: the code itself will detect if lastlog is a directory
3510AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3511AC_TRY_COMPILE([
3512#include <sys/types.h>
3513#include <utmp.h>
3514#ifdef HAVE_LASTLOG_H
3515# include <lastlog.h>
3516#endif
Damien Miller2994e082000-06-04 15:51:47 +10003517#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003518# include <paths.h>
3519#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003520#ifdef HAVE_LOGIN_H
3521# include <login.h>
3522#endif
andre2ff7b5d2000-06-03 14:57:40 +00003523 ],
3524 [ char *lastlog = LASTLOG_FILE; ],
3525 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003526 [
3527 AC_MSG_RESULT(no)
3528 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3529 AC_TRY_COMPILE([
3530#include <sys/types.h>
3531#include <utmp.h>
3532#ifdef HAVE_LASTLOG_H
3533# include <lastlog.h>
3534#endif
3535#ifdef HAVE_PATHS_H
3536# include <paths.h>
3537#endif
3538 ],
3539 [ char *lastlog = _PATH_LASTLOG; ],
3540 [ AC_MSG_RESULT(yes) ],
3541 [
andree441aa32000-06-12 22:34:38 +00003542 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003543 system_lastlog_path=no
3544 ])
3545 ]
andre2ff7b5d2000-06-03 14:57:40 +00003546)
Damien Miller2994e082000-06-04 15:51:47 +10003547
andre2ff7b5d2000-06-03 14:57:40 +00003548if test -z "$conf_lastlog_location"; then
3549 if test x"$system_lastlog_path" = x"no" ; then
3550 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003551 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003552 conf_lastlog_location=$f
3553 fi
3554 done
3555 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003556 AC_MSG_WARN([** Cannot find lastlog **])
3557 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003558 fi
3559 fi
3560fi
3561
3562if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003563 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3564 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003565fi
andre2ff7b5d2000-06-03 14:57:40 +00003566
3567dnl utmp detection
3568AC_MSG_CHECKING([if your system defines UTMP_FILE])
3569AC_TRY_COMPILE([
3570#include <sys/types.h>
3571#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003572#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003573# include <paths.h>
3574#endif
3575 ],
3576 [ char *utmp = UTMP_FILE; ],
3577 [ AC_MSG_RESULT(yes) ],
3578 [ AC_MSG_RESULT(no)
3579 system_utmp_path=no ]
3580)
3581if test -z "$conf_utmp_location"; then
3582 if test x"$system_utmp_path" = x"no" ; then
3583 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3584 if test -f $f ; then
3585 conf_utmp_location=$f
3586 fi
3587 done
3588 if test -z "$conf_utmp_location"; then
3589 AC_DEFINE(DISABLE_UTMP)
3590 fi
3591 fi
3592fi
3593if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003594 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3595 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003596fi
andre2ff7b5d2000-06-03 14:57:40 +00003597
3598dnl wtmp detection
3599AC_MSG_CHECKING([if your system defines WTMP_FILE])
3600AC_TRY_COMPILE([
3601#include <sys/types.h>
3602#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003603#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003604# include <paths.h>
3605#endif
3606 ],
3607 [ char *wtmp = WTMP_FILE; ],
3608 [ AC_MSG_RESULT(yes) ],
3609 [ AC_MSG_RESULT(no)
3610 system_wtmp_path=no ]
3611)
3612if test -z "$conf_wtmp_location"; then
3613 if test x"$system_wtmp_path" = x"no" ; then
3614 for f in /usr/adm/wtmp /var/log/wtmp; do
3615 if test -f $f ; then
3616 conf_wtmp_location=$f
3617 fi
3618 done
3619 if test -z "$conf_wtmp_location"; then
3620 AC_DEFINE(DISABLE_WTMP)
3621 fi
3622 fi
3623fi
3624if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003625 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3626 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003627fi
andre2ff7b5d2000-06-03 14:57:40 +00003628
3629
3630dnl utmpx detection - I don't know any system so perverse as to require
3631dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3632dnl there, though.
3633AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3634AC_TRY_COMPILE([
3635#include <sys/types.h>
3636#include <utmp.h>
3637#ifdef HAVE_UTMPX_H
3638#include <utmpx.h>
3639#endif
Damien Miller2994e082000-06-04 15:51:47 +10003640#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003641# include <paths.h>
3642#endif
3643 ],
3644 [ char *utmpx = UTMPX_FILE; ],
3645 [ AC_MSG_RESULT(yes) ],
3646 [ AC_MSG_RESULT(no)
3647 system_utmpx_path=no ]
3648)
3649if test -z "$conf_utmpx_location"; then
3650 if test x"$system_utmpx_path" = x"no" ; then
3651 AC_DEFINE(DISABLE_UTMPX)
3652 fi
3653else
Tim Rice7df8d392005-09-19 09:33:39 -07003654 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3655 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003656fi
andre2ff7b5d2000-06-03 14:57:40 +00003657
3658dnl wtmpx detection
3659AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3660AC_TRY_COMPILE([
3661#include <sys/types.h>
3662#include <utmp.h>
3663#ifdef HAVE_UTMPX_H
3664#include <utmpx.h>
3665#endif
Damien Miller2994e082000-06-04 15:51:47 +10003666#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003667# include <paths.h>
3668#endif
3669 ],
3670 [ char *wtmpx = WTMPX_FILE; ],
3671 [ AC_MSG_RESULT(yes) ],
3672 [ AC_MSG_RESULT(no)
3673 system_wtmpx_path=no ]
3674)
3675if test -z "$conf_wtmpx_location"; then
3676 if test x"$system_wtmpx_path" = x"no" ; then
3677 AC_DEFINE(DISABLE_WTMPX)
3678 fi
3679else
Tim Rice7df8d392005-09-19 09:33:39 -07003680 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3681 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003682fi
andre2ff7b5d2000-06-03 14:57:40 +00003683
Damien Miller4018c192000-04-30 09:30:44 +10003684
Damien Miller29ea30d2000-03-17 10:54:15 +11003685if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003686 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3687 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003688fi
3689
Tim Rice4cec93f2002-02-26 08:40:48 -08003690dnl remove pam and dl because they are in $LIBPAM
3691if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003692 LIBS=`echo $LIBS | sed 's/-lpam //'`
3693fi
3694if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3695 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003696fi
3697
Darren Tucker7da23cb2005-08-03 00:20:15 +10003698dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3699dnl Add now.
3700CFLAGS="$CFLAGS $werror_flags"
3701
Damien Millerbac2d8a2000-09-05 16:13:06 +11003702AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003703AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3704 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003705AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003706
Damien Miller7b22d652000-06-18 14:07:04 +10003707# Print summary of options
3708
Damien Miller7b22d652000-06-18 14:07:04 +10003709# Someone please show me a better way :)
3710A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3711B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3712C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3713D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003714E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003715F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003716G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003717H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3718I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3719J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003720
3721echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003722echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003723echo " User binaries: $B"
3724echo " System binaries: $C"
3725echo " Configuration files: $D"
3726echo " Askpass program: $E"
3727echo " Manual pages: $F"
3728echo " PID file: $G"
3729echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003730if test "x$external_path_file" = "x/etc/login.conf" ; then
3731echo " At runtime, sshd will use the path defined in $external_path_file"
3732echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003733else
Damien Millerf58c6722002-05-13 13:15:42 +10003734echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003735 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003736echo " (If PATH is set in $external_path_file it will be used instead. If"
3737echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3738 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003739fi
Damien Millera18bbd32002-05-13 10:48:57 +10003740if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003741echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003742fi
Damien Millerf58c6722002-05-13 13:15:42 +10003743echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003744echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003745echo " KerberosV support: $KRB5_MSG"
3746echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003747echo " S/KEY support: $SKEY_MSG"
3748echo " TCP Wrappers support: $TCPW_MSG"
3749echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003750echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003751echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003752echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3753echo " BSD Auth support: $BSD_AUTH_MSG"
3754echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003755if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003756echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003757fi
3758
Damien Miller7b22d652000-06-18 14:07:04 +10003759echo ""
3760
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003761echo " Host: ${host}"
3762echo " Compiler: ${CC}"
3763echo " Compiler flags: ${CFLAGS}"
3764echo "Preprocessor flags: ${CPPFLAGS}"
3765echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003766echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003767
3768echo ""
3769
Tim Rice6f1f7582004-05-30 21:38:51 -07003770if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003771 echo "SVR4 style packages are supported with \"make package\""
3772 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003773fi
3774
Damien Miller82cf0ce2000-12-20 13:34:48 +11003775if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003776 echo "PAM is enabled. You may need to install a PAM control file "
3777 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003778 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003779 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003780 echo ""
3781fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003782
Damien Miller6c21c512002-01-22 21:57:53 +11003783if test ! -z "$RAND_HELPER_CMDHASH" ; then
3784 echo "WARNING: you are using the builtin random number collection "
3785 echo "service. Please read WARNING.RNG and request that your OS "
3786 echo "vendor includes kernel-based random number collection in "
3787 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003788 echo ""
3789fi
Damien Miller60396b02001-02-18 17:01:00 +11003790
Damien Millerb4097182004-05-23 14:09:40 +10003791if test ! -z "$NO_PEERCHECK" ; then
3792 echo "WARNING: the operating system that you are using does not "
3793 echo "appear to support either the getpeereid() API nor the "
3794 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3795 echo "enforce security checks to prevent unauthorised connections to "
3796 echo "ssh-agent. Their absence increases the risk that a malicious "
3797 echo "user can connect to your agent. "
3798 echo ""
3799fi
3800
Darren Tuckerd9f88912005-02-20 21:01:48 +11003801if test "$AUDIT_MODULE" = "bsm" ; then
3802 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3803 echo "See the Solaris section in README.platform for details."
3804fi