blob: b24d3717817fa4c38ac43517dea3c6fff955858c [file] [log] [blame]
Damien Miller7b58e802005-12-13 19:33:19 +11001# $Id: configure.ac,v 1.313 2005/12/13 08:33:20 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 Millerb29ea912000-01-15 14:12:03 +1100329 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000330mips-sony-bsd|mips-sony-newsos4)
Tim Rice7df8d392005-09-19 09:33:39 -0700331 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000332 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000333 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100334*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000335 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800336 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800337 need_dash_r=1
338 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100339 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100340*-*-freebsd*)
341 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000342 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Millerfbd884a2001-02-27 08:39:07 +1100343 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000344*-*-bsdi*)
345 AC_DEFINE(SETEUID_BREAKS_SETUID)
346 AC_DEFINE(BROKEN_SETREUID)
347 AC_DEFINE(BROKEN_SETREGID)
348 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000349*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000350 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100351 conf_utmp_location=/etc/utmp
352 conf_wtmp_location=/usr/adm/wtmp
353 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700354 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000355 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000356 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700357 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000358 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000359*-*-openbsd*)
360 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000361 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Darren Tucker4a422572005-07-14 17:22:11 +1000362 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100363*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800364 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800365 need_dash_r=1
366 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100367 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000368 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700369 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
370 [Some versions of /bin/login need the TERM supplied
371 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000372 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700373 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
374 [Define if pam_chauthtok wants real uid set
375 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000376 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000377 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700378 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
379 [Define if sshd somehow reacquires a controlling TTY
380 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000381 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000382 # hardwire lastlog location (can't detect it on some versions)
383 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000384 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
385 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
386 if test "$sol2ver" -ge 8; then
387 AC_MSG_RESULT(yes)
388 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700389 AC_DEFINE(DISABLE_WTMP, 1,
390 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000391 else
392 AC_MSG_RESULT(no)
393 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100394 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000395*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000396 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000397 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100398 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000399 conf_utmp_location=/etc/utmp
400 conf_wtmp_location=/var/adm/wtmp
401 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000402 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000403 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000404*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700405 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000406 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000407 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000408 AC_DEFINE(SETEUID_BREAKS_SETUID)
409 AC_DEFINE(BROKEN_SETREUID)
410 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000411 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000412*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700413 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000414 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100415 # -lresolv needs to be at the end of LIBS or DNS lookups break
416 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100417 IPADDR_IN_DISPLAY=yes
418 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000419 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000420 AC_DEFINE(SETEUID_BREAKS_SETUID)
421 AC_DEFINE(BROKEN_SETREUID)
422 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000423 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000424 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700425 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
426 # Attention: always take care to bind libsocket and libnsl before libc,
427 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000428 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800429# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100430*-*-sysv4.2*)
Damien Miller57f39152005-11-24 19:58:19 +1100431 CFLAGS="$CFLAGS -Dva_list=_VA_LIST"
Damien Miller5dfe9762001-02-16 12:05:39 +1100432 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700433 AC_DEFINE(SETEUID_BREAKS_SETUID)
434 AC_DEFINE(BROKEN_SETREUID)
435 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700436 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800437 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100438 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800439# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100440*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700441 check_for_libcrypt_later=1
442 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100443 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700444 AC_DEFINE(SETEUID_BREAKS_SETUID)
445 AC_DEFINE(BROKEN_SETREUID)
446 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700447 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700448 case "$host" in
449 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
450 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700451 AC_DEFINE(BROKEN_LIBIAF, 1,
452 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700453 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800454 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
455 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700456 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100457 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100458*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100459 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800460# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100461*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800462 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100463 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800464# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100465*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800466 if test -z "$GCC"; then
467 CFLAGS="$CFLAGS -belf"
468 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100469 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000470 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100471 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000472 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000473 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700474 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700475 AC_DEFINE(SETEUID_BREAKS_SETUID)
476 AC_DEFINE(BROKEN_SETREUID)
477 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700478 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700479 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700480 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100481 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700482 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700483 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000484 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000485*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700486 AC_DEFINE(NO_SSH_LASTLOG, 1,
487 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100488 AC_DEFINE(SETEUID_BREAKS_SETUID)
489 AC_DEFINE(BROKEN_SETREUID)
490 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000491 AC_DEFINE(USE_PIPES)
492 AC_DEFINE(DISABLE_FD_PASSING)
493 LDFLAGS="$LDFLAGS"
494 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
495 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000496 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000497*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100498 AC_DEFINE(SETEUID_BREAKS_SETUID)
499 AC_DEFINE(BROKEN_SETREUID)
500 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000501 AC_DEFINE(WITH_ABBREV_NO_TTY)
502 AC_DEFINE(USE_PIPES)
503 AC_DEFINE(DISABLE_FD_PASSING)
504 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100505 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000506 MANTYPE=cat
507 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000508*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100509 AC_DEFINE(SETEUID_BREAKS_SETUID)
510 AC_DEFINE(BROKEN_SETREUID)
511 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000512 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700513 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700514 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000515 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
516 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
517 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700518 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000519*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000520 AC_MSG_CHECKING(for Digital Unix SIA)
521 no_osfsia=""
522 AC_ARG_WITH(osfsia,
523 [ --with-osfsia Enable Digital Unix SIA],
524 [
525 if test "x$withval" = "xno" ; then
526 AC_MSG_RESULT(disabled)
527 no_osfsia=1
528 fi
529 ],
530 )
531 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000532 if test -f /etc/sia/matrix.conf; then
533 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700534 AC_DEFINE(HAVE_OSF_SIA, 1,
535 [Define if you have Digital Unix Security
536 Integration Architecture])
537 AC_DEFINE(DISABLE_LOGIN, 1,
538 [Define if you don't want to use your
539 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000540 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000541 LIBS="$LIBS -lsecurity -ldb -lm -laud"
542 else
543 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700544 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
545 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000546 fi
547 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000548 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700549 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000550 AC_DEFINE(BROKEN_SETREUID)
551 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000552 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000553
554*-*-nto-qnx)
555 AC_DEFINE(USE_PIPES)
556 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700557 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
558 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
559 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000560 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000561
562*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700563 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
564 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
565 AC_DEFINE(NEED_SETPRGP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700566 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
567 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000568
569*-*-lynxos)
570 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700571 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000572 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
573 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100574esac
575
Damien Millere37bfc12000-06-05 09:37:43 +1000576# Allow user to specify flags
577AC_ARG_WITH(cflags,
578 [ --with-cflags Specify additional flags to pass to compiler],
579 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800580 if test -n "$withval" && test "x$withval" != "xno" && \
581 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000582 CFLAGS="$CFLAGS $withval"
583 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800584 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000585)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000586AC_ARG_WITH(cppflags,
587 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
588 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800589 if test -n "$withval" && test "x$withval" != "xno" && \
590 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000591 CPPFLAGS="$CPPFLAGS $withval"
592 fi
593 ]
594)
Damien Millere37bfc12000-06-05 09:37:43 +1000595AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000596 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000597 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800598 if test -n "$withval" && test "x$withval" != "xno" && \
599 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000600 LDFLAGS="$LDFLAGS $withval"
601 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800602 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000603)
604AC_ARG_WITH(libs,
605 [ --with-libs Specify additional libraries to link with],
606 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800607 if test -n "$withval" && test "x$withval" != "xno" && \
608 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000609 LIBS="$LIBS $withval"
610 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800611 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000612)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000613AC_ARG_WITH(Werror,
614 [ --with-Werror Build main code with -Werror],
615 [
616 if test -n "$withval" && test "x$withval" != "xno"; then
617 werror_flags="-Werror"
Damien Millere04ec6f2005-10-08 16:21:19 +1000618 if test "x${withval}" != "xyes"; then
Darren Tucker7da23cb2005-08-03 00:20:15 +1000619 werror_flags="$withval"
620 fi
621 fi
622 ]
623)
Damien Millere37bfc12000-06-05 09:37:43 +1000624
Darren Tucker6eb93042003-06-29 21:30:41 +1000625AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000626AC_RUN_IFELSE(
627 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000628#include <stdio.h>
629int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000630 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000631 [ AC_MSG_RESULT(yes) ],
632 [
633 AC_MSG_RESULT(no)
634 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000635 ],
636 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000637)
638
Darren Tucker0c9653f2005-05-28 15:58:14 +1000639dnl Checks for header files.
640AC_CHECK_HEADERS( \
641 bstring.h \
642 crypt.h \
643 dirent.h \
644 endian.h \
645 features.h \
646 floatingpoint.h \
647 getopt.h \
648 glob.h \
649 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700650 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000651 lastlog.h \
652 limits.h \
653 login.h \
654 login_cap.h \
655 maillock.h \
656 ndir.h \
Damien Miller7b58e802005-12-13 19:33:19 +1100657 net/if.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000658 netdb.h \
659 netgroup.h \
660 netinet/in_systm.h \
661 pam/pam_appl.h \
662 paths.h \
663 pty.h \
664 readpassphrase.h \
665 rpc/types.h \
666 security/pam_appl.h \
667 shadow.h \
668 stddef.h \
669 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000670 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000671 strings.h \
672 sys/audit.h \
673 sys/bitypes.h \
674 sys/bsdtty.h \
675 sys/cdefs.h \
676 sys/dir.h \
677 sys/mman.h \
678 sys/ndir.h \
679 sys/prctl.h \
680 sys/pstat.h \
681 sys/select.h \
682 sys/stat.h \
683 sys/stream.h \
684 sys/stropts.h \
685 sys/strtio.h \
686 sys/sysmacros.h \
687 sys/time.h \
688 sys/timers.h \
689 sys/un.h \
690 time.h \
691 tmpdir.h \
692 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000693 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000694 usersec.h \
695 util.h \
696 utime.h \
697 utmp.h \
698 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000699 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000700)
Tim Rice4cec93f2002-02-26 08:40:48 -0800701
Darren Tucker48d99d32004-08-29 17:04:50 +1000702# sys/ptms.h requires sys/stream.h to be included first on Solaris
703AC_CHECK_HEADERS(sys/ptms.h, [], [], [
704#ifdef HAVE_SYS_STREAM_H
705# include <sys/stream.h>
706#endif
707])
708
Damien Millera22ba012000-03-02 23:09:20 +1100709# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700710AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
711AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000712
Tim Rice1e1ef642003-09-11 22:19:31 -0700713dnl IRIX and Solaris 2.5.1 have dirname() in libgen
714AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
715 AC_CHECK_LIB(gen, dirname,[
716 AC_CACHE_CHECK([for broken dirname],
717 ac_cv_have_broken_dirname, [
718 save_LIBS="$LIBS"
719 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000720 AC_RUN_IFELSE(
721 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700722#include <libgen.h>
723#include <string.h>
724
725int main(int argc, char **argv) {
726 char *s, buf[32];
727
728 strncpy(buf,"/etc", 32);
729 s = dirname(buf);
730 if (!s || strncmp(s, "/", 32) != 0) {
731 exit(1);
732 } else {
733 exit(0);
734 }
735}
Darren Tucker314d89e2005-10-17 23:29:23 +1000736 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700737 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000738 [ ac_cv_have_broken_dirname="yes" ],
739 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700740 )
741 LIBS="$save_LIBS"
742 ])
743 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
744 LIBS="$LIBS -lgen"
745 AC_DEFINE(HAVE_DIRNAME)
746 AC_CHECK_HEADERS(libgen.h)
747 fi
748 ])
749])
750
751AC_CHECK_FUNC(getspnam, ,
752 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700753AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
754 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700755
Tim Rice13aae5e2001-10-21 17:53:58 -0700756dnl zlib is required
757AC_ARG_WITH(zlib,
758 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100759 [ if test "x$withval" = "xno" ; then
760 AC_MSG_ERROR([*** zlib is required ***])
761 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700762 if test -d "$withval/lib"; then
763 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700764 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700765 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700766 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700767 fi
768 else
769 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700770 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700771 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700772 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700773 fi
774 fi
775 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700776 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700777 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700778 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700779 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100780 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700781)
782
Tim Ricefcb62202004-01-23 18:35:16 -0800783AC_CHECK_LIB(z, deflate, ,
784 [
785 saved_CPPFLAGS="$CPPFLAGS"
786 saved_LDFLAGS="$LDFLAGS"
787 save_LIBS="$LIBS"
788 dnl Check default zlib install dir
789 if test -n "${need_dash_r}"; then
790 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
791 else
792 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
793 fi
794 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
795 LIBS="$LIBS -lz"
796 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
797 [
798 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
799 ]
800 )
801 ]
802)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100803AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100804
805AC_ARG_WITH(zlib-version-check,
806 [ --without-zlib-version-check Disable zlib version check],
807 [ if test "x$withval" = "xno" ; then
808 zlib_check_nonfatal=1
809 fi
810 ]
811)
812
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000813AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000814AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000815#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100816#include <zlib.h>
817int main()
818{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000819 int a=0, b=0, c=0, d=0, n, v;
820 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
821 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100822 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000823 v = a*1000000 + b*10000 + c*100 + d;
824 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
825
826 /* 1.1.4 is OK */
827 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100828 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000829
Darren Tucker41097ed2005-07-25 15:24:21 +1000830 /* 1.2.3 and up are OK */
831 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000832 exit(0);
833
Darren Tucker2dcd2392004-01-23 17:13:33 +1100834 exit(2);
835}
Darren Tucker623d92f2004-09-12 22:36:15 +1000836 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000837 AC_MSG_RESULT(no),
838 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100839 if test -z "$zlib_check_nonfatal" ; then
840 AC_MSG_ERROR([*** zlib too old - check config.log ***
841Your reported zlib version has known security problems. It's possible your
842vendor has fixed these problems without changing the version number. If you
843are sure this is the case, you can disable the check by running
844"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000845If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000846See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100847 else
848 AC_MSG_WARN([zlib version may have security problems])
849 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000850 ],
851 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100852)
Damien Miller6f9c3372000-10-25 10:06:04 +1100853
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000854dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100855AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000856 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
857)
Darren Tucker5bfe1682005-11-12 18:42:36 +1100858AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700859 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
860 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000861)
Damien Millerab18c411999-11-11 10:40:23 +1100862
Tim Ricee589a292001-11-03 11:09:32 -0800863dnl Checks for libutil functions
864AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700865AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
866 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800867AC_CHECK_FUNCS(logout updwtmp logwtmp)
868
Ben Lindstrom8697e082001-02-24 21:41:10 +0000869AC_FUNC_STRFTIME
870
Damien Miller3c027682001-03-14 11:39:45 +1100871# Check for ALTDIRFUNC glob() extension
872AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
873AC_EGREP_CPP(FOUNDIT,
874 [
875 #include <glob.h>
876 #ifdef GLOB_ALTDIRFUNC
877 FOUNDIT
878 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100879 ],
Damien Miller3c027682001-03-14 11:39:45 +1100880 [
Tim Rice7df8d392005-09-19 09:33:39 -0700881 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
882 [Define if your system glob() function has
883 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100884 AC_MSG_RESULT(yes)
885 ],
886 [
887 AC_MSG_RESULT(no)
888 ]
889)
Damien Millerab18c411999-11-11 10:40:23 +1100890
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000891# Check for g.gl_matchc glob() extension
892AC_MSG_CHECKING(for gl_matchc field in glob_t)
893AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100894 [
895 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000896 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100897 ],
898 [
Tim Rice7df8d392005-09-19 09:33:39 -0700899 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
900 [Define if your system glob() function has
901 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100902 AC_MSG_RESULT(yes)
903 ],
904 [
905 AC_MSG_RESULT(no)
906 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000907)
908
Damien Miller18bb4732001-03-28 14:35:30 +1000909AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000910AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000911 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000912#include <sys/types.h>
913#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700914int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000915 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100916 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000917 [
918 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700919 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +1100920 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -0700921 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000922 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800923 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000924 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
925 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000926 ]
927)
928
Damien Miller36f49652004-08-15 18:40:59 +1000929AC_MSG_CHECKING([for /proc/pid/fd directory])
930if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700931 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000932 AC_MSG_RESULT(yes)
933else
934 AC_MSG_RESULT(no)
935fi
936
Damien Millerc547bf12001-02-16 10:18:12 +1100937# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100938SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100939AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100940 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100941 [
942 if test "x$withval" != "xno" ; then
943
944 if test "x$withval" != "xyes" ; then
945 CPPFLAGS="$CPPFLAGS -I${withval}/include"
946 LDFLAGS="$LDFLAGS -L${withval}/lib"
947 fi
948
Tim Rice7df8d392005-09-19 09:33:39 -0700949 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +1100950 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100951 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800952
Tim Rice4cec93f2002-02-26 08:40:48 -0800953 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +1000954 AC_LINK_IFELSE(
955 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -0800956#include <stdio.h>
957#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700958int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +1000959 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -0800960 [AC_MSG_RESULT(yes)],
961 [
962 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100963 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
964 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000965 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
966 AC_TRY_COMPILE(
967 [#include <stdio.h>
968 #include <skey.h>],
969 [(void)skeychallenge(NULL,"name","",0);],
970 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700971 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
972 [Define if your skeychallenge()
973 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +1000974 [AC_MSG_RESULT(no)]
975 )
Damien Millerc547bf12001-02-16 10:18:12 +1100976 fi
977 ]
978)
979
980# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700981TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100982AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100983 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100984 [
985 if test "x$withval" != "xno" ; then
986 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700987 saved_LDFLAGS="$LDFLAGS"
988 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800989 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800990 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700991 if test -d "${withval}/lib"; then
992 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700993 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700994 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700995 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700996 fi
997 else
998 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700999 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001000 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001001 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001002 fi
1003 fi
1004 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001005 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001006 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001007 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001008 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001009 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001010 LIBWRAP="-lwrap"
1011 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001012 AC_MSG_CHECKING(for libwrap)
1013 AC_TRY_LINK(
1014 [
Damien Miller0ac45002004-04-14 20:14:26 +10001015#include <sys/types.h>
1016#include <sys/socket.h>
1017#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001018#include <tcpd.h>
1019 int deny_severity = 0, allow_severity = 0;
1020 ],
1021 [hosts_access(0);],
1022 [
1023 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001024 AC_DEFINE(LIBWRAP, 1,
1025 [Define if you want
1026 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001027 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001028 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001029 ],
1030 [
1031 AC_MSG_ERROR([*** libwrap missing])
1032 ]
1033 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001034 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001035 fi
1036 ]
1037)
1038
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001039# Check whether user wants libedit support
1040LIBEDIT_MSG="no"
1041AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001042 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001043 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001044 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001045 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1046 if test -n "${need_dash_r}"; then
1047 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1048 else
1049 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1050 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001051 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001052 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001053 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001054 LIBEDIT="-ledit -lcurses"
1055 LIBEDIT_MSG="yes"
1056 AC_SUBST(LIBEDIT)
1057 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001058 [ AC_MSG_ERROR(libedit not found) ],
1059 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001060 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001061 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001062 AC_COMPILE_IFELSE(
1063 [AC_LANG_SOURCE([[
1064#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001065int main(void)
1066{
1067 int i = H_SETSIZE;
1068 el_init("", NULL, NULL, NULL);
1069 exit(0);
1070}
Tim Ricec1819c82005-08-15 17:48:40 -07001071 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001072 [ AC_MSG_RESULT(yes) ],
1073 [ AC_MSG_RESULT(no)
1074 AC_MSG_ERROR(libedit version is not compatible) ]
1075 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001076 fi ]
1077)
1078
Darren Tuckerd9f88912005-02-20 21:01:48 +11001079AUDIT_MODULE=none
1080AC_ARG_WITH(audit,
1081 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1082 [
1083 AC_MSG_CHECKING(for supported audit module)
1084 case "$withval" in
1085 bsm)
1086 AC_MSG_RESULT(bsm)
1087 AUDIT_MODULE=bsm
1088 dnl Checks for headers, libs and functions
1089 AC_CHECK_HEADERS(bsm/audit.h, [],
1090 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1091 AC_CHECK_LIB(bsm, getaudit, [],
1092 [AC_MSG_ERROR(BSM enabled and required library not found)])
1093 AC_CHECK_FUNCS(getaudit, [],
1094 [AC_MSG_ERROR(BSM enabled and required function not found)])
1095 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001096 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001097 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001098 ;;
1099 debug)
1100 AUDIT_MODULE=debug
1101 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001102 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001103 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001104 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001105 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001106 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001107 *)
1108 AC_MSG_ERROR([Unknown audit module $withval])
1109 ;;
1110 esac ]
1111)
1112
Damien Millerfe1f1432003-02-24 15:45:42 +11001113dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001114AC_CHECK_FUNCS( \
1115 arc4random \
Damien Miller57f39152005-11-24 19:58:19 +11001116 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001117 b64_ntop \
1118 __b64_ntop \
1119 b64_pton \
1120 __b64_pton \
1121 bcopy \
1122 bindresvport_sa \
1123 clock \
1124 closefrom \
1125 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001126 fchmod \
1127 fchown \
1128 freeaddrinfo \
1129 futimes \
1130 getaddrinfo \
1131 getcwd \
1132 getgrouplist \
1133 getnameinfo \
1134 getopt \
1135 getpeereid \
1136 _getpty \
1137 getrlimit \
1138 getttyent \
1139 glob \
1140 inet_aton \
1141 inet_ntoa \
1142 inet_ntop \
1143 innetgr \
1144 login_getcapbool \
1145 md5_crypt \
1146 memmove \
1147 mkdtemp \
1148 mmap \
1149 ngetaddrinfo \
1150 nsleep \
1151 ogetaddrinfo \
1152 openlog_r \
1153 openpty \
1154 prctl \
1155 pstat \
1156 readpassphrase \
1157 realpath \
1158 recvmsg \
1159 rresvport_af \
1160 sendmsg \
1161 setdtablesize \
1162 setegid \
1163 setenv \
1164 seteuid \
1165 setgroups \
1166 setlogin \
1167 setpcred \
1168 setproctitle \
1169 setregid \
1170 setreuid \
1171 setrlimit \
1172 setsid \
1173 setvbuf \
1174 sigaction \
1175 sigvec \
1176 snprintf \
1177 socketpair \
1178 strdup \
1179 strerror \
1180 strlcat \
1181 strlcpy \
1182 strmode \
1183 strnvis \
1184 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001185 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001186 strtoul \
1187 sysconf \
1188 tcgetpgrp \
1189 truncate \
1190 unsetenv \
1191 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001192 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001193 vhangup \
1194 vsnprintf \
1195 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001196)
Tim Rice13aae5e2001-10-21 17:53:58 -07001197
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001198# IRIX has a const char return value for gai_strerror()
1199AC_CHECK_FUNCS(gai_strerror,[
1200 AC_DEFINE(HAVE_GAI_STRERROR)
1201 AC_TRY_COMPILE([
1202#include <sys/types.h>
1203#include <sys/socket.h>
1204#include <netdb.h>
1205
1206const char *gai_strerror(int);],[
1207char *str;
1208
1209str = gai_strerror(0);],[
1210 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1211 [Define if gai_strerror() returns const char *])])])
1212
Tim Rice7df8d392005-09-19 09:33:39 -07001213AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1214 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001215
Darren Tuckerf1159b52003-07-07 19:44:01 +10001216dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001217AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001218AC_CHECK_DECL(strsep,
1219 [AC_CHECK_FUNCS(strsep)],
1220 [],
1221 [
1222#ifdef HAVE_STRING_H
1223# include <string.h>
1224#endif
1225 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001226
Darren Tuckerb2427c82003-09-10 15:22:44 +10001227dnl tcsendbreak might be a macro
1228AC_CHECK_DECL(tcsendbreak,
1229 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001230 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001231 [#include <termios.h>]
1232)
1233
Darren Tucker5bb14002004-04-23 18:53:10 +10001234AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1235
Darren Tucker2a6b0292003-12-31 14:59:17 +11001236AC_CHECK_FUNCS(setresuid, [
1237 dnl Some platorms have setresuid that isn't implemented, test for this
1238 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001239 AC_RUN_IFELSE(
1240 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001241#include <stdlib.h>
1242#include <errno.h>
1243int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001244 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001245 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001246 [AC_DEFINE(BROKEN_SETRESUID, 1,
1247 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001248 AC_MSG_RESULT(not implemented)],
1249 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001250 )
1251])
Darren Tuckere937be32003-12-17 18:53:26 +11001252
Darren Tucker2a6b0292003-12-31 14:59:17 +11001253AC_CHECK_FUNCS(setresgid, [
1254 dnl Some platorms have setresgid that isn't implemented, test for this
1255 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001256 AC_RUN_IFELSE(
1257 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001258#include <stdlib.h>
1259#include <errno.h>
1260int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001261 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001262 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001263 [AC_DEFINE(BROKEN_SETRESGID, 1,
1264 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001265 AC_MSG_RESULT(not implemented)],
1266 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001267 )
1268])
Darren Tuckere937be32003-12-17 18:53:26 +11001269
Damien Millerad833b32000-08-23 10:46:23 +10001270dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001271AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001272dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001273AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001274AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001275dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001276AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001277AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001278
Damien Millera8e06ce2003-11-21 23:48:55 +11001279AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001280 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1281 [AC_CHECK_LIB(bsd, daemon,
1282 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001283)
1284
Damien Millera8e06ce2003-11-21 23:48:55 +11001285AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001286 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1287 [Define if your libraries define getpagesize()])],
1288 [AC_CHECK_LIB(ucb, getpagesize,
1289 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001290)
1291
Damien Millercb170cb2000-07-01 16:52:55 +10001292# Check for broken snprintf
1293if test "x$ac_cv_func_snprintf" = "xyes" ; then
1294 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001295 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001296 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001297#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001298int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001299 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001300 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001301 [
1302 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001303 AC_DEFINE(BROKEN_SNPRINTF, 1,
1304 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001305 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001306 ],
1307 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001308 )
1309fi
1310
Damien Miller57f39152005-11-24 19:58:19 +11001311# If we don't have a working asprintf, then we strongly depend on vsnprintf
1312# returning the right thing on overflow: the number of characters it tried to
1313# create (as per SUSv3)
1314if test "x$ac_cv_func_asprintf" != "xyes" && \
1315 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1316 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1317 AC_RUN_IFELSE(
1318 [AC_LANG_SOURCE([[
1319#include <sys/types.h>
1320#include <stdio.h>
1321#include <stdarg.h>
1322
1323int x_snprintf(char *str,size_t count,const char *fmt,...)
1324{
1325 size_t ret; va_list ap;
1326 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1327 return ret;
1328}
1329int main(void)
1330{
1331 char x[1];
1332 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1333} ]])],
1334 [AC_MSG_RESULT(yes)],
1335 [
1336 AC_MSG_RESULT(no)
1337 AC_DEFINE(BROKEN_SNPRINTF, 1,
1338 [Define if your snprintf is busted])
1339 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1340 ],
1341 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1342 )
1343fi
1344
Damien Millerb4097182004-05-23 14:09:40 +10001345# Check for missing getpeereid (or equiv) support
1346NO_PEERCHECK=""
1347if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1348 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1349 AC_TRY_COMPILE(
1350 [#include <sys/types.h>
1351 #include <sys/socket.h>],
1352 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001353 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001354 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001355 ],
Damien Millerb4097182004-05-23 14:09:40 +10001356 [AC_MSG_RESULT(no)
1357 NO_PEERCHECK=1]
1358 )
1359fi
1360
Damien Millere8328192003-01-07 15:18:32 +11001361dnl see whether mkstemp() requires XXXXXX
1362if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1363AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001364AC_RUN_IFELSE(
1365 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001366#include <stdlib.h>
1367main() { char template[]="conftest.mkstemp-test";
1368if (mkstemp(template) == -1)
1369 exit(1);
1370unlink(template); exit(0);
1371}
Darren Tucker314d89e2005-10-17 23:29:23 +10001372 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001373 [
1374 AC_MSG_RESULT(no)
1375 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001376 [
Damien Millere8328192003-01-07 15:18:32 +11001377 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001378 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001379 ],
1380 [
1381 AC_MSG_RESULT(yes)
1382 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001383 ]
Damien Millere8328192003-01-07 15:18:32 +11001384)
1385fi
1386
Darren Tucker70a3d552003-08-21 17:58:29 +10001387dnl make sure that openpty does not reacquire controlling terminal
1388if test ! -z "$check_for_openpty_ctty_bug"; then
1389 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001390 AC_RUN_IFELSE(
1391 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001392#include <stdio.h>
1393#include <sys/fcntl.h>
1394#include <sys/types.h>
1395#include <sys/wait.h>
1396
1397int
1398main()
1399{
1400 pid_t pid;
1401 int fd, ptyfd, ttyfd, status;
1402
1403 pid = fork();
1404 if (pid < 0) { /* failed */
1405 exit(1);
1406 } else if (pid > 0) { /* parent */
1407 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001408 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001409 exit(WEXITSTATUS(status));
1410 else
1411 exit(2);
1412 } else { /* child */
1413 close(0); close(1); close(2);
1414 setsid();
1415 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1416 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1417 if (fd >= 0)
1418 exit(3); /* Acquired ctty: broken */
1419 else
1420 exit(0); /* Did not acquire ctty: OK */
1421 }
1422}
Darren Tucker314d89e2005-10-17 23:29:23 +10001423 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001424 [
1425 AC_MSG_RESULT(yes)
1426 ],
1427 [
1428 AC_MSG_RESULT(no)
1429 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001430 ],
1431 [
1432 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001433 ]
1434 )
1435fi
1436
Tim Rice8bb561b2005-03-17 16:23:19 -08001437if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1438 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001439 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001440 AC_RUN_IFELSE(
1441 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001442#include <stdio.h>
1443#include <sys/socket.h>
1444#include <netdb.h>
1445#include <errno.h>
1446#include <netinet/in.h>
1447
1448#define TEST_PORT "2222"
1449
1450int
1451main(void)
1452{
1453 int err, sock;
1454 struct addrinfo *gai_ai, *ai, hints;
1455 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1456
1457 memset(&hints, 0, sizeof(hints));
1458 hints.ai_family = PF_UNSPEC;
1459 hints.ai_socktype = SOCK_STREAM;
1460 hints.ai_flags = AI_PASSIVE;
1461
1462 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1463 if (err != 0) {
1464 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1465 exit(1);
1466 }
1467
1468 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1469 if (ai->ai_family != AF_INET6)
1470 continue;
1471
1472 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1473 sizeof(ntop), strport, sizeof(strport),
1474 NI_NUMERICHOST|NI_NUMERICSERV);
1475
1476 if (err != 0) {
1477 if (err == EAI_SYSTEM)
1478 perror("getnameinfo EAI_SYSTEM");
1479 else
1480 fprintf(stderr, "getnameinfo failed: %s\n",
1481 gai_strerror(err));
1482 exit(2);
1483 }
1484
1485 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1486 if (sock < 0)
1487 perror("socket");
1488 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1489 if (errno == EBADF)
1490 exit(3);
1491 }
1492 }
1493 exit(0);
1494}
Darren Tucker314d89e2005-10-17 23:29:23 +10001495 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001496 [
1497 AC_MSG_RESULT(yes)
1498 ],
1499 [
1500 AC_MSG_RESULT(no)
1501 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001502 ],
1503 [
1504 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001505 ]
1506 )
1507fi
1508
Tim Rice8bb561b2005-03-17 16:23:19 -08001509if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1510 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001511 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001512 AC_RUN_IFELSE(
1513 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001514#include <stdio.h>
1515#include <sys/socket.h>
1516#include <netdb.h>
1517#include <errno.h>
1518#include <netinet/in.h>
1519
1520#define TEST_PORT "2222"
1521
1522int
1523main(void)
1524{
1525 int err, sock;
1526 struct addrinfo *gai_ai, *ai, hints;
1527 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1528
1529 memset(&hints, 0, sizeof(hints));
1530 hints.ai_family = PF_UNSPEC;
1531 hints.ai_socktype = SOCK_STREAM;
1532 hints.ai_flags = AI_PASSIVE;
1533
1534 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1535 if (err != 0) {
1536 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1537 exit(1);
1538 }
1539
1540 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1541 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1542 continue;
1543
1544 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1545 sizeof(ntop), strport, sizeof(strport),
1546 NI_NUMERICHOST|NI_NUMERICSERV);
1547
1548 if (ai->ai_family == AF_INET && err != 0) {
1549 perror("getnameinfo");
1550 exit(2);
1551 }
1552 }
1553 exit(0);
1554}
Darren Tucker314d89e2005-10-17 23:29:23 +10001555 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001556 [
1557 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001558 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1559 [Define if you have a getaddrinfo that fails
1560 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001561 ],
1562 [
1563 AC_MSG_RESULT(no)
1564 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001565 ],
1566 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001567 ]
1568 )
1569fi
1570
Darren Tuckera56f1912004-11-02 20:30:54 +11001571if test "x$check_for_conflicting_getspnam" = "x1"; then
1572 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1573 AC_COMPILE_IFELSE(
1574 [
1575#include <shadow.h>
1576int main(void) {exit(0);}
1577 ],
1578 [
1579 AC_MSG_RESULT(no)
1580 ],
1581 [
1582 AC_MSG_RESULT(yes)
1583 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1584 [Conflicting defs for getspnam])
1585 ]
1586 )
1587fi
1588
Damien Miller606f8802000-09-16 15:39:56 +11001589AC_FUNC_GETPGRP
1590
Damien Millera64b57a2001-01-17 10:44:13 +11001591# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001592PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001593AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001594 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001595 [
Damien Millera64b57a2001-01-17 10:44:13 +11001596 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001597 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1598 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001599 AC_MSG_ERROR([PAM headers not found])
1600 fi
1601
1602 AC_CHECK_LIB(dl, dlopen, , )
1603 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1604 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001605 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001606
Damien Millera64b57a2001-01-17 10:44:13 +11001607 PAM_MSG="yes"
1608
Tim Rice7df8d392005-09-19 09:33:39 -07001609 AC_DEFINE(USE_PAM, 1,
1610 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001611 if test $ac_cv_lib_dl_dlopen = yes; then
1612 LIBPAM="-lpam -ldl"
1613 else
1614 LIBPAM="-lpam"
1615 fi
1616 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001617 fi
1618 ]
1619)
Damien Millera22ba012000-03-02 23:09:20 +11001620
Damien Millera64b57a2001-01-17 10:44:13 +11001621# Check for older PAM
1622if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001623 # Check PAM strerror arguments (old PAM)
1624 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1625 AC_TRY_COMPILE(
1626 [
Damien Miller81171112000-04-23 11:14:01 +10001627#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001628#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001629#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001630#elif defined (HAVE_PAM_PAM_APPL_H)
1631#include <pam/pam_appl.h>
1632#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001633 ],
1634 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001635 [AC_MSG_RESULT(no)],
1636 [
Tim Rice7df8d392005-09-19 09:33:39 -07001637 AC_DEFINE(HAVE_OLD_PAM, 1,
1638 [Define if you have an old version of PAM
1639 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001640 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001641 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001642 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001643 )
Damien Millera22ba012000-03-02 23:09:20 +11001644fi
1645
Tim Riceaef73712002-05-11 13:17:42 -07001646# Search for OpenSSL
1647saved_CPPFLAGS="$CPPFLAGS"
1648saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001649AC_ARG_WITH(ssl-dir,
1650 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1651 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001652 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001653 case "$withval" in
1654 # Relative paths
1655 ./*|../*) withval="`pwd`/$withval"
1656 esac
Tim Riceaef73712002-05-11 13:17:42 -07001657 if test -d "$withval/lib"; then
1658 if test -n "${need_dash_r}"; then
1659 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1660 else
1661 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1662 fi
1663 else
1664 if test -n "${need_dash_r}"; then
1665 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1666 else
1667 LDFLAGS="-L${withval} ${LDFLAGS}"
1668 fi
1669 fi
1670 if test -d "$withval/include"; then
1671 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1672 else
1673 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1674 fi
Damien Millera22ba012000-03-02 23:09:20 +11001675 fi
1676 ]
1677)
Tim Rice3d5352e2004-02-12 09:27:21 -08001678LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001679AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1680 [Define if your ssl headers are included
1681 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001682 [
Tim Riceaef73712002-05-11 13:17:42 -07001683 dnl Check default openssl install dir
1684 if test -n "${need_dash_r}"; then
1685 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001686 else
Tim Riceaef73712002-05-11 13:17:42 -07001687 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001688 fi
Tim Riceaef73712002-05-11 13:17:42 -07001689 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1690 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1691 [
1692 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1693 ]
1694 )
1695 ]
1696)
1697
Tim Riced730b782002-08-13 18:52:10 -07001698# Determine OpenSSL header version
1699AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001700AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001701 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001702#include <stdio.h>
1703#include <string.h>
1704#include <openssl/opensslv.h>
1705#define DATA "conftest.sslincver"
1706int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001707 FILE *fd;
1708 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001709
Damien Millera8e06ce2003-11-21 23:48:55 +11001710 fd = fopen(DATA,"w");
1711 if(fd == NULL)
1712 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001713
1714 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1715 exit(1);
1716
1717 exit(0);
1718}
Darren Tucker623d92f2004-09-12 22:36:15 +10001719 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001720 [
1721 ssl_header_ver=`cat conftest.sslincver`
1722 AC_MSG_RESULT($ssl_header_ver)
1723 ],
1724 [
1725 AC_MSG_RESULT(not found)
1726 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001727 ],
1728 [
1729 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001730 ]
1731)
1732
1733# Determine OpenSSL library version
1734AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001735AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001736 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001737#include <stdio.h>
1738#include <string.h>
1739#include <openssl/opensslv.h>
1740#include <openssl/crypto.h>
1741#define DATA "conftest.ssllibver"
1742int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001743 FILE *fd;
1744 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001745
Damien Millera8e06ce2003-11-21 23:48:55 +11001746 fd = fopen(DATA,"w");
1747 if(fd == NULL)
1748 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001749
1750 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1751 exit(1);
1752
1753 exit(0);
1754}
Darren Tucker623d92f2004-09-12 22:36:15 +10001755 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001756 [
1757 ssl_library_ver=`cat conftest.ssllibver`
1758 AC_MSG_RESULT($ssl_library_ver)
1759 ],
1760 [
1761 AC_MSG_RESULT(not found)
1762 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001763 ],
1764 [
1765 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001766 ]
1767)
Damien Millera22ba012000-03-02 23:09:20 +11001768
Damien Millerec932372002-01-22 22:16:03 +11001769# Sanity check OpenSSL headers
1770AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001771AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001772 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001773#include <string.h>
1774#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001775int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001776 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001777 [
1778 AC_MSG_RESULT(yes)
1779 ],
1780 [
1781 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001782 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1783Check config.log for details.
1784Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001785 ],
1786 [
1787 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001788 ]
1789)
1790
Tim Rice3d5352e2004-02-12 09:27:21 -08001791# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1792# because the system crypt() is more featureful.
1793if test "x$check_for_libcrypt_before" = "x1"; then
1794 AC_CHECK_LIB(crypt, crypt)
1795fi
1796
Damien Millera8e06ce2003-11-21 23:48:55 +11001797# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001798# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001799if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001800 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001801fi
1802
Tim Rice2291c002005-08-26 13:15:19 -07001803AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001804
1805### Configure cryptographic random number support
1806
1807# Check wheter OpenSSL seeds itself
1808AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001809AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001810 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001811#include <string.h>
1812#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001813int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001814 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001815 [
1816 OPENSSL_SEEDS_ITSELF=yes
1817 AC_MSG_RESULT(yes)
1818 ],
1819 [
1820 AC_MSG_RESULT(no)
1821 # Default to use of the rand helper if OpenSSL doesn't
1822 # seed itself
1823 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001824 ],
1825 [
1826 AC_MSG_WARN([cross compiling: assuming yes])
1827 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001828 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001829 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001830 ]
1831)
1832
1833
1834# Do we want to force the use of the rand helper?
1835AC_ARG_WITH(rand-helper,
1836 [ --with-rand-helper Use subprocess to gather strong randomness ],
1837 [
1838 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001839 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001840 # the previous test showed it to be unseeded.
1841 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1842 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1843 OPENSSL_SEEDS_ITSELF=yes
1844 USE_RAND_HELPER=""
1845 fi
1846 else
1847 USE_RAND_HELPER=yes
1848 fi
1849 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001850)
Damien Miller6c21c512002-01-22 21:57:53 +11001851
1852# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001853if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001854 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001855 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1856 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001857 RAND_MSG="OpenSSL internal ONLY"
1858 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001859elif test ! -z "$USE_RAND_HELPER" ; then
1860 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001861 RAND_MSG="ssh-rand-helper"
1862 INSTALL_SSH_RAND_HELPER="yes"
1863fi
1864AC_SUBST(INSTALL_SSH_RAND_HELPER)
1865
1866### Configuration of ssh-rand-helper
1867
1868# PRNGD TCP socket
1869AC_ARG_WITH(prngd-port,
1870 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1871 [
Damien Millere996d722002-01-23 11:20:59 +11001872 case "$withval" in
1873 no)
1874 withval=""
1875 ;;
1876 [[0-9]]*)
1877 ;;
1878 *)
1879 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1880 ;;
1881 esac
1882 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001883 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001884 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1885 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001886 fi
1887 ]
1888)
1889
1890# PRNGD Unix domain socket
1891AC_ARG_WITH(prngd-socket,
1892 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1893 [
Damien Millere996d722002-01-23 11:20:59 +11001894 case "$withval" in
1895 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001896 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001897 ;;
1898 no)
1899 withval=""
1900 ;;
1901 /*)
1902 ;;
1903 *)
1904 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1905 ;;
1906 esac
1907
1908 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001909 if test ! -z "$PRNGD_PORT" ; then
1910 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1911 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001912 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001913 AC_MSG_WARN(Entropy socket is not readable)
1914 fi
1915 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001916 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1917 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001918 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001919 ],
1920 [
1921 # Check for existing socket only if we don't have a random device already
1922 if test "$USE_RAND_HELPER" = yes ; then
1923 AC_MSG_CHECKING(for PRNGD/EGD socket)
1924 # Insert other locations here
1925 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1926 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1927 PRNGD_SOCKET="$sock"
1928 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1929 break;
1930 fi
1931 done
1932 if test ! -z "$PRNGD_SOCKET" ; then
1933 AC_MSG_RESULT($PRNGD_SOCKET)
1934 else
1935 AC_MSG_RESULT(not found)
1936 fi
1937 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001938 ]
1939)
1940
1941# Change default command timeout for hashing entropy source
1942entropy_timeout=200
1943AC_ARG_WITH(entropy-timeout,
1944 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1945 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001946 if test -n "$withval" && test "x$withval" != "xno" && \
1947 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001948 entropy_timeout=$withval
1949 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001950 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001951)
Tim Rice7df8d392005-09-19 09:33:39 -07001952AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1953 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11001954
Damien Millerd3f6ad22002-06-25 10:24:47 +10001955SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001956AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001957 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001958 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001959 if test -n "$withval" && test "x$withval" != "xno" && \
1960 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001961 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001962 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001963 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001964)
Tim Rice7df8d392005-09-19 09:33:39 -07001965AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
1966 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10001967AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001968
Tim Rice88f2ab52002-03-17 12:17:34 -08001969# We do this little dance with the search path to insure
1970# that programs that we select for use by installed programs
1971# (which may be run by the super-user) come from trusted
1972# locations before they come from the user's private area.
1973# This should help avoid accidentally configuring some
1974# random version of a program in someone's personal bin.
1975
1976OPATH=$PATH
1977PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001978test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001979test -d /sbin && PATH=$PATH:/sbin
1980test -d /usr/sbin && PATH=$PATH:/usr/sbin
1981PATH=$PATH:/etc:$OPATH
1982
Damien Millera8e06ce2003-11-21 23:48:55 +11001983# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001984OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1985OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1986OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1987OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1988OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1989OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1990OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1991OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1992OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1993OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1994OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1995OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1996OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1997OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1998OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1999OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002000# restore PATH
2001PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002002
2003# Where does ssh-rand-helper get its randomness from?
2004INSTALL_SSH_PRNG_CMDS=""
2005if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2006 if test ! -z "$PRNGD_PORT" ; then
2007 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2008 elif test ! -z "$PRNGD_SOCKET" ; then
2009 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2010 else
2011 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2012 RAND_HELPER_CMDHASH=yes
2013 INSTALL_SSH_PRNG_CMDS="yes"
2014 fi
2015fi
2016AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2017
2018
Ben Lindstromb5628642000-10-18 00:02:25 +00002019# Cheap hack to ensure NEWS-OS libraries are arranged right.
2020if test ! -z "$SONY" ; then
2021 LIBS="$LIBS -liberty";
2022fi
2023
Damien Miller57f39152005-11-24 19:58:19 +11002024# Check for long long datatypes
2025AC_CHECK_TYPES([long long, unsigned long long, long double])
2026
2027# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002028AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002029AC_CHECK_SIZEOF(short int, 2)
2030AC_CHECK_SIZEOF(int, 4)
2031AC_CHECK_SIZEOF(long int, 4)
2032AC_CHECK_SIZEOF(long long int, 8)
2033
Damien Millerfa2bb692002-04-23 23:22:25 +10002034# Sanity check long long for some platforms (AIX)
2035if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2036 ac_cv_sizeof_long_long_int=0
2037fi
2038
Darren Tucker537f1ed2005-10-25 18:38:33 +10002039# compute LLONG_MIN and LLONG_MAX if we don't know them.
2040if test -z "$have_llong_max"; then
2041 AC_MSG_CHECKING([for max value of long long])
2042 AC_RUN_IFELSE(
2043 [AC_LANG_SOURCE([[
2044#include <stdio.h>
2045/* Why is this so damn hard? */
2046#ifdef __GNUC__
2047# undef __GNUC__
2048#endif
2049#define __USE_ISOC99
2050#include <limits.h>
2051#define DATA "conftest.llminmax"
2052int main(void) {
2053 FILE *f;
2054 long long i, llmin, llmax = 0;
2055
2056 if((f = fopen(DATA,"w")) == NULL)
2057 exit(1);
2058
2059#if defined(LLONG_MIN) && defined(LLONG_MAX)
2060 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2061 llmin = LLONG_MIN;
2062 llmax = LLONG_MAX;
2063#else
2064 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2065 /* This will work on one's complement and two's complement */
2066 for (i = 1; i > llmax; i <<= 1, i++)
2067 llmax = i;
2068 llmin = llmax + 1LL; /* wrap */
2069#endif
2070
2071 /* Sanity check */
2072 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2073 || llmax - 1 > llmax) {
2074 fprintf(f, "unknown unknown\n");
2075 exit(2);
2076 }
2077
2078 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2079 exit(3);
2080
2081 exit(0);
2082}
2083 ]])],
2084 [
2085 llong_min=`$AWK '{print $1}' conftest.llminmax`
2086 llong_max=`$AWK '{print $2}' conftest.llminmax`
2087
2088 # snprintf on some Tru64s doesn't understand "%lld"
2089 case "$host" in
2090 alpha-dec-osf*)
2091 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2092 test "x$llong_max" = "xld"; then
2093 llong_min="-9223372036854775808"
2094 llong_max="9223372036854775807"
2095 fi
2096 ;;
2097 esac
2098
2099 AC_MSG_RESULT($llong_max)
2100 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2101 [max value of long long calculated by configure])
2102 AC_MSG_CHECKING([for min value of long long])
2103 AC_MSG_RESULT($llong_min)
2104 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2105 [min value of long long calculated by configure])
2106 ],
2107 [
2108 AC_MSG_RESULT(not found)
2109 ],
2110 [
2111 AC_MSG_WARN([cross compiling: not checking])
2112 ]
2113 )
2114fi
2115
2116
Damien Millera22ba012000-03-02 23:09:20 +11002117# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002118AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2119 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002120 [ #include <sys/types.h> ],
2121 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002122 [ ac_cv_have_u_int="yes" ],
2123 [ ac_cv_have_u_int="no" ]
2124 )
2125])
2126if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002127 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002128 have_u_int=1
2129fi
2130
Damien Miller61e50f12000-05-08 20:49:37 +10002131AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2132 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002133 [ #include <sys/types.h> ],
2134 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002135 [ ac_cv_have_intxx_t="yes" ],
2136 [ ac_cv_have_intxx_t="no" ]
2137 )
2138])
2139if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002140 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002141 have_intxx_t=1
2142fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002143
2144if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002145 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002146then
2147 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2148 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002149 [ #include <stdint.h> ],
2150 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002151 [
2152 AC_DEFINE(HAVE_INTXX_T)
2153 AC_MSG_RESULT(yes)
2154 ],
2155 [ AC_MSG_RESULT(no) ]
2156 )
2157fi
2158
Damien Miller578783e2000-09-23 14:12:24 +11002159AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2160 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002161 [
2162#include <sys/types.h>
2163#ifdef HAVE_STDINT_H
2164# include <stdint.h>
2165#endif
2166#include <sys/socket.h>
2167#ifdef HAVE_SYS_BITYPES_H
2168# include <sys/bitypes.h>
2169#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002170 ],
2171 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002172 [ ac_cv_have_int64_t="yes" ],
2173 [ ac_cv_have_int64_t="no" ]
2174 )
2175])
2176if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002177 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002178fi
2179
Damien Miller61e50f12000-05-08 20:49:37 +10002180AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2181 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002182 [ #include <sys/types.h> ],
2183 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002184 [ ac_cv_have_u_intxx_t="yes" ],
2185 [ ac_cv_have_u_intxx_t="no" ]
2186 )
2187])
2188if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002189 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002190 have_u_intxx_t=1
2191fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002192
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002193if test -z "$have_u_intxx_t" ; then
2194 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2195 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002196 [ #include <sys/socket.h> ],
2197 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002198 [
2199 AC_DEFINE(HAVE_U_INTXX_T)
2200 AC_MSG_RESULT(yes)
2201 ],
2202 [ AC_MSG_RESULT(no) ]
2203 )
2204fi
2205
Damien Miller578783e2000-09-23 14:12:24 +11002206AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2207 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002208 [ #include <sys/types.h> ],
2209 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002210 [ ac_cv_have_u_int64_t="yes" ],
2211 [ ac_cv_have_u_int64_t="no" ]
2212 )
2213])
2214if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002215 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002216 have_u_int64_t=1
2217fi
2218
Tim Rice4cec93f2002-02-26 08:40:48 -08002219if test -z "$have_u_int64_t" ; then
2220 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2221 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002222 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002223 [ u_int64_t a; a = 1],
2224 [
2225 AC_DEFINE(HAVE_U_INT64_T)
2226 AC_MSG_RESULT(yes)
2227 ],
2228 [ AC_MSG_RESULT(no) ]
2229 )
2230fi
2231
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002232if test -z "$have_u_intxx_t" ; then
2233 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2234 AC_TRY_COMPILE(
2235 [
2236#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002237 ],
2238 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002239 [ ac_cv_have_uintxx_t="yes" ],
2240 [ ac_cv_have_uintxx_t="no" ]
2241 )
2242 ])
2243 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002244 AC_DEFINE(HAVE_UINTXX_T, 1,
2245 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002246 fi
2247fi
2248
2249if test -z "$have_uintxx_t" ; then
2250 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2251 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002252 [ #include <stdint.h> ],
2253 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002254 [
2255 AC_DEFINE(HAVE_UINTXX_T)
2256 AC_MSG_RESULT(yes)
2257 ],
2258 [ AC_MSG_RESULT(no) ]
2259 )
2260fi
2261
Damien Milleredb82922000-06-20 13:25:52 +10002262if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002263 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002264then
2265 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2266 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002267 [
2268#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002269 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002270 [
Damien Miller70494d12000-04-03 15:57:06 +10002271 int8_t a; int16_t b; int32_t c;
2272 u_int8_t e; u_int16_t f; u_int32_t g;
2273 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002274 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002275 [
2276 AC_DEFINE(HAVE_U_INTXX_T)
2277 AC_DEFINE(HAVE_INTXX_T)
2278 AC_MSG_RESULT(yes)
2279 ],
2280 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002281 )
Damien Millerb29ea912000-01-15 14:12:03 +11002282fi
2283
Damien Miller58be7382001-09-15 21:31:54 +10002284
2285AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2286 AC_TRY_COMPILE(
2287 [
2288#include <sys/types.h>
2289 ],
2290 [ u_char foo; foo = 125; ],
2291 [ ac_cv_have_u_char="yes" ],
2292 [ ac_cv_have_u_char="no" ]
2293 )
2294])
2295if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002296 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002297fi
2298
Tim Rice13aae5e2001-10-21 17:53:58 -07002299TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002300
Tim Rice200a5c02002-02-26 22:12:34 -08002301AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002302
Damien Miller848b9932005-02-24 12:12:34 +11002303AC_CHECK_TYPES(in_addr_t,,,
2304[#include <sys/types.h>
2305#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002306
Damien Miller61e50f12000-05-08 20:49:37 +10002307AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2308 AC_TRY_COMPILE(
2309 [
2310#include <sys/types.h>
2311 ],
2312 [ size_t foo; foo = 1235; ],
2313 [ ac_cv_have_size_t="yes" ],
2314 [ ac_cv_have_size_t="no" ]
2315 )
2316])
2317if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002318 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002319fi
Damien Miller95058511999-12-29 10:36:45 +11002320
Damien Miller615f9392000-05-17 22:53:33 +10002321AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2322 AC_TRY_COMPILE(
2323 [
2324#include <sys/types.h>
2325 ],
2326 [ ssize_t foo; foo = 1235; ],
2327 [ ac_cv_have_ssize_t="yes" ],
2328 [ ac_cv_have_ssize_t="no" ]
2329 )
2330])
2331if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002332 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002333fi
2334
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002335AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2336 AC_TRY_COMPILE(
2337 [
2338#include <time.h>
2339 ],
2340 [ clock_t foo; foo = 1235; ],
2341 [ ac_cv_have_clock_t="yes" ],
2342 [ ac_cv_have_clock_t="no" ]
2343 )
2344])
2345if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002346 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002347fi
2348
Damien Millerb54b40e2000-06-23 08:23:34 +10002349AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2350 AC_TRY_COMPILE(
2351 [
2352#include <sys/types.h>
2353#include <sys/socket.h>
2354 ],
2355 [ sa_family_t foo; foo = 1235; ],
2356 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002357 [ AC_TRY_COMPILE(
2358 [
2359#include <sys/types.h>
2360#include <sys/socket.h>
2361#include <netinet/in.h>
2362 ],
2363 [ sa_family_t foo; foo = 1235; ],
2364 [ ac_cv_have_sa_family_t="yes" ],
2365
Damien Millerb54b40e2000-06-23 08:23:34 +10002366 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002367 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002368 )
2369])
2370if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002371 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2372 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002373fi
2374
Damien Miller0f91b4e2000-06-18 15:43:25 +10002375AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2376 AC_TRY_COMPILE(
2377 [
2378#include <sys/types.h>
2379 ],
2380 [ pid_t foo; foo = 1235; ],
2381 [ ac_cv_have_pid_t="yes" ],
2382 [ ac_cv_have_pid_t="no" ]
2383 )
2384])
2385if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002386 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002387fi
2388
2389AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2390 AC_TRY_COMPILE(
2391 [
2392#include <sys/types.h>
2393 ],
2394 [ mode_t foo; foo = 1235; ],
2395 [ ac_cv_have_mode_t="yes" ],
2396 [ ac_cv_have_mode_t="no" ]
2397 )
2398])
2399if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002400 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002401fi
2402
Damien Miller61e50f12000-05-08 20:49:37 +10002403
2404AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2405 AC_TRY_COMPILE(
2406 [
Damien Miller81171112000-04-23 11:14:01 +10002407#include <sys/types.h>
2408#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002409 ],
2410 [ struct sockaddr_storage s; ],
2411 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2412 [ ac_cv_have_struct_sockaddr_storage="no" ]
2413 )
2414])
2415if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002416 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2417 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002418fi
Damien Miller34132e52000-01-14 15:45:46 +11002419
Damien Miller61e50f12000-05-08 20:49:37 +10002420AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2421 AC_TRY_COMPILE(
2422 [
Damien Miller7b22d652000-06-18 14:07:04 +10002423#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002424#include <netinet/in.h>
2425 ],
2426 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2427 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2428 [ ac_cv_have_struct_sockaddr_in6="no" ]
2429 )
2430])
2431if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002432 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2433 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002434fi
Damien Miller34132e52000-01-14 15:45:46 +11002435
Damien Miller61e50f12000-05-08 20:49:37 +10002436AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2437 AC_TRY_COMPILE(
2438 [
Damien Miller7b22d652000-06-18 14:07:04 +10002439#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002440#include <netinet/in.h>
2441 ],
2442 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2443 [ ac_cv_have_struct_in6_addr="yes" ],
2444 [ ac_cv_have_struct_in6_addr="no" ]
2445 )
2446])
2447if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002448 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2449 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002450fi
Damien Miller34132e52000-01-14 15:45:46 +11002451
Damien Miller61e50f12000-05-08 20:49:37 +10002452AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2453 AC_TRY_COMPILE(
2454 [
Damien Miller81171112000-04-23 11:14:01 +10002455#include <sys/types.h>
2456#include <sys/socket.h>
2457#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002458 ],
2459 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2460 [ ac_cv_have_struct_addrinfo="yes" ],
2461 [ ac_cv_have_struct_addrinfo="no" ]
2462 )
2463])
2464if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002465 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2466 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002467fi
2468
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002469AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2470 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002471 [ #include <sys/time.h> ],
2472 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002473 [ ac_cv_have_struct_timeval="yes" ],
2474 [ ac_cv_have_struct_timeval="no" ]
2475 )
2476])
2477if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002478 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002479 have_struct_timeval=1
2480fi
2481
Tim Rice4e4dc562003-03-18 10:21:40 -08002482AC_CHECK_TYPES(struct timespec)
2483
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002484# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002485if test "x$ac_cv_have_int64_t" = "xno" && \
2486 test "x$ac_cv_sizeof_long_int" != "x8" && \
2487 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002488 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2489 echo "an alternative compiler (I.E., GCC) before continuing."
2490 echo ""
2491 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002492else
2493dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002494 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002495 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002496#include <stdio.h>
2497#include <string.h>
2498#ifdef HAVE_SNPRINTF
2499main()
2500{
2501 char buf[50];
2502 char expected_out[50];
2503 int mazsize = 50 ;
2504#if (SIZEOF_LONG_INT == 8)
2505 long int num = 0x7fffffffffffffff;
2506#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002507 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002508#endif
2509 strcpy(expected_out, "9223372036854775807");
2510 snprintf(buf, mazsize, "%lld", num);
2511 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002512 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002513 exit(0);
2514}
2515#else
2516main() { exit(0); }
2517#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002518 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002519 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002520 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002521fi
2522
Damien Miller78315eb2000-09-29 23:01:36 +11002523dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002524OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2525OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2526OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2527OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2528OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002529OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002530OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2531OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002532OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002533OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2534OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2535OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2536OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002537OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2538OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2539OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2540OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002541
2542AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002543AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2544 [Define if we don't have struct __res_state in resolv.h])],
2545[
2546#include <stdio.h>
2547#if HAVE_SYS_TYPES_H
2548# include <sys/types.h>
2549#endif
2550#include <netinet/in.h>
2551#include <arpa/nameser.h>
2552#include <resolv.h>
2553])
andre2ff7b5d2000-06-03 14:57:40 +00002554
Damien Miller61e50f12000-05-08 20:49:37 +10002555AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2556 ac_cv_have_ss_family_in_struct_ss, [
2557 AC_TRY_COMPILE(
2558 [
Damien Miller81171112000-04-23 11:14:01 +10002559#include <sys/types.h>
2560#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002561 ],
2562 [ struct sockaddr_storage s; s.ss_family = 1; ],
2563 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2564 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2565 )
2566])
2567if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002568 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002569fi
2570
Damien Miller61e50f12000-05-08 20:49:37 +10002571AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2572 ac_cv_have___ss_family_in_struct_ss, [
2573 AC_TRY_COMPILE(
2574 [
Damien Miller81171112000-04-23 11:14:01 +10002575#include <sys/types.h>
2576#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002577 ],
2578 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2579 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2580 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2581 )
2582])
2583if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002584 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2585 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002586fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002587
Damien Millerad833b32000-08-23 10:46:23 +10002588AC_CACHE_CHECK([for pw_class field in struct passwd],
2589 ac_cv_have_pw_class_in_struct_passwd, [
2590 AC_TRY_COMPILE(
2591 [
Damien Millerad833b32000-08-23 10:46:23 +10002592#include <pwd.h>
2593 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002594 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002595 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2596 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2597 )
2598])
2599if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002600 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2601 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002602fi
2603
Kevin Steves82456952001-06-22 21:14:18 +00002604AC_CACHE_CHECK([for pw_expire field in struct passwd],
2605 ac_cv_have_pw_expire_in_struct_passwd, [
2606 AC_TRY_COMPILE(
2607 [
2608#include <pwd.h>
2609 ],
2610 [ struct passwd p; p.pw_expire = 0; ],
2611 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2612 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2613 )
2614])
2615if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002616 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2617 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002618fi
2619
2620AC_CACHE_CHECK([for pw_change field in struct passwd],
2621 ac_cv_have_pw_change_in_struct_passwd, [
2622 AC_TRY_COMPILE(
2623 [
2624#include <pwd.h>
2625 ],
2626 [ struct passwd p; p.pw_change = 0; ],
2627 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2628 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2629 )
2630])
2631if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002632 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2633 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002634fi
Damien Miller61e50f12000-05-08 20:49:37 +10002635
Tim Rice28bbb0c2002-05-27 17:37:32 -07002636dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002637AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2638 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002639 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002640 [
Tim Riceae49fe62002-04-12 10:26:21 -07002641#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002642#include <sys/socket.h>
2643#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002644int main() {
2645#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002646#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002647exit(1);
2648#endif
2649struct msghdr m;
2650m.msg_accrights = 0;
2651exit(0);
2652}
Kevin Steves939c9db2002-03-22 17:23:25 +00002653 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002654 [ ac_cv_have_accrights_in_msghdr="yes" ],
2655 [ ac_cv_have_accrights_in_msghdr="no" ]
2656 )
2657])
2658if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002659 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2660 [Define if your system uses access rights style
2661 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002662fi
2663
Kevin Stevesa44e0352002-04-07 16:18:03 +00002664AC_CACHE_CHECK([for msg_control field in struct msghdr],
2665 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002666 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002667 [
Tim Riceae49fe62002-04-12 10:26:21 -07002668#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002669#include <sys/socket.h>
2670#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002671int main() {
2672#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002673#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002674exit(1);
2675#endif
2676struct msghdr m;
2677m.msg_control = 0;
2678exit(0);
2679}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002680 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002681 [ ac_cv_have_control_in_msghdr="yes" ],
2682 [ ac_cv_have_control_in_msghdr="no" ]
2683 )
2684])
2685if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002686 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2687 [Define if your system uses ancillary data style
2688 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002689fi
2690
Damien Miller61e50f12000-05-08 20:49:37 +10002691AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002692 AC_TRY_LINK([],
2693 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002694 [ ac_cv_libc_defines___progname="yes" ],
2695 [ ac_cv_libc_defines___progname="no" ]
2696 )
2697])
2698if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002699 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002700fi
2701
Kevin Steves4846f4a2002-03-22 18:19:53 +00002702AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2703 AC_TRY_LINK([
2704#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002705],
2706 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002707 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2708 [ ac_cv_cc_implements___FUNCTION__="no" ]
2709 )
2710])
2711if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002712 AC_DEFINE(HAVE___FUNCTION__, 1,
2713 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002714fi
2715
2716AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2717 AC_TRY_LINK([
2718#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002719],
2720 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002721 [ ac_cv_cc_implements___func__="yes" ],
2722 [ ac_cv_cc_implements___func__="no" ]
2723 )
2724])
2725if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002726 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002727fi
2728
Damien Miller57f39152005-11-24 19:58:19 +11002729AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
2730 AC_TRY_LINK(
2731 [#include <stdarg.h>
2732 va_list x,y;],
2733 [va_copy(x,y);],
2734 [ ac_cv_have_va_copy="yes" ],
2735 [ ac_cv_have_va_copy="no" ]
2736 )
2737])
2738if test "x$ac_cv_have_va_copy" = "xyes" ; then
2739 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
2740fi
2741
2742AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
2743 AC_TRY_LINK(
2744 [#include <stdarg.h>
2745 va_list x,y;],
2746 [__va_copy(x,y);],
2747 [ ac_cv_have___va_copy="yes" ],
2748 [ ac_cv_have___va_copy="no" ]
2749 )
2750])
2751if test "x$ac_cv_have___va_copy" = "xyes" ; then
2752 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2753fi
2754
Damien Miller4f8e6692001-07-14 13:22:53 +10002755AC_CACHE_CHECK([whether getopt has optreset support],
2756 ac_cv_have_getopt_optreset, [
2757 AC_TRY_LINK(
2758 [
2759#include <getopt.h>
2760 ],
2761 [ extern int optreset; optreset = 0; ],
2762 [ ac_cv_have_getopt_optreset="yes" ],
2763 [ ac_cv_have_getopt_optreset="no" ]
2764 )
2765])
2766if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002767 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2768 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002769fi
Damien Millera22ba012000-03-02 23:09:20 +11002770
Damien Millerecbb26d2000-07-15 14:59:14 +10002771AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002772 AC_TRY_LINK([],
2773 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002774 [ ac_cv_libc_defines_sys_errlist="yes" ],
2775 [ ac_cv_libc_defines_sys_errlist="no" ]
2776 )
2777])
2778if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002779 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2780 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002781fi
2782
2783
Damien Miller11fa2cc2000-08-16 10:35:58 +10002784AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002785 AC_TRY_LINK([],
2786 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002787 [ ac_cv_libc_defines_sys_nerr="yes" ],
2788 [ ac_cv_libc_defines_sys_nerr="no" ]
2789 )
2790])
2791if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002792 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002793fi
2794
Damien Millera8e06ce2003-11-21 23:48:55 +11002795SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002796# Check whether user wants sectok support
2797AC_ARG_WITH(sectok,
2798 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002799 [
2800 if test "x$withval" != "xno" ; then
2801 if test "x$withval" != "xyes" ; then
2802 CPPFLAGS="$CPPFLAGS -I${withval}"
2803 LDFLAGS="$LDFLAGS -L${withval}"
2804 if test ! -z "$need_dash_r" ; then
2805 LDFLAGS="$LDFLAGS -R${withval}"
2806 fi
2807 if test ! -z "$blibpath" ; then
2808 blibpath="$blibpath:${withval}"
2809 fi
2810 fi
2811 AC_CHECK_HEADERS(sectok.h)
2812 if test "$ac_cv_header_sectok_h" != yes; then
2813 AC_MSG_ERROR(Can't find sectok.h)
2814 fi
2815 AC_CHECK_LIB(sectok, sectok_open)
2816 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2817 AC_MSG_ERROR(Can't find libsectok)
2818 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002819 AC_DEFINE(SMARTCARD, 1,
2820 [Define if you want smartcard support])
2821 AC_DEFINE(USE_SECTOK, 1,
2822 [Define if you want smartcard support
2823 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002824 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002825 fi
2826 ]
2827)
2828
2829# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002830OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002831AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10002832 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08002833 [
2834 if test "x$withval" != "xno" ; then
2835 if test "x$withval" != "xyes" ; then
2836 OPENSC_CONFIG=$withval/bin/opensc-config
2837 else
2838 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2839 fi
2840 if test "$OPENSC_CONFIG" != "no"; then
2841 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2842 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2843 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2844 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2845 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002846 AC_DEFINE(USE_OPENSC, 1,
2847 [Define if you want smartcard support
2848 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002849 SCARD_MSG="yes, using OpenSC"
2850 fi
2851 fi
2852 ]
2853)
Damien Miller85de5802001-09-18 14:01:11 +10002854
Darren Tucker5f88d342003-10-15 16:57:57 +10002855# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002856AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002857 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2858 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002859 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002860 # Needed by our getrrsetbyname()
2861 AC_SEARCH_LIBS(res_query, resolv)
2862 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002863 AC_MSG_CHECKING(if res_query will link)
2864 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2865 [AC_MSG_RESULT(no)
2866 saved_LIBS="$LIBS"
2867 LIBS="$LIBS -lresolv"
2868 AC_MSG_CHECKING(for res_query in -lresolv)
2869 AC_LINK_IFELSE([
2870#include <resolv.h>
2871int main()
2872{
2873 res_query (0, 0, 0, 0, 0);
2874 return 0;
2875}
2876 ],
2877 [LIBS="$LIBS -lresolv"
2878 AC_MSG_RESULT(yes)],
2879 [LIBS="$saved_LIBS"
2880 AC_MSG_RESULT(no)])
2881 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002882 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002883 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002884 [#include <sys/types.h>
2885 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002886 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07002887 [AC_DEFINE(HAVE_HEADER_AD, 1,
2888 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10002889 [#include <arpa/nameser.h>])
2890 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002891
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002892# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002893KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002894AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002895 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002896 [ if test "x$withval" != "xno" ; then
2897 if test "x$withval" = "xyes" ; then
2898 KRB5ROOT="/usr/local"
2899 else
2900 KRB5ROOT=${withval}
2901 fi
2902
Tim Rice7df8d392005-09-19 09:33:39 -07002903 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11002904 KRB5_MSG="yes"
2905
2906 AC_MSG_CHECKING(for krb5-config)
2907 if test -x $KRB5ROOT/bin/krb5-config ; then
2908 KRB5CONF=$KRB5ROOT/bin/krb5-config
2909 AC_MSG_RESULT($KRB5CONF)
2910
2911 AC_MSG_CHECKING(for gssapi support)
2912 if $KRB5CONF | grep gssapi >/dev/null ; then
2913 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002914 AC_DEFINE(GSSAPI, 1,
2915 [Define this if you want GSSAPI
2916 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11002917 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002918 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002919 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002920 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002921 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002922 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2923 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002924 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002925 AC_MSG_CHECKING(whether we are using Heimdal)
2926 AC_TRY_COMPILE([ #include <krb5.h> ],
2927 [ char *tmp = heimdal_version; ],
2928 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002929 AC_DEFINE(HEIMDAL, 1,
2930 [Define this if you are using the
2931 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002932 AC_MSG_RESULT(no)
2933 )
2934 else
2935 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002936 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002937 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002938 AC_MSG_CHECKING(whether we are using Heimdal)
2939 AC_TRY_COMPILE([ #include <krb5.h> ],
2940 [ char *tmp = heimdal_version; ],
2941 [ AC_MSG_RESULT(yes)
2942 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002943 K5LIBS="-lkrb5 -ldes"
2944 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002945 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002946 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002947 ],
2948 [ AC_MSG_RESULT(no)
2949 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2950 ]
2951 )
Damien Miller200d0a72003-06-30 19:21:36 +10002952 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002953
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002954 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2955 [ AC_DEFINE(GSSAPI)
2956 K5LIBS="-lgssapi $K5LIBS" ],
2957 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2958 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002959 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002960 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2961 $K5LIBS)
2962 ],
2963 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002964
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002965 AC_CHECK_HEADER(gssapi.h, ,
2966 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002967 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002968 AC_CHECK_HEADERS(gssapi.h, ,
2969 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002970 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002971 ]
2972 )
2973
2974 oldCPP="$CPPFLAGS"
2975 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2976 AC_CHECK_HEADER(gssapi_krb5.h, ,
2977 [ CPPFLAGS="$oldCPP" ])
2978
Damien Millera8e06ce2003-11-21 23:48:55 +11002979 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002980 if test ! -z "$need_dash_r" ; then
2981 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2982 fi
2983 if test ! -z "$blibpath" ; then
2984 blibpath="$blibpath:${KRB5ROOT}/lib"
2985 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07002986
2987 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2988 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2989 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2990
2991 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07002992 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
2993 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002994 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002995 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002996)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002997
Damien Millera22ba012000-03-02 23:09:20 +11002998# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002999
Damien Millerf58c6722002-05-13 13:15:42 +10003000PRIVSEP_PATH=/var/empty
3001AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003002 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003003 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003004 if test -n "$withval" && test "x$withval" != "xno" && \
3005 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003006 PRIVSEP_PATH=$withval
3007 fi
3008 ]
3009)
3010AC_SUBST(PRIVSEP_PATH)
3011
Damien Millera22ba012000-03-02 23:09:20 +11003012AC_ARG_WITH(xauth,
3013 [ --with-xauth=PATH Specify path to xauth program ],
3014 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003015 if test -n "$withval" && test "x$withval" != "xno" && \
3016 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003017 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003018 fi
3019 ],
3020 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003021 TestPath="$PATH"
3022 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3023 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3024 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3025 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3026 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003027 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003028 xauth_path="/usr/openwin/bin/xauth"
3029 fi
3030 ]
3031)
3032
Damien Miller7d901272003-01-13 16:55:22 +11003033STRIP_OPT=-s
3034AC_ARG_ENABLE(strip,
3035 [ --disable-strip Disable calling strip(1) on install],
3036 [
3037 if test "x$enableval" = "xno" ; then
3038 STRIP_OPT=
3039 fi
3040 ]
3041)
3042AC_SUBST(STRIP_OPT)
3043
Damien Millera19cf472000-11-29 13:28:50 +11003044if test -z "$xauth_path" ; then
3045 XAUTH_PATH="undefined"
3046 AC_SUBST(XAUTH_PATH)
3047else
Tim Rice7df8d392005-09-19 09:33:39 -07003048 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3049 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003050 XAUTH_PATH=$xauth_path
3051 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003052fi
Damien Millera22ba012000-03-02 23:09:20 +11003053
3054# Check for mail directory (last resort if we cannot get it from headers)
3055if test ! -z "$MAIL" ; then
3056 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003057 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3058 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003059fi
3060
Darren Tucker623d92f2004-09-12 22:36:15 +10003061if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003062 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3063 disable_ptmx_check=yes
3064fi
Damien Millera22ba012000-03-02 23:09:20 +11003065if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003066 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003067 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003068 [
Tim Rice7df8d392005-09-19 09:33:39 -07003069 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3070 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003071 have_dev_ptmx=1
3072 ]
3073 )
3074 fi
Damien Millera22ba012000-03-02 23:09:20 +11003075fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003076
Darren Tucker623d92f2004-09-12 22:36:15 +10003077if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003078 AC_CHECK_FILE("/dev/ptc",
3079 [
Tim Rice7df8d392005-09-19 09:33:39 -07003080 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3081 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003082 have_dev_ptc=1
3083 ]
3084 )
3085else
3086 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3087fi
Damien Miller204ad072000-03-02 23:56:12 +11003088
Damien Millera22ba012000-03-02 23:09:20 +11003089# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003090AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003091 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003092 [
Damien Miller897741e2001-04-16 10:41:46 +10003093 case "$withval" in
3094 man|cat|doc)
3095 MANTYPE=$withval
3096 ;;
3097 *)
3098 AC_MSG_ERROR(invalid man type: $withval)
3099 ;;
3100 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003101 ]
3102)
Ben Lindstrombc709922001-04-18 18:04:21 +00003103if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003104 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3105 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003106 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3107 MANTYPE=doc
3108 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3109 MANTYPE=man
3110 else
3111 MANTYPE=cat
3112 fi
3113fi
Damien Miller670a4b82000-01-22 13:53:11 +11003114AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003115if test "$MANTYPE" = "doc"; then
3116 mansubdir=man;
3117else
3118 mansubdir=$MANTYPE;
3119fi
3120AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003121
Damien Millera22ba012000-03-02 23:09:20 +11003122# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003123MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003124AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003125 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003126 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003127 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003128 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3129 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003130 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003131 fi
3132 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003133)
3134
Damien Millera22ba012000-03-02 23:09:20 +11003135# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003136AC_ARG_WITH(shadow,
3137 [ --without-shadow Disable shadow password support],
3138 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003139 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003140 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003141 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003142 fi
3143 ]
3144)
3145
Damien Miller1f335fb2000-06-26 11:31:33 +10003146if test -z "$disable_shadow" ; then
3147 AC_MSG_CHECKING([if the systems has expire shadow information])
3148 AC_TRY_COMPILE(
3149 [
3150#include <sys/types.h>
3151#include <shadow.h>
3152 struct spwd sp;
3153 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3154 [ sp_expire_available=yes ], []
3155 )
3156
3157 if test "x$sp_expire_available" = "xyes" ; then
3158 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003159 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3160 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003161 else
3162 AC_MSG_RESULT(no)
3163 fi
3164fi
3165
Damien Millera22ba012000-03-02 23:09:20 +11003166# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003167if test ! -z "$IPADDR_IN_DISPLAY" ; then
3168 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003169 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3170 [Define if you need to use IP address
3171 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003172else
Damien Millera8e06ce2003-11-21 23:48:55 +11003173 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003174 AC_ARG_WITH(ipaddr-display,
3175 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3176 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003177 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003178 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003179 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003180 fi
3181 ]
3182 )
3183fi
Damien Miller76112de1999-12-21 11:18:08 +11003184
Darren Tuckere1a790d2003-09-16 11:52:19 +10003185# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003186AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003187 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003188 [ if test "x$enableval" = "xno"; then
3189 AC_MSG_NOTICE([/etc/default/login handling disabled])
3190 etc_default_login=no
3191 else
3192 etc_default_login=yes
3193 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003194 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3195 then
3196 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3197 etc_default_login=no
3198 else
3199 etc_default_login=yes
3200 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003201)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003202
Darren Tucker2f9573d2005-02-10 22:28:54 +11003203if test "x$etc_default_login" != "xno"; then
3204 AC_CHECK_FILE("/etc/default/login",
3205 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003206 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003207 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3208 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003209 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003210fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003211
Tim Rice43a1c132002-04-17 21:19:14 -07003212dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003213if test $ac_cv_func_login_getcapbool = "yes" && \
3214 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003215 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003216fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003217
Damien Millera22ba012000-03-02 23:09:20 +11003218# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003219SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003220AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003221 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003222 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003223 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003224 AC_MSG_WARN([
3225--with-default-path=PATH has no effect on this system.
3226Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003227 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003228 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003229 AC_MSG_WARN([
3230--with-default-path=PATH will only be used if PATH is not defined in
3231$external_path_file .])
3232 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003233 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003234 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003235 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003236 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003237 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3238 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003239 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003240 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003241 AC_MSG_WARN([
3242If PATH is defined in $external_path_file, ensure the path to scp is included,
3243otherwise scp will not work.])
3244 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003245 AC_RUN_IFELSE(
3246 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003247/* find out what STDPATH is */
3248#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003249#ifdef HAVE_PATHS_H
3250# include <paths.h>
3251#endif
3252#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003253# ifdef _PATH_USERPATH /* Irix */
3254# define _PATH_STDPATH _PATH_USERPATH
3255# else
3256# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3257# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003258#endif
3259#include <sys/types.h>
3260#include <sys/stat.h>
3261#include <fcntl.h>
3262#define DATA "conftest.stdpath"
3263
3264main()
3265{
3266 FILE *fd;
3267 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003268
Tim Rice59ea0a02001-03-10 13:50:45 -08003269 fd = fopen(DATA,"w");
3270 if(fd == NULL)
3271 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003272
Tim Rice59ea0a02001-03-10 13:50:45 -08003273 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3274 exit(1);
3275
3276 exit(0);
3277}
Darren Tucker314d89e2005-10-17 23:29:23 +10003278 ]])],
3279 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003280 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3281 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3282 )
3283# make sure $bindir is in USER_PATH so scp will work
3284 t_bindir=`eval echo ${bindir}`
3285 case $t_bindir in
3286 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3287 esac
3288 case $t_bindir in
3289 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3290 esac
3291 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3292 if test $? -ne 0 ; then
3293 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3294 if test $? -ne 0 ; then
3295 user_path=$user_path:$t_bindir
3296 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3297 fi
3298 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003299 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003300)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003301if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003302 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003303 AC_SUBST(user_path)
3304fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003305
Damien Millera18bbd32002-05-13 10:48:57 +10003306# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003307AC_ARG_WITH(superuser-path,
3308 [ --with-superuser-path= Specify different path for super-user],
3309 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003310 if test -n "$withval" && test "x$withval" != "xno" && \
3311 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003312 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3313 [Define if you want a different $PATH
3314 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003315 superuser_path=$withval
3316 fi
3317 ]
3318)
3319
3320
Damien Miller61e50f12000-05-08 20:49:37 +10003321AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003322IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003323AC_ARG_WITH(4in6,
3324 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3325 [
3326 if test "x$withval" != "xno" ; then
3327 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003328 AC_DEFINE(IPV4_IN_IPV6, 1,
3329 [Detect IPv4 in IPv6 mapped addresses
3330 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003331 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003332 else
3333 AC_MSG_RESULT(no)
3334 fi
3335 ],[
3336 if test "x$inet6_default_4in6" = "xyes"; then
3337 AC_MSG_RESULT([yes (default)])
3338 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003339 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003340 else
3341 AC_MSG_RESULT([no (default)])
3342 fi
3343 ]
3344)
3345
Damien Miller60396b02001-02-18 17:01:00 +11003346# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003347BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003348AC_ARG_WITH(bsd-auth,
3349 [ --with-bsd-auth Enable BSD auth support],
3350 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003351 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003352 AC_DEFINE(BSD_AUTH, 1,
3353 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003354 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003355 fi
3356 ]
3357)
3358
Damien Millera22ba012000-03-02 23:09:20 +11003359# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003360piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003361# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003362if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003363 piddir=`eval echo ${sysconfdir}`
3364 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003365 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003366 esac
3367fi
3368
Tim Rice88f2ab52002-03-17 12:17:34 -08003369AC_ARG_WITH(pid-dir,
3370 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3371 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003372 if test -n "$withval" && test "x$withval" != "xno" && \
3373 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003374 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003375 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003376 AC_MSG_WARN([** no $piddir directory on this system **])
3377 fi
3378 fi
3379 ]
3380)
3381
Tim Rice7df8d392005-09-19 09:33:39 -07003382AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003383AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003384
andre2ff7b5d2000-06-03 14:57:40 +00003385dnl allow user to disable some login recording features
3386AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003387 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003388 [
3389 if test "x$enableval" = "xno" ; then
3390 AC_DEFINE(DISABLE_LASTLOG)
3391 fi
3392 ]
andre2ff7b5d2000-06-03 14:57:40 +00003393)
3394AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003395 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003396 [
3397 if test "x$enableval" = "xno" ; then
3398 AC_DEFINE(DISABLE_UTMP)
3399 fi
3400 ]
andre2ff7b5d2000-06-03 14:57:40 +00003401)
3402AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003403 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003404 [
3405 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003406 AC_DEFINE(DISABLE_UTMPX, 1,
3407 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003408 fi
3409 ]
andre2ff7b5d2000-06-03 14:57:40 +00003410)
3411AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003412 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003413 [
3414 if test "x$enableval" = "xno" ; then
3415 AC_DEFINE(DISABLE_WTMP)
3416 fi
3417 ]
andre2ff7b5d2000-06-03 14:57:40 +00003418)
3419AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003420 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003421 [
3422 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003423 AC_DEFINE(DISABLE_WTMPX, 1,
3424 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003425 fi
3426 ]
andre2ff7b5d2000-06-03 14:57:40 +00003427)
3428AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003429 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003430 [
3431 if test "x$enableval" = "xno" ; then
3432 AC_DEFINE(DISABLE_LOGIN)
3433 fi
3434 ]
andre2ff7b5d2000-06-03 14:57:40 +00003435)
3436AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003437 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003438 [
3439 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003440 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3441 [Define if you don't want to use pututline()
3442 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003443 fi
3444 ]
andre2ff7b5d2000-06-03 14:57:40 +00003445)
3446AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003447 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003448 [
3449 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003450 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3451 [Define if you don't want to use pututxline()
3452 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003453 fi
3454 ]
andre2ff7b5d2000-06-03 14:57:40 +00003455)
3456AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003457 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003458 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003459 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003460 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003461 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003462 conf_lastlog_location=$withval
3463 fi
3464 ]
3465)
andre2ff7b5d2000-06-03 14:57:40 +00003466
3467dnl lastlog, [uw]tmpx? detection
3468dnl NOTE: set the paths in the platform section to avoid the
3469dnl need for command-line parameters
3470dnl lastlog and [uw]tmp are subject to a file search if all else fails
3471
3472dnl lastlog detection
3473dnl NOTE: the code itself will detect if lastlog is a directory
3474AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3475AC_TRY_COMPILE([
3476#include <sys/types.h>
3477#include <utmp.h>
3478#ifdef HAVE_LASTLOG_H
3479# include <lastlog.h>
3480#endif
Damien Miller2994e082000-06-04 15:51:47 +10003481#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003482# include <paths.h>
3483#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003484#ifdef HAVE_LOGIN_H
3485# include <login.h>
3486#endif
andre2ff7b5d2000-06-03 14:57:40 +00003487 ],
3488 [ char *lastlog = LASTLOG_FILE; ],
3489 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003490 [
3491 AC_MSG_RESULT(no)
3492 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3493 AC_TRY_COMPILE([
3494#include <sys/types.h>
3495#include <utmp.h>
3496#ifdef HAVE_LASTLOG_H
3497# include <lastlog.h>
3498#endif
3499#ifdef HAVE_PATHS_H
3500# include <paths.h>
3501#endif
3502 ],
3503 [ char *lastlog = _PATH_LASTLOG; ],
3504 [ AC_MSG_RESULT(yes) ],
3505 [
andree441aa32000-06-12 22:34:38 +00003506 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003507 system_lastlog_path=no
3508 ])
3509 ]
andre2ff7b5d2000-06-03 14:57:40 +00003510)
Damien Miller2994e082000-06-04 15:51:47 +10003511
andre2ff7b5d2000-06-03 14:57:40 +00003512if test -z "$conf_lastlog_location"; then
3513 if test x"$system_lastlog_path" = x"no" ; then
3514 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003515 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003516 conf_lastlog_location=$f
3517 fi
3518 done
3519 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003520 AC_MSG_WARN([** Cannot find lastlog **])
3521 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003522 fi
3523 fi
3524fi
3525
3526if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003527 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3528 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003529fi
andre2ff7b5d2000-06-03 14:57:40 +00003530
3531dnl utmp detection
3532AC_MSG_CHECKING([if your system defines UTMP_FILE])
3533AC_TRY_COMPILE([
3534#include <sys/types.h>
3535#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003536#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003537# include <paths.h>
3538#endif
3539 ],
3540 [ char *utmp = UTMP_FILE; ],
3541 [ AC_MSG_RESULT(yes) ],
3542 [ AC_MSG_RESULT(no)
3543 system_utmp_path=no ]
3544)
3545if test -z "$conf_utmp_location"; then
3546 if test x"$system_utmp_path" = x"no" ; then
3547 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3548 if test -f $f ; then
3549 conf_utmp_location=$f
3550 fi
3551 done
3552 if test -z "$conf_utmp_location"; then
3553 AC_DEFINE(DISABLE_UTMP)
3554 fi
3555 fi
3556fi
3557if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003558 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3559 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003560fi
andre2ff7b5d2000-06-03 14:57:40 +00003561
3562dnl wtmp detection
3563AC_MSG_CHECKING([if your system defines WTMP_FILE])
3564AC_TRY_COMPILE([
3565#include <sys/types.h>
3566#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003567#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003568# include <paths.h>
3569#endif
3570 ],
3571 [ char *wtmp = WTMP_FILE; ],
3572 [ AC_MSG_RESULT(yes) ],
3573 [ AC_MSG_RESULT(no)
3574 system_wtmp_path=no ]
3575)
3576if test -z "$conf_wtmp_location"; then
3577 if test x"$system_wtmp_path" = x"no" ; then
3578 for f in /usr/adm/wtmp /var/log/wtmp; do
3579 if test -f $f ; then
3580 conf_wtmp_location=$f
3581 fi
3582 done
3583 if test -z "$conf_wtmp_location"; then
3584 AC_DEFINE(DISABLE_WTMP)
3585 fi
3586 fi
3587fi
3588if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003589 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3590 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003591fi
andre2ff7b5d2000-06-03 14:57:40 +00003592
3593
3594dnl utmpx detection - I don't know any system so perverse as to require
3595dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3596dnl there, though.
3597AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3598AC_TRY_COMPILE([
3599#include <sys/types.h>
3600#include <utmp.h>
3601#ifdef HAVE_UTMPX_H
3602#include <utmpx.h>
3603#endif
Damien Miller2994e082000-06-04 15:51:47 +10003604#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003605# include <paths.h>
3606#endif
3607 ],
3608 [ char *utmpx = UTMPX_FILE; ],
3609 [ AC_MSG_RESULT(yes) ],
3610 [ AC_MSG_RESULT(no)
3611 system_utmpx_path=no ]
3612)
3613if test -z "$conf_utmpx_location"; then
3614 if test x"$system_utmpx_path" = x"no" ; then
3615 AC_DEFINE(DISABLE_UTMPX)
3616 fi
3617else
Tim Rice7df8d392005-09-19 09:33:39 -07003618 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3619 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003620fi
andre2ff7b5d2000-06-03 14:57:40 +00003621
3622dnl wtmpx detection
3623AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3624AC_TRY_COMPILE([
3625#include <sys/types.h>
3626#include <utmp.h>
3627#ifdef HAVE_UTMPX_H
3628#include <utmpx.h>
3629#endif
Damien Miller2994e082000-06-04 15:51:47 +10003630#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003631# include <paths.h>
3632#endif
3633 ],
3634 [ char *wtmpx = WTMPX_FILE; ],
3635 [ AC_MSG_RESULT(yes) ],
3636 [ AC_MSG_RESULT(no)
3637 system_wtmpx_path=no ]
3638)
3639if test -z "$conf_wtmpx_location"; then
3640 if test x"$system_wtmpx_path" = x"no" ; then
3641 AC_DEFINE(DISABLE_WTMPX)
3642 fi
3643else
Tim Rice7df8d392005-09-19 09:33:39 -07003644 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3645 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003646fi
andre2ff7b5d2000-06-03 14:57:40 +00003647
Damien Miller4018c192000-04-30 09:30:44 +10003648
Damien Miller29ea30d2000-03-17 10:54:15 +11003649if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003650 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3651 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003652fi
3653
Tim Rice4cec93f2002-02-26 08:40:48 -08003654dnl remove pam and dl because they are in $LIBPAM
3655if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003656 LIBS=`echo $LIBS | sed 's/-lpam //'`
3657fi
3658if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3659 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003660fi
3661
Darren Tucker7da23cb2005-08-03 00:20:15 +10003662dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3663dnl Add now.
3664CFLAGS="$CFLAGS $werror_flags"
3665
Damien Millerbac2d8a2000-09-05 16:13:06 +11003666AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003667AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3668 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003669AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003670
Damien Miller7b22d652000-06-18 14:07:04 +10003671# Print summary of options
3672
Damien Miller7b22d652000-06-18 14:07:04 +10003673# Someone please show me a better way :)
3674A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3675B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3676C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3677D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003678E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003679F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003680G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003681H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3682I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3683J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003684
3685echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003686echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003687echo " User binaries: $B"
3688echo " System binaries: $C"
3689echo " Configuration files: $D"
3690echo " Askpass program: $E"
3691echo " Manual pages: $F"
3692echo " PID file: $G"
3693echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003694if test "x$external_path_file" = "x/etc/login.conf" ; then
3695echo " At runtime, sshd will use the path defined in $external_path_file"
3696echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003697else
Damien Millerf58c6722002-05-13 13:15:42 +10003698echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003699 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003700echo " (If PATH is set in $external_path_file it will be used instead. If"
3701echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3702 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003703fi
Damien Millera18bbd32002-05-13 10:48:57 +10003704if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003705echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003706fi
Damien Millerf58c6722002-05-13 13:15:42 +10003707echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003708echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003709echo " KerberosV support: $KRB5_MSG"
3710echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003711echo " S/KEY support: $SKEY_MSG"
3712echo " TCP Wrappers support: $TCPW_MSG"
3713echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003714echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003715echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003716echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3717echo " BSD Auth support: $BSD_AUTH_MSG"
3718echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003719if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003720echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003721fi
3722
Damien Miller7b22d652000-06-18 14:07:04 +10003723echo ""
3724
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003725echo " Host: ${host}"
3726echo " Compiler: ${CC}"
3727echo " Compiler flags: ${CFLAGS}"
3728echo "Preprocessor flags: ${CPPFLAGS}"
3729echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003730echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003731
3732echo ""
3733
Tim Rice6f1f7582004-05-30 21:38:51 -07003734if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003735 echo "SVR4 style packages are supported with \"make package\""
3736 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003737fi
3738
Damien Miller82cf0ce2000-12-20 13:34:48 +11003739if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003740 echo "PAM is enabled. You may need to install a PAM control file "
3741 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003742 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003743 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003744 echo ""
3745fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003746
Damien Miller6c21c512002-01-22 21:57:53 +11003747if test ! -z "$RAND_HELPER_CMDHASH" ; then
3748 echo "WARNING: you are using the builtin random number collection "
3749 echo "service. Please read WARNING.RNG and request that your OS "
3750 echo "vendor includes kernel-based random number collection in "
3751 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003752 echo ""
3753fi
Damien Miller60396b02001-02-18 17:01:00 +11003754
Damien Millerb4097182004-05-23 14:09:40 +10003755if test ! -z "$NO_PEERCHECK" ; then
3756 echo "WARNING: the operating system that you are using does not "
3757 echo "appear to support either the getpeereid() API nor the "
3758 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3759 echo "enforce security checks to prevent unauthorised connections to "
3760 echo "ssh-agent. Their absence increases the risk that a malicious "
3761 echo "user can connect to your agent. "
3762 echo ""
3763fi
3764
Darren Tuckerd9f88912005-02-20 21:01:48 +11003765if test "$AUDIT_MODULE" = "bsm" ; then
3766 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3767 echo "See the Solaris section in README.platform for details."
3768fi