blob: 26ed218d554fcf3c391cc6fd0f249aed0aecd129 [file] [log] [blame]
Damien Millerc4bcc912005-12-31 17:05:58 +11001# $Id: configure.ac,v 1.319 2005/12/31 06:05:58 djm Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070060 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
61 [If your header files don't define LOGIN_PROGRAM,
62 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100063else
64 # Search for login
65 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
66 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
67 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
68 fi
69fi
70
Darren Tucker23bc8d02004-02-06 16:24:31 +110071AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
72if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070073 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
74 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110075fi
76
Damien Miller166bd442000-03-16 10:48:25 +110077if test -z "$LD" ; then
78 LD=$CC
79fi
80AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080081
Damien Miller166bd442000-03-16 10:48:25 +110082AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100083
84AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
85
Damien Millera8e06ce2003-11-21 23:48:55 +110086if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100087 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Darren Tucker3f9545e2005-11-12 15:20:52 +110088 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -070089 case $GCC_VER in
90 1.*) ;;
91 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
92 2.*) ;;
Darren Tuckerb0288092005-11-10 14:46:48 +110093 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
Darren Tuckerf0324352005-11-10 21:30:36 +110094 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
95 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -070096 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +100097
Darren Tucker67b37032005-06-03 17:58:31 +100098 if test -z "$have_llong_max"; then
99 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
100 unset ac_cv_have_decl_LLONG_MAX
101 saved_CFLAGS="$CFLAGS"
102 CFLAGS="$CFLAGS -std=gnu99"
103 AC_CHECK_DECL(LLONG_MAX,
104 [have_llong_max=1],
105 [CFLAGS="$saved_CFLAGS"],
106 [#include <limits.h>]
107 )
108 fi
Damien Miller166bd442000-03-16 10:48:25 +1100109fi
110
Tim Rice88368a32003-12-08 12:35:59 -0800111AC_ARG_WITH(rpath,
112 [ --without-rpath Disable auto-added -R linker paths],
113 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800114 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800115 need_dash_r=""
116 fi
117 if test "x$withval" = "xyes" ; then
118 need_dash_r=1
119 fi
120 ]
121)
122
Damien Millera22ba012000-03-02 23:09:20 +1100123# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100124case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100125*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100126 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000127 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800128 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100129 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000130 saved_LDFLAGS="$LDFLAGS"
131 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
132 if (test -z "$blibflags"); then
133 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
134 AC_TRY_LINK([], [], [blibflags=$tryflags])
135 fi
136 done
137 if (test -z "$blibflags"); then
138 AC_MSG_RESULT(not found)
139 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
140 else
141 AC_MSG_RESULT($blibflags)
142 fi
143 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000144 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700145 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
146 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700147 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000148 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700149 LIBS="$LIBS -ls"
150 ])
151 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100152 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100153 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100154 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000155 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100156 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000157 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
158 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000159 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000160 [(void)loginfailed("user","host","tty",0);],
161 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700162 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
163 [Define if your AIX loginfailed() function
164 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000165 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000166 )],
167 [],
168 [#include <usersec.h>]
169 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000170 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100171 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700172 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
173 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
174 [Define if your platform breaks doing a seteuid before a setuid])
175 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
176 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000177 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700178 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
179 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
180 [Some systems need a utmpx entry for /bin/login to work])
181 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
182 [Define to a Set Process Title type if your system is
183 supported by bsd-setproctitle.c])
Darren Tucker91d25a02005-11-26 22:24:09 +1100184 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
185 [AIX 5.2 and 5.3 (and presumably newer) require this])
Damien Miller75b1d102000-01-07 14:01:41 +1100186 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100187*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100188 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800189 LIBS="$LIBS /usr/lib/textmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700190 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
191 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
192 AC_DEFINE(DISABLE_SHADOW, 1,
193 [Define if you want to disable shadow passwords])
194 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
195 [Define if your system choked on IP TOS setting])
196 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
197 [Define if X11 doesn't support AF_UNIX sockets on that system])
198 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
199 [Define if the concept of ports only accessible to
200 superusers isn't known])
201 AC_DEFINE(DISABLE_FD_PASSING, 1,
202 [Define if your platform needs to skip post auth
203 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100204 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000205*-*-dgux*)
206 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100207 AC_DEFINE(SETEUID_BREAKS_SETUID)
208 AC_DEFINE(BROKEN_SETREUID)
209 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000210 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000211*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000212 AC_MSG_CHECKING(if we have working getaddrinfo)
213 AC_TRY_RUN([#include <mach-o/dyld.h>
214main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
215 exit(0);
216 else
217 exit(1);
218}], [AC_MSG_RESULT(working)],
219 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700220 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700221 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000222 AC_DEFINE(SETEUID_BREAKS_SETUID)
223 AC_DEFINE(BROKEN_SETREUID)
224 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700225 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
226 [Define if your resolver libs need this for getrrsetbyname])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000227 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000228*-*-hpux*)
229 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000230 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100231 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000232 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700233 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
234 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000235 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700236 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
237 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000238 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000239 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700240 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000241 AC_CHECK_LIB(xnet, t_error, ,
242 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
243
244 # next, we define all of the options specific to major releases
245 case "$host" in
246 *-*-hpux10*)
247 if test -z "$GCC"; then
248 CFLAGS="$CFLAGS -Ae"
249 fi
250 ;;
251 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700252 AC_DEFINE(PAM_SUN_CODEBASE, 1,
253 [Define if you are using Solaris-derived PAM which
254 passes pam_messages to the conversation function
255 with an extra level of indirection])
256 AC_DEFINE(DISABLE_UTMP, 1,
257 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000258 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
259 check_for_hpux_broken_getaddrinfo=1
260 check_for_conflicting_getspnam=1
261 ;;
262 esac
263
264 # lastly, we define options specific to minor releases
265 case "$host" in
266 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700267 AC_DEFINE(HAVE_SECUREWARE, 1,
268 [Define if you have SecureWare-based
269 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000270 disable_ptmx_check=yes
271 LIBS="$LIBS -lsecpw"
272 ;;
273 esac
Damien Miller1bead332000-04-30 00:47:29 +1000274 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100275*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100276 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700277 AC_DEFINE(BROKEN_INET_NTOA, 1,
278 [Define if you system's inet_ntoa is busted
279 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000280 AC_DEFINE(SETEUID_BREAKS_SETUID)
281 AC_DEFINE(BROKEN_SETREUID)
282 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700283 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
284 [Define if you shouldn't strip 'tty' from your
285 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000286 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100287 ;;
288*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100289 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700290 AC_DEFINE(WITH_IRIX_ARRAY, 1,
291 [Define if you have/want arrays
292 (cluster-wide session managment, not C arrays)])
293 AC_DEFINE(WITH_IRIX_PROJECT, 1,
294 [Define if you want IRIX project management])
295 AC_DEFINE(WITH_IRIX_AUDIT, 1,
296 [Define if you want IRIX audit trails])
297 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
298 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000299 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000300 AC_DEFINE(SETEUID_BREAKS_SETUID)
301 AC_DEFINE(BROKEN_SETREUID)
302 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700303 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000304 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000305 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100306 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100307*-*-linux*)
308 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100309 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000310 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700311 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
312 AC_DEFINE(PAM_TTY_KLUDGE, 1,
313 [Work around problematic Linux PAM modules handling of PAM_TTY])
314 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
315 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000316 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700317 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
318 [Define to whatever link() returns for "not supported"
319 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100320 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700321 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100322 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000323 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000324 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700325 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
326 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000327 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000328 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100329 # tun(4) forwarding compat code
Damien Millerc4bcc912005-12-31 17:05:58 +1100330 AC_CHECK_HEADERS(linux/if_tun.h)
Damien Miller89e03ba2005-12-31 16:42:03 +1100331 if test "x$ac_cv_header_linux_tun_h" = "xyes" ; then
332 AC_DEFINE(SSH_TUN_LINUX, 1,
333 [Open tunnel devices the Linux tun/tap way])
334 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
335 [Use tunnel device compatibility to OpenBSD])
336 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
337 [Prepend the address family to IP tunnel traffic])
338 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100339 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000340mips-sony-bsd|mips-sony-newsos4)
Tim Rice7df8d392005-09-19 09:33:39 -0700341 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000342 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000343 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100344*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000345 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800346 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800347 need_dash_r=1
348 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100349 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100350*-*-freebsd*)
351 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000352 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Millerfbd884a2001-02-27 08:39:07 +1100353 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000354*-*-bsdi*)
355 AC_DEFINE(SETEUID_BREAKS_SETUID)
356 AC_DEFINE(BROKEN_SETREUID)
357 AC_DEFINE(BROKEN_SETREGID)
358 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000359*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000360 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100361 conf_utmp_location=/etc/utmp
362 conf_wtmp_location=/usr/adm/wtmp
363 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700364 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000365 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000366 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700367 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000368 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000369*-*-openbsd*)
370 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000371 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller62a31c92005-12-13 20:44:13 +1100372 AC_DEFINE(SSH_TUN_BSD, 1, [Open tunnel devices the BSD way])
Darren Tucker4a422572005-07-14 17:22:11 +1000373 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100374*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800375 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800376 need_dash_r=1
377 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100378 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000379 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700380 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
381 [Some versions of /bin/login need the TERM supplied
382 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000383 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700384 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
385 [Define if pam_chauthtok wants real uid set
386 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000387 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000388 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700389 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
390 [Define if sshd somehow reacquires a controlling TTY
391 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000392 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000393 # hardwire lastlog location (can't detect it on some versions)
394 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000395 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
396 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
397 if test "$sol2ver" -ge 8; then
398 AC_MSG_RESULT(yes)
399 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700400 AC_DEFINE(DISABLE_WTMP, 1,
401 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000402 else
403 AC_MSG_RESULT(no)
404 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100405 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000406*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000407 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000408 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100409 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000410 conf_utmp_location=/etc/utmp
411 conf_wtmp_location=/var/adm/wtmp
412 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000413 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000414 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000415*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700416 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000417 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000418 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000419 AC_DEFINE(SETEUID_BREAKS_SETUID)
420 AC_DEFINE(BROKEN_SETREUID)
421 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000422 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000423*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700424 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000425 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100426 # -lresolv needs to be at the end of LIBS or DNS lookups break
427 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100428 IPADDR_IN_DISPLAY=yes
429 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000430 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000431 AC_DEFINE(SETEUID_BREAKS_SETUID)
432 AC_DEFINE(BROKEN_SETREUID)
433 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000434 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000435 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700436 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
437 # Attention: always take care to bind libsocket and libnsl before libc,
438 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000439 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800440# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100441*-*-sysv4.2*)
Damien Miller57f39152005-11-24 19:58:19 +1100442 CFLAGS="$CFLAGS -Dva_list=_VA_LIST"
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 Rice2f97b8b2005-04-11 19:00:18 -0700447 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800448 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100449 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800450# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100451*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700452 check_for_libcrypt_later=1
453 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100454 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700455 AC_DEFINE(SETEUID_BREAKS_SETUID)
456 AC_DEFINE(BROKEN_SETREUID)
457 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700458 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700459 case "$host" in
460 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
461 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700462 AC_DEFINE(BROKEN_LIBIAF, 1,
463 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700464 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800465 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
466 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700467 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100468 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100469*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100470 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800471# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100472*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800473 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100474 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800475# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100476*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800477 if test -z "$GCC"; then
478 CFLAGS="$CFLAGS -belf"
479 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100480 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000481 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100482 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000483 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000484 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700485 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700486 AC_DEFINE(SETEUID_BREAKS_SETUID)
487 AC_DEFINE(BROKEN_SETREUID)
488 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700489 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700490 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700491 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100492 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700493 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700494 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000495 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000496*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700497 AC_DEFINE(NO_SSH_LASTLOG, 1,
498 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100499 AC_DEFINE(SETEUID_BREAKS_SETUID)
500 AC_DEFINE(BROKEN_SETREUID)
501 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000502 AC_DEFINE(USE_PIPES)
503 AC_DEFINE(DISABLE_FD_PASSING)
504 LDFLAGS="$LDFLAGS"
505 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
506 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000507 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000508*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100509 AC_DEFINE(SETEUID_BREAKS_SETUID)
510 AC_DEFINE(BROKEN_SETREUID)
511 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000512 AC_DEFINE(WITH_ABBREV_NO_TTY)
513 AC_DEFINE(USE_PIPES)
514 AC_DEFINE(DISABLE_FD_PASSING)
515 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100516 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000517 MANTYPE=cat
518 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000519*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100520 AC_DEFINE(SETEUID_BREAKS_SETUID)
521 AC_DEFINE(BROKEN_SETREUID)
522 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000523 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700524 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700525 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000526 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
527 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
528 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700529 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000530*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000531 AC_MSG_CHECKING(for Digital Unix SIA)
532 no_osfsia=""
533 AC_ARG_WITH(osfsia,
534 [ --with-osfsia Enable Digital Unix SIA],
535 [
536 if test "x$withval" = "xno" ; then
537 AC_MSG_RESULT(disabled)
538 no_osfsia=1
539 fi
540 ],
541 )
542 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000543 if test -f /etc/sia/matrix.conf; then
544 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700545 AC_DEFINE(HAVE_OSF_SIA, 1,
546 [Define if you have Digital Unix Security
547 Integration Architecture])
548 AC_DEFINE(DISABLE_LOGIN, 1,
549 [Define if you don't want to use your
550 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000551 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000552 LIBS="$LIBS -lsecurity -ldb -lm -laud"
553 else
554 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700555 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
556 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000557 fi
558 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000559 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700560 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000561 AC_DEFINE(BROKEN_SETREUID)
562 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000563 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000564
565*-*-nto-qnx)
566 AC_DEFINE(USE_PIPES)
567 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700568 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
569 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
570 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000571 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000572
573*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700574 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
575 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
576 AC_DEFINE(NEED_SETPRGP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700577 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
578 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000579
580*-*-lynxos)
581 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700582 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000583 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
584 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100585esac
586
Damien Millere37bfc12000-06-05 09:37:43 +1000587# Allow user to specify flags
588AC_ARG_WITH(cflags,
589 [ --with-cflags Specify additional flags to pass to compiler],
590 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800591 if test -n "$withval" && test "x$withval" != "xno" && \
592 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000593 CFLAGS="$CFLAGS $withval"
594 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800595 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000596)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000597AC_ARG_WITH(cppflags,
598 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
599 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800600 if test -n "$withval" && test "x$withval" != "xno" && \
601 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000602 CPPFLAGS="$CPPFLAGS $withval"
603 fi
604 ]
605)
Damien Millere37bfc12000-06-05 09:37:43 +1000606AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000607 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000608 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800609 if test -n "$withval" && test "x$withval" != "xno" && \
610 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000611 LDFLAGS="$LDFLAGS $withval"
612 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800613 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000614)
615AC_ARG_WITH(libs,
616 [ --with-libs Specify additional libraries to link with],
617 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800618 if test -n "$withval" && test "x$withval" != "xno" && \
619 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000620 LIBS="$LIBS $withval"
621 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800622 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000623)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000624AC_ARG_WITH(Werror,
625 [ --with-Werror Build main code with -Werror],
626 [
627 if test -n "$withval" && test "x$withval" != "xno"; then
628 werror_flags="-Werror"
Damien Millere04ec6f2005-10-08 16:21:19 +1000629 if test "x${withval}" != "xyes"; then
Darren Tucker7da23cb2005-08-03 00:20:15 +1000630 werror_flags="$withval"
631 fi
632 fi
633 ]
634)
Damien Millere37bfc12000-06-05 09:37:43 +1000635
Darren Tucker6eb93042003-06-29 21:30:41 +1000636AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000637AC_RUN_IFELSE(
638 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000639#include <stdio.h>
640int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000641 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000642 [ AC_MSG_RESULT(yes) ],
643 [
644 AC_MSG_RESULT(no)
645 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000646 ],
647 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000648)
649
Darren Tucker0c9653f2005-05-28 15:58:14 +1000650dnl Checks for header files.
651AC_CHECK_HEADERS( \
652 bstring.h \
653 crypt.h \
654 dirent.h \
655 endian.h \
656 features.h \
657 floatingpoint.h \
658 getopt.h \
659 glob.h \
660 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700661 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000662 lastlog.h \
663 limits.h \
664 login.h \
665 login_cap.h \
666 maillock.h \
667 ndir.h \
Damien Miller7b58e802005-12-13 19:33:19 +1100668 net/if.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000669 netdb.h \
670 netgroup.h \
671 netinet/in_systm.h \
672 pam/pam_appl.h \
673 paths.h \
674 pty.h \
675 readpassphrase.h \
676 rpc/types.h \
677 security/pam_appl.h \
678 shadow.h \
679 stddef.h \
680 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000681 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000682 strings.h \
683 sys/audit.h \
684 sys/bitypes.h \
685 sys/bsdtty.h \
686 sys/cdefs.h \
687 sys/dir.h \
688 sys/mman.h \
689 sys/ndir.h \
690 sys/prctl.h \
691 sys/pstat.h \
692 sys/select.h \
693 sys/stat.h \
694 sys/stream.h \
695 sys/stropts.h \
696 sys/strtio.h \
697 sys/sysmacros.h \
698 sys/time.h \
699 sys/timers.h \
700 sys/un.h \
701 time.h \
702 tmpdir.h \
703 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000704 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000705 usersec.h \
706 util.h \
707 utime.h \
708 utmp.h \
709 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000710 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000711)
Tim Rice4cec93f2002-02-26 08:40:48 -0800712
Darren Tucker48d99d32004-08-29 17:04:50 +1000713# sys/ptms.h requires sys/stream.h to be included first on Solaris
714AC_CHECK_HEADERS(sys/ptms.h, [], [], [
715#ifdef HAVE_SYS_STREAM_H
716# include <sys/stream.h>
717#endif
718])
719
Damien Millera22ba012000-03-02 23:09:20 +1100720# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700721AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
722AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000723
Tim Rice1e1ef642003-09-11 22:19:31 -0700724dnl IRIX and Solaris 2.5.1 have dirname() in libgen
725AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
726 AC_CHECK_LIB(gen, dirname,[
727 AC_CACHE_CHECK([for broken dirname],
728 ac_cv_have_broken_dirname, [
729 save_LIBS="$LIBS"
730 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000731 AC_RUN_IFELSE(
732 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700733#include <libgen.h>
734#include <string.h>
735
736int main(int argc, char **argv) {
737 char *s, buf[32];
738
739 strncpy(buf,"/etc", 32);
740 s = dirname(buf);
741 if (!s || strncmp(s, "/", 32) != 0) {
742 exit(1);
743 } else {
744 exit(0);
745 }
746}
Darren Tucker314d89e2005-10-17 23:29:23 +1000747 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700748 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000749 [ ac_cv_have_broken_dirname="yes" ],
750 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700751 )
752 LIBS="$save_LIBS"
753 ])
754 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
755 LIBS="$LIBS -lgen"
756 AC_DEFINE(HAVE_DIRNAME)
757 AC_CHECK_HEADERS(libgen.h)
758 fi
759 ])
760])
761
762AC_CHECK_FUNC(getspnam, ,
763 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700764AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
765 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700766
Tim Rice13aae5e2001-10-21 17:53:58 -0700767dnl zlib is required
768AC_ARG_WITH(zlib,
769 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100770 [ if test "x$withval" = "xno" ; then
771 AC_MSG_ERROR([*** zlib is required ***])
772 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700773 if test -d "$withval/lib"; then
774 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700775 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700776 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700777 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700778 fi
779 else
780 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700781 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700782 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700783 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700784 fi
785 fi
786 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700787 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700788 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700789 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700790 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100791 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700792)
793
Tim Ricefcb62202004-01-23 18:35:16 -0800794AC_CHECK_LIB(z, deflate, ,
795 [
796 saved_CPPFLAGS="$CPPFLAGS"
797 saved_LDFLAGS="$LDFLAGS"
798 save_LIBS="$LIBS"
799 dnl Check default zlib install dir
800 if test -n "${need_dash_r}"; then
801 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
802 else
803 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
804 fi
805 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
806 LIBS="$LIBS -lz"
807 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
808 [
809 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
810 ]
811 )
812 ]
813)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100814AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100815
816AC_ARG_WITH(zlib-version-check,
817 [ --without-zlib-version-check Disable zlib version check],
818 [ if test "x$withval" = "xno" ; then
819 zlib_check_nonfatal=1
820 fi
821 ]
822)
823
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000824AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000825AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000826#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100827#include <zlib.h>
828int main()
829{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000830 int a=0, b=0, c=0, d=0, n, v;
831 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
832 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100833 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000834 v = a*1000000 + b*10000 + c*100 + d;
835 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
836
837 /* 1.1.4 is OK */
838 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100839 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000840
Darren Tucker41097ed2005-07-25 15:24:21 +1000841 /* 1.2.3 and up are OK */
842 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000843 exit(0);
844
Darren Tucker2dcd2392004-01-23 17:13:33 +1100845 exit(2);
846}
Darren Tucker623d92f2004-09-12 22:36:15 +1000847 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000848 AC_MSG_RESULT(no),
849 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100850 if test -z "$zlib_check_nonfatal" ; then
851 AC_MSG_ERROR([*** zlib too old - check config.log ***
852Your reported zlib version has known security problems. It's possible your
853vendor has fixed these problems without changing the version number. If you
854are sure this is the case, you can disable the check by running
855"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000856If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000857See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100858 else
859 AC_MSG_WARN([zlib version may have security problems])
860 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000861 ],
862 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100863)
Damien Miller6f9c3372000-10-25 10:06:04 +1100864
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000865dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100866AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000867 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
868)
Darren Tucker5bfe1682005-11-12 18:42:36 +1100869AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700870 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
871 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000872)
Damien Millerab18c411999-11-11 10:40:23 +1100873
Tim Ricee589a292001-11-03 11:09:32 -0800874dnl Checks for libutil functions
875AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700876AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
877 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800878AC_CHECK_FUNCS(logout updwtmp logwtmp)
879
Ben Lindstrom8697e082001-02-24 21:41:10 +0000880AC_FUNC_STRFTIME
881
Damien Miller3c027682001-03-14 11:39:45 +1100882# Check for ALTDIRFUNC glob() extension
883AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
884AC_EGREP_CPP(FOUNDIT,
885 [
886 #include <glob.h>
887 #ifdef GLOB_ALTDIRFUNC
888 FOUNDIT
889 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100890 ],
Damien Miller3c027682001-03-14 11:39:45 +1100891 [
Tim Rice7df8d392005-09-19 09:33:39 -0700892 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
893 [Define if your system glob() function has
894 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100895 AC_MSG_RESULT(yes)
896 ],
897 [
898 AC_MSG_RESULT(no)
899 ]
900)
Damien Millerab18c411999-11-11 10:40:23 +1100901
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000902# Check for g.gl_matchc glob() extension
903AC_MSG_CHECKING(for gl_matchc field in glob_t)
904AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100905 [
906 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000907 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100908 ],
909 [
Tim Rice7df8d392005-09-19 09:33:39 -0700910 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
911 [Define if your system glob() function has
912 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100913 AC_MSG_RESULT(yes)
914 ],
915 [
916 AC_MSG_RESULT(no)
917 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000918)
919
Damien Miller18bb4732001-03-28 14:35:30 +1000920AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000921AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000922 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000923#include <sys/types.h>
924#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700925int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000926 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100927 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000928 [
929 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700930 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +1100931 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -0700932 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000933 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800934 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000935 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
936 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000937 ]
938)
939
Damien Miller36f49652004-08-15 18:40:59 +1000940AC_MSG_CHECKING([for /proc/pid/fd directory])
941if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700942 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000943 AC_MSG_RESULT(yes)
944else
945 AC_MSG_RESULT(no)
946fi
947
Damien Millerc547bf12001-02-16 10:18:12 +1100948# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100949SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100950AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100951 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100952 [
953 if test "x$withval" != "xno" ; then
954
955 if test "x$withval" != "xyes" ; then
956 CPPFLAGS="$CPPFLAGS -I${withval}/include"
957 LDFLAGS="$LDFLAGS -L${withval}/lib"
958 fi
959
Tim Rice7df8d392005-09-19 09:33:39 -0700960 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +1100961 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100962 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800963
Tim Rice4cec93f2002-02-26 08:40:48 -0800964 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +1000965 AC_LINK_IFELSE(
966 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -0800967#include <stdio.h>
968#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700969int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +1000970 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -0800971 [AC_MSG_RESULT(yes)],
972 [
973 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100974 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
975 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000976 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
977 AC_TRY_COMPILE(
978 [#include <stdio.h>
979 #include <skey.h>],
980 [(void)skeychallenge(NULL,"name","",0);],
981 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700982 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
983 [Define if your skeychallenge()
984 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +1000985 [AC_MSG_RESULT(no)]
986 )
Damien Millerc547bf12001-02-16 10:18:12 +1100987 fi
988 ]
989)
990
991# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700992TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100993AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100994 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100995 [
996 if test "x$withval" != "xno" ; then
997 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700998 saved_LDFLAGS="$LDFLAGS"
999 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001000 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001001 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001002 if test -d "${withval}/lib"; then
1003 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001004 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001005 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001006 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001007 fi
1008 else
1009 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001010 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001011 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001012 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001013 fi
1014 fi
1015 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001016 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001017 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001018 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001019 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001020 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001021 LIBWRAP="-lwrap"
1022 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001023 AC_MSG_CHECKING(for libwrap)
1024 AC_TRY_LINK(
1025 [
Damien Miller0ac45002004-04-14 20:14:26 +10001026#include <sys/types.h>
1027#include <sys/socket.h>
1028#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001029#include <tcpd.h>
1030 int deny_severity = 0, allow_severity = 0;
1031 ],
1032 [hosts_access(0);],
1033 [
1034 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001035 AC_DEFINE(LIBWRAP, 1,
1036 [Define if you want
1037 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001038 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001039 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001040 ],
1041 [
1042 AC_MSG_ERROR([*** libwrap missing])
1043 ]
1044 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001045 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001046 fi
1047 ]
1048)
1049
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001050# Check whether user wants libedit support
1051LIBEDIT_MSG="no"
1052AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001053 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001054 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001055 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001056 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1057 if test -n "${need_dash_r}"; then
1058 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1059 else
1060 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1061 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001062 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001063 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001064 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001065 LIBEDIT="-ledit -lcurses"
1066 LIBEDIT_MSG="yes"
1067 AC_SUBST(LIBEDIT)
1068 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001069 [ AC_MSG_ERROR(libedit not found) ],
1070 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001071 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001072 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001073 AC_COMPILE_IFELSE(
1074 [AC_LANG_SOURCE([[
1075#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001076int main(void)
1077{
1078 int i = H_SETSIZE;
1079 el_init("", NULL, NULL, NULL);
1080 exit(0);
1081}
Tim Ricec1819c82005-08-15 17:48:40 -07001082 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001083 [ AC_MSG_RESULT(yes) ],
1084 [ AC_MSG_RESULT(no)
1085 AC_MSG_ERROR(libedit version is not compatible) ]
1086 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001087 fi ]
1088)
1089
Darren Tuckerd9f88912005-02-20 21:01:48 +11001090AUDIT_MODULE=none
1091AC_ARG_WITH(audit,
1092 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1093 [
1094 AC_MSG_CHECKING(for supported audit module)
1095 case "$withval" in
1096 bsm)
1097 AC_MSG_RESULT(bsm)
1098 AUDIT_MODULE=bsm
1099 dnl Checks for headers, libs and functions
1100 AC_CHECK_HEADERS(bsm/audit.h, [],
1101 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1102 AC_CHECK_LIB(bsm, getaudit, [],
1103 [AC_MSG_ERROR(BSM enabled and required library not found)])
1104 AC_CHECK_FUNCS(getaudit, [],
1105 [AC_MSG_ERROR(BSM enabled and required function not found)])
1106 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001107 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001108 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001109 ;;
1110 debug)
1111 AUDIT_MODULE=debug
1112 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001113 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001114 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001115 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001116 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001117 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001118 *)
1119 AC_MSG_ERROR([Unknown audit module $withval])
1120 ;;
1121 esac ]
1122)
1123
Damien Millerfe1f1432003-02-24 15:45:42 +11001124dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001125AC_CHECK_FUNCS( \
1126 arc4random \
Damien Miller57f39152005-11-24 19:58:19 +11001127 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001128 b64_ntop \
1129 __b64_ntop \
1130 b64_pton \
1131 __b64_pton \
1132 bcopy \
1133 bindresvport_sa \
1134 clock \
1135 closefrom \
1136 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001137 fchmod \
1138 fchown \
1139 freeaddrinfo \
1140 futimes \
1141 getaddrinfo \
1142 getcwd \
1143 getgrouplist \
1144 getnameinfo \
1145 getopt \
1146 getpeereid \
1147 _getpty \
1148 getrlimit \
1149 getttyent \
1150 glob \
1151 inet_aton \
1152 inet_ntoa \
1153 inet_ntop \
1154 innetgr \
1155 login_getcapbool \
1156 md5_crypt \
1157 memmove \
1158 mkdtemp \
1159 mmap \
1160 ngetaddrinfo \
1161 nsleep \
1162 ogetaddrinfo \
1163 openlog_r \
1164 openpty \
1165 prctl \
1166 pstat \
1167 readpassphrase \
1168 realpath \
1169 recvmsg \
1170 rresvport_af \
1171 sendmsg \
1172 setdtablesize \
1173 setegid \
1174 setenv \
1175 seteuid \
1176 setgroups \
1177 setlogin \
1178 setpcred \
1179 setproctitle \
1180 setregid \
1181 setreuid \
1182 setrlimit \
1183 setsid \
1184 setvbuf \
1185 sigaction \
1186 sigvec \
1187 snprintf \
1188 socketpair \
1189 strdup \
1190 strerror \
1191 strlcat \
1192 strlcpy \
1193 strmode \
1194 strnvis \
1195 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001196 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001197 strtoul \
1198 sysconf \
1199 tcgetpgrp \
1200 truncate \
1201 unsetenv \
1202 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001203 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001204 vhangup \
1205 vsnprintf \
1206 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001207)
Tim Rice13aae5e2001-10-21 17:53:58 -07001208
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001209# IRIX has a const char return value for gai_strerror()
1210AC_CHECK_FUNCS(gai_strerror,[
1211 AC_DEFINE(HAVE_GAI_STRERROR)
1212 AC_TRY_COMPILE([
1213#include <sys/types.h>
1214#include <sys/socket.h>
1215#include <netdb.h>
1216
1217const char *gai_strerror(int);],[
1218char *str;
1219
1220str = gai_strerror(0);],[
1221 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1222 [Define if gai_strerror() returns const char *])])])
1223
Tim Rice7df8d392005-09-19 09:33:39 -07001224AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1225 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001226
Darren Tuckerf1159b52003-07-07 19:44:01 +10001227dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001228AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001229AC_CHECK_DECL(strsep,
1230 [AC_CHECK_FUNCS(strsep)],
1231 [],
1232 [
1233#ifdef HAVE_STRING_H
1234# include <string.h>
1235#endif
1236 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001237
Darren Tuckerb2427c82003-09-10 15:22:44 +10001238dnl tcsendbreak might be a macro
1239AC_CHECK_DECL(tcsendbreak,
1240 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001241 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001242 [#include <termios.h>]
1243)
1244
Darren Tucker5bb14002004-04-23 18:53:10 +10001245AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1246
Darren Tucker2a6b0292003-12-31 14:59:17 +11001247AC_CHECK_FUNCS(setresuid, [
1248 dnl Some platorms have setresuid that isn't implemented, test for this
1249 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001250 AC_RUN_IFELSE(
1251 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001252#include <stdlib.h>
1253#include <errno.h>
1254int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001255 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001256 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001257 [AC_DEFINE(BROKEN_SETRESUID, 1,
1258 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001259 AC_MSG_RESULT(not implemented)],
1260 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001261 )
1262])
Darren Tuckere937be32003-12-17 18:53:26 +11001263
Darren Tucker2a6b0292003-12-31 14:59:17 +11001264AC_CHECK_FUNCS(setresgid, [
1265 dnl Some platorms have setresgid that isn't implemented, test for this
1266 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001267 AC_RUN_IFELSE(
1268 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001269#include <stdlib.h>
1270#include <errno.h>
1271int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001272 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001273 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001274 [AC_DEFINE(BROKEN_SETRESGID, 1,
1275 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001276 AC_MSG_RESULT(not implemented)],
1277 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001278 )
1279])
Darren Tuckere937be32003-12-17 18:53:26 +11001280
Damien Millerad833b32000-08-23 10:46:23 +10001281dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001282AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001283dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001284AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001285AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001286dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001287AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001288AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001289
Damien Millera8e06ce2003-11-21 23:48:55 +11001290AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001291 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1292 [AC_CHECK_LIB(bsd, daemon,
1293 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001294)
1295
Damien Millera8e06ce2003-11-21 23:48:55 +11001296AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001297 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1298 [Define if your libraries define getpagesize()])],
1299 [AC_CHECK_LIB(ucb, getpagesize,
1300 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001301)
1302
Damien Millercb170cb2000-07-01 16:52:55 +10001303# Check for broken snprintf
1304if test "x$ac_cv_func_snprintf" = "xyes" ; then
1305 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001306 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001307 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001308#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001309int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001310 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001311 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001312 [
1313 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001314 AC_DEFINE(BROKEN_SNPRINTF, 1,
1315 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001316 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001317 ],
1318 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001319 )
1320fi
1321
Damien Miller57f39152005-11-24 19:58:19 +11001322# If we don't have a working asprintf, then we strongly depend on vsnprintf
1323# returning the right thing on overflow: the number of characters it tried to
1324# create (as per SUSv3)
1325if test "x$ac_cv_func_asprintf" != "xyes" && \
1326 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1327 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1328 AC_RUN_IFELSE(
1329 [AC_LANG_SOURCE([[
1330#include <sys/types.h>
1331#include <stdio.h>
1332#include <stdarg.h>
1333
1334int x_snprintf(char *str,size_t count,const char *fmt,...)
1335{
1336 size_t ret; va_list ap;
1337 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1338 return ret;
1339}
1340int main(void)
1341{
1342 char x[1];
1343 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1344} ]])],
1345 [AC_MSG_RESULT(yes)],
1346 [
1347 AC_MSG_RESULT(no)
1348 AC_DEFINE(BROKEN_SNPRINTF, 1,
1349 [Define if your snprintf is busted])
1350 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1351 ],
1352 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1353 )
1354fi
1355
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001356# On systems where [v]snprintf is broken, but is declared in stdio,
1357# check that the fmt argument is const char * or just char *.
1358# This is only useful for when BROKEN_SNPRINTF
1359AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1360AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1361 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1362 int main(void) { snprintf(0, 0, 0); }
1363 ]])],
1364 [AC_MSG_RESULT(yes)
1365 AC_DEFINE(SNPRINTF_CONST, [const],
1366 [Define as const if snprintf() can declare const char *fmt])],
1367 [AC_MSG_RESULT(no)
1368 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1369
Damien Millerb4097182004-05-23 14:09:40 +10001370# Check for missing getpeereid (or equiv) support
1371NO_PEERCHECK=""
1372if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1373 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1374 AC_TRY_COMPILE(
1375 [#include <sys/types.h>
1376 #include <sys/socket.h>],
1377 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001378 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001379 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001380 ],
Damien Millerb4097182004-05-23 14:09:40 +10001381 [AC_MSG_RESULT(no)
1382 NO_PEERCHECK=1]
1383 )
1384fi
1385
Damien Millere8328192003-01-07 15:18:32 +11001386dnl see whether mkstemp() requires XXXXXX
1387if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1388AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001389AC_RUN_IFELSE(
1390 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001391#include <stdlib.h>
1392main() { char template[]="conftest.mkstemp-test";
1393if (mkstemp(template) == -1)
1394 exit(1);
1395unlink(template); exit(0);
1396}
Darren Tucker314d89e2005-10-17 23:29:23 +10001397 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001398 [
1399 AC_MSG_RESULT(no)
1400 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001401 [
Damien Millere8328192003-01-07 15:18:32 +11001402 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001403 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001404 ],
1405 [
1406 AC_MSG_RESULT(yes)
1407 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001408 ]
Damien Millere8328192003-01-07 15:18:32 +11001409)
1410fi
1411
Darren Tucker70a3d552003-08-21 17:58:29 +10001412dnl make sure that openpty does not reacquire controlling terminal
1413if test ! -z "$check_for_openpty_ctty_bug"; then
1414 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001415 AC_RUN_IFELSE(
1416 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001417#include <stdio.h>
1418#include <sys/fcntl.h>
1419#include <sys/types.h>
1420#include <sys/wait.h>
1421
1422int
1423main()
1424{
1425 pid_t pid;
1426 int fd, ptyfd, ttyfd, status;
1427
1428 pid = fork();
1429 if (pid < 0) { /* failed */
1430 exit(1);
1431 } else if (pid > 0) { /* parent */
1432 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001433 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001434 exit(WEXITSTATUS(status));
1435 else
1436 exit(2);
1437 } else { /* child */
1438 close(0); close(1); close(2);
1439 setsid();
1440 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1441 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1442 if (fd >= 0)
1443 exit(3); /* Acquired ctty: broken */
1444 else
1445 exit(0); /* Did not acquire ctty: OK */
1446 }
1447}
Darren Tucker314d89e2005-10-17 23:29:23 +10001448 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001449 [
1450 AC_MSG_RESULT(yes)
1451 ],
1452 [
1453 AC_MSG_RESULT(no)
1454 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001455 ],
1456 [
1457 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001458 ]
1459 )
1460fi
1461
Tim Rice8bb561b2005-03-17 16:23:19 -08001462if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1463 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001464 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001465 AC_RUN_IFELSE(
1466 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001467#include <stdio.h>
1468#include <sys/socket.h>
1469#include <netdb.h>
1470#include <errno.h>
1471#include <netinet/in.h>
1472
1473#define TEST_PORT "2222"
1474
1475int
1476main(void)
1477{
1478 int err, sock;
1479 struct addrinfo *gai_ai, *ai, hints;
1480 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1481
1482 memset(&hints, 0, sizeof(hints));
1483 hints.ai_family = PF_UNSPEC;
1484 hints.ai_socktype = SOCK_STREAM;
1485 hints.ai_flags = AI_PASSIVE;
1486
1487 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1488 if (err != 0) {
1489 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1490 exit(1);
1491 }
1492
1493 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1494 if (ai->ai_family != AF_INET6)
1495 continue;
1496
1497 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1498 sizeof(ntop), strport, sizeof(strport),
1499 NI_NUMERICHOST|NI_NUMERICSERV);
1500
1501 if (err != 0) {
1502 if (err == EAI_SYSTEM)
1503 perror("getnameinfo EAI_SYSTEM");
1504 else
1505 fprintf(stderr, "getnameinfo failed: %s\n",
1506 gai_strerror(err));
1507 exit(2);
1508 }
1509
1510 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1511 if (sock < 0)
1512 perror("socket");
1513 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1514 if (errno == EBADF)
1515 exit(3);
1516 }
1517 }
1518 exit(0);
1519}
Darren Tucker314d89e2005-10-17 23:29:23 +10001520 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001521 [
1522 AC_MSG_RESULT(yes)
1523 ],
1524 [
1525 AC_MSG_RESULT(no)
1526 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001527 ],
1528 [
1529 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001530 ]
1531 )
1532fi
1533
Tim Rice8bb561b2005-03-17 16:23:19 -08001534if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1535 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001536 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001537 AC_RUN_IFELSE(
1538 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001539#include <stdio.h>
1540#include <sys/socket.h>
1541#include <netdb.h>
1542#include <errno.h>
1543#include <netinet/in.h>
1544
1545#define TEST_PORT "2222"
1546
1547int
1548main(void)
1549{
1550 int err, sock;
1551 struct addrinfo *gai_ai, *ai, hints;
1552 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1553
1554 memset(&hints, 0, sizeof(hints));
1555 hints.ai_family = PF_UNSPEC;
1556 hints.ai_socktype = SOCK_STREAM;
1557 hints.ai_flags = AI_PASSIVE;
1558
1559 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1560 if (err != 0) {
1561 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1562 exit(1);
1563 }
1564
1565 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1566 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1567 continue;
1568
1569 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1570 sizeof(ntop), strport, sizeof(strport),
1571 NI_NUMERICHOST|NI_NUMERICSERV);
1572
1573 if (ai->ai_family == AF_INET && err != 0) {
1574 perror("getnameinfo");
1575 exit(2);
1576 }
1577 }
1578 exit(0);
1579}
Darren Tucker314d89e2005-10-17 23:29:23 +10001580 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001581 [
1582 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001583 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1584 [Define if you have a getaddrinfo that fails
1585 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001586 ],
1587 [
1588 AC_MSG_RESULT(no)
1589 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001590 ],
1591 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001592 ]
1593 )
1594fi
1595
Darren Tuckera56f1912004-11-02 20:30:54 +11001596if test "x$check_for_conflicting_getspnam" = "x1"; then
1597 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1598 AC_COMPILE_IFELSE(
1599 [
1600#include <shadow.h>
1601int main(void) {exit(0);}
1602 ],
1603 [
1604 AC_MSG_RESULT(no)
1605 ],
1606 [
1607 AC_MSG_RESULT(yes)
1608 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1609 [Conflicting defs for getspnam])
1610 ]
1611 )
1612fi
1613
Damien Miller606f8802000-09-16 15:39:56 +11001614AC_FUNC_GETPGRP
1615
Damien Millera64b57a2001-01-17 10:44:13 +11001616# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001617PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001618AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001619 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001620 [
Damien Millera64b57a2001-01-17 10:44:13 +11001621 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001622 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1623 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001624 AC_MSG_ERROR([PAM headers not found])
1625 fi
1626
1627 AC_CHECK_LIB(dl, dlopen, , )
1628 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1629 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001630 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001631
Damien Millera64b57a2001-01-17 10:44:13 +11001632 PAM_MSG="yes"
1633
Tim Rice7df8d392005-09-19 09:33:39 -07001634 AC_DEFINE(USE_PAM, 1,
1635 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001636 if test $ac_cv_lib_dl_dlopen = yes; then
1637 LIBPAM="-lpam -ldl"
1638 else
1639 LIBPAM="-lpam"
1640 fi
1641 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001642 fi
1643 ]
1644)
Damien Millera22ba012000-03-02 23:09:20 +11001645
Damien Millera64b57a2001-01-17 10:44:13 +11001646# Check for older PAM
1647if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001648 # Check PAM strerror arguments (old PAM)
1649 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1650 AC_TRY_COMPILE(
1651 [
Damien Miller81171112000-04-23 11:14:01 +10001652#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001653#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001654#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001655#elif defined (HAVE_PAM_PAM_APPL_H)
1656#include <pam/pam_appl.h>
1657#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001658 ],
1659 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001660 [AC_MSG_RESULT(no)],
1661 [
Tim Rice7df8d392005-09-19 09:33:39 -07001662 AC_DEFINE(HAVE_OLD_PAM, 1,
1663 [Define if you have an old version of PAM
1664 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001665 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001666 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001667 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001668 )
Damien Millera22ba012000-03-02 23:09:20 +11001669fi
1670
Tim Riceaef73712002-05-11 13:17:42 -07001671# Search for OpenSSL
1672saved_CPPFLAGS="$CPPFLAGS"
1673saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001674AC_ARG_WITH(ssl-dir,
1675 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1676 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001677 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001678 case "$withval" in
1679 # Relative paths
1680 ./*|../*) withval="`pwd`/$withval"
1681 esac
Tim Riceaef73712002-05-11 13:17:42 -07001682 if test -d "$withval/lib"; then
1683 if test -n "${need_dash_r}"; then
1684 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1685 else
1686 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1687 fi
1688 else
1689 if test -n "${need_dash_r}"; then
1690 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1691 else
1692 LDFLAGS="-L${withval} ${LDFLAGS}"
1693 fi
1694 fi
1695 if test -d "$withval/include"; then
1696 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1697 else
1698 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1699 fi
Damien Millera22ba012000-03-02 23:09:20 +11001700 fi
1701 ]
1702)
Tim Rice3d5352e2004-02-12 09:27:21 -08001703LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001704AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1705 [Define if your ssl headers are included
1706 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001707 [
Tim Riceaef73712002-05-11 13:17:42 -07001708 dnl Check default openssl install dir
1709 if test -n "${need_dash_r}"; then
1710 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001711 else
Tim Riceaef73712002-05-11 13:17:42 -07001712 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001713 fi
Tim Riceaef73712002-05-11 13:17:42 -07001714 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1715 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1716 [
1717 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1718 ]
1719 )
1720 ]
1721)
1722
Tim Riced730b782002-08-13 18:52:10 -07001723# Determine OpenSSL header version
1724AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001725AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001726 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001727#include <stdio.h>
1728#include <string.h>
1729#include <openssl/opensslv.h>
1730#define DATA "conftest.sslincver"
1731int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001732 FILE *fd;
1733 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001734
Damien Millera8e06ce2003-11-21 23:48:55 +11001735 fd = fopen(DATA,"w");
1736 if(fd == NULL)
1737 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001738
1739 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1740 exit(1);
1741
1742 exit(0);
1743}
Darren Tucker623d92f2004-09-12 22:36:15 +10001744 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001745 [
1746 ssl_header_ver=`cat conftest.sslincver`
1747 AC_MSG_RESULT($ssl_header_ver)
1748 ],
1749 [
1750 AC_MSG_RESULT(not found)
1751 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001752 ],
1753 [
1754 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001755 ]
1756)
1757
1758# Determine OpenSSL library version
1759AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001760AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001761 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001762#include <stdio.h>
1763#include <string.h>
1764#include <openssl/opensslv.h>
1765#include <openssl/crypto.h>
1766#define DATA "conftest.ssllibver"
1767int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001768 FILE *fd;
1769 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001770
Damien Millera8e06ce2003-11-21 23:48:55 +11001771 fd = fopen(DATA,"w");
1772 if(fd == NULL)
1773 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001774
1775 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1776 exit(1);
1777
1778 exit(0);
1779}
Darren Tucker623d92f2004-09-12 22:36:15 +10001780 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001781 [
1782 ssl_library_ver=`cat conftest.ssllibver`
1783 AC_MSG_RESULT($ssl_library_ver)
1784 ],
1785 [
1786 AC_MSG_RESULT(not found)
1787 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001788 ],
1789 [
1790 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001791 ]
1792)
Damien Millera22ba012000-03-02 23:09:20 +11001793
Damien Millerec932372002-01-22 22:16:03 +11001794# Sanity check OpenSSL headers
1795AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001796AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001797 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001798#include <string.h>
1799#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001800int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001801 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001802 [
1803 AC_MSG_RESULT(yes)
1804 ],
1805 [
1806 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001807 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1808Check config.log for details.
1809Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001810 ],
1811 [
1812 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001813 ]
1814)
1815
Darren Tucker129d0bb2005-12-19 17:40:40 +11001816# Check for OpenSSL without EVP_aes_{192,256}_cbc
1817AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
1818AC_COMPILE_IFELSE(
1819 [AC_LANG_SOURCE([[
1820#include <string.h>
1821#include <openssl/evp.h>
1822int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL)}
1823 ]])],
1824 [
1825 AC_MSG_RESULT(no)
1826 ],
1827 [
1828 AC_MSG_RESULT(yes)
1829 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
1830 [libcrypto is missing AES 192 and 256 bit functions])
1831 ]
1832)
1833
Tim Rice3d5352e2004-02-12 09:27:21 -08001834# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1835# because the system crypt() is more featureful.
1836if test "x$check_for_libcrypt_before" = "x1"; then
1837 AC_CHECK_LIB(crypt, crypt)
1838fi
1839
Damien Millera8e06ce2003-11-21 23:48:55 +11001840# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001841# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001842if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001843 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001844fi
1845
Tim Rice2291c002005-08-26 13:15:19 -07001846AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001847
1848### Configure cryptographic random number support
1849
1850# Check wheter OpenSSL seeds itself
1851AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001852AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001853 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001854#include <string.h>
1855#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001856int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001857 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001858 [
1859 OPENSSL_SEEDS_ITSELF=yes
1860 AC_MSG_RESULT(yes)
1861 ],
1862 [
1863 AC_MSG_RESULT(no)
1864 # Default to use of the rand helper if OpenSSL doesn't
1865 # seed itself
1866 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001867 ],
1868 [
1869 AC_MSG_WARN([cross compiling: assuming yes])
1870 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001871 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001872 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001873 ]
1874)
1875
1876
1877# Do we want to force the use of the rand helper?
1878AC_ARG_WITH(rand-helper,
1879 [ --with-rand-helper Use subprocess to gather strong randomness ],
1880 [
1881 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001882 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001883 # the previous test showed it to be unseeded.
1884 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1885 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1886 OPENSSL_SEEDS_ITSELF=yes
1887 USE_RAND_HELPER=""
1888 fi
1889 else
1890 USE_RAND_HELPER=yes
1891 fi
1892 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001893)
Damien Miller6c21c512002-01-22 21:57:53 +11001894
1895# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001896if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001897 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001898 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1899 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001900 RAND_MSG="OpenSSL internal ONLY"
1901 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001902elif test ! -z "$USE_RAND_HELPER" ; then
1903 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001904 RAND_MSG="ssh-rand-helper"
1905 INSTALL_SSH_RAND_HELPER="yes"
1906fi
1907AC_SUBST(INSTALL_SSH_RAND_HELPER)
1908
1909### Configuration of ssh-rand-helper
1910
1911# PRNGD TCP socket
1912AC_ARG_WITH(prngd-port,
1913 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1914 [
Damien Millere996d722002-01-23 11:20:59 +11001915 case "$withval" in
1916 no)
1917 withval=""
1918 ;;
1919 [[0-9]]*)
1920 ;;
1921 *)
1922 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1923 ;;
1924 esac
1925 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001926 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001927 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1928 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001929 fi
1930 ]
1931)
1932
1933# PRNGD Unix domain socket
1934AC_ARG_WITH(prngd-socket,
1935 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1936 [
Damien Millere996d722002-01-23 11:20:59 +11001937 case "$withval" in
1938 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001939 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001940 ;;
1941 no)
1942 withval=""
1943 ;;
1944 /*)
1945 ;;
1946 *)
1947 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1948 ;;
1949 esac
1950
1951 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001952 if test ! -z "$PRNGD_PORT" ; then
1953 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1954 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001955 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001956 AC_MSG_WARN(Entropy socket is not readable)
1957 fi
1958 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001959 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1960 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001961 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001962 ],
1963 [
1964 # Check for existing socket only if we don't have a random device already
1965 if test "$USE_RAND_HELPER" = yes ; then
1966 AC_MSG_CHECKING(for PRNGD/EGD socket)
1967 # Insert other locations here
1968 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1969 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1970 PRNGD_SOCKET="$sock"
1971 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1972 break;
1973 fi
1974 done
1975 if test ! -z "$PRNGD_SOCKET" ; then
1976 AC_MSG_RESULT($PRNGD_SOCKET)
1977 else
1978 AC_MSG_RESULT(not found)
1979 fi
1980 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001981 ]
1982)
1983
1984# Change default command timeout for hashing entropy source
1985entropy_timeout=200
1986AC_ARG_WITH(entropy-timeout,
1987 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1988 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001989 if test -n "$withval" && test "x$withval" != "xno" && \
1990 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001991 entropy_timeout=$withval
1992 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001993 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001994)
Tim Rice7df8d392005-09-19 09:33:39 -07001995AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1996 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11001997
Damien Millerd3f6ad22002-06-25 10:24:47 +10001998SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001999AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00002000 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002001 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002002 if test -n "$withval" && test "x$withval" != "xno" && \
2003 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002004 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002005 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002006 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002007)
Tim Rice7df8d392005-09-19 09:33:39 -07002008AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2009 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002010AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002011
Tim Rice88f2ab52002-03-17 12:17:34 -08002012# We do this little dance with the search path to insure
2013# that programs that we select for use by installed programs
2014# (which may be run by the super-user) come from trusted
2015# locations before they come from the user's private area.
2016# This should help avoid accidentally configuring some
2017# random version of a program in someone's personal bin.
2018
2019OPATH=$PATH
2020PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002021test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002022test -d /sbin && PATH=$PATH:/sbin
2023test -d /usr/sbin && PATH=$PATH:/usr/sbin
2024PATH=$PATH:/etc:$OPATH
2025
Damien Millera8e06ce2003-11-21 23:48:55 +11002026# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002027OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2028OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2029OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2030OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2031OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2032OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2033OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2034OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2035OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2036OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2037OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2038OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2039OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2040OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2041OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2042OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002043# restore PATH
2044PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002045
2046# Where does ssh-rand-helper get its randomness from?
2047INSTALL_SSH_PRNG_CMDS=""
2048if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2049 if test ! -z "$PRNGD_PORT" ; then
2050 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2051 elif test ! -z "$PRNGD_SOCKET" ; then
2052 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2053 else
2054 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2055 RAND_HELPER_CMDHASH=yes
2056 INSTALL_SSH_PRNG_CMDS="yes"
2057 fi
2058fi
2059AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2060
2061
Ben Lindstromb5628642000-10-18 00:02:25 +00002062# Cheap hack to ensure NEWS-OS libraries are arranged right.
2063if test ! -z "$SONY" ; then
2064 LIBS="$LIBS -liberty";
2065fi
2066
Damien Miller57f39152005-11-24 19:58:19 +11002067# Check for long long datatypes
2068AC_CHECK_TYPES([long long, unsigned long long, long double])
2069
2070# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002071AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002072AC_CHECK_SIZEOF(short int, 2)
2073AC_CHECK_SIZEOF(int, 4)
2074AC_CHECK_SIZEOF(long int, 4)
2075AC_CHECK_SIZEOF(long long int, 8)
2076
Damien Millerfa2bb692002-04-23 23:22:25 +10002077# Sanity check long long for some platforms (AIX)
2078if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2079 ac_cv_sizeof_long_long_int=0
2080fi
2081
Darren Tucker537f1ed2005-10-25 18:38:33 +10002082# compute LLONG_MIN and LLONG_MAX if we don't know them.
2083if test -z "$have_llong_max"; then
2084 AC_MSG_CHECKING([for max value of long long])
2085 AC_RUN_IFELSE(
2086 [AC_LANG_SOURCE([[
2087#include <stdio.h>
2088/* Why is this so damn hard? */
2089#ifdef __GNUC__
2090# undef __GNUC__
2091#endif
2092#define __USE_ISOC99
2093#include <limits.h>
2094#define DATA "conftest.llminmax"
2095int main(void) {
2096 FILE *f;
2097 long long i, llmin, llmax = 0;
2098
2099 if((f = fopen(DATA,"w")) == NULL)
2100 exit(1);
2101
2102#if defined(LLONG_MIN) && defined(LLONG_MAX)
2103 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2104 llmin = LLONG_MIN;
2105 llmax = LLONG_MAX;
2106#else
2107 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2108 /* This will work on one's complement and two's complement */
2109 for (i = 1; i > llmax; i <<= 1, i++)
2110 llmax = i;
2111 llmin = llmax + 1LL; /* wrap */
2112#endif
2113
2114 /* Sanity check */
2115 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2116 || llmax - 1 > llmax) {
2117 fprintf(f, "unknown unknown\n");
2118 exit(2);
2119 }
2120
2121 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2122 exit(3);
2123
2124 exit(0);
2125}
2126 ]])],
2127 [
2128 llong_min=`$AWK '{print $1}' conftest.llminmax`
2129 llong_max=`$AWK '{print $2}' conftest.llminmax`
2130
2131 # snprintf on some Tru64s doesn't understand "%lld"
2132 case "$host" in
2133 alpha-dec-osf*)
2134 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2135 test "x$llong_max" = "xld"; then
2136 llong_min="-9223372036854775808"
2137 llong_max="9223372036854775807"
2138 fi
2139 ;;
2140 esac
2141
2142 AC_MSG_RESULT($llong_max)
2143 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2144 [max value of long long calculated by configure])
2145 AC_MSG_CHECKING([for min value of long long])
2146 AC_MSG_RESULT($llong_min)
2147 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2148 [min value of long long calculated by configure])
2149 ],
2150 [
2151 AC_MSG_RESULT(not found)
2152 ],
2153 [
2154 AC_MSG_WARN([cross compiling: not checking])
2155 ]
2156 )
2157fi
2158
2159
Damien Millera22ba012000-03-02 23:09:20 +11002160# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002161AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2162 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002163 [ #include <sys/types.h> ],
2164 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002165 [ ac_cv_have_u_int="yes" ],
2166 [ ac_cv_have_u_int="no" ]
2167 )
2168])
2169if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002170 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002171 have_u_int=1
2172fi
2173
Damien Miller61e50f12000-05-08 20:49:37 +10002174AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2175 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002176 [ #include <sys/types.h> ],
2177 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002178 [ ac_cv_have_intxx_t="yes" ],
2179 [ ac_cv_have_intxx_t="no" ]
2180 )
2181])
2182if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002183 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002184 have_intxx_t=1
2185fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002186
2187if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002188 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002189then
2190 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2191 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002192 [ #include <stdint.h> ],
2193 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002194 [
2195 AC_DEFINE(HAVE_INTXX_T)
2196 AC_MSG_RESULT(yes)
2197 ],
2198 [ AC_MSG_RESULT(no) ]
2199 )
2200fi
2201
Damien Miller578783e2000-09-23 14:12:24 +11002202AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2203 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002204 [
2205#include <sys/types.h>
2206#ifdef HAVE_STDINT_H
2207# include <stdint.h>
2208#endif
2209#include <sys/socket.h>
2210#ifdef HAVE_SYS_BITYPES_H
2211# include <sys/bitypes.h>
2212#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002213 ],
2214 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002215 [ ac_cv_have_int64_t="yes" ],
2216 [ ac_cv_have_int64_t="no" ]
2217 )
2218])
2219if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002220 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002221fi
2222
Damien Miller61e50f12000-05-08 20:49:37 +10002223AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2224 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002225 [ #include <sys/types.h> ],
2226 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002227 [ ac_cv_have_u_intxx_t="yes" ],
2228 [ ac_cv_have_u_intxx_t="no" ]
2229 )
2230])
2231if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002232 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002233 have_u_intxx_t=1
2234fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002235
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002236if test -z "$have_u_intxx_t" ; then
2237 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2238 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002239 [ #include <sys/socket.h> ],
2240 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002241 [
2242 AC_DEFINE(HAVE_U_INTXX_T)
2243 AC_MSG_RESULT(yes)
2244 ],
2245 [ AC_MSG_RESULT(no) ]
2246 )
2247fi
2248
Damien Miller578783e2000-09-23 14:12:24 +11002249AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2250 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002251 [ #include <sys/types.h> ],
2252 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002253 [ ac_cv_have_u_int64_t="yes" ],
2254 [ ac_cv_have_u_int64_t="no" ]
2255 )
2256])
2257if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002258 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002259 have_u_int64_t=1
2260fi
2261
Tim Rice4cec93f2002-02-26 08:40:48 -08002262if test -z "$have_u_int64_t" ; then
2263 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2264 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002265 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002266 [ u_int64_t a; a = 1],
2267 [
2268 AC_DEFINE(HAVE_U_INT64_T)
2269 AC_MSG_RESULT(yes)
2270 ],
2271 [ AC_MSG_RESULT(no) ]
2272 )
2273fi
2274
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002275if test -z "$have_u_intxx_t" ; then
2276 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2277 AC_TRY_COMPILE(
2278 [
2279#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002280 ],
2281 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002282 [ ac_cv_have_uintxx_t="yes" ],
2283 [ ac_cv_have_uintxx_t="no" ]
2284 )
2285 ])
2286 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002287 AC_DEFINE(HAVE_UINTXX_T, 1,
2288 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002289 fi
2290fi
2291
2292if test -z "$have_uintxx_t" ; then
2293 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2294 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002295 [ #include <stdint.h> ],
2296 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002297 [
2298 AC_DEFINE(HAVE_UINTXX_T)
2299 AC_MSG_RESULT(yes)
2300 ],
2301 [ AC_MSG_RESULT(no) ]
2302 )
2303fi
2304
Damien Milleredb82922000-06-20 13:25:52 +10002305if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002306 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002307then
2308 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2309 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002310 [
2311#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002312 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002313 [
Damien Miller70494d12000-04-03 15:57:06 +10002314 int8_t a; int16_t b; int32_t c;
2315 u_int8_t e; u_int16_t f; u_int32_t g;
2316 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002317 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002318 [
2319 AC_DEFINE(HAVE_U_INTXX_T)
2320 AC_DEFINE(HAVE_INTXX_T)
2321 AC_MSG_RESULT(yes)
2322 ],
2323 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002324 )
Damien Millerb29ea912000-01-15 14:12:03 +11002325fi
2326
Damien Miller58be7382001-09-15 21:31:54 +10002327
2328AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2329 AC_TRY_COMPILE(
2330 [
2331#include <sys/types.h>
2332 ],
2333 [ u_char foo; foo = 125; ],
2334 [ ac_cv_have_u_char="yes" ],
2335 [ ac_cv_have_u_char="no" ]
2336 )
2337])
2338if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002339 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002340fi
2341
Tim Rice13aae5e2001-10-21 17:53:58 -07002342TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002343
Tim Rice200a5c02002-02-26 22:12:34 -08002344AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002345
Damien Miller848b9932005-02-24 12:12:34 +11002346AC_CHECK_TYPES(in_addr_t,,,
2347[#include <sys/types.h>
2348#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002349
Damien Miller61e50f12000-05-08 20:49:37 +10002350AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2351 AC_TRY_COMPILE(
2352 [
2353#include <sys/types.h>
2354 ],
2355 [ size_t foo; foo = 1235; ],
2356 [ ac_cv_have_size_t="yes" ],
2357 [ ac_cv_have_size_t="no" ]
2358 )
2359])
2360if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002361 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002362fi
Damien Miller95058511999-12-29 10:36:45 +11002363
Damien Miller615f9392000-05-17 22:53:33 +10002364AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2365 AC_TRY_COMPILE(
2366 [
2367#include <sys/types.h>
2368 ],
2369 [ ssize_t foo; foo = 1235; ],
2370 [ ac_cv_have_ssize_t="yes" ],
2371 [ ac_cv_have_ssize_t="no" ]
2372 )
2373])
2374if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002375 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002376fi
2377
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002378AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2379 AC_TRY_COMPILE(
2380 [
2381#include <time.h>
2382 ],
2383 [ clock_t foo; foo = 1235; ],
2384 [ ac_cv_have_clock_t="yes" ],
2385 [ ac_cv_have_clock_t="no" ]
2386 )
2387])
2388if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002389 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002390fi
2391
Damien Millerb54b40e2000-06-23 08:23:34 +10002392AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2393 AC_TRY_COMPILE(
2394 [
2395#include <sys/types.h>
2396#include <sys/socket.h>
2397 ],
2398 [ sa_family_t foo; foo = 1235; ],
2399 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002400 [ AC_TRY_COMPILE(
2401 [
2402#include <sys/types.h>
2403#include <sys/socket.h>
2404#include <netinet/in.h>
2405 ],
2406 [ sa_family_t foo; foo = 1235; ],
2407 [ ac_cv_have_sa_family_t="yes" ],
2408
Damien Millerb54b40e2000-06-23 08:23:34 +10002409 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002410 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002411 )
2412])
2413if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002414 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2415 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002416fi
2417
Damien Miller0f91b4e2000-06-18 15:43:25 +10002418AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2419 AC_TRY_COMPILE(
2420 [
2421#include <sys/types.h>
2422 ],
2423 [ pid_t foo; foo = 1235; ],
2424 [ ac_cv_have_pid_t="yes" ],
2425 [ ac_cv_have_pid_t="no" ]
2426 )
2427])
2428if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002429 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002430fi
2431
2432AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2433 AC_TRY_COMPILE(
2434 [
2435#include <sys/types.h>
2436 ],
2437 [ mode_t foo; foo = 1235; ],
2438 [ ac_cv_have_mode_t="yes" ],
2439 [ ac_cv_have_mode_t="no" ]
2440 )
2441])
2442if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002443 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002444fi
2445
Damien Miller61e50f12000-05-08 20:49:37 +10002446
2447AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2448 AC_TRY_COMPILE(
2449 [
Damien Miller81171112000-04-23 11:14:01 +10002450#include <sys/types.h>
2451#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002452 ],
2453 [ struct sockaddr_storage s; ],
2454 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2455 [ ac_cv_have_struct_sockaddr_storage="no" ]
2456 )
2457])
2458if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002459 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2460 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002461fi
Damien Miller34132e52000-01-14 15:45:46 +11002462
Damien Miller61e50f12000-05-08 20:49:37 +10002463AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2464 AC_TRY_COMPILE(
2465 [
Damien Miller7b22d652000-06-18 14:07:04 +10002466#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002467#include <netinet/in.h>
2468 ],
2469 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2470 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2471 [ ac_cv_have_struct_sockaddr_in6="no" ]
2472 )
2473])
2474if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002475 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2476 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002477fi
Damien Miller34132e52000-01-14 15:45:46 +11002478
Damien Miller61e50f12000-05-08 20:49:37 +10002479AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2480 AC_TRY_COMPILE(
2481 [
Damien Miller7b22d652000-06-18 14:07:04 +10002482#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002483#include <netinet/in.h>
2484 ],
2485 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2486 [ ac_cv_have_struct_in6_addr="yes" ],
2487 [ ac_cv_have_struct_in6_addr="no" ]
2488 )
2489])
2490if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002491 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2492 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002493fi
Damien Miller34132e52000-01-14 15:45:46 +11002494
Damien Miller61e50f12000-05-08 20:49:37 +10002495AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2496 AC_TRY_COMPILE(
2497 [
Damien Miller81171112000-04-23 11:14:01 +10002498#include <sys/types.h>
2499#include <sys/socket.h>
2500#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002501 ],
2502 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2503 [ ac_cv_have_struct_addrinfo="yes" ],
2504 [ ac_cv_have_struct_addrinfo="no" ]
2505 )
2506])
2507if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002508 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2509 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002510fi
2511
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002512AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2513 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002514 [ #include <sys/time.h> ],
2515 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002516 [ ac_cv_have_struct_timeval="yes" ],
2517 [ ac_cv_have_struct_timeval="no" ]
2518 )
2519])
2520if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002521 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002522 have_struct_timeval=1
2523fi
2524
Tim Rice4e4dc562003-03-18 10:21:40 -08002525AC_CHECK_TYPES(struct timespec)
2526
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002527# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002528if test "x$ac_cv_have_int64_t" = "xno" && \
2529 test "x$ac_cv_sizeof_long_int" != "x8" && \
2530 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002531 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2532 echo "an alternative compiler (I.E., GCC) before continuing."
2533 echo ""
2534 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002535else
2536dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002537 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002538 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002539#include <stdio.h>
2540#include <string.h>
2541#ifdef HAVE_SNPRINTF
2542main()
2543{
2544 char buf[50];
2545 char expected_out[50];
2546 int mazsize = 50 ;
2547#if (SIZEOF_LONG_INT == 8)
2548 long int num = 0x7fffffffffffffff;
2549#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002550 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002551#endif
2552 strcpy(expected_out, "9223372036854775807");
2553 snprintf(buf, mazsize, "%lld", num);
2554 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002555 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002556 exit(0);
2557}
2558#else
2559main() { exit(0); }
2560#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002561 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002562 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002563 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002564fi
2565
Damien Miller78315eb2000-09-29 23:01:36 +11002566dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002567OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2568OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2569OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2570OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2571OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002572OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002573OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2574OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002575OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002576OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2577OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2578OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2579OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002580OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2581OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2582OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2583OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002584
2585AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002586AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2587 [Define if we don't have struct __res_state in resolv.h])],
2588[
2589#include <stdio.h>
2590#if HAVE_SYS_TYPES_H
2591# include <sys/types.h>
2592#endif
2593#include <netinet/in.h>
2594#include <arpa/nameser.h>
2595#include <resolv.h>
2596])
andre2ff7b5d2000-06-03 14:57:40 +00002597
Damien Miller61e50f12000-05-08 20:49:37 +10002598AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2599 ac_cv_have_ss_family_in_struct_ss, [
2600 AC_TRY_COMPILE(
2601 [
Damien Miller81171112000-04-23 11:14:01 +10002602#include <sys/types.h>
2603#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002604 ],
2605 [ struct sockaddr_storage s; s.ss_family = 1; ],
2606 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2607 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2608 )
2609])
2610if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002611 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002612fi
2613
Damien Miller61e50f12000-05-08 20:49:37 +10002614AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2615 ac_cv_have___ss_family_in_struct_ss, [
2616 AC_TRY_COMPILE(
2617 [
Damien Miller81171112000-04-23 11:14:01 +10002618#include <sys/types.h>
2619#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002620 ],
2621 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2622 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2623 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2624 )
2625])
2626if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002627 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2628 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002629fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002630
Damien Millerad833b32000-08-23 10:46:23 +10002631AC_CACHE_CHECK([for pw_class field in struct passwd],
2632 ac_cv_have_pw_class_in_struct_passwd, [
2633 AC_TRY_COMPILE(
2634 [
Damien Millerad833b32000-08-23 10:46:23 +10002635#include <pwd.h>
2636 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002637 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002638 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2639 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2640 )
2641])
2642if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002643 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2644 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002645fi
2646
Kevin Steves82456952001-06-22 21:14:18 +00002647AC_CACHE_CHECK([for pw_expire field in struct passwd],
2648 ac_cv_have_pw_expire_in_struct_passwd, [
2649 AC_TRY_COMPILE(
2650 [
2651#include <pwd.h>
2652 ],
2653 [ struct passwd p; p.pw_expire = 0; ],
2654 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2655 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2656 )
2657])
2658if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002659 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2660 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002661fi
2662
2663AC_CACHE_CHECK([for pw_change field in struct passwd],
2664 ac_cv_have_pw_change_in_struct_passwd, [
2665 AC_TRY_COMPILE(
2666 [
2667#include <pwd.h>
2668 ],
2669 [ struct passwd p; p.pw_change = 0; ],
2670 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2671 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2672 )
2673])
2674if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002675 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2676 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002677fi
Damien Miller61e50f12000-05-08 20:49:37 +10002678
Tim Rice28bbb0c2002-05-27 17:37:32 -07002679dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002680AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2681 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002682 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002683 [
Tim Riceae49fe62002-04-12 10:26:21 -07002684#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002685#include <sys/socket.h>
2686#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002687int main() {
2688#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002689#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002690exit(1);
2691#endif
2692struct msghdr m;
2693m.msg_accrights = 0;
2694exit(0);
2695}
Kevin Steves939c9db2002-03-22 17:23:25 +00002696 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002697 [ ac_cv_have_accrights_in_msghdr="yes" ],
2698 [ ac_cv_have_accrights_in_msghdr="no" ]
2699 )
2700])
2701if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002702 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2703 [Define if your system uses access rights style
2704 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002705fi
2706
Kevin Stevesa44e0352002-04-07 16:18:03 +00002707AC_CACHE_CHECK([for msg_control field in struct msghdr],
2708 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002709 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002710 [
Tim Riceae49fe62002-04-12 10:26:21 -07002711#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002712#include <sys/socket.h>
2713#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002714int main() {
2715#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002716#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002717exit(1);
2718#endif
2719struct msghdr m;
2720m.msg_control = 0;
2721exit(0);
2722}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002723 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002724 [ ac_cv_have_control_in_msghdr="yes" ],
2725 [ ac_cv_have_control_in_msghdr="no" ]
2726 )
2727])
2728if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002729 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2730 [Define if your system uses ancillary data style
2731 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002732fi
2733
Damien Miller61e50f12000-05-08 20:49:37 +10002734AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002735 AC_TRY_LINK([],
2736 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002737 [ ac_cv_libc_defines___progname="yes" ],
2738 [ ac_cv_libc_defines___progname="no" ]
2739 )
2740])
2741if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002742 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002743fi
2744
Kevin Steves4846f4a2002-03-22 18:19:53 +00002745AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2746 AC_TRY_LINK([
2747#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002748],
2749 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002750 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2751 [ ac_cv_cc_implements___FUNCTION__="no" ]
2752 )
2753])
2754if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002755 AC_DEFINE(HAVE___FUNCTION__, 1,
2756 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002757fi
2758
2759AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2760 AC_TRY_LINK([
2761#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002762],
2763 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002764 [ ac_cv_cc_implements___func__="yes" ],
2765 [ ac_cv_cc_implements___func__="no" ]
2766 )
2767])
2768if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002769 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002770fi
2771
Damien Miller57f39152005-11-24 19:58:19 +11002772AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
2773 AC_TRY_LINK(
2774 [#include <stdarg.h>
2775 va_list x,y;],
2776 [va_copy(x,y);],
2777 [ ac_cv_have_va_copy="yes" ],
2778 [ ac_cv_have_va_copy="no" ]
2779 )
2780])
2781if test "x$ac_cv_have_va_copy" = "xyes" ; then
2782 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
2783fi
2784
2785AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
2786 AC_TRY_LINK(
2787 [#include <stdarg.h>
2788 va_list x,y;],
2789 [__va_copy(x,y);],
2790 [ ac_cv_have___va_copy="yes" ],
2791 [ ac_cv_have___va_copy="no" ]
2792 )
2793])
2794if test "x$ac_cv_have___va_copy" = "xyes" ; then
2795 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2796fi
2797
Damien Miller4f8e6692001-07-14 13:22:53 +10002798AC_CACHE_CHECK([whether getopt has optreset support],
2799 ac_cv_have_getopt_optreset, [
2800 AC_TRY_LINK(
2801 [
2802#include <getopt.h>
2803 ],
2804 [ extern int optreset; optreset = 0; ],
2805 [ ac_cv_have_getopt_optreset="yes" ],
2806 [ ac_cv_have_getopt_optreset="no" ]
2807 )
2808])
2809if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002810 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2811 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002812fi
Damien Millera22ba012000-03-02 23:09:20 +11002813
Damien Millerecbb26d2000-07-15 14:59:14 +10002814AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002815 AC_TRY_LINK([],
2816 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002817 [ ac_cv_libc_defines_sys_errlist="yes" ],
2818 [ ac_cv_libc_defines_sys_errlist="no" ]
2819 )
2820])
2821if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002822 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2823 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002824fi
2825
2826
Damien Miller11fa2cc2000-08-16 10:35:58 +10002827AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002828 AC_TRY_LINK([],
2829 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002830 [ ac_cv_libc_defines_sys_nerr="yes" ],
2831 [ ac_cv_libc_defines_sys_nerr="no" ]
2832 )
2833])
2834if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002835 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002836fi
2837
Damien Millera8e06ce2003-11-21 23:48:55 +11002838SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002839# Check whether user wants sectok support
2840AC_ARG_WITH(sectok,
2841 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002842 [
2843 if test "x$withval" != "xno" ; then
2844 if test "x$withval" != "xyes" ; then
2845 CPPFLAGS="$CPPFLAGS -I${withval}"
2846 LDFLAGS="$LDFLAGS -L${withval}"
2847 if test ! -z "$need_dash_r" ; then
2848 LDFLAGS="$LDFLAGS -R${withval}"
2849 fi
2850 if test ! -z "$blibpath" ; then
2851 blibpath="$blibpath:${withval}"
2852 fi
2853 fi
2854 AC_CHECK_HEADERS(sectok.h)
2855 if test "$ac_cv_header_sectok_h" != yes; then
2856 AC_MSG_ERROR(Can't find sectok.h)
2857 fi
2858 AC_CHECK_LIB(sectok, sectok_open)
2859 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2860 AC_MSG_ERROR(Can't find libsectok)
2861 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002862 AC_DEFINE(SMARTCARD, 1,
2863 [Define if you want smartcard support])
2864 AC_DEFINE(USE_SECTOK, 1,
2865 [Define if you want smartcard support
2866 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002867 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002868 fi
2869 ]
2870)
2871
2872# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002873OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002874AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10002875 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08002876 [
2877 if test "x$withval" != "xno" ; then
2878 if test "x$withval" != "xyes" ; then
2879 OPENSC_CONFIG=$withval/bin/opensc-config
2880 else
2881 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2882 fi
2883 if test "$OPENSC_CONFIG" != "no"; then
2884 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2885 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2886 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2887 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2888 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002889 AC_DEFINE(USE_OPENSC, 1,
2890 [Define if you want smartcard support
2891 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002892 SCARD_MSG="yes, using OpenSC"
2893 fi
2894 fi
2895 ]
2896)
Damien Miller85de5802001-09-18 14:01:11 +10002897
Darren Tucker5f88d342003-10-15 16:57:57 +10002898# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002899AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002900 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2901 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002902 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002903 # Needed by our getrrsetbyname()
2904 AC_SEARCH_LIBS(res_query, resolv)
2905 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002906 AC_MSG_CHECKING(if res_query will link)
2907 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2908 [AC_MSG_RESULT(no)
2909 saved_LIBS="$LIBS"
2910 LIBS="$LIBS -lresolv"
2911 AC_MSG_CHECKING(for res_query in -lresolv)
2912 AC_LINK_IFELSE([
2913#include <resolv.h>
2914int main()
2915{
2916 res_query (0, 0, 0, 0, 0);
2917 return 0;
2918}
2919 ],
2920 [LIBS="$LIBS -lresolv"
2921 AC_MSG_RESULT(yes)],
2922 [LIBS="$saved_LIBS"
2923 AC_MSG_RESULT(no)])
2924 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002925 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002926 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002927 [#include <sys/types.h>
2928 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002929 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07002930 [AC_DEFINE(HAVE_HEADER_AD, 1,
2931 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10002932 [#include <arpa/nameser.h>])
2933 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002934
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002935# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002936KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002937AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002938 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002939 [ if test "x$withval" != "xno" ; then
2940 if test "x$withval" = "xyes" ; then
2941 KRB5ROOT="/usr/local"
2942 else
2943 KRB5ROOT=${withval}
2944 fi
2945
Tim Rice7df8d392005-09-19 09:33:39 -07002946 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11002947 KRB5_MSG="yes"
2948
2949 AC_MSG_CHECKING(for krb5-config)
2950 if test -x $KRB5ROOT/bin/krb5-config ; then
2951 KRB5CONF=$KRB5ROOT/bin/krb5-config
2952 AC_MSG_RESULT($KRB5CONF)
2953
2954 AC_MSG_CHECKING(for gssapi support)
2955 if $KRB5CONF | grep gssapi >/dev/null ; then
2956 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002957 AC_DEFINE(GSSAPI, 1,
2958 [Define this if you want GSSAPI
2959 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11002960 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002961 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002962 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002963 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002964 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002965 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2966 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002967 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002968 AC_MSG_CHECKING(whether we are using Heimdal)
2969 AC_TRY_COMPILE([ #include <krb5.h> ],
2970 [ char *tmp = heimdal_version; ],
2971 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002972 AC_DEFINE(HEIMDAL, 1,
2973 [Define this if you are using the
2974 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002975 AC_MSG_RESULT(no)
2976 )
2977 else
2978 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002979 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002980 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002981 AC_MSG_CHECKING(whether we are using Heimdal)
2982 AC_TRY_COMPILE([ #include <krb5.h> ],
2983 [ char *tmp = heimdal_version; ],
2984 [ AC_MSG_RESULT(yes)
2985 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002986 K5LIBS="-lkrb5 -ldes"
2987 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002988 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002989 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002990 ],
2991 [ AC_MSG_RESULT(no)
2992 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2993 ]
2994 )
Damien Miller200d0a72003-06-30 19:21:36 +10002995 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002996
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002997 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2998 [ AC_DEFINE(GSSAPI)
2999 K5LIBS="-lgssapi $K5LIBS" ],
3000 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3001 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11003002 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003003 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3004 $K5LIBS)
3005 ],
3006 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003007
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003008 AC_CHECK_HEADER(gssapi.h, ,
3009 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003010 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003011 AC_CHECK_HEADERS(gssapi.h, ,
3012 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003013 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003014 ]
3015 )
3016
3017 oldCPP="$CPPFLAGS"
3018 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3019 AC_CHECK_HEADER(gssapi_krb5.h, ,
3020 [ CPPFLAGS="$oldCPP" ])
3021
Damien Millera8e06ce2003-11-21 23:48:55 +11003022 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003023 if test ! -z "$need_dash_r" ; then
3024 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3025 fi
3026 if test ! -z "$blibpath" ; then
3027 blibpath="$blibpath:${KRB5ROOT}/lib"
3028 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003029
3030 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3031 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3032 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3033
3034 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003035 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3036 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003037 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003038 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003039)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003040
Damien Millera22ba012000-03-02 23:09:20 +11003041# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003042
Damien Millerf58c6722002-05-13 13:15:42 +10003043PRIVSEP_PATH=/var/empty
3044AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003045 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003046 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003047 if test -n "$withval" && test "x$withval" != "xno" && \
3048 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003049 PRIVSEP_PATH=$withval
3050 fi
3051 ]
3052)
3053AC_SUBST(PRIVSEP_PATH)
3054
Damien Millera22ba012000-03-02 23:09:20 +11003055AC_ARG_WITH(xauth,
3056 [ --with-xauth=PATH Specify path to xauth program ],
3057 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003058 if test -n "$withval" && test "x$withval" != "xno" && \
3059 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003060 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003061 fi
3062 ],
3063 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003064 TestPath="$PATH"
3065 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3066 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3067 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3068 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3069 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003070 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003071 xauth_path="/usr/openwin/bin/xauth"
3072 fi
3073 ]
3074)
3075
Damien Miller7d901272003-01-13 16:55:22 +11003076STRIP_OPT=-s
3077AC_ARG_ENABLE(strip,
3078 [ --disable-strip Disable calling strip(1) on install],
3079 [
3080 if test "x$enableval" = "xno" ; then
3081 STRIP_OPT=
3082 fi
3083 ]
3084)
3085AC_SUBST(STRIP_OPT)
3086
Damien Millera19cf472000-11-29 13:28:50 +11003087if test -z "$xauth_path" ; then
3088 XAUTH_PATH="undefined"
3089 AC_SUBST(XAUTH_PATH)
3090else
Tim Rice7df8d392005-09-19 09:33:39 -07003091 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3092 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003093 XAUTH_PATH=$xauth_path
3094 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003095fi
Damien Millera22ba012000-03-02 23:09:20 +11003096
3097# Check for mail directory (last resort if we cannot get it from headers)
3098if test ! -z "$MAIL" ; then
3099 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003100 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3101 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003102fi
3103
Darren Tucker623d92f2004-09-12 22:36:15 +10003104if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003105 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3106 disable_ptmx_check=yes
3107fi
Damien Millera22ba012000-03-02 23:09:20 +11003108if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003109 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003110 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003111 [
Tim Rice7df8d392005-09-19 09:33:39 -07003112 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3113 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003114 have_dev_ptmx=1
3115 ]
3116 )
3117 fi
Damien Millera22ba012000-03-02 23:09:20 +11003118fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003119
Darren Tucker623d92f2004-09-12 22:36:15 +10003120if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003121 AC_CHECK_FILE("/dev/ptc",
3122 [
Tim Rice7df8d392005-09-19 09:33:39 -07003123 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3124 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003125 have_dev_ptc=1
3126 ]
3127 )
3128else
3129 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3130fi
Damien Miller204ad072000-03-02 23:56:12 +11003131
Damien Millera22ba012000-03-02 23:09:20 +11003132# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003133AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003134 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003135 [
Damien Miller897741e2001-04-16 10:41:46 +10003136 case "$withval" in
3137 man|cat|doc)
3138 MANTYPE=$withval
3139 ;;
3140 *)
3141 AC_MSG_ERROR(invalid man type: $withval)
3142 ;;
3143 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003144 ]
3145)
Ben Lindstrombc709922001-04-18 18:04:21 +00003146if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003147 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3148 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003149 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3150 MANTYPE=doc
3151 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3152 MANTYPE=man
3153 else
3154 MANTYPE=cat
3155 fi
3156fi
Damien Miller670a4b82000-01-22 13:53:11 +11003157AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003158if test "$MANTYPE" = "doc"; then
3159 mansubdir=man;
3160else
3161 mansubdir=$MANTYPE;
3162fi
3163AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003164
Damien Millera22ba012000-03-02 23:09:20 +11003165# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003166MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003167AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003168 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003169 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003170 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003171 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3172 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003173 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003174 fi
3175 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003176)
3177
Damien Millera22ba012000-03-02 23:09:20 +11003178# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003179AC_ARG_WITH(shadow,
3180 [ --without-shadow Disable shadow password support],
3181 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003182 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003183 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003184 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003185 fi
3186 ]
3187)
3188
Damien Miller1f335fb2000-06-26 11:31:33 +10003189if test -z "$disable_shadow" ; then
3190 AC_MSG_CHECKING([if the systems has expire shadow information])
3191 AC_TRY_COMPILE(
3192 [
3193#include <sys/types.h>
3194#include <shadow.h>
3195 struct spwd sp;
3196 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3197 [ sp_expire_available=yes ], []
3198 )
3199
3200 if test "x$sp_expire_available" = "xyes" ; then
3201 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003202 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3203 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003204 else
3205 AC_MSG_RESULT(no)
3206 fi
3207fi
3208
Damien Millera22ba012000-03-02 23:09:20 +11003209# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003210if test ! -z "$IPADDR_IN_DISPLAY" ; then
3211 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003212 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3213 [Define if you need to use IP address
3214 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003215else
Damien Millera8e06ce2003-11-21 23:48:55 +11003216 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003217 AC_ARG_WITH(ipaddr-display,
3218 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3219 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003220 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003221 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003222 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003223 fi
3224 ]
3225 )
3226fi
Damien Miller76112de1999-12-21 11:18:08 +11003227
Darren Tuckere1a790d2003-09-16 11:52:19 +10003228# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003229AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003230 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003231 [ if test "x$enableval" = "xno"; then
3232 AC_MSG_NOTICE([/etc/default/login handling disabled])
3233 etc_default_login=no
3234 else
3235 etc_default_login=yes
3236 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003237 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3238 then
3239 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3240 etc_default_login=no
3241 else
3242 etc_default_login=yes
3243 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003244)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003245
Darren Tucker2f9573d2005-02-10 22:28:54 +11003246if test "x$etc_default_login" != "xno"; then
3247 AC_CHECK_FILE("/etc/default/login",
3248 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003249 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003250 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3251 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003252 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003253fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003254
Tim Rice43a1c132002-04-17 21:19:14 -07003255dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003256if test $ac_cv_func_login_getcapbool = "yes" && \
3257 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003258 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003259fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003260
Damien Millera22ba012000-03-02 23:09:20 +11003261# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003262SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003263AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003264 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003265 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003266 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003267 AC_MSG_WARN([
3268--with-default-path=PATH has no effect on this system.
3269Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003270 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003271 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003272 AC_MSG_WARN([
3273--with-default-path=PATH will only be used if PATH is not defined in
3274$external_path_file .])
3275 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003276 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003277 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003278 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003279 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003280 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3281 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003282 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003283 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003284 AC_MSG_WARN([
3285If PATH is defined in $external_path_file, ensure the path to scp is included,
3286otherwise scp will not work.])
3287 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003288 AC_RUN_IFELSE(
3289 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003290/* find out what STDPATH is */
3291#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003292#ifdef HAVE_PATHS_H
3293# include <paths.h>
3294#endif
3295#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003296# ifdef _PATH_USERPATH /* Irix */
3297# define _PATH_STDPATH _PATH_USERPATH
3298# else
3299# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3300# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003301#endif
3302#include <sys/types.h>
3303#include <sys/stat.h>
3304#include <fcntl.h>
3305#define DATA "conftest.stdpath"
3306
3307main()
3308{
3309 FILE *fd;
3310 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003311
Tim Rice59ea0a02001-03-10 13:50:45 -08003312 fd = fopen(DATA,"w");
3313 if(fd == NULL)
3314 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003315
Tim Rice59ea0a02001-03-10 13:50:45 -08003316 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3317 exit(1);
3318
3319 exit(0);
3320}
Darren Tucker314d89e2005-10-17 23:29:23 +10003321 ]])],
3322 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003323 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3324 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3325 )
3326# make sure $bindir is in USER_PATH so scp will work
3327 t_bindir=`eval echo ${bindir}`
3328 case $t_bindir in
3329 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3330 esac
3331 case $t_bindir in
3332 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3333 esac
3334 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3335 if test $? -ne 0 ; then
3336 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3337 if test $? -ne 0 ; then
3338 user_path=$user_path:$t_bindir
3339 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3340 fi
3341 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003342 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003343)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003344if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003345 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003346 AC_SUBST(user_path)
3347fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003348
Damien Millera18bbd32002-05-13 10:48:57 +10003349# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003350AC_ARG_WITH(superuser-path,
3351 [ --with-superuser-path= Specify different path for super-user],
3352 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003353 if test -n "$withval" && test "x$withval" != "xno" && \
3354 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003355 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3356 [Define if you want a different $PATH
3357 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003358 superuser_path=$withval
3359 fi
3360 ]
3361)
3362
3363
Damien Miller61e50f12000-05-08 20:49:37 +10003364AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003365IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003366AC_ARG_WITH(4in6,
3367 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3368 [
3369 if test "x$withval" != "xno" ; then
3370 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003371 AC_DEFINE(IPV4_IN_IPV6, 1,
3372 [Detect IPv4 in IPv6 mapped addresses
3373 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003374 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003375 else
3376 AC_MSG_RESULT(no)
3377 fi
3378 ],[
3379 if test "x$inet6_default_4in6" = "xyes"; then
3380 AC_MSG_RESULT([yes (default)])
3381 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003382 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003383 else
3384 AC_MSG_RESULT([no (default)])
3385 fi
3386 ]
3387)
3388
Damien Miller60396b02001-02-18 17:01:00 +11003389# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003390BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003391AC_ARG_WITH(bsd-auth,
3392 [ --with-bsd-auth Enable BSD auth support],
3393 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003394 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003395 AC_DEFINE(BSD_AUTH, 1,
3396 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003397 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003398 fi
3399 ]
3400)
3401
Damien Millera22ba012000-03-02 23:09:20 +11003402# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003403piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003404# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003405if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003406 piddir=`eval echo ${sysconfdir}`
3407 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003408 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003409 esac
3410fi
3411
Tim Rice88f2ab52002-03-17 12:17:34 -08003412AC_ARG_WITH(pid-dir,
3413 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3414 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003415 if test -n "$withval" && test "x$withval" != "xno" && \
3416 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003417 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003418 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003419 AC_MSG_WARN([** no $piddir directory on this system **])
3420 fi
3421 fi
3422 ]
3423)
3424
Tim Rice7df8d392005-09-19 09:33:39 -07003425AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003426AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003427
andre2ff7b5d2000-06-03 14:57:40 +00003428dnl allow user to disable some login recording features
3429AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003430 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003431 [
3432 if test "x$enableval" = "xno" ; then
3433 AC_DEFINE(DISABLE_LASTLOG)
3434 fi
3435 ]
andre2ff7b5d2000-06-03 14:57:40 +00003436)
3437AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003438 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003439 [
3440 if test "x$enableval" = "xno" ; then
3441 AC_DEFINE(DISABLE_UTMP)
3442 fi
3443 ]
andre2ff7b5d2000-06-03 14:57:40 +00003444)
3445AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003446 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003447 [
3448 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003449 AC_DEFINE(DISABLE_UTMPX, 1,
3450 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003451 fi
3452 ]
andre2ff7b5d2000-06-03 14:57:40 +00003453)
3454AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003455 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003456 [
3457 if test "x$enableval" = "xno" ; then
3458 AC_DEFINE(DISABLE_WTMP)
3459 fi
3460 ]
andre2ff7b5d2000-06-03 14:57:40 +00003461)
3462AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003463 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003464 [
3465 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003466 AC_DEFINE(DISABLE_WTMPX, 1,
3467 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003468 fi
3469 ]
andre2ff7b5d2000-06-03 14:57:40 +00003470)
3471AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003472 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003473 [
3474 if test "x$enableval" = "xno" ; then
3475 AC_DEFINE(DISABLE_LOGIN)
3476 fi
3477 ]
andre2ff7b5d2000-06-03 14:57:40 +00003478)
3479AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003480 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003481 [
3482 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003483 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3484 [Define if you don't want to use pututline()
3485 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003486 fi
3487 ]
andre2ff7b5d2000-06-03 14:57:40 +00003488)
3489AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003490 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003491 [
3492 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003493 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3494 [Define if you don't want to use pututxline()
3495 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003496 fi
3497 ]
andre2ff7b5d2000-06-03 14:57:40 +00003498)
3499AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003500 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003501 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003502 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003503 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003504 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003505 conf_lastlog_location=$withval
3506 fi
3507 ]
3508)
andre2ff7b5d2000-06-03 14:57:40 +00003509
3510dnl lastlog, [uw]tmpx? detection
3511dnl NOTE: set the paths in the platform section to avoid the
3512dnl need for command-line parameters
3513dnl lastlog and [uw]tmp are subject to a file search if all else fails
3514
3515dnl lastlog detection
3516dnl NOTE: the code itself will detect if lastlog is a directory
3517AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3518AC_TRY_COMPILE([
3519#include <sys/types.h>
3520#include <utmp.h>
3521#ifdef HAVE_LASTLOG_H
3522# include <lastlog.h>
3523#endif
Damien Miller2994e082000-06-04 15:51:47 +10003524#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003525# include <paths.h>
3526#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003527#ifdef HAVE_LOGIN_H
3528# include <login.h>
3529#endif
andre2ff7b5d2000-06-03 14:57:40 +00003530 ],
3531 [ char *lastlog = LASTLOG_FILE; ],
3532 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003533 [
3534 AC_MSG_RESULT(no)
3535 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3536 AC_TRY_COMPILE([
3537#include <sys/types.h>
3538#include <utmp.h>
3539#ifdef HAVE_LASTLOG_H
3540# include <lastlog.h>
3541#endif
3542#ifdef HAVE_PATHS_H
3543# include <paths.h>
3544#endif
3545 ],
3546 [ char *lastlog = _PATH_LASTLOG; ],
3547 [ AC_MSG_RESULT(yes) ],
3548 [
andree441aa32000-06-12 22:34:38 +00003549 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003550 system_lastlog_path=no
3551 ])
3552 ]
andre2ff7b5d2000-06-03 14:57:40 +00003553)
Damien Miller2994e082000-06-04 15:51:47 +10003554
andre2ff7b5d2000-06-03 14:57:40 +00003555if test -z "$conf_lastlog_location"; then
3556 if test x"$system_lastlog_path" = x"no" ; then
3557 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003558 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003559 conf_lastlog_location=$f
3560 fi
3561 done
3562 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003563 AC_MSG_WARN([** Cannot find lastlog **])
3564 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003565 fi
3566 fi
3567fi
3568
3569if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003570 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3571 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003572fi
andre2ff7b5d2000-06-03 14:57:40 +00003573
3574dnl utmp detection
3575AC_MSG_CHECKING([if your system defines UTMP_FILE])
3576AC_TRY_COMPILE([
3577#include <sys/types.h>
3578#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003579#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003580# include <paths.h>
3581#endif
3582 ],
3583 [ char *utmp = UTMP_FILE; ],
3584 [ AC_MSG_RESULT(yes) ],
3585 [ AC_MSG_RESULT(no)
3586 system_utmp_path=no ]
3587)
3588if test -z "$conf_utmp_location"; then
3589 if test x"$system_utmp_path" = x"no" ; then
3590 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3591 if test -f $f ; then
3592 conf_utmp_location=$f
3593 fi
3594 done
3595 if test -z "$conf_utmp_location"; then
3596 AC_DEFINE(DISABLE_UTMP)
3597 fi
3598 fi
3599fi
3600if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003601 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3602 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003603fi
andre2ff7b5d2000-06-03 14:57:40 +00003604
3605dnl wtmp detection
3606AC_MSG_CHECKING([if your system defines WTMP_FILE])
3607AC_TRY_COMPILE([
3608#include <sys/types.h>
3609#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003610#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003611# include <paths.h>
3612#endif
3613 ],
3614 [ char *wtmp = WTMP_FILE; ],
3615 [ AC_MSG_RESULT(yes) ],
3616 [ AC_MSG_RESULT(no)
3617 system_wtmp_path=no ]
3618)
3619if test -z "$conf_wtmp_location"; then
3620 if test x"$system_wtmp_path" = x"no" ; then
3621 for f in /usr/adm/wtmp /var/log/wtmp; do
3622 if test -f $f ; then
3623 conf_wtmp_location=$f
3624 fi
3625 done
3626 if test -z "$conf_wtmp_location"; then
3627 AC_DEFINE(DISABLE_WTMP)
3628 fi
3629 fi
3630fi
3631if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003632 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3633 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003634fi
andre2ff7b5d2000-06-03 14:57:40 +00003635
3636
3637dnl utmpx detection - I don't know any system so perverse as to require
3638dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3639dnl there, though.
3640AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3641AC_TRY_COMPILE([
3642#include <sys/types.h>
3643#include <utmp.h>
3644#ifdef HAVE_UTMPX_H
3645#include <utmpx.h>
3646#endif
Damien Miller2994e082000-06-04 15:51:47 +10003647#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003648# include <paths.h>
3649#endif
3650 ],
3651 [ char *utmpx = UTMPX_FILE; ],
3652 [ AC_MSG_RESULT(yes) ],
3653 [ AC_MSG_RESULT(no)
3654 system_utmpx_path=no ]
3655)
3656if test -z "$conf_utmpx_location"; then
3657 if test x"$system_utmpx_path" = x"no" ; then
3658 AC_DEFINE(DISABLE_UTMPX)
3659 fi
3660else
Tim Rice7df8d392005-09-19 09:33:39 -07003661 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3662 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003663fi
andre2ff7b5d2000-06-03 14:57:40 +00003664
3665dnl wtmpx detection
3666AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3667AC_TRY_COMPILE([
3668#include <sys/types.h>
3669#include <utmp.h>
3670#ifdef HAVE_UTMPX_H
3671#include <utmpx.h>
3672#endif
Damien Miller2994e082000-06-04 15:51:47 +10003673#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003674# include <paths.h>
3675#endif
3676 ],
3677 [ char *wtmpx = WTMPX_FILE; ],
3678 [ AC_MSG_RESULT(yes) ],
3679 [ AC_MSG_RESULT(no)
3680 system_wtmpx_path=no ]
3681)
3682if test -z "$conf_wtmpx_location"; then
3683 if test x"$system_wtmpx_path" = x"no" ; then
3684 AC_DEFINE(DISABLE_WTMPX)
3685 fi
3686else
Tim Rice7df8d392005-09-19 09:33:39 -07003687 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3688 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003689fi
andre2ff7b5d2000-06-03 14:57:40 +00003690
Damien Miller4018c192000-04-30 09:30:44 +10003691
Damien Miller29ea30d2000-03-17 10:54:15 +11003692if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003693 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3694 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003695fi
3696
Tim Rice4cec93f2002-02-26 08:40:48 -08003697dnl remove pam and dl because they are in $LIBPAM
3698if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003699 LIBS=`echo $LIBS | sed 's/-lpam //'`
3700fi
3701if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3702 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003703fi
3704
Darren Tucker7da23cb2005-08-03 00:20:15 +10003705dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3706dnl Add now.
3707CFLAGS="$CFLAGS $werror_flags"
3708
Damien Millerbac2d8a2000-09-05 16:13:06 +11003709AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003710AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3711 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003712AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003713
Damien Miller7b22d652000-06-18 14:07:04 +10003714# Print summary of options
3715
Damien Miller7b22d652000-06-18 14:07:04 +10003716# Someone please show me a better way :)
3717A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3718B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3719C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3720D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003721E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003722F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003723G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003724H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3725I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3726J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003727
3728echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003729echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003730echo " User binaries: $B"
3731echo " System binaries: $C"
3732echo " Configuration files: $D"
3733echo " Askpass program: $E"
3734echo " Manual pages: $F"
3735echo " PID file: $G"
3736echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003737if test "x$external_path_file" = "x/etc/login.conf" ; then
3738echo " At runtime, sshd will use the path defined in $external_path_file"
3739echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003740else
Damien Millerf58c6722002-05-13 13:15:42 +10003741echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003742 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003743echo " (If PATH is set in $external_path_file it will be used instead. If"
3744echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3745 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003746fi
Damien Millera18bbd32002-05-13 10:48:57 +10003747if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003748echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003749fi
Damien Millerf58c6722002-05-13 13:15:42 +10003750echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003751echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003752echo " KerberosV support: $KRB5_MSG"
3753echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003754echo " S/KEY support: $SKEY_MSG"
3755echo " TCP Wrappers support: $TCPW_MSG"
3756echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003757echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003758echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003759echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3760echo " BSD Auth support: $BSD_AUTH_MSG"
3761echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003762if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003763echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003764fi
3765
Damien Miller7b22d652000-06-18 14:07:04 +10003766echo ""
3767
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003768echo " Host: ${host}"
3769echo " Compiler: ${CC}"
3770echo " Compiler flags: ${CFLAGS}"
3771echo "Preprocessor flags: ${CPPFLAGS}"
3772echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003773echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003774
3775echo ""
3776
Tim Rice6f1f7582004-05-30 21:38:51 -07003777if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003778 echo "SVR4 style packages are supported with \"make package\""
3779 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003780fi
3781
Damien Miller82cf0ce2000-12-20 13:34:48 +11003782if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003783 echo "PAM is enabled. You may need to install a PAM control file "
3784 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003785 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003786 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003787 echo ""
3788fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003789
Damien Miller6c21c512002-01-22 21:57:53 +11003790if test ! -z "$RAND_HELPER_CMDHASH" ; then
3791 echo "WARNING: you are using the builtin random number collection "
3792 echo "service. Please read WARNING.RNG and request that your OS "
3793 echo "vendor includes kernel-based random number collection in "
3794 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003795 echo ""
3796fi
Damien Miller60396b02001-02-18 17:01:00 +11003797
Damien Millerb4097182004-05-23 14:09:40 +10003798if test ! -z "$NO_PEERCHECK" ; then
3799 echo "WARNING: the operating system that you are using does not "
3800 echo "appear to support either the getpeereid() API nor the "
3801 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3802 echo "enforce security checks to prevent unauthorised connections to "
3803 echo "ssh-agent. Their absence increases the risk that a malicious "
3804 echo "user can connect to your agent. "
3805 echo ""
3806fi
3807
Darren Tuckerd9f88912005-02-20 21:01:48 +11003808if test "$AUDIT_MODULE" = "bsm" ; then
3809 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3810 echo "See the Solaris section in README.platform for details."
3811fi