blob: 2834c580240a3283a12f27e6559b764b2b680f5a [file] [log] [blame]
Tim Riceeb456542005-08-30 07:12:02 -07001# $Id: configure.ac,v 1.291 2005/08/30 14:12:02 tim 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
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
61else
62 # Search for login
63 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
64 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
65 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
66 fi
67fi
68
Darren Tucker23bc8d02004-02-06 16:24:31 +110069AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
70if test ! -z "$PATH_PASSWD_PROG" ; then
71 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
72fi
73
Damien Miller166bd442000-03-16 10:48:25 +110074if test -z "$LD" ; then
75 LD=$CC
76fi
77AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080078
Damien Miller166bd442000-03-16 10:48:25 +110079AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100080
81AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
82
Damien Millera8e06ce2003-11-21 23:48:55 +110083if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100084 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Tim Rice3db1e3f2005-08-23 17:11:26 -070085 GCC_VER=`$CC --version`
86 case $GCC_VER in
87 1.*) ;;
88 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
89 2.*) ;;
90 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
91 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +100092
Darren Tucker67b37032005-06-03 17:58:31 +100093 if test -z "$have_llong_max"; then
94 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
95 unset ac_cv_have_decl_LLONG_MAX
96 saved_CFLAGS="$CFLAGS"
97 CFLAGS="$CFLAGS -std=gnu99"
98 AC_CHECK_DECL(LLONG_MAX,
99 [have_llong_max=1],
100 [CFLAGS="$saved_CFLAGS"],
101 [#include <limits.h>]
102 )
103 fi
Damien Miller166bd442000-03-16 10:48:25 +1100104fi
105
Darren Tucker431f0222005-06-07 17:53:40 +1000106if test -z "$have_llong_max"; then
107 AC_MSG_CHECKING([for max value of long long])
108 AC_RUN_IFELSE(
109 [AC_LANG_SOURCE([[
110#include <stdio.h>
111/* Why is this so damn hard? */
112#ifdef __GNUC__
113# undef __GNUC__
114#endif
115#define __USE_ISOC99
116#include <limits.h>
117#define DATA "conftest.llminmax"
118int main(void) {
119 FILE *f;
120 long long i, llmin, llmax = 0;
121
122 if((f = fopen(DATA,"w")) == NULL)
123 exit(1);
124
125#if defined(LLONG_MIN) && defined(LLONG_MAX)
126 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
127 llmin = LLONG_MIN;
128 llmax = LLONG_MAX;
129#else
130 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
131 /* This will work on one's complement and two's complement */
132 for (i = 1; i > llmax; i <<= 1, i++)
133 llmax = i;
134 llmin = llmax + 1LL; /* wrap */
135#endif
136
137 /* Sanity check */
138 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
139 || llmax - 1 > llmax) {
140 fprintf(f, "unknown unknown\n");
141 exit(2);
142 }
143
144 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
145 exit(3);
146
147 exit(0);
148}
149 ]])],
150 [
151 llong_min=`$AWK '{print $1}' conftest.llminmax`
152 llong_max=`$AWK '{print $2}' conftest.llminmax`
153 AC_MSG_RESULT($llong_max)
154 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
155 [max value of long long calculated by configure])
156 AC_MSG_CHECKING([for min value of long long])
157 AC_MSG_RESULT($llong_min)
158 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
159 [min value of long long calculated by configure])
160 ],
161 [
162 AC_MSG_RESULT(not found)
163 ],
164 [
165 AC_MSG_WARN([cross compiling: not checking])
166 ]
167 )
168fi
169
Tim Rice88368a32003-12-08 12:35:59 -0800170AC_ARG_WITH(rpath,
171 [ --without-rpath Disable auto-added -R linker paths],
172 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800173 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800174 need_dash_r=""
175 fi
176 if test "x$withval" = "xyes" ; then
177 need_dash_r=1
178 fi
179 ]
180)
181
Damien Millera22ba012000-03-02 23:09:20 +1100182# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100183case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100184*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100185 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000186 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800187 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100188 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000189 saved_LDFLAGS="$LDFLAGS"
190 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
191 if (test -z "$blibflags"); then
192 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
193 AC_TRY_LINK([], [], [blibflags=$tryflags])
194 fi
195 done
196 if (test -z "$blibflags"); then
197 AC_MSG_RESULT(not found)
198 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
199 else
200 AC_MSG_RESULT($blibflags)
201 fi
202 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000203 dnl Check for authenticate. Might be in libs.a on older AIXes
204 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700205 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000206 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700207 LIBS="$LIBS -ls"
208 ])
209 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100210 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100211 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100212 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000213 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100214 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000215 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
216 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000217 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000218 [(void)loginfailed("user","host","tty",0);],
219 [AC_MSG_RESULT(yes)
220 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000221 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000222 )],
223 [],
224 [#include <usersec.h>]
225 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000226 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100227 check_for_aix_broken_getaddrinfo=1
Damien Millerf5fea442002-04-23 22:52:45 +1000228 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000229 AC_DEFINE(SETEUID_BREAKS_SETUID)
230 AC_DEFINE(BROKEN_SETREUID)
231 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000232 dnl AIX handles lastlog as part of its login message
233 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000234 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000235 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100236 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100237*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100238 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800239 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100240 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000241 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100242 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100243 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000244 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000245 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700246 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100247 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000248*-*-dgux*)
249 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100250 AC_DEFINE(SETEUID_BREAKS_SETUID)
251 AC_DEFINE(BROKEN_SETREUID)
252 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000253 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000254*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000255 AC_MSG_CHECKING(if we have working getaddrinfo)
256 AC_TRY_RUN([#include <mach-o/dyld.h>
257main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
258 exit(0);
259 else
260 exit(1);
261}], [AC_MSG_RESULT(working)],
262 [AC_MSG_RESULT(buggy)
263 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700264 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000265 AC_DEFINE(SETEUID_BREAKS_SETUID)
266 AC_DEFINE(BROKEN_SETREUID)
267 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100268 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000269 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000270*-*-hpux*)
271 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000272 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100273 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000274 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000275 AC_DEFINE(LOGIN_NO_ENDOPT)
276 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000277 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000278 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700279 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000280 AC_CHECK_LIB(xnet, t_error, ,
281 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
282
283 # next, we define all of the options specific to major releases
284 case "$host" in
285 *-*-hpux10*)
286 if test -z "$GCC"; then
287 CFLAGS="$CFLAGS -Ae"
288 fi
289 ;;
290 *-*-hpux11*)
291 AC_DEFINE(PAM_SUN_CODEBASE)
292 AC_DEFINE(DISABLE_UTMP)
293 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
294 check_for_hpux_broken_getaddrinfo=1
295 check_for_conflicting_getspnam=1
296 ;;
297 esac
298
299 # lastly, we define options specific to minor releases
300 case "$host" in
301 *-*-hpux10.26)
302 AC_DEFINE(HAVE_SECUREWARE)
303 disable_ptmx_check=yes
304 LIBS="$LIBS -lsecpw"
305 ;;
306 esac
Damien Miller1bead332000-04-30 00:47:29 +1000307 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100308*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100309 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000310 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000311 AC_DEFINE(SETEUID_BREAKS_SETUID)
312 AC_DEFINE(BROKEN_SETREUID)
313 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000314 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000315 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100316 ;;
317*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100318 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000319 AC_DEFINE(WITH_IRIX_ARRAY)
320 AC_DEFINE(WITH_IRIX_PROJECT)
321 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000322 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000323 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000324 AC_DEFINE(SETEUID_BREAKS_SETUID)
325 AC_DEFINE(BROKEN_SETREUID)
326 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000327 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000328 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000329 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100330 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100331*-*-linux*)
332 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100333 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000334 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100335 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000336 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000337 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000338 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000339 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Darren Tucker2fba9932005-02-02 23:30:24 +1100340 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
341 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
Damien Miller7bcb0892000-03-11 20:45:40 +1100342 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000343 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000344 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000345 AC_DEFINE(BROKEN_CMSG_TYPE)
346 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000347 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100348 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000349mips-sony-bsd|mips-sony-newsos4)
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000350 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000351 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000352 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100353*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000354 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800355 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800356 need_dash_r=1
357 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100358 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100359*-*-freebsd*)
360 check_for_libcrypt_later=1
361 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000362*-*-bsdi*)
363 AC_DEFINE(SETEUID_BREAKS_SETUID)
364 AC_DEFINE(BROKEN_SETREUID)
365 AC_DEFINE(BROKEN_SETREGID)
366 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000367*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000368 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100369 conf_utmp_location=/etc/utmp
370 conf_wtmp_location=/usr/adm/wtmp
371 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000372 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000373 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000374 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100375 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000376 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000377*-*-openbsd*)
378 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
379 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100380*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800381 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800382 need_dash_r=1
383 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100384 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000385 AC_DEFINE(LOGIN_NEEDS_UTMPX)
386 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000387 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker21dd0892004-08-16 23:12:05 +1000388 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000389 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000390 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
391 AC_DEFINE(SSHD_ACQUIRES_CTTY)
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)
400 AC_DEFINE(DISABLE_WTMP)
401 else
402 AC_MSG_RESULT(no)
403 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100404 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000405*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000406 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000407 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100408 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000409 conf_utmp_location=/etc/utmp
410 conf_wtmp_location=/var/adm/wtmp
411 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000412 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000413 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000414*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700415 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000416 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000417 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000418 AC_DEFINE(SETEUID_BREAKS_SETUID)
419 AC_DEFINE(BROKEN_SETREUID)
420 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000421 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000422*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700423 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000424 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100425 # -lresolv needs to be at then end of LIBS or DNS lookups break
426 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100427 IPADDR_IN_DISPLAY=yes
428 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000429 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000430 AC_DEFINE(SETEUID_BREAKS_SETUID)
431 AC_DEFINE(BROKEN_SETREUID)
432 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000433 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000434 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700435 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
436 # Attention: always take care to bind libsocket and libnsl before libc,
437 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000438 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800439# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100440*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100441 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700442 AC_DEFINE(SETEUID_BREAKS_SETUID)
443 AC_DEFINE(BROKEN_SETREUID)
444 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700445 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100446 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800447# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100448*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700449 check_for_libcrypt_later=1
450 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100451 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700452 AC_DEFINE(SETEUID_BREAKS_SETUID)
453 AC_DEFINE(BROKEN_SETREUID)
454 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700455 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice4dbacff2005-06-01 20:09:28 -0700456 case "$host" in
457 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
458 TEST_SHELL=/u95/bin/sh
459 ;;
460 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100461 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100462*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100463 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800464# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100465*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800466 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100467 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800468# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100469*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800470 if test -z "$GCC"; then
471 CFLAGS="$CFLAGS -belf"
472 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100473 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000474 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100475 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000476 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000477 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700478 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700479 AC_DEFINE(SETEUID_BREAKS_SETUID)
480 AC_DEFINE(BROKEN_SETREUID)
481 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700482 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700483 AC_DEFINE(BROKEN_UPDWTMPX)
Darren Tucker33370e02005-02-09 22:17:28 +1100484 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller217f5672001-02-16 12:12:41 +1100485 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700486 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700487 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000488 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000489*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100490 AC_DEFINE(NO_SSH_LASTLOG)
491 AC_DEFINE(SETEUID_BREAKS_SETUID)
492 AC_DEFINE(BROKEN_SETREUID)
493 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000494 AC_DEFINE(USE_PIPES)
495 AC_DEFINE(DISABLE_FD_PASSING)
496 LDFLAGS="$LDFLAGS"
497 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
498 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000499 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000500*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100501 AC_DEFINE(SETEUID_BREAKS_SETUID)
502 AC_DEFINE(BROKEN_SETREUID)
503 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000504 AC_DEFINE(WITH_ABBREV_NO_TTY)
505 AC_DEFINE(USE_PIPES)
506 AC_DEFINE(DISABLE_FD_PASSING)
507 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100508 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000509 MANTYPE=cat
510 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000511*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100512 AC_DEFINE(SETEUID_BREAKS_SETUID)
513 AC_DEFINE(BROKEN_SETREUID)
514 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000515 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700516 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700517 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000518 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
519 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
520 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700521 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000522*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000523 AC_MSG_CHECKING(for Digital Unix SIA)
524 no_osfsia=""
525 AC_ARG_WITH(osfsia,
526 [ --with-osfsia Enable Digital Unix SIA],
527 [
528 if test "x$withval" = "xno" ; then
529 AC_MSG_RESULT(disabled)
530 no_osfsia=1
531 fi
532 ],
533 )
534 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000535 if test -f /etc/sia/matrix.conf; then
536 AC_MSG_RESULT(yes)
537 AC_DEFINE(HAVE_OSF_SIA)
538 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000539 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000540 LIBS="$LIBS -lsecurity -ldb -lm -laud"
541 else
542 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100543 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000544 fi
545 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000546 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700547 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000548 AC_DEFINE(BROKEN_SETREUID)
549 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000550 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000551
552*-*-nto-qnx)
553 AC_DEFINE(USE_PIPES)
554 AC_DEFINE(NO_X11_UNIX_SOCKETS)
555 AC_DEFINE(MISSING_NFDBITS)
556 AC_DEFINE(MISSING_HOWMANY)
557 AC_DEFINE(MISSING_FD_MASK)
558 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000559
560*-*-ultrix*)
561 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
562 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
563 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700564 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
565 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000566
567*-*-lynxos)
568 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
569 AC_DEFINE(MISSING_HOWMANY)
570 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
571 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100572esac
573
Damien Millere37bfc12000-06-05 09:37:43 +1000574# Allow user to specify flags
575AC_ARG_WITH(cflags,
576 [ --with-cflags Specify additional flags to pass to compiler],
577 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800578 if test -n "$withval" && test "x$withval" != "xno" && \
579 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000580 CFLAGS="$CFLAGS $withval"
581 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800582 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000583)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000584AC_ARG_WITH(cppflags,
585 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
586 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800587 if test -n "$withval" && test "x$withval" != "xno" && \
588 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000589 CPPFLAGS="$CPPFLAGS $withval"
590 fi
591 ]
592)
Damien Millere37bfc12000-06-05 09:37:43 +1000593AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000594 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000595 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800596 if test -n "$withval" && test "x$withval" != "xno" && \
597 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000598 LDFLAGS="$LDFLAGS $withval"
599 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800600 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000601)
602AC_ARG_WITH(libs,
603 [ --with-libs Specify additional libraries to link with],
604 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800605 if test -n "$withval" && test "x$withval" != "xno" && \
606 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000607 LIBS="$LIBS $withval"
608 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800609 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000610)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000611AC_ARG_WITH(Werror,
612 [ --with-Werror Build main code with -Werror],
613 [
614 if test -n "$withval" && test "x$withval" != "xno"; then
615 werror_flags="-Werror"
616 if "x${withval}" != "xyes"; then
617 werror_flags="$withval"
618 fi
619 fi
620 ]
621)
Damien Millere37bfc12000-06-05 09:37:43 +1000622
Darren Tucker6eb93042003-06-29 21:30:41 +1000623AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000624AC_RUN_IFELSE(
625 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000626#include <stdio.h>
627int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000628 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000629 [ AC_MSG_RESULT(yes) ],
630 [
631 AC_MSG_RESULT(no)
632 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000633 ],
634 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000635)
636
Darren Tucker0c9653f2005-05-28 15:58:14 +1000637dnl Checks for header files.
638AC_CHECK_HEADERS( \
639 bstring.h \
640 crypt.h \
641 dirent.h \
642 endian.h \
643 features.h \
644 floatingpoint.h \
645 getopt.h \
646 glob.h \
647 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700648 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000649 lastlog.h \
650 limits.h \
651 login.h \
652 login_cap.h \
653 maillock.h \
654 ndir.h \
655 netdb.h \
656 netgroup.h \
657 netinet/in_systm.h \
658 pam/pam_appl.h \
659 paths.h \
660 pty.h \
661 readpassphrase.h \
662 rpc/types.h \
663 security/pam_appl.h \
664 shadow.h \
665 stddef.h \
666 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000667 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000668 strings.h \
669 sys/audit.h \
670 sys/bitypes.h \
671 sys/bsdtty.h \
672 sys/cdefs.h \
673 sys/dir.h \
674 sys/mman.h \
675 sys/ndir.h \
676 sys/prctl.h \
677 sys/pstat.h \
678 sys/select.h \
679 sys/stat.h \
680 sys/stream.h \
681 sys/stropts.h \
682 sys/strtio.h \
683 sys/sysmacros.h \
684 sys/time.h \
685 sys/timers.h \
686 sys/un.h \
687 time.h \
688 tmpdir.h \
689 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000690 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000691 usersec.h \
692 util.h \
693 utime.h \
694 utmp.h \
695 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000696 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000697)
Tim Rice4cec93f2002-02-26 08:40:48 -0800698
Darren Tucker48d99d32004-08-29 17:04:50 +1000699# sys/ptms.h requires sys/stream.h to be included first on Solaris
700AC_CHECK_HEADERS(sys/ptms.h, [], [], [
701#ifdef HAVE_SYS_STREAM_H
702# include <sys/stream.h>
703#endif
704])
705
Damien Millera22ba012000-03-02 23:09:20 +1100706# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700707AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
708AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000709
Tim Rice1e1ef642003-09-11 22:19:31 -0700710dnl IRIX and Solaris 2.5.1 have dirname() in libgen
711AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
712 AC_CHECK_LIB(gen, dirname,[
713 AC_CACHE_CHECK([for broken dirname],
714 ac_cv_have_broken_dirname, [
715 save_LIBS="$LIBS"
716 LIBS="$LIBS -lgen"
717 AC_TRY_RUN(
718 [
719#include <libgen.h>
720#include <string.h>
721
722int main(int argc, char **argv) {
723 char *s, buf[32];
724
725 strncpy(buf,"/etc", 32);
726 s = dirname(buf);
727 if (!s || strncmp(s, "/", 32) != 0) {
728 exit(1);
729 } else {
730 exit(0);
731 }
732}
733 ],
734 [ ac_cv_have_broken_dirname="no" ],
735 [ ac_cv_have_broken_dirname="yes" ]
736 )
737 LIBS="$save_LIBS"
738 ])
739 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
740 LIBS="$LIBS -lgen"
741 AC_DEFINE(HAVE_DIRNAME)
742 AC_CHECK_HEADERS(libgen.h)
743 fi
744 ])
745])
746
747AC_CHECK_FUNC(getspnam, ,
748 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
749AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
750
Tim Rice13aae5e2001-10-21 17:53:58 -0700751dnl zlib is required
752AC_ARG_WITH(zlib,
753 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100754 [ if test "x$withval" = "xno" ; then
755 AC_MSG_ERROR([*** zlib is required ***])
756 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700757 if test -d "$withval/lib"; then
758 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700759 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700760 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700761 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700762 fi
763 else
764 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700765 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700766 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700767 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700768 fi
769 fi
770 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700771 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700772 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700773 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700774 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100775 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700776)
777
Tim Ricefcb62202004-01-23 18:35:16 -0800778AC_CHECK_LIB(z, deflate, ,
779 [
780 saved_CPPFLAGS="$CPPFLAGS"
781 saved_LDFLAGS="$LDFLAGS"
782 save_LIBS="$LIBS"
783 dnl Check default zlib install dir
784 if test -n "${need_dash_r}"; then
785 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
786 else
787 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
788 fi
789 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
790 LIBS="$LIBS -lz"
791 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
792 [
793 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
794 ]
795 )
796 ]
797)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100798AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100799
800AC_ARG_WITH(zlib-version-check,
801 [ --without-zlib-version-check Disable zlib version check],
802 [ if test "x$withval" = "xno" ; then
803 zlib_check_nonfatal=1
804 fi
805 ]
806)
807
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000808AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000809AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000810#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100811#include <zlib.h>
812int main()
813{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000814 int a=0, b=0, c=0, d=0, n, v;
815 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
816 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100817 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000818 v = a*1000000 + b*10000 + c*100 + d;
819 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
820
821 /* 1.1.4 is OK */
822 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100823 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000824
Darren Tucker41097ed2005-07-25 15:24:21 +1000825 /* 1.2.3 and up are OK */
826 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000827 exit(0);
828
Darren Tucker2dcd2392004-01-23 17:13:33 +1100829 exit(2);
830}
Darren Tucker623d92f2004-09-12 22:36:15 +1000831 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000832 AC_MSG_RESULT(no),
833 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100834 if test -z "$zlib_check_nonfatal" ; then
835 AC_MSG_ERROR([*** zlib too old - check config.log ***
836Your reported zlib version has known security problems. It's possible your
837vendor has fixed these problems without changing the version number. If you
838are sure this is the case, you can disable the check by running
839"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000840If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000841See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100842 else
843 AC_MSG_WARN([zlib version may have security problems])
844 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000845 ],
846 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100847)
Damien Miller6f9c3372000-10-25 10:06:04 +1100848
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000849dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100850AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000851 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
852)
Damien Millera8e06ce2003-11-21 23:48:55 +1100853AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700854 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
855 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000856)
Damien Millerab18c411999-11-11 10:40:23 +1100857
Tim Ricee589a292001-11-03 11:09:32 -0800858dnl Checks for libutil functions
859AC_CHECK_HEADERS(libutil.h)
860AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
861AC_CHECK_FUNCS(logout updwtmp logwtmp)
862
Ben Lindstrom8697e082001-02-24 21:41:10 +0000863AC_FUNC_STRFTIME
864
Damien Miller3c027682001-03-14 11:39:45 +1100865# Check for ALTDIRFUNC glob() extension
866AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
867AC_EGREP_CPP(FOUNDIT,
868 [
869 #include <glob.h>
870 #ifdef GLOB_ALTDIRFUNC
871 FOUNDIT
872 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100873 ],
Damien Miller3c027682001-03-14 11:39:45 +1100874 [
875 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
876 AC_MSG_RESULT(yes)
877 ],
878 [
879 AC_MSG_RESULT(no)
880 ]
881)
Damien Millerab18c411999-11-11 10:40:23 +1100882
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000883# Check for g.gl_matchc glob() extension
884AC_MSG_CHECKING(for gl_matchc field in glob_t)
885AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100886 [
887 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000888 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100889 ],
890 [
891 AC_DEFINE(GLOB_HAS_GL_MATCHC)
892 AC_MSG_RESULT(yes)
893 ],
894 [
895 AC_MSG_RESULT(no)
896 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000897)
898
Damien Miller18bb4732001-03-28 14:35:30 +1000899AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000900AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000901 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000902#include <sys/types.h>
903#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700904int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000905 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100906 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000907 [
908 AC_MSG_RESULT(no)
909 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000910 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800911 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000912 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
913 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000914 ]
915)
916
Damien Miller36f49652004-08-15 18:40:59 +1000917AC_MSG_CHECKING([for /proc/pid/fd directory])
918if test -d "/proc/$$/fd" ; then
919 AC_DEFINE(HAVE_PROC_PID)
920 AC_MSG_RESULT(yes)
921else
922 AC_MSG_RESULT(no)
923fi
924
Damien Millerc547bf12001-02-16 10:18:12 +1100925# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100926SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100927AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100928 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100929 [
930 if test "x$withval" != "xno" ; then
931
932 if test "x$withval" != "xyes" ; then
933 CPPFLAGS="$CPPFLAGS -I${withval}/include"
934 LDFLAGS="$LDFLAGS -L${withval}/lib"
935 fi
936
937 AC_DEFINE(SKEY)
938 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100939 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800940
Tim Rice4cec93f2002-02-26 08:40:48 -0800941 AC_MSG_CHECKING([for s/key support])
942 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100943 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800944#include <stdio.h>
945#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700946int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800947 ],
948 [AC_MSG_RESULT(yes)],
949 [
950 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100951 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
952 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000953 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
954 AC_TRY_COMPILE(
955 [#include <stdio.h>
956 #include <skey.h>],
957 [(void)skeychallenge(NULL,"name","",0);],
958 [AC_MSG_RESULT(yes)
959 AC_DEFINE(SKEYCHALLENGE_4ARG)],
960 [AC_MSG_RESULT(no)]
961 )
Damien Millerc547bf12001-02-16 10:18:12 +1100962 fi
963 ]
964)
965
966# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700967TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100968AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100969 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100970 [
971 if test "x$withval" != "xno" ; then
972 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700973 saved_LDFLAGS="$LDFLAGS"
974 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800975 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800976 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700977 if test -d "${withval}/lib"; then
978 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700979 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700980 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700981 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700982 fi
983 else
984 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700985 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700986 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700987 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700988 fi
989 fi
990 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700991 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700992 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700993 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700994 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700995 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800996 LIBWRAP="-lwrap"
997 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100998 AC_MSG_CHECKING(for libwrap)
999 AC_TRY_LINK(
1000 [
Damien Miller0ac45002004-04-14 20:14:26 +10001001#include <sys/types.h>
1002#include <sys/socket.h>
1003#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001004#include <tcpd.h>
1005 int deny_severity = 0, allow_severity = 0;
1006 ],
1007 [hosts_access(0);],
1008 [
1009 AC_MSG_RESULT(yes)
1010 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -08001011 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001012 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001013 ],
1014 [
1015 AC_MSG_ERROR([*** libwrap missing])
1016 ]
1017 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001018 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001019 fi
1020 ]
1021)
1022
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001023# Check whether user wants libedit support
1024LIBEDIT_MSG="no"
1025AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001026 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001027 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001028 if test "x$withval" != "xyes"; then
1029 CPPFLAGS="$CPPFLAGS -I$withval/include"
1030 LDFLAGS="$LDFLAGS -L$withval/lib"
1031 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001032 AC_CHECK_LIB(edit, el_init,
1033 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
1034 LIBEDIT="-ledit -lcurses"
1035 LIBEDIT_MSG="yes"
1036 AC_SUBST(LIBEDIT)
1037 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001038 [ AC_MSG_ERROR(libedit not found) ],
1039 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001040 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001041 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001042 AC_COMPILE_IFELSE(
1043 [AC_LANG_SOURCE([[
1044#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001045int main(void)
1046{
1047 int i = H_SETSIZE;
1048 el_init("", NULL, NULL, NULL);
1049 exit(0);
1050}
Tim Ricec1819c82005-08-15 17:48:40 -07001051 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001052 [ AC_MSG_RESULT(yes) ],
1053 [ AC_MSG_RESULT(no)
1054 AC_MSG_ERROR(libedit version is not compatible) ]
1055 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001056 fi ]
1057)
1058
Darren Tuckerd9f88912005-02-20 21:01:48 +11001059AUDIT_MODULE=none
1060AC_ARG_WITH(audit,
1061 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1062 [
1063 AC_MSG_CHECKING(for supported audit module)
1064 case "$withval" in
1065 bsm)
1066 AC_MSG_RESULT(bsm)
1067 AUDIT_MODULE=bsm
1068 dnl Checks for headers, libs and functions
1069 AC_CHECK_HEADERS(bsm/audit.h, [],
1070 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1071 AC_CHECK_LIB(bsm, getaudit, [],
1072 [AC_MSG_ERROR(BSM enabled and required library not found)])
1073 AC_CHECK_FUNCS(getaudit, [],
1074 [AC_MSG_ERROR(BSM enabled and required function not found)])
1075 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001076 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001077 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
1078 ;;
1079 debug)
1080 AUDIT_MODULE=debug
1081 AC_MSG_RESULT(debug)
1082 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
1083 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001084 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001085 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001086 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001087 *)
1088 AC_MSG_ERROR([Unknown audit module $withval])
1089 ;;
1090 esac ]
1091)
1092
Damien Millerfe1f1432003-02-24 15:45:42 +11001093dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001094AC_CHECK_FUNCS( \
1095 arc4random \
1096 b64_ntop \
1097 __b64_ntop \
1098 b64_pton \
1099 __b64_pton \
1100 bcopy \
1101 bindresvport_sa \
1102 clock \
1103 closefrom \
1104 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001105 fchmod \
1106 fchown \
1107 freeaddrinfo \
1108 futimes \
1109 getaddrinfo \
1110 getcwd \
1111 getgrouplist \
1112 getnameinfo \
1113 getopt \
1114 getpeereid \
1115 _getpty \
1116 getrlimit \
1117 getttyent \
1118 glob \
1119 inet_aton \
1120 inet_ntoa \
1121 inet_ntop \
1122 innetgr \
1123 login_getcapbool \
1124 md5_crypt \
1125 memmove \
1126 mkdtemp \
1127 mmap \
1128 ngetaddrinfo \
1129 nsleep \
1130 ogetaddrinfo \
1131 openlog_r \
1132 openpty \
1133 prctl \
1134 pstat \
1135 readpassphrase \
1136 realpath \
1137 recvmsg \
1138 rresvport_af \
1139 sendmsg \
1140 setdtablesize \
1141 setegid \
1142 setenv \
1143 seteuid \
1144 setgroups \
1145 setlogin \
1146 setpcred \
1147 setproctitle \
1148 setregid \
1149 setreuid \
1150 setrlimit \
1151 setsid \
1152 setvbuf \
1153 sigaction \
1154 sigvec \
1155 snprintf \
1156 socketpair \
1157 strdup \
1158 strerror \
1159 strlcat \
1160 strlcpy \
1161 strmode \
1162 strnvis \
1163 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001164 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001165 strtoul \
1166 sysconf \
1167 tcgetpgrp \
1168 truncate \
1169 unsetenv \
1170 updwtmpx \
1171 utimes \
1172 vhangup \
1173 vsnprintf \
1174 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001175)
Tim Rice13aae5e2001-10-21 17:53:58 -07001176
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001177# IRIX has a const char return value for gai_strerror()
1178AC_CHECK_FUNCS(gai_strerror,[
1179 AC_DEFINE(HAVE_GAI_STRERROR)
1180 AC_TRY_COMPILE([
1181#include <sys/types.h>
1182#include <sys/socket.h>
1183#include <netdb.h>
1184
1185const char *gai_strerror(int);],[
1186char *str;
1187
1188str = gai_strerror(0);],[
1189 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1190 [Define if gai_strerror() returns const char *])])])
1191
Damien Millercd6853c2003-01-28 11:33:42 +11001192AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1193
Darren Tuckerf1159b52003-07-07 19:44:01 +10001194dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001195AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001196AC_CHECK_DECL(strsep,
1197 [AC_CHECK_FUNCS(strsep)],
1198 [],
1199 [
1200#ifdef HAVE_STRING_H
1201# include <string.h>
1202#endif
1203 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001204
Darren Tuckerb2427c82003-09-10 15:22:44 +10001205dnl tcsendbreak might be a macro
1206AC_CHECK_DECL(tcsendbreak,
1207 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001208 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001209 [#include <termios.h>]
1210)
1211
Darren Tucker5bb14002004-04-23 18:53:10 +10001212AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1213
Darren Tucker2a6b0292003-12-31 14:59:17 +11001214AC_CHECK_FUNCS(setresuid, [
1215 dnl Some platorms have setresuid that isn't implemented, test for this
1216 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001217 AC_RUN_IFELSE(
1218 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001219#include <stdlib.h>
1220#include <errno.h>
1221int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001222 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001223 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +11001224 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001225 AC_MSG_RESULT(not implemented)],
1226 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001227 )
1228])
Darren Tuckere937be32003-12-17 18:53:26 +11001229
Darren Tucker2a6b0292003-12-31 14:59:17 +11001230AC_CHECK_FUNCS(setresgid, [
1231 dnl Some platorms have setresgid that isn't implemented, test for this
1232 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001233 AC_RUN_IFELSE(
1234 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001235#include <stdlib.h>
1236#include <errno.h>
1237int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001238 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001239 [AC_MSG_RESULT(yes)],
1240 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001241 AC_MSG_RESULT(not implemented)],
1242 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001243 )
1244])
Darren Tuckere937be32003-12-17 18:53:26 +11001245
Damien Millerad833b32000-08-23 10:46:23 +10001246dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001247AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001248dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001249AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001250AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001251dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001252AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001253AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001254
Damien Millera8e06ce2003-11-21 23:48:55 +11001255AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001256 [AC_DEFINE(HAVE_DAEMON)],
1257 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1258)
1259
Damien Millera8e06ce2003-11-21 23:48:55 +11001260AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001261 [AC_DEFINE(HAVE_GETPAGESIZE)],
1262 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1263)
1264
Damien Millercb170cb2000-07-01 16:52:55 +10001265# Check for broken snprintf
1266if test "x$ac_cv_func_snprintf" = "xyes" ; then
1267 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001268 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001269 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001270#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001271int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001272 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001273 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001274 [
1275 AC_MSG_RESULT(no)
1276 AC_DEFINE(BROKEN_SNPRINTF)
1277 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001278 ],
1279 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001280 )
1281fi
1282
Damien Millerb4097182004-05-23 14:09:40 +10001283# Check for missing getpeereid (or equiv) support
1284NO_PEERCHECK=""
1285if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1286 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1287 AC_TRY_COMPILE(
1288 [#include <sys/types.h>
1289 #include <sys/socket.h>],
1290 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001291 [ AC_MSG_RESULT(yes)
1292 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1293 ],
Damien Millerb4097182004-05-23 14:09:40 +10001294 [AC_MSG_RESULT(no)
1295 NO_PEERCHECK=1]
1296 )
1297fi
1298
Damien Millere8328192003-01-07 15:18:32 +11001299dnl see whether mkstemp() requires XXXXXX
1300if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1301AC_MSG_CHECKING([for (overly) strict mkstemp])
1302AC_TRY_RUN(
1303 [
1304#include <stdlib.h>
1305main() { char template[]="conftest.mkstemp-test";
1306if (mkstemp(template) == -1)
1307 exit(1);
1308unlink(template); exit(0);
1309}
1310 ],
1311 [
1312 AC_MSG_RESULT(no)
1313 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001314 [
Damien Millere8328192003-01-07 15:18:32 +11001315 AC_MSG_RESULT(yes)
1316 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1317 ],
1318 [
1319 AC_MSG_RESULT(yes)
1320 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001321 ]
Damien Millere8328192003-01-07 15:18:32 +11001322)
1323fi
1324
Darren Tucker70a3d552003-08-21 17:58:29 +10001325dnl make sure that openpty does not reacquire controlling terminal
1326if test ! -z "$check_for_openpty_ctty_bug"; then
1327 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1328 AC_TRY_RUN(
1329 [
1330#include <stdio.h>
1331#include <sys/fcntl.h>
1332#include <sys/types.h>
1333#include <sys/wait.h>
1334
1335int
1336main()
1337{
1338 pid_t pid;
1339 int fd, ptyfd, ttyfd, status;
1340
1341 pid = fork();
1342 if (pid < 0) { /* failed */
1343 exit(1);
1344 } else if (pid > 0) { /* parent */
1345 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001346 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001347 exit(WEXITSTATUS(status));
1348 else
1349 exit(2);
1350 } else { /* child */
1351 close(0); close(1); close(2);
1352 setsid();
1353 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1354 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1355 if (fd >= 0)
1356 exit(3); /* Acquired ctty: broken */
1357 else
1358 exit(0); /* Did not acquire ctty: OK */
1359 }
1360}
1361 ],
1362 [
1363 AC_MSG_RESULT(yes)
1364 ],
1365 [
1366 AC_MSG_RESULT(no)
1367 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1368 ]
1369 )
1370fi
1371
Tim Rice8bb561b2005-03-17 16:23:19 -08001372if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1373 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001374 AC_MSG_CHECKING(if getaddrinfo seems to work)
1375 AC_TRY_RUN(
1376 [
1377#include <stdio.h>
1378#include <sys/socket.h>
1379#include <netdb.h>
1380#include <errno.h>
1381#include <netinet/in.h>
1382
1383#define TEST_PORT "2222"
1384
1385int
1386main(void)
1387{
1388 int err, sock;
1389 struct addrinfo *gai_ai, *ai, hints;
1390 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1391
1392 memset(&hints, 0, sizeof(hints));
1393 hints.ai_family = PF_UNSPEC;
1394 hints.ai_socktype = SOCK_STREAM;
1395 hints.ai_flags = AI_PASSIVE;
1396
1397 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1398 if (err != 0) {
1399 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1400 exit(1);
1401 }
1402
1403 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1404 if (ai->ai_family != AF_INET6)
1405 continue;
1406
1407 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1408 sizeof(ntop), strport, sizeof(strport),
1409 NI_NUMERICHOST|NI_NUMERICSERV);
1410
1411 if (err != 0) {
1412 if (err == EAI_SYSTEM)
1413 perror("getnameinfo EAI_SYSTEM");
1414 else
1415 fprintf(stderr, "getnameinfo failed: %s\n",
1416 gai_strerror(err));
1417 exit(2);
1418 }
1419
1420 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1421 if (sock < 0)
1422 perror("socket");
1423 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1424 if (errno == EBADF)
1425 exit(3);
1426 }
1427 }
1428 exit(0);
1429}
1430 ],
1431 [
1432 AC_MSG_RESULT(yes)
1433 ],
1434 [
1435 AC_MSG_RESULT(no)
1436 AC_DEFINE(BROKEN_GETADDRINFO)
1437 ]
1438 )
1439fi
1440
Tim Rice8bb561b2005-03-17 16:23:19 -08001441if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1442 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001443 AC_MSG_CHECKING(if getaddrinfo seems to work)
1444 AC_TRY_RUN(
1445 [
1446#include <stdio.h>
1447#include <sys/socket.h>
1448#include <netdb.h>
1449#include <errno.h>
1450#include <netinet/in.h>
1451
1452#define TEST_PORT "2222"
1453
1454int
1455main(void)
1456{
1457 int err, sock;
1458 struct addrinfo *gai_ai, *ai, hints;
1459 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1460
1461 memset(&hints, 0, sizeof(hints));
1462 hints.ai_family = PF_UNSPEC;
1463 hints.ai_socktype = SOCK_STREAM;
1464 hints.ai_flags = AI_PASSIVE;
1465
1466 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1467 if (err != 0) {
1468 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1469 exit(1);
1470 }
1471
1472 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1473 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1474 continue;
1475
1476 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1477 sizeof(ntop), strport, sizeof(strport),
1478 NI_NUMERICHOST|NI_NUMERICSERV);
1479
1480 if (ai->ai_family == AF_INET && err != 0) {
1481 perror("getnameinfo");
1482 exit(2);
1483 }
1484 }
1485 exit(0);
1486}
1487 ],
1488 [
1489 AC_MSG_RESULT(yes)
1490 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1491[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1492 ],
1493 [
1494 AC_MSG_RESULT(no)
1495 AC_DEFINE(BROKEN_GETADDRINFO)
1496 ]
1497 )
1498fi
1499
Darren Tuckera56f1912004-11-02 20:30:54 +11001500if test "x$check_for_conflicting_getspnam" = "x1"; then
1501 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1502 AC_COMPILE_IFELSE(
1503 [
1504#include <shadow.h>
1505int main(void) {exit(0);}
1506 ],
1507 [
1508 AC_MSG_RESULT(no)
1509 ],
1510 [
1511 AC_MSG_RESULT(yes)
1512 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1513 [Conflicting defs for getspnam])
1514 ]
1515 )
1516fi
1517
Damien Miller606f8802000-09-16 15:39:56 +11001518AC_FUNC_GETPGRP
1519
Damien Millera64b57a2001-01-17 10:44:13 +11001520# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001521PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001522AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001523 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001524 [
Damien Millera64b57a2001-01-17 10:44:13 +11001525 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001526 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1527 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001528 AC_MSG_ERROR([PAM headers not found])
1529 fi
1530
1531 AC_CHECK_LIB(dl, dlopen, , )
1532 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1533 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001534 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001535
Damien Millera64b57a2001-01-17 10:44:13 +11001536 PAM_MSG="yes"
1537
1538 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001539 if test $ac_cv_lib_dl_dlopen = yes; then
1540 LIBPAM="-lpam -ldl"
1541 else
1542 LIBPAM="-lpam"
1543 fi
1544 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001545 fi
1546 ]
1547)
Damien Millera22ba012000-03-02 23:09:20 +11001548
Damien Millera64b57a2001-01-17 10:44:13 +11001549# Check for older PAM
1550if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001551 # Check PAM strerror arguments (old PAM)
1552 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1553 AC_TRY_COMPILE(
1554 [
Damien Miller81171112000-04-23 11:14:01 +10001555#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001556#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001557#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001558#elif defined (HAVE_PAM_PAM_APPL_H)
1559#include <pam/pam_appl.h>
1560#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001561 ],
1562 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001563 [AC_MSG_RESULT(no)],
1564 [
1565 AC_DEFINE(HAVE_OLD_PAM)
1566 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001567 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001568 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001569 )
Damien Millera22ba012000-03-02 23:09:20 +11001570fi
1571
Tim Riceaef73712002-05-11 13:17:42 -07001572# Search for OpenSSL
1573saved_CPPFLAGS="$CPPFLAGS"
1574saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001575AC_ARG_WITH(ssl-dir,
1576 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1577 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001578 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001579 case "$withval" in
1580 # Relative paths
1581 ./*|../*) withval="`pwd`/$withval"
1582 esac
Tim Riceaef73712002-05-11 13:17:42 -07001583 if test -d "$withval/lib"; then
1584 if test -n "${need_dash_r}"; then
1585 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1586 else
1587 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1588 fi
1589 else
1590 if test -n "${need_dash_r}"; then
1591 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1592 else
1593 LDFLAGS="-L${withval} ${LDFLAGS}"
1594 fi
1595 fi
1596 if test -d "$withval/include"; then
1597 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1598 else
1599 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1600 fi
Damien Millera22ba012000-03-02 23:09:20 +11001601 fi
1602 ]
1603)
Tim Rice3d5352e2004-02-12 09:27:21 -08001604LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001605AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001606 [
Tim Riceaef73712002-05-11 13:17:42 -07001607 dnl Check default openssl install dir
1608 if test -n "${need_dash_r}"; then
1609 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001610 else
Tim Riceaef73712002-05-11 13:17:42 -07001611 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001612 fi
Tim Riceaef73712002-05-11 13:17:42 -07001613 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1614 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1615 [
1616 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1617 ]
1618 )
1619 ]
1620)
1621
Tim Riced730b782002-08-13 18:52:10 -07001622# Determine OpenSSL header version
1623AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001624AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001625 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001626#include <stdio.h>
1627#include <string.h>
1628#include <openssl/opensslv.h>
1629#define DATA "conftest.sslincver"
1630int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001631 FILE *fd;
1632 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001633
Damien Millera8e06ce2003-11-21 23:48:55 +11001634 fd = fopen(DATA,"w");
1635 if(fd == NULL)
1636 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001637
1638 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1639 exit(1);
1640
1641 exit(0);
1642}
Darren Tucker623d92f2004-09-12 22:36:15 +10001643 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001644 [
1645 ssl_header_ver=`cat conftest.sslincver`
1646 AC_MSG_RESULT($ssl_header_ver)
1647 ],
1648 [
1649 AC_MSG_RESULT(not found)
1650 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001651 ],
1652 [
1653 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001654 ]
1655)
1656
1657# Determine OpenSSL library version
1658AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001659AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001660 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001661#include <stdio.h>
1662#include <string.h>
1663#include <openssl/opensslv.h>
1664#include <openssl/crypto.h>
1665#define DATA "conftest.ssllibver"
1666int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001667 FILE *fd;
1668 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001669
Damien Millera8e06ce2003-11-21 23:48:55 +11001670 fd = fopen(DATA,"w");
1671 if(fd == NULL)
1672 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001673
1674 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1675 exit(1);
1676
1677 exit(0);
1678}
Darren Tucker623d92f2004-09-12 22:36:15 +10001679 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001680 [
1681 ssl_library_ver=`cat conftest.ssllibver`
1682 AC_MSG_RESULT($ssl_library_ver)
1683 ],
1684 [
1685 AC_MSG_RESULT(not found)
1686 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001687 ],
1688 [
1689 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001690 ]
1691)
Damien Millera22ba012000-03-02 23:09:20 +11001692
Damien Millerec932372002-01-22 22:16:03 +11001693# Sanity check OpenSSL headers
1694AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001695AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001696 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001697#include <string.h>
1698#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001699int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001700 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001701 [
1702 AC_MSG_RESULT(yes)
1703 ],
1704 [
1705 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001706 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1707Check config.log for details.
1708Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001709 ],
1710 [
1711 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001712 ]
1713)
1714
Tim Rice3d5352e2004-02-12 09:27:21 -08001715# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1716# because the system crypt() is more featureful.
1717if test "x$check_for_libcrypt_before" = "x1"; then
1718 AC_CHECK_LIB(crypt, crypt)
1719fi
1720
Damien Millera8e06ce2003-11-21 23:48:55 +11001721# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001722# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001723if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001724 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001725fi
1726
Tim Rice2291c002005-08-26 13:15:19 -07001727AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001728
1729### Configure cryptographic random number support
1730
1731# Check wheter OpenSSL seeds itself
1732AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001733AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001734 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001735#include <string.h>
1736#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001737int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001738 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001739 [
1740 OPENSSL_SEEDS_ITSELF=yes
1741 AC_MSG_RESULT(yes)
1742 ],
1743 [
1744 AC_MSG_RESULT(no)
1745 # Default to use of the rand helper if OpenSSL doesn't
1746 # seed itself
1747 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001748 ],
1749 [
1750 AC_MSG_WARN([cross compiling: assuming yes])
1751 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001752 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001753 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001754 ]
1755)
1756
1757
1758# Do we want to force the use of the rand helper?
1759AC_ARG_WITH(rand-helper,
1760 [ --with-rand-helper Use subprocess to gather strong randomness ],
1761 [
1762 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001763 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001764 # the previous test showed it to be unseeded.
1765 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1766 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1767 OPENSSL_SEEDS_ITSELF=yes
1768 USE_RAND_HELPER=""
1769 fi
1770 else
1771 USE_RAND_HELPER=yes
1772 fi
1773 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001774)
Damien Miller6c21c512002-01-22 21:57:53 +11001775
1776# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001777if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001778 # OpenSSL only
1779 AC_DEFINE(OPENSSL_PRNG_ONLY)
1780 RAND_MSG="OpenSSL internal ONLY"
1781 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001782elif test ! -z "$USE_RAND_HELPER" ; then
1783 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001784 RAND_MSG="ssh-rand-helper"
1785 INSTALL_SSH_RAND_HELPER="yes"
1786fi
1787AC_SUBST(INSTALL_SSH_RAND_HELPER)
1788
1789### Configuration of ssh-rand-helper
1790
1791# PRNGD TCP socket
1792AC_ARG_WITH(prngd-port,
1793 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1794 [
Damien Millere996d722002-01-23 11:20:59 +11001795 case "$withval" in
1796 no)
1797 withval=""
1798 ;;
1799 [[0-9]]*)
1800 ;;
1801 *)
1802 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1803 ;;
1804 esac
1805 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001806 PRNGD_PORT="$withval"
1807 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1808 fi
1809 ]
1810)
1811
1812# PRNGD Unix domain socket
1813AC_ARG_WITH(prngd-socket,
1814 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1815 [
Damien Millere996d722002-01-23 11:20:59 +11001816 case "$withval" in
1817 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001818 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001819 ;;
1820 no)
1821 withval=""
1822 ;;
1823 /*)
1824 ;;
1825 *)
1826 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1827 ;;
1828 esac
1829
1830 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001831 if test ! -z "$PRNGD_PORT" ; then
1832 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1833 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001834 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001835 AC_MSG_WARN(Entropy socket is not readable)
1836 fi
1837 PRNGD_SOCKET="$withval"
1838 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1839 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001840 ],
1841 [
1842 # Check for existing socket only if we don't have a random device already
1843 if test "$USE_RAND_HELPER" = yes ; then
1844 AC_MSG_CHECKING(for PRNGD/EGD socket)
1845 # Insert other locations here
1846 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1847 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1848 PRNGD_SOCKET="$sock"
1849 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1850 break;
1851 fi
1852 done
1853 if test ! -z "$PRNGD_SOCKET" ; then
1854 AC_MSG_RESULT($PRNGD_SOCKET)
1855 else
1856 AC_MSG_RESULT(not found)
1857 fi
1858 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001859 ]
1860)
1861
1862# Change default command timeout for hashing entropy source
1863entropy_timeout=200
1864AC_ARG_WITH(entropy-timeout,
1865 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1866 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001867 if test -n "$withval" && test "x$withval" != "xno" && \
1868 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001869 entropy_timeout=$withval
1870 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001871 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001872)
Damien Miller6c21c512002-01-22 21:57:53 +11001873AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1874
Damien Millerd3f6ad22002-06-25 10:24:47 +10001875SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001876AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001877 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001878 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001879 if test -n "$withval" && test "x$withval" != "xno" && \
1880 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001881 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001882 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001883 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001884)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001885AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1886AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001887
Tim Rice88f2ab52002-03-17 12:17:34 -08001888# We do this little dance with the search path to insure
1889# that programs that we select for use by installed programs
1890# (which may be run by the super-user) come from trusted
1891# locations before they come from the user's private area.
1892# This should help avoid accidentally configuring some
1893# random version of a program in someone's personal bin.
1894
1895OPATH=$PATH
1896PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001897test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001898test -d /sbin && PATH=$PATH:/sbin
1899test -d /usr/sbin && PATH=$PATH:/usr/sbin
1900PATH=$PATH:/etc:$OPATH
1901
Damien Millera8e06ce2003-11-21 23:48:55 +11001902# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001903OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1904OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1905OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1906OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1907OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1908OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1909OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1910OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1911OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1912OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1913OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1914OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1915OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1916OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1917OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1918OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001919# restore PATH
1920PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001921
1922# Where does ssh-rand-helper get its randomness from?
1923INSTALL_SSH_PRNG_CMDS=""
1924if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1925 if test ! -z "$PRNGD_PORT" ; then
1926 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1927 elif test ! -z "$PRNGD_SOCKET" ; then
1928 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1929 else
1930 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1931 RAND_HELPER_CMDHASH=yes
1932 INSTALL_SSH_PRNG_CMDS="yes"
1933 fi
1934fi
1935AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1936
1937
Ben Lindstromb5628642000-10-18 00:02:25 +00001938# Cheap hack to ensure NEWS-OS libraries are arranged right.
1939if test ! -z "$SONY" ; then
1940 LIBS="$LIBS -liberty";
1941fi
1942
Damien Millera22ba012000-03-02 23:09:20 +11001943# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001944AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001945AC_CHECK_SIZEOF(short int, 2)
1946AC_CHECK_SIZEOF(int, 4)
1947AC_CHECK_SIZEOF(long int, 4)
1948AC_CHECK_SIZEOF(long long int, 8)
1949
Damien Millerfa2bb692002-04-23 23:22:25 +10001950# Sanity check long long for some platforms (AIX)
1951if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1952 ac_cv_sizeof_long_long_int=0
1953fi
1954
Damien Millera22ba012000-03-02 23:09:20 +11001955# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001956AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1957 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001958 [ #include <sys/types.h> ],
1959 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001960 [ ac_cv_have_u_int="yes" ],
1961 [ ac_cv_have_u_int="no" ]
1962 )
1963])
1964if test "x$ac_cv_have_u_int" = "xyes" ; then
1965 AC_DEFINE(HAVE_U_INT)
1966 have_u_int=1
1967fi
1968
Damien Miller61e50f12000-05-08 20:49:37 +10001969AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1970 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001971 [ #include <sys/types.h> ],
1972 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001973 [ ac_cv_have_intxx_t="yes" ],
1974 [ ac_cv_have_intxx_t="no" ]
1975 )
1976])
1977if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1978 AC_DEFINE(HAVE_INTXX_T)
1979 have_intxx_t=1
1980fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001981
1982if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001983 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001984then
1985 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1986 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001987 [ #include <stdint.h> ],
1988 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001989 [
1990 AC_DEFINE(HAVE_INTXX_T)
1991 AC_MSG_RESULT(yes)
1992 ],
1993 [ AC_MSG_RESULT(no) ]
1994 )
1995fi
1996
Damien Miller578783e2000-09-23 14:12:24 +11001997AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1998 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001999 [
2000#include <sys/types.h>
2001#ifdef HAVE_STDINT_H
2002# include <stdint.h>
2003#endif
2004#include <sys/socket.h>
2005#ifdef HAVE_SYS_BITYPES_H
2006# include <sys/bitypes.h>
2007#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002008 ],
2009 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002010 [ ac_cv_have_int64_t="yes" ],
2011 [ ac_cv_have_int64_t="no" ]
2012 )
2013])
2014if test "x$ac_cv_have_int64_t" = "xyes" ; then
2015 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08002016fi
2017
Damien Miller61e50f12000-05-08 20:49:37 +10002018AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2019 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002020 [ #include <sys/types.h> ],
2021 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002022 [ ac_cv_have_u_intxx_t="yes" ],
2023 [ ac_cv_have_u_intxx_t="no" ]
2024 )
2025])
2026if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2027 AC_DEFINE(HAVE_U_INTXX_T)
2028 have_u_intxx_t=1
2029fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002030
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002031if test -z "$have_u_intxx_t" ; then
2032 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2033 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002034 [ #include <sys/socket.h> ],
2035 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002036 [
2037 AC_DEFINE(HAVE_U_INTXX_T)
2038 AC_MSG_RESULT(yes)
2039 ],
2040 [ AC_MSG_RESULT(no) ]
2041 )
2042fi
2043
Damien Miller578783e2000-09-23 14:12:24 +11002044AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2045 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002046 [ #include <sys/types.h> ],
2047 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002048 [ ac_cv_have_u_int64_t="yes" ],
2049 [ ac_cv_have_u_int64_t="no" ]
2050 )
2051])
2052if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2053 AC_DEFINE(HAVE_U_INT64_T)
2054 have_u_int64_t=1
2055fi
2056
Tim Rice4cec93f2002-02-26 08:40:48 -08002057if test -z "$have_u_int64_t" ; then
2058 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2059 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002060 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002061 [ u_int64_t a; a = 1],
2062 [
2063 AC_DEFINE(HAVE_U_INT64_T)
2064 AC_MSG_RESULT(yes)
2065 ],
2066 [ AC_MSG_RESULT(no) ]
2067 )
2068fi
2069
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002070if test -z "$have_u_intxx_t" ; then
2071 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2072 AC_TRY_COMPILE(
2073 [
2074#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002075 ],
2076 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002077 [ ac_cv_have_uintxx_t="yes" ],
2078 [ ac_cv_have_uintxx_t="no" ]
2079 )
2080 ])
2081 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2082 AC_DEFINE(HAVE_UINTXX_T)
2083 fi
2084fi
2085
2086if test -z "$have_uintxx_t" ; then
2087 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2088 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002089 [ #include <stdint.h> ],
2090 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002091 [
2092 AC_DEFINE(HAVE_UINTXX_T)
2093 AC_MSG_RESULT(yes)
2094 ],
2095 [ AC_MSG_RESULT(no) ]
2096 )
2097fi
2098
Damien Milleredb82922000-06-20 13:25:52 +10002099if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002100 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002101then
2102 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2103 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002104 [
2105#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002106 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002107 [
Damien Miller70494d12000-04-03 15:57:06 +10002108 int8_t a; int16_t b; int32_t c;
2109 u_int8_t e; u_int16_t f; u_int32_t g;
2110 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002111 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002112 [
2113 AC_DEFINE(HAVE_U_INTXX_T)
2114 AC_DEFINE(HAVE_INTXX_T)
2115 AC_MSG_RESULT(yes)
2116 ],
2117 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002118 )
Damien Millerb29ea912000-01-15 14:12:03 +11002119fi
2120
Damien Miller58be7382001-09-15 21:31:54 +10002121
2122AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2123 AC_TRY_COMPILE(
2124 [
2125#include <sys/types.h>
2126 ],
2127 [ u_char foo; foo = 125; ],
2128 [ ac_cv_have_u_char="yes" ],
2129 [ ac_cv_have_u_char="no" ]
2130 )
2131])
2132if test "x$ac_cv_have_u_char" = "xyes" ; then
2133 AC_DEFINE(HAVE_U_CHAR)
2134fi
2135
Tim Rice13aae5e2001-10-21 17:53:58 -07002136TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002137
Tim Rice200a5c02002-02-26 22:12:34 -08002138AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002139
Damien Miller848b9932005-02-24 12:12:34 +11002140AC_CHECK_TYPES(in_addr_t,,,
2141[#include <sys/types.h>
2142#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002143
Damien Miller61e50f12000-05-08 20:49:37 +10002144AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2145 AC_TRY_COMPILE(
2146 [
2147#include <sys/types.h>
2148 ],
2149 [ size_t foo; foo = 1235; ],
2150 [ ac_cv_have_size_t="yes" ],
2151 [ ac_cv_have_size_t="no" ]
2152 )
2153])
2154if test "x$ac_cv_have_size_t" = "xyes" ; then
2155 AC_DEFINE(HAVE_SIZE_T)
2156fi
Damien Miller95058511999-12-29 10:36:45 +11002157
Damien Miller615f9392000-05-17 22:53:33 +10002158AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2159 AC_TRY_COMPILE(
2160 [
2161#include <sys/types.h>
2162 ],
2163 [ ssize_t foo; foo = 1235; ],
2164 [ ac_cv_have_ssize_t="yes" ],
2165 [ ac_cv_have_ssize_t="no" ]
2166 )
2167])
2168if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2169 AC_DEFINE(HAVE_SSIZE_T)
2170fi
2171
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002172AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2173 AC_TRY_COMPILE(
2174 [
2175#include <time.h>
2176 ],
2177 [ clock_t foo; foo = 1235; ],
2178 [ ac_cv_have_clock_t="yes" ],
2179 [ ac_cv_have_clock_t="no" ]
2180 )
2181])
2182if test "x$ac_cv_have_clock_t" = "xyes" ; then
2183 AC_DEFINE(HAVE_CLOCK_T)
2184fi
2185
Damien Millerb54b40e2000-06-23 08:23:34 +10002186AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2187 AC_TRY_COMPILE(
2188 [
2189#include <sys/types.h>
2190#include <sys/socket.h>
2191 ],
2192 [ sa_family_t foo; foo = 1235; ],
2193 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002194 [ AC_TRY_COMPILE(
2195 [
2196#include <sys/types.h>
2197#include <sys/socket.h>
2198#include <netinet/in.h>
2199 ],
2200 [ sa_family_t foo; foo = 1235; ],
2201 [ ac_cv_have_sa_family_t="yes" ],
2202
Damien Millerb54b40e2000-06-23 08:23:34 +10002203 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002204 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002205 )
2206])
2207if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2208 AC_DEFINE(HAVE_SA_FAMILY_T)
2209fi
2210
Damien Miller0f91b4e2000-06-18 15:43:25 +10002211AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2212 AC_TRY_COMPILE(
2213 [
2214#include <sys/types.h>
2215 ],
2216 [ pid_t foo; foo = 1235; ],
2217 [ ac_cv_have_pid_t="yes" ],
2218 [ ac_cv_have_pid_t="no" ]
2219 )
2220])
2221if test "x$ac_cv_have_pid_t" = "xyes" ; then
2222 AC_DEFINE(HAVE_PID_T)
2223fi
2224
2225AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2226 AC_TRY_COMPILE(
2227 [
2228#include <sys/types.h>
2229 ],
2230 [ mode_t foo; foo = 1235; ],
2231 [ ac_cv_have_mode_t="yes" ],
2232 [ ac_cv_have_mode_t="no" ]
2233 )
2234])
2235if test "x$ac_cv_have_mode_t" = "xyes" ; then
2236 AC_DEFINE(HAVE_MODE_T)
2237fi
2238
Damien Miller61e50f12000-05-08 20:49:37 +10002239
2240AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2241 AC_TRY_COMPILE(
2242 [
Damien Miller81171112000-04-23 11:14:01 +10002243#include <sys/types.h>
2244#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002245 ],
2246 [ struct sockaddr_storage s; ],
2247 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2248 [ ac_cv_have_struct_sockaddr_storage="no" ]
2249 )
2250])
2251if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2252 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2253fi
Damien Miller34132e52000-01-14 15:45:46 +11002254
Damien Miller61e50f12000-05-08 20:49:37 +10002255AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2256 AC_TRY_COMPILE(
2257 [
Damien Miller7b22d652000-06-18 14:07:04 +10002258#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002259#include <netinet/in.h>
2260 ],
2261 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2262 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2263 [ ac_cv_have_struct_sockaddr_in6="no" ]
2264 )
2265])
2266if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2267 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2268fi
Damien Miller34132e52000-01-14 15:45:46 +11002269
Damien Miller61e50f12000-05-08 20:49:37 +10002270AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2271 AC_TRY_COMPILE(
2272 [
Damien Miller7b22d652000-06-18 14:07:04 +10002273#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002274#include <netinet/in.h>
2275 ],
2276 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2277 [ ac_cv_have_struct_in6_addr="yes" ],
2278 [ ac_cv_have_struct_in6_addr="no" ]
2279 )
2280])
2281if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2282 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2283fi
Damien Miller34132e52000-01-14 15:45:46 +11002284
Damien Miller61e50f12000-05-08 20:49:37 +10002285AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2286 AC_TRY_COMPILE(
2287 [
Damien Miller81171112000-04-23 11:14:01 +10002288#include <sys/types.h>
2289#include <sys/socket.h>
2290#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002291 ],
2292 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2293 [ ac_cv_have_struct_addrinfo="yes" ],
2294 [ ac_cv_have_struct_addrinfo="no" ]
2295 )
2296])
2297if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2298 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2299fi
2300
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002301AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2302 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002303 [ #include <sys/time.h> ],
2304 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002305 [ ac_cv_have_struct_timeval="yes" ],
2306 [ ac_cv_have_struct_timeval="no" ]
2307 )
2308])
2309if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2310 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2311 have_struct_timeval=1
2312fi
2313
Tim Rice4e4dc562003-03-18 10:21:40 -08002314AC_CHECK_TYPES(struct timespec)
2315
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002316# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002317if test "x$ac_cv_have_int64_t" = "xno" && \
2318 test "x$ac_cv_sizeof_long_int" != "x8" && \
2319 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002320 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2321 echo "an alternative compiler (I.E., GCC) before continuing."
2322 echo ""
2323 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002324else
2325dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002326 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002327 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002328#include <stdio.h>
2329#include <string.h>
2330#ifdef HAVE_SNPRINTF
2331main()
2332{
2333 char buf[50];
2334 char expected_out[50];
2335 int mazsize = 50 ;
2336#if (SIZEOF_LONG_INT == 8)
2337 long int num = 0x7fffffffffffffff;
2338#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002339 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002340#endif
2341 strcpy(expected_out, "9223372036854775807");
2342 snprintf(buf, mazsize, "%lld", num);
2343 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002344 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002345 exit(0);
2346}
2347#else
2348main() { exit(0); }
2349#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002350 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002351 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002352 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002353fi
2354
Damien Miller78315eb2000-09-29 23:01:36 +11002355dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002356OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2357OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2358OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2359OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2360OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002361OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002362OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2363OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002364OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002365OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2366OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2367OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2368OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002369OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2370OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2371OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2372OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002373
2374AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002375
Damien Miller61e50f12000-05-08 20:49:37 +10002376AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2377 ac_cv_have_ss_family_in_struct_ss, [
2378 AC_TRY_COMPILE(
2379 [
Damien Miller81171112000-04-23 11:14:01 +10002380#include <sys/types.h>
2381#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002382 ],
2383 [ struct sockaddr_storage s; s.ss_family = 1; ],
2384 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2385 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2386 )
2387])
2388if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2389 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2390fi
2391
Damien Miller61e50f12000-05-08 20:49:37 +10002392AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2393 ac_cv_have___ss_family_in_struct_ss, [
2394 AC_TRY_COMPILE(
2395 [
Damien Miller81171112000-04-23 11:14:01 +10002396#include <sys/types.h>
2397#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002398 ],
2399 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2400 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2401 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2402 )
2403])
2404if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2405 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2406fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002407
Damien Millerad833b32000-08-23 10:46:23 +10002408AC_CACHE_CHECK([for pw_class field in struct passwd],
2409 ac_cv_have_pw_class_in_struct_passwd, [
2410 AC_TRY_COMPILE(
2411 [
Damien Millerad833b32000-08-23 10:46:23 +10002412#include <pwd.h>
2413 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002414 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002415 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2416 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2417 )
2418])
2419if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2420 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2421fi
2422
Kevin Steves82456952001-06-22 21:14:18 +00002423AC_CACHE_CHECK([for pw_expire field in struct passwd],
2424 ac_cv_have_pw_expire_in_struct_passwd, [
2425 AC_TRY_COMPILE(
2426 [
2427#include <pwd.h>
2428 ],
2429 [ struct passwd p; p.pw_expire = 0; ],
2430 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2431 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2432 )
2433])
2434if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2435 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2436fi
2437
2438AC_CACHE_CHECK([for pw_change field in struct passwd],
2439 ac_cv_have_pw_change_in_struct_passwd, [
2440 AC_TRY_COMPILE(
2441 [
2442#include <pwd.h>
2443 ],
2444 [ struct passwd p; p.pw_change = 0; ],
2445 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2446 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2447 )
2448])
2449if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2450 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2451fi
Damien Miller61e50f12000-05-08 20:49:37 +10002452
Tim Rice28bbb0c2002-05-27 17:37:32 -07002453dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002454AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2455 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002456 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002457 [
Tim Riceae49fe62002-04-12 10:26:21 -07002458#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002459#include <sys/socket.h>
2460#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002461int main() {
2462#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002463#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002464exit(1);
2465#endif
2466struct msghdr m;
2467m.msg_accrights = 0;
2468exit(0);
2469}
Kevin Steves939c9db2002-03-22 17:23:25 +00002470 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002471 [ ac_cv_have_accrights_in_msghdr="yes" ],
2472 [ ac_cv_have_accrights_in_msghdr="no" ]
2473 )
2474])
2475if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2476 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2477fi
2478
Kevin Stevesa44e0352002-04-07 16:18:03 +00002479AC_CACHE_CHECK([for msg_control field in struct msghdr],
2480 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002481 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002482 [
Tim Riceae49fe62002-04-12 10:26:21 -07002483#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002484#include <sys/socket.h>
2485#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002486int main() {
2487#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002488#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002489exit(1);
2490#endif
2491struct msghdr m;
2492m.msg_control = 0;
2493exit(0);
2494}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002495 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002496 [ ac_cv_have_control_in_msghdr="yes" ],
2497 [ ac_cv_have_control_in_msghdr="no" ]
2498 )
2499])
2500if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2501 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2502fi
2503
Damien Miller61e50f12000-05-08 20:49:37 +10002504AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002505 AC_TRY_LINK([],
2506 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002507 [ ac_cv_libc_defines___progname="yes" ],
2508 [ ac_cv_libc_defines___progname="no" ]
2509 )
2510])
2511if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2512 AC_DEFINE(HAVE___PROGNAME)
2513fi
2514
Kevin Steves4846f4a2002-03-22 18:19:53 +00002515AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2516 AC_TRY_LINK([
2517#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002518],
2519 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002520 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2521 [ ac_cv_cc_implements___FUNCTION__="no" ]
2522 )
2523])
2524if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2525 AC_DEFINE(HAVE___FUNCTION__)
2526fi
2527
2528AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2529 AC_TRY_LINK([
2530#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002531],
2532 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002533 [ ac_cv_cc_implements___func__="yes" ],
2534 [ ac_cv_cc_implements___func__="no" ]
2535 )
2536])
2537if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2538 AC_DEFINE(HAVE___func__)
2539fi
2540
Damien Miller4f8e6692001-07-14 13:22:53 +10002541AC_CACHE_CHECK([whether getopt has optreset support],
2542 ac_cv_have_getopt_optreset, [
2543 AC_TRY_LINK(
2544 [
2545#include <getopt.h>
2546 ],
2547 [ extern int optreset; optreset = 0; ],
2548 [ ac_cv_have_getopt_optreset="yes" ],
2549 [ ac_cv_have_getopt_optreset="no" ]
2550 )
2551])
2552if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2553 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2554fi
Damien Millera22ba012000-03-02 23:09:20 +11002555
Damien Millerecbb26d2000-07-15 14:59:14 +10002556AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002557 AC_TRY_LINK([],
2558 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002559 [ ac_cv_libc_defines_sys_errlist="yes" ],
2560 [ ac_cv_libc_defines_sys_errlist="no" ]
2561 )
2562])
2563if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2564 AC_DEFINE(HAVE_SYS_ERRLIST)
2565fi
2566
2567
Damien Miller11fa2cc2000-08-16 10:35:58 +10002568AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002569 AC_TRY_LINK([],
2570 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002571 [ ac_cv_libc_defines_sys_nerr="yes" ],
2572 [ ac_cv_libc_defines_sys_nerr="no" ]
2573 )
2574])
2575if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2576 AC_DEFINE(HAVE_SYS_NERR)
2577fi
2578
Damien Millera8e06ce2003-11-21 23:48:55 +11002579SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002580# Check whether user wants sectok support
2581AC_ARG_WITH(sectok,
2582 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002583 [
2584 if test "x$withval" != "xno" ; then
2585 if test "x$withval" != "xyes" ; then
2586 CPPFLAGS="$CPPFLAGS -I${withval}"
2587 LDFLAGS="$LDFLAGS -L${withval}"
2588 if test ! -z "$need_dash_r" ; then
2589 LDFLAGS="$LDFLAGS -R${withval}"
2590 fi
2591 if test ! -z "$blibpath" ; then
2592 blibpath="$blibpath:${withval}"
2593 fi
2594 fi
2595 AC_CHECK_HEADERS(sectok.h)
2596 if test "$ac_cv_header_sectok_h" != yes; then
2597 AC_MSG_ERROR(Can't find sectok.h)
2598 fi
2599 AC_CHECK_LIB(sectok, sectok_open)
2600 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2601 AC_MSG_ERROR(Can't find libsectok)
2602 fi
2603 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002604 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002605 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002606 fi
2607 ]
2608)
2609
2610# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002611OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002612AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002613 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2614 [
2615 if test "x$withval" != "xno" ; then
2616 if test "x$withval" != "xyes" ; then
2617 OPENSC_CONFIG=$withval/bin/opensc-config
2618 else
2619 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2620 fi
2621 if test "$OPENSC_CONFIG" != "no"; then
2622 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2623 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2624 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2625 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2626 AC_DEFINE(SMARTCARD)
2627 AC_DEFINE(USE_OPENSC)
2628 SCARD_MSG="yes, using OpenSC"
2629 fi
2630 fi
2631 ]
2632)
Damien Miller85de5802001-09-18 14:01:11 +10002633
Darren Tucker5f88d342003-10-15 16:57:57 +10002634# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002635AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002636 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002637 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002638 # Needed by our getrrsetbyname()
2639 AC_SEARCH_LIBS(res_query, resolv)
2640 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002641 AC_MSG_CHECKING(if res_query will link)
2642 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2643 [AC_MSG_RESULT(no)
2644 saved_LIBS="$LIBS"
2645 LIBS="$LIBS -lresolv"
2646 AC_MSG_CHECKING(for res_query in -lresolv)
2647 AC_LINK_IFELSE([
2648#include <resolv.h>
2649int main()
2650{
2651 res_query (0, 0, 0, 0, 0);
2652 return 0;
2653}
2654 ],
2655 [LIBS="$LIBS -lresolv"
2656 AC_MSG_RESULT(yes)],
2657 [LIBS="$saved_LIBS"
2658 AC_MSG_RESULT(no)])
2659 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002660 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002661 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002662 [#include <sys/types.h>
2663 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002664 AC_CHECK_MEMBER(HEADER.ad,
2665 [AC_DEFINE(HAVE_HEADER_AD)],,
2666 [#include <arpa/nameser.h>])
2667 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002668
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002669# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002670KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002671AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002672 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002673 [ if test "x$withval" != "xno" ; then
2674 if test "x$withval" = "xyes" ; then
2675 KRB5ROOT="/usr/local"
2676 else
2677 KRB5ROOT=${withval}
2678 fi
2679
2680 AC_DEFINE(KRB5)
2681 KRB5_MSG="yes"
2682
2683 AC_MSG_CHECKING(for krb5-config)
2684 if test -x $KRB5ROOT/bin/krb5-config ; then
2685 KRB5CONF=$KRB5ROOT/bin/krb5-config
2686 AC_MSG_RESULT($KRB5CONF)
2687
2688 AC_MSG_CHECKING(for gssapi support)
2689 if $KRB5CONF | grep gssapi >/dev/null ; then
2690 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002691 AC_DEFINE(GSSAPI)
2692 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002693 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002694 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002695 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002696 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002697 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2698 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002699 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002700 AC_MSG_CHECKING(whether we are using Heimdal)
2701 AC_TRY_COMPILE([ #include <krb5.h> ],
2702 [ char *tmp = heimdal_version; ],
2703 [ AC_MSG_RESULT(yes)
2704 AC_DEFINE(HEIMDAL) ],
2705 AC_MSG_RESULT(no)
2706 )
2707 else
2708 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002709 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002710 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002711 AC_MSG_CHECKING(whether we are using Heimdal)
2712 AC_TRY_COMPILE([ #include <krb5.h> ],
2713 [ char *tmp = heimdal_version; ],
2714 [ AC_MSG_RESULT(yes)
2715 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002716 K5LIBS="-lkrb5 -ldes"
2717 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002718 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002719 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002720 ],
2721 [ AC_MSG_RESULT(no)
2722 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2723 ]
2724 )
Damien Miller200d0a72003-06-30 19:21:36 +10002725 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002726
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002727 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2728 [ AC_DEFINE(GSSAPI)
2729 K5LIBS="-lgssapi $K5LIBS" ],
2730 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2731 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002732 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002733 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2734 $K5LIBS)
2735 ],
2736 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002737
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002738 AC_CHECK_HEADER(gssapi.h, ,
2739 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002740 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002741 AC_CHECK_HEADERS(gssapi.h, ,
2742 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002743 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002744 ]
2745 )
2746
2747 oldCPP="$CPPFLAGS"
2748 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2749 AC_CHECK_HEADER(gssapi_krb5.h, ,
2750 [ CPPFLAGS="$oldCPP" ])
2751
Damien Millera8e06ce2003-11-21 23:48:55 +11002752 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002753 if test ! -z "$need_dash_r" ; then
2754 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2755 fi
2756 if test ! -z "$blibpath" ; then
2757 blibpath="$blibpath:${KRB5ROOT}/lib"
2758 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002759 fi
2760
2761 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2762 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2763 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2764
2765 LIBS="$LIBS $K5LIBS"
2766 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2767 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002768)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002769
Damien Millera22ba012000-03-02 23:09:20 +11002770# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002771
Damien Millerf58c6722002-05-13 13:15:42 +10002772PRIVSEP_PATH=/var/empty
2773AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002774 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002775 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002776 if test -n "$withval" && test "x$withval" != "xno" && \
2777 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002778 PRIVSEP_PATH=$withval
2779 fi
2780 ]
2781)
2782AC_SUBST(PRIVSEP_PATH)
2783
Damien Millera22ba012000-03-02 23:09:20 +11002784AC_ARG_WITH(xauth,
2785 [ --with-xauth=PATH Specify path to xauth program ],
2786 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002787 if test -n "$withval" && test "x$withval" != "xno" && \
2788 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002789 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002790 fi
2791 ],
2792 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002793 TestPath="$PATH"
2794 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2795 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2796 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2797 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2798 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002799 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002800 xauth_path="/usr/openwin/bin/xauth"
2801 fi
2802 ]
2803)
2804
Damien Miller7d901272003-01-13 16:55:22 +11002805STRIP_OPT=-s
2806AC_ARG_ENABLE(strip,
2807 [ --disable-strip Disable calling strip(1) on install],
2808 [
2809 if test "x$enableval" = "xno" ; then
2810 STRIP_OPT=
2811 fi
2812 ]
2813)
2814AC_SUBST(STRIP_OPT)
2815
Damien Millera19cf472000-11-29 13:28:50 +11002816if test -z "$xauth_path" ; then
2817 XAUTH_PATH="undefined"
2818 AC_SUBST(XAUTH_PATH)
2819else
Damien Millera22ba012000-03-02 23:09:20 +11002820 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002821 XAUTH_PATH=$xauth_path
2822 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002823fi
Damien Millera22ba012000-03-02 23:09:20 +11002824
2825# Check for mail directory (last resort if we cannot get it from headers)
2826if test ! -z "$MAIL" ; then
2827 maildir=`dirname $MAIL`
2828 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2829fi
2830
Darren Tucker623d92f2004-09-12 22:36:15 +10002831if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002832 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2833 disable_ptmx_check=yes
2834fi
Damien Millera22ba012000-03-02 23:09:20 +11002835if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002836 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002837 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002838 [
2839 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2840 have_dev_ptmx=1
2841 ]
2842 )
2843 fi
Damien Millera22ba012000-03-02 23:09:20 +11002844fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002845
Darren Tucker623d92f2004-09-12 22:36:15 +10002846if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002847 AC_CHECK_FILE("/dev/ptc",
2848 [
2849 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2850 have_dev_ptc=1
2851 ]
2852 )
2853else
2854 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2855fi
Damien Miller204ad072000-03-02 23:56:12 +11002856
Damien Millera22ba012000-03-02 23:09:20 +11002857# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002858AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002859 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002860 [
Damien Miller897741e2001-04-16 10:41:46 +10002861 case "$withval" in
2862 man|cat|doc)
2863 MANTYPE=$withval
2864 ;;
2865 *)
2866 AC_MSG_ERROR(invalid man type: $withval)
2867 ;;
2868 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002869 ]
2870)
Ben Lindstrombc709922001-04-18 18:04:21 +00002871if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002872 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2873 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002874 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2875 MANTYPE=doc
2876 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2877 MANTYPE=man
2878 else
2879 MANTYPE=cat
2880 fi
2881fi
Damien Miller670a4b82000-01-22 13:53:11 +11002882AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002883if test "$MANTYPE" = "doc"; then
2884 mansubdir=man;
2885else
2886 mansubdir=$MANTYPE;
2887fi
2888AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002889
Damien Millera22ba012000-03-02 23:09:20 +11002890# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002891MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002892AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002893 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002894 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002895 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002896 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002897 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002898 fi
2899 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002900)
2901
Damien Millera22ba012000-03-02 23:09:20 +11002902# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002903AC_ARG_WITH(shadow,
2904 [ --without-shadow Disable shadow password support],
2905 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002906 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002907 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002908 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002909 fi
2910 ]
2911)
2912
Damien Miller1f335fb2000-06-26 11:31:33 +10002913if test -z "$disable_shadow" ; then
2914 AC_MSG_CHECKING([if the systems has expire shadow information])
2915 AC_TRY_COMPILE(
2916 [
2917#include <sys/types.h>
2918#include <shadow.h>
2919 struct spwd sp;
2920 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2921 [ sp_expire_available=yes ], []
2922 )
2923
2924 if test "x$sp_expire_available" = "xyes" ; then
2925 AC_MSG_RESULT(yes)
2926 AC_DEFINE(HAS_SHADOW_EXPIRE)
2927 else
2928 AC_MSG_RESULT(no)
2929 fi
2930fi
2931
Damien Millera22ba012000-03-02 23:09:20 +11002932# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002933if test ! -z "$IPADDR_IN_DISPLAY" ; then
2934 DISPLAY_HACK_MSG="yes"
2935 AC_DEFINE(IPADDR_IN_DISPLAY)
2936else
Damien Millera8e06ce2003-11-21 23:48:55 +11002937 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002938 AC_ARG_WITH(ipaddr-display,
2939 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2940 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002941 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002942 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002943 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002944 fi
2945 ]
2946 )
2947fi
Damien Miller76112de1999-12-21 11:18:08 +11002948
Darren Tuckere1a790d2003-09-16 11:52:19 +10002949# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002950AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002951 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002952 [ if test "x$enableval" = "xno"; then
2953 AC_MSG_NOTICE([/etc/default/login handling disabled])
2954 etc_default_login=no
2955 else
2956 etc_default_login=yes
2957 fi ],
2958 [ etc_default_login=yes ]
2959)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002960
Darren Tucker2f9573d2005-02-10 22:28:54 +11002961if test "x$etc_default_login" != "xno"; then
2962 AC_CHECK_FILE("/etc/default/login",
2963 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002964 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2965 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002966 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2967 elif test "x$external_path_file" = "x/etc/default/login"; then
2968 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2969 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002970fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002971
Tim Rice43a1c132002-04-17 21:19:14 -07002972dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002973if test $ac_cv_func_login_getcapbool = "yes" && \
2974 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002975 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002976fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002977
Damien Millera22ba012000-03-02 23:09:20 +11002978# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002979SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002980AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002981 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002982 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002983 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002984 AC_MSG_WARN([
2985--with-default-path=PATH has no effect on this system.
2986Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002987 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002988 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002989 AC_MSG_WARN([
2990--with-default-path=PATH will only be used if PATH is not defined in
2991$external_path_file .])
2992 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002993 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002994 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002995 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002996 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002997 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2998 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002999 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003000 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003001 AC_MSG_WARN([
3002If PATH is defined in $external_path_file, ensure the path to scp is included,
3003otherwise scp will not work.])
3004 fi
3005 AC_TRY_RUN(
3006 [
Tim Rice59ea0a02001-03-10 13:50:45 -08003007/* find out what STDPATH is */
3008#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003009#ifdef HAVE_PATHS_H
3010# include <paths.h>
3011#endif
3012#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003013# ifdef _PATH_USERPATH /* Irix */
3014# define _PATH_STDPATH _PATH_USERPATH
3015# else
3016# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3017# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003018#endif
3019#include <sys/types.h>
3020#include <sys/stat.h>
3021#include <fcntl.h>
3022#define DATA "conftest.stdpath"
3023
3024main()
3025{
3026 FILE *fd;
3027 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003028
Tim Rice59ea0a02001-03-10 13:50:45 -08003029 fd = fopen(DATA,"w");
3030 if(fd == NULL)
3031 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003032
Tim Rice59ea0a02001-03-10 13:50:45 -08003033 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3034 exit(1);
3035
3036 exit(0);
3037}
3038 ], [ user_path=`cat conftest.stdpath` ],
3039 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3040 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3041 )
3042# make sure $bindir is in USER_PATH so scp will work
3043 t_bindir=`eval echo ${bindir}`
3044 case $t_bindir in
3045 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3046 esac
3047 case $t_bindir in
3048 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3049 esac
3050 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3051 if test $? -ne 0 ; then
3052 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3053 if test $? -ne 0 ; then
3054 user_path=$user_path:$t_bindir
3055 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3056 fi
3057 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003058 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003059)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003060if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003061 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
3062 AC_SUBST(user_path)
3063fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003064
Damien Millera18bbd32002-05-13 10:48:57 +10003065# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003066AC_ARG_WITH(superuser-path,
3067 [ --with-superuser-path= Specify different path for super-user],
3068 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003069 if test -n "$withval" && test "x$withval" != "xno" && \
3070 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10003071 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
3072 superuser_path=$withval
3073 fi
3074 ]
3075)
3076
3077
Damien Miller61e50f12000-05-08 20:49:37 +10003078AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003079IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003080AC_ARG_WITH(4in6,
3081 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3082 [
3083 if test "x$withval" != "xno" ; then
3084 AC_MSG_RESULT(yes)
3085 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003086 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003087 else
3088 AC_MSG_RESULT(no)
3089 fi
3090 ],[
3091 if test "x$inet6_default_4in6" = "xyes"; then
3092 AC_MSG_RESULT([yes (default)])
3093 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003094 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003095 else
3096 AC_MSG_RESULT([no (default)])
3097 fi
3098 ]
3099)
3100
Damien Miller60396b02001-02-18 17:01:00 +11003101# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003102BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003103AC_ARG_WITH(bsd-auth,
3104 [ --with-bsd-auth Enable BSD auth support],
3105 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003106 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11003107 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11003108 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003109 fi
3110 ]
3111)
3112
Damien Millera22ba012000-03-02 23:09:20 +11003113# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003114piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003115# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003116if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003117 piddir=`eval echo ${sysconfdir}`
3118 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003119 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003120 esac
3121fi
3122
Tim Rice88f2ab52002-03-17 12:17:34 -08003123AC_ARG_WITH(pid-dir,
3124 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3125 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003126 if test -n "$withval" && test "x$withval" != "xno" && \
3127 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003128 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003129 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003130 AC_MSG_WARN([** no $piddir directory on this system **])
3131 fi
3132 fi
3133 ]
3134)
3135
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003136AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11003137AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003138
andre2ff7b5d2000-06-03 14:57:40 +00003139dnl allow user to disable some login recording features
3140AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003141 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003142 [
3143 if test "x$enableval" = "xno" ; then
3144 AC_DEFINE(DISABLE_LASTLOG)
3145 fi
3146 ]
andre2ff7b5d2000-06-03 14:57:40 +00003147)
3148AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003149 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003150 [
3151 if test "x$enableval" = "xno" ; then
3152 AC_DEFINE(DISABLE_UTMP)
3153 fi
3154 ]
andre2ff7b5d2000-06-03 14:57:40 +00003155)
3156AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003157 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003158 [
3159 if test "x$enableval" = "xno" ; then
3160 AC_DEFINE(DISABLE_UTMPX)
3161 fi
3162 ]
andre2ff7b5d2000-06-03 14:57:40 +00003163)
3164AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003165 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003166 [
3167 if test "x$enableval" = "xno" ; then
3168 AC_DEFINE(DISABLE_WTMP)
3169 fi
3170 ]
andre2ff7b5d2000-06-03 14:57:40 +00003171)
3172AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003173 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003174 [
3175 if test "x$enableval" = "xno" ; then
3176 AC_DEFINE(DISABLE_WTMPX)
3177 fi
3178 ]
andre2ff7b5d2000-06-03 14:57:40 +00003179)
3180AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003181 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003182 [
3183 if test "x$enableval" = "xno" ; then
3184 AC_DEFINE(DISABLE_LOGIN)
3185 fi
3186 ]
andre2ff7b5d2000-06-03 14:57:40 +00003187)
3188AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003189 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003190 [
3191 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003192 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10003193 fi
3194 ]
andre2ff7b5d2000-06-03 14:57:40 +00003195)
3196AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003197 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003198 [
3199 if test "x$enableval" = "xno" ; then
3200 AC_DEFINE(DISABLE_PUTUTXLINE)
3201 fi
3202 ]
andre2ff7b5d2000-06-03 14:57:40 +00003203)
3204AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003205 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003206 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003207 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003208 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003209 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003210 conf_lastlog_location=$withval
3211 fi
3212 ]
3213)
andre2ff7b5d2000-06-03 14:57:40 +00003214
3215dnl lastlog, [uw]tmpx? detection
3216dnl NOTE: set the paths in the platform section to avoid the
3217dnl need for command-line parameters
3218dnl lastlog and [uw]tmp are subject to a file search if all else fails
3219
3220dnl lastlog detection
3221dnl NOTE: the code itself will detect if lastlog is a directory
3222AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3223AC_TRY_COMPILE([
3224#include <sys/types.h>
3225#include <utmp.h>
3226#ifdef HAVE_LASTLOG_H
3227# include <lastlog.h>
3228#endif
Damien Miller2994e082000-06-04 15:51:47 +10003229#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003230# include <paths.h>
3231#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003232#ifdef HAVE_LOGIN_H
3233# include <login.h>
3234#endif
andre2ff7b5d2000-06-03 14:57:40 +00003235 ],
3236 [ char *lastlog = LASTLOG_FILE; ],
3237 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003238 [
3239 AC_MSG_RESULT(no)
3240 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3241 AC_TRY_COMPILE([
3242#include <sys/types.h>
3243#include <utmp.h>
3244#ifdef HAVE_LASTLOG_H
3245# include <lastlog.h>
3246#endif
3247#ifdef HAVE_PATHS_H
3248# include <paths.h>
3249#endif
3250 ],
3251 [ char *lastlog = _PATH_LASTLOG; ],
3252 [ AC_MSG_RESULT(yes) ],
3253 [
andree441aa32000-06-12 22:34:38 +00003254 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003255 system_lastlog_path=no
3256 ])
3257 ]
andre2ff7b5d2000-06-03 14:57:40 +00003258)
Damien Miller2994e082000-06-04 15:51:47 +10003259
andre2ff7b5d2000-06-03 14:57:40 +00003260if test -z "$conf_lastlog_location"; then
3261 if test x"$system_lastlog_path" = x"no" ; then
3262 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003263 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003264 conf_lastlog_location=$f
3265 fi
3266 done
3267 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003268 AC_MSG_WARN([** Cannot find lastlog **])
3269 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003270 fi
3271 fi
3272fi
3273
3274if test -n "$conf_lastlog_location"; then
3275 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003276fi
andre2ff7b5d2000-06-03 14:57:40 +00003277
3278dnl utmp detection
3279AC_MSG_CHECKING([if your system defines UTMP_FILE])
3280AC_TRY_COMPILE([
3281#include <sys/types.h>
3282#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003283#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003284# include <paths.h>
3285#endif
3286 ],
3287 [ char *utmp = UTMP_FILE; ],
3288 [ AC_MSG_RESULT(yes) ],
3289 [ AC_MSG_RESULT(no)
3290 system_utmp_path=no ]
3291)
3292if test -z "$conf_utmp_location"; then
3293 if test x"$system_utmp_path" = x"no" ; then
3294 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3295 if test -f $f ; then
3296 conf_utmp_location=$f
3297 fi
3298 done
3299 if test -z "$conf_utmp_location"; then
3300 AC_DEFINE(DISABLE_UTMP)
3301 fi
3302 fi
3303fi
3304if test -n "$conf_utmp_location"; then
3305 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003306fi
andre2ff7b5d2000-06-03 14:57:40 +00003307
3308dnl wtmp detection
3309AC_MSG_CHECKING([if your system defines WTMP_FILE])
3310AC_TRY_COMPILE([
3311#include <sys/types.h>
3312#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003313#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003314# include <paths.h>
3315#endif
3316 ],
3317 [ char *wtmp = WTMP_FILE; ],
3318 [ AC_MSG_RESULT(yes) ],
3319 [ AC_MSG_RESULT(no)
3320 system_wtmp_path=no ]
3321)
3322if test -z "$conf_wtmp_location"; then
3323 if test x"$system_wtmp_path" = x"no" ; then
3324 for f in /usr/adm/wtmp /var/log/wtmp; do
3325 if test -f $f ; then
3326 conf_wtmp_location=$f
3327 fi
3328 done
3329 if test -z "$conf_wtmp_location"; then
3330 AC_DEFINE(DISABLE_WTMP)
3331 fi
3332 fi
3333fi
3334if test -n "$conf_wtmp_location"; then
3335 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003336fi
andre2ff7b5d2000-06-03 14:57:40 +00003337
3338
3339dnl utmpx detection - I don't know any system so perverse as to require
3340dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3341dnl there, though.
3342AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3343AC_TRY_COMPILE([
3344#include <sys/types.h>
3345#include <utmp.h>
3346#ifdef HAVE_UTMPX_H
3347#include <utmpx.h>
3348#endif
Damien Miller2994e082000-06-04 15:51:47 +10003349#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003350# include <paths.h>
3351#endif
3352 ],
3353 [ char *utmpx = UTMPX_FILE; ],
3354 [ AC_MSG_RESULT(yes) ],
3355 [ AC_MSG_RESULT(no)
3356 system_utmpx_path=no ]
3357)
3358if test -z "$conf_utmpx_location"; then
3359 if test x"$system_utmpx_path" = x"no" ; then
3360 AC_DEFINE(DISABLE_UTMPX)
3361 fi
3362else
3363 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003364fi
andre2ff7b5d2000-06-03 14:57:40 +00003365
3366dnl wtmpx detection
3367AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3368AC_TRY_COMPILE([
3369#include <sys/types.h>
3370#include <utmp.h>
3371#ifdef HAVE_UTMPX_H
3372#include <utmpx.h>
3373#endif
Damien Miller2994e082000-06-04 15:51:47 +10003374#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003375# include <paths.h>
3376#endif
3377 ],
3378 [ char *wtmpx = WTMPX_FILE; ],
3379 [ AC_MSG_RESULT(yes) ],
3380 [ AC_MSG_RESULT(no)
3381 system_wtmpx_path=no ]
3382)
3383if test -z "$conf_wtmpx_location"; then
3384 if test x"$system_wtmpx_path" = x"no" ; then
3385 AC_DEFINE(DISABLE_WTMPX)
3386 fi
3387else
3388 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003389fi
andre2ff7b5d2000-06-03 14:57:40 +00003390
Damien Miller4018c192000-04-30 09:30:44 +10003391
Damien Miller29ea30d2000-03-17 10:54:15 +11003392if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003393 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3394 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003395fi
3396
Tim Rice4cec93f2002-02-26 08:40:48 -08003397dnl remove pam and dl because they are in $LIBPAM
3398if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003399 LIBS=`echo $LIBS | sed 's/-lpam //'`
3400fi
3401if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3402 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003403fi
3404
Darren Tucker7da23cb2005-08-03 00:20:15 +10003405dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3406dnl Add now.
3407CFLAGS="$CFLAGS $werror_flags"
3408
Damien Millerbac2d8a2000-09-05 16:13:06 +11003409AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003410AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3411 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003412AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003413
Damien Miller7b22d652000-06-18 14:07:04 +10003414# Print summary of options
3415
Damien Miller7b22d652000-06-18 14:07:04 +10003416# Someone please show me a better way :)
3417A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3418B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3419C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3420D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003421E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003422F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003423G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003424H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3425I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3426J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003427
3428echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003429echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003430echo " User binaries: $B"
3431echo " System binaries: $C"
3432echo " Configuration files: $D"
3433echo " Askpass program: $E"
3434echo " Manual pages: $F"
3435echo " PID file: $G"
3436echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003437if test "x$external_path_file" = "x/etc/login.conf" ; then
3438echo " At runtime, sshd will use the path defined in $external_path_file"
3439echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003440else
Damien Millerf58c6722002-05-13 13:15:42 +10003441echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003442 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003443echo " (If PATH is set in $external_path_file it will be used instead. If"
3444echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3445 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003446fi
Damien Millera18bbd32002-05-13 10:48:57 +10003447if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003448echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003449fi
Damien Millerf58c6722002-05-13 13:15:42 +10003450echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003451echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003452echo " KerberosV support: $KRB5_MSG"
3453echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003454echo " S/KEY support: $SKEY_MSG"
3455echo " TCP Wrappers support: $TCPW_MSG"
3456echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003457echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003458echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003459echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3460echo " BSD Auth support: $BSD_AUTH_MSG"
3461echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003462if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003463echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003464fi
3465
Damien Miller7b22d652000-06-18 14:07:04 +10003466echo ""
3467
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003468echo " Host: ${host}"
3469echo " Compiler: ${CC}"
3470echo " Compiler flags: ${CFLAGS}"
3471echo "Preprocessor flags: ${CPPFLAGS}"
3472echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003473echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003474
3475echo ""
3476
Tim Rice6f1f7582004-05-30 21:38:51 -07003477if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003478 echo "SVR4 style packages are supported with \"make package\""
3479 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003480fi
3481
Damien Miller82cf0ce2000-12-20 13:34:48 +11003482if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003483 echo "PAM is enabled. You may need to install a PAM control file "
3484 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003485 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003486 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003487 echo ""
3488fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003489
Damien Miller6c21c512002-01-22 21:57:53 +11003490if test ! -z "$RAND_HELPER_CMDHASH" ; then
3491 echo "WARNING: you are using the builtin random number collection "
3492 echo "service. Please read WARNING.RNG and request that your OS "
3493 echo "vendor includes kernel-based random number collection in "
3494 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003495 echo ""
3496fi
Damien Miller60396b02001-02-18 17:01:00 +11003497
Damien Millerb4097182004-05-23 14:09:40 +10003498if test ! -z "$NO_PEERCHECK" ; then
3499 echo "WARNING: the operating system that you are using does not "
3500 echo "appear to support either the getpeereid() API nor the "
3501 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3502 echo "enforce security checks to prevent unauthorised connections to "
3503 echo "ssh-agent. Their absence increases the risk that a malicious "
3504 echo "user can connect to your agent. "
3505 echo ""
3506fi
3507
Darren Tuckerd9f88912005-02-20 21:01:48 +11003508if test "$AUDIT_MODULE" = "bsm" ; then
3509 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3510 echo "See the Solaris section in README.platform for details."
3511fi