blob: f1588c6931bfda1dd25d793e4ddfa4d1e330c6ba [file] [log] [blame]
Tim Rice3db1e3f2005-08-23 17:11:26 -07001# $Id: configure.ac,v 1.288 2005/08/24 00:11:26 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*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100449 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700450 AC_DEFINE(SETEUID_BREAKS_SETUID)
451 AC_DEFINE(BROKEN_SETREUID)
452 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700453 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice4dbacff2005-06-01 20:09:28 -0700454 case "$host" in
455 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
456 TEST_SHELL=/u95/bin/sh
457 ;;
458 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100459 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100460*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100461 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800462# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100463*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800464 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100465 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800466# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100467*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800468 if test -z "$GCC"; then
469 CFLAGS="$CFLAGS -belf"
470 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100471 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000472 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100473 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000474 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000475 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700476 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700477 AC_DEFINE(SETEUID_BREAKS_SETUID)
478 AC_DEFINE(BROKEN_SETREUID)
479 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700480 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700481 AC_DEFINE(BROKEN_UPDWTMPX)
Darren Tucker33370e02005-02-09 22:17:28 +1100482 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller217f5672001-02-16 12:12:41 +1100483 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700484 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700485 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000486 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000487*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100488 AC_DEFINE(NO_SSH_LASTLOG)
489 AC_DEFINE(SETEUID_BREAKS_SETUID)
490 AC_DEFINE(BROKEN_SETREUID)
491 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000492 AC_DEFINE(USE_PIPES)
493 AC_DEFINE(DISABLE_FD_PASSING)
494 LDFLAGS="$LDFLAGS"
495 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
496 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000497 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000498*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100499 AC_DEFINE(SETEUID_BREAKS_SETUID)
500 AC_DEFINE(BROKEN_SETREUID)
501 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000502 AC_DEFINE(WITH_ABBREV_NO_TTY)
503 AC_DEFINE(USE_PIPES)
504 AC_DEFINE(DISABLE_FD_PASSING)
505 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100506 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000507 MANTYPE=cat
508 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000509*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100510 AC_DEFINE(SETEUID_BREAKS_SETUID)
511 AC_DEFINE(BROKEN_SETREUID)
512 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000513 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700514 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700515 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000516 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
517 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
518 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700519 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000520*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000521 AC_MSG_CHECKING(for Digital Unix SIA)
522 no_osfsia=""
523 AC_ARG_WITH(osfsia,
524 [ --with-osfsia Enable Digital Unix SIA],
525 [
526 if test "x$withval" = "xno" ; then
527 AC_MSG_RESULT(disabled)
528 no_osfsia=1
529 fi
530 ],
531 )
532 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000533 if test -f /etc/sia/matrix.conf; then
534 AC_MSG_RESULT(yes)
535 AC_DEFINE(HAVE_OSF_SIA)
536 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000537 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000538 LIBS="$LIBS -lsecurity -ldb -lm -laud"
539 else
540 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100541 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000542 fi
543 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000544 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700545 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000546 AC_DEFINE(BROKEN_SETREUID)
547 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000548 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000549
550*-*-nto-qnx)
551 AC_DEFINE(USE_PIPES)
552 AC_DEFINE(NO_X11_UNIX_SOCKETS)
553 AC_DEFINE(MISSING_NFDBITS)
554 AC_DEFINE(MISSING_HOWMANY)
555 AC_DEFINE(MISSING_FD_MASK)
556 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000557
558*-*-ultrix*)
559 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
560 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
561 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700562 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
563 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000564
565*-*-lynxos)
566 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
567 AC_DEFINE(MISSING_HOWMANY)
568 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
569 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100570esac
571
Damien Millere37bfc12000-06-05 09:37:43 +1000572# Allow user to specify flags
573AC_ARG_WITH(cflags,
574 [ --with-cflags Specify additional flags to pass to compiler],
575 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800576 if test -n "$withval" && test "x$withval" != "xno" && \
577 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000578 CFLAGS="$CFLAGS $withval"
579 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800580 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000581)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000582AC_ARG_WITH(cppflags,
583 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
584 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800585 if test -n "$withval" && test "x$withval" != "xno" && \
586 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000587 CPPFLAGS="$CPPFLAGS $withval"
588 fi
589 ]
590)
Damien Millere37bfc12000-06-05 09:37:43 +1000591AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000592 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000593 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800594 if test -n "$withval" && test "x$withval" != "xno" && \
595 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000596 LDFLAGS="$LDFLAGS $withval"
597 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800598 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000599)
600AC_ARG_WITH(libs,
601 [ --with-libs Specify additional libraries to link with],
602 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800603 if test -n "$withval" && test "x$withval" != "xno" && \
604 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000605 LIBS="$LIBS $withval"
606 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800607 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000608)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000609AC_ARG_WITH(Werror,
610 [ --with-Werror Build main code with -Werror],
611 [
612 if test -n "$withval" && test "x$withval" != "xno"; then
613 werror_flags="-Werror"
614 if "x${withval}" != "xyes"; then
615 werror_flags="$withval"
616 fi
617 fi
618 ]
619)
Damien Millere37bfc12000-06-05 09:37:43 +1000620
Darren Tucker6eb93042003-06-29 21:30:41 +1000621AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000622AC_RUN_IFELSE(
623 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000624#include <stdio.h>
625int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000626 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000627 [ AC_MSG_RESULT(yes) ],
628 [
629 AC_MSG_RESULT(no)
630 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000631 ],
632 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000633)
634
Darren Tucker0c9653f2005-05-28 15:58:14 +1000635dnl Checks for header files.
636AC_CHECK_HEADERS( \
637 bstring.h \
638 crypt.h \
639 dirent.h \
640 endian.h \
641 features.h \
642 floatingpoint.h \
643 getopt.h \
644 glob.h \
645 ia.h \
646 lastlog.h \
647 limits.h \
648 login.h \
649 login_cap.h \
650 maillock.h \
651 ndir.h \
652 netdb.h \
653 netgroup.h \
654 netinet/in_systm.h \
655 pam/pam_appl.h \
656 paths.h \
657 pty.h \
658 readpassphrase.h \
659 rpc/types.h \
660 security/pam_appl.h \
661 shadow.h \
662 stddef.h \
663 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000664 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000665 strings.h \
666 sys/audit.h \
667 sys/bitypes.h \
668 sys/bsdtty.h \
669 sys/cdefs.h \
670 sys/dir.h \
671 sys/mman.h \
672 sys/ndir.h \
673 sys/prctl.h \
674 sys/pstat.h \
675 sys/select.h \
676 sys/stat.h \
677 sys/stream.h \
678 sys/stropts.h \
679 sys/strtio.h \
680 sys/sysmacros.h \
681 sys/time.h \
682 sys/timers.h \
683 sys/un.h \
684 time.h \
685 tmpdir.h \
686 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000687 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000688 usersec.h \
689 util.h \
690 utime.h \
691 utmp.h \
692 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000693 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000694)
Tim Rice4cec93f2002-02-26 08:40:48 -0800695
Darren Tucker48d99d32004-08-29 17:04:50 +1000696# sys/ptms.h requires sys/stream.h to be included first on Solaris
697AC_CHECK_HEADERS(sys/ptms.h, [], [], [
698#ifdef HAVE_SYS_STREAM_H
699# include <sys/stream.h>
700#endif
701])
702
Damien Millera22ba012000-03-02 23:09:20 +1100703# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700704AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
705AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000706
Tim Rice1e1ef642003-09-11 22:19:31 -0700707dnl IRIX and Solaris 2.5.1 have dirname() in libgen
708AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
709 AC_CHECK_LIB(gen, dirname,[
710 AC_CACHE_CHECK([for broken dirname],
711 ac_cv_have_broken_dirname, [
712 save_LIBS="$LIBS"
713 LIBS="$LIBS -lgen"
714 AC_TRY_RUN(
715 [
716#include <libgen.h>
717#include <string.h>
718
719int main(int argc, char **argv) {
720 char *s, buf[32];
721
722 strncpy(buf,"/etc", 32);
723 s = dirname(buf);
724 if (!s || strncmp(s, "/", 32) != 0) {
725 exit(1);
726 } else {
727 exit(0);
728 }
729}
730 ],
731 [ ac_cv_have_broken_dirname="no" ],
732 [ ac_cv_have_broken_dirname="yes" ]
733 )
734 LIBS="$save_LIBS"
735 ])
736 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
737 LIBS="$LIBS -lgen"
738 AC_DEFINE(HAVE_DIRNAME)
739 AC_CHECK_HEADERS(libgen.h)
740 fi
741 ])
742])
743
744AC_CHECK_FUNC(getspnam, ,
745 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
746AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
747
Tim Rice13aae5e2001-10-21 17:53:58 -0700748dnl zlib is required
749AC_ARG_WITH(zlib,
750 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100751 [ if test "x$withval" = "xno" ; then
752 AC_MSG_ERROR([*** zlib is required ***])
753 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700754 if test -d "$withval/lib"; then
755 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700756 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700757 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700758 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700759 fi
760 else
761 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700762 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700763 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700764 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700765 fi
766 fi
767 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700768 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700769 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700770 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700771 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100772 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700773)
774
Tim Ricefcb62202004-01-23 18:35:16 -0800775AC_CHECK_LIB(z, deflate, ,
776 [
777 saved_CPPFLAGS="$CPPFLAGS"
778 saved_LDFLAGS="$LDFLAGS"
779 save_LIBS="$LIBS"
780 dnl Check default zlib install dir
781 if test -n "${need_dash_r}"; then
782 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
783 else
784 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
785 fi
786 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
787 LIBS="$LIBS -lz"
788 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
789 [
790 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
791 ]
792 )
793 ]
794)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100795AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100796
797AC_ARG_WITH(zlib-version-check,
798 [ --without-zlib-version-check Disable zlib version check],
799 [ if test "x$withval" = "xno" ; then
800 zlib_check_nonfatal=1
801 fi
802 ]
803)
804
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000805AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000806AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000807#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100808#include <zlib.h>
809int main()
810{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000811 int a=0, b=0, c=0, d=0, n, v;
812 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
813 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100814 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000815 v = a*1000000 + b*10000 + c*100 + d;
816 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
817
818 /* 1.1.4 is OK */
819 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100820 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000821
Darren Tucker41097ed2005-07-25 15:24:21 +1000822 /* 1.2.3 and up are OK */
823 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000824 exit(0);
825
Darren Tucker2dcd2392004-01-23 17:13:33 +1100826 exit(2);
827}
Darren Tucker623d92f2004-09-12 22:36:15 +1000828 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000829 AC_MSG_RESULT(no),
830 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100831 if test -z "$zlib_check_nonfatal" ; then
832 AC_MSG_ERROR([*** zlib too old - check config.log ***
833Your reported zlib version has known security problems. It's possible your
834vendor has fixed these problems without changing the version number. If you
835are sure this is the case, you can disable the check by running
836"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000837If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000838See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100839 else
840 AC_MSG_WARN([zlib version may have security problems])
841 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000842 ],
843 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100844)
Damien Miller6f9c3372000-10-25 10:06:04 +1100845
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000846dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100847AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000848 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
849)
Damien Millera8e06ce2003-11-21 23:48:55 +1100850AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700851 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
852 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000853)
Damien Millerab18c411999-11-11 10:40:23 +1100854
Tim Ricee589a292001-11-03 11:09:32 -0800855dnl Checks for libutil functions
856AC_CHECK_HEADERS(libutil.h)
857AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
858AC_CHECK_FUNCS(logout updwtmp logwtmp)
859
Ben Lindstrom8697e082001-02-24 21:41:10 +0000860AC_FUNC_STRFTIME
861
Damien Miller3c027682001-03-14 11:39:45 +1100862# Check for ALTDIRFUNC glob() extension
863AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
864AC_EGREP_CPP(FOUNDIT,
865 [
866 #include <glob.h>
867 #ifdef GLOB_ALTDIRFUNC
868 FOUNDIT
869 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100870 ],
Damien Miller3c027682001-03-14 11:39:45 +1100871 [
872 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
873 AC_MSG_RESULT(yes)
874 ],
875 [
876 AC_MSG_RESULT(no)
877 ]
878)
Damien Millerab18c411999-11-11 10:40:23 +1100879
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000880# Check for g.gl_matchc glob() extension
881AC_MSG_CHECKING(for gl_matchc field in glob_t)
882AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100883 [
884 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000885 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100886 ],
887 [
888 AC_DEFINE(GLOB_HAS_GL_MATCHC)
889 AC_MSG_RESULT(yes)
890 ],
891 [
892 AC_MSG_RESULT(no)
893 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000894)
895
Damien Miller18bb4732001-03-28 14:35:30 +1000896AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000897AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000898 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000899#include <sys/types.h>
900#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700901int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000902 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100903 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000904 [
905 AC_MSG_RESULT(no)
906 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000907 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800908 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000909 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
910 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000911 ]
912)
913
Damien Miller36f49652004-08-15 18:40:59 +1000914AC_MSG_CHECKING([for /proc/pid/fd directory])
915if test -d "/proc/$$/fd" ; then
916 AC_DEFINE(HAVE_PROC_PID)
917 AC_MSG_RESULT(yes)
918else
919 AC_MSG_RESULT(no)
920fi
921
Damien Millerc547bf12001-02-16 10:18:12 +1100922# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100923SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100924AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100925 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100926 [
927 if test "x$withval" != "xno" ; then
928
929 if test "x$withval" != "xyes" ; then
930 CPPFLAGS="$CPPFLAGS -I${withval}/include"
931 LDFLAGS="$LDFLAGS -L${withval}/lib"
932 fi
933
934 AC_DEFINE(SKEY)
935 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100936 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800937
Tim Rice4cec93f2002-02-26 08:40:48 -0800938 AC_MSG_CHECKING([for s/key support])
939 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100940 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800941#include <stdio.h>
942#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700943int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800944 ],
945 [AC_MSG_RESULT(yes)],
946 [
947 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100948 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
949 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000950 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
951 AC_TRY_COMPILE(
952 [#include <stdio.h>
953 #include <skey.h>],
954 [(void)skeychallenge(NULL,"name","",0);],
955 [AC_MSG_RESULT(yes)
956 AC_DEFINE(SKEYCHALLENGE_4ARG)],
957 [AC_MSG_RESULT(no)]
958 )
Damien Millerc547bf12001-02-16 10:18:12 +1100959 fi
960 ]
961)
962
963# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700964TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100965AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100966 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100967 [
968 if test "x$withval" != "xno" ; then
969 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700970 saved_LDFLAGS="$LDFLAGS"
971 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800972 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800973 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700974 if test -d "${withval}/lib"; then
975 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700976 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700977 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700978 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700979 fi
980 else
981 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700982 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700983 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700984 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700985 fi
986 fi
987 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700988 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700989 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700990 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700991 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700992 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800993 LIBWRAP="-lwrap"
994 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100995 AC_MSG_CHECKING(for libwrap)
996 AC_TRY_LINK(
997 [
Damien Miller0ac45002004-04-14 20:14:26 +1000998#include <sys/types.h>
999#include <sys/socket.h>
1000#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001001#include <tcpd.h>
1002 int deny_severity = 0, allow_severity = 0;
1003 ],
1004 [hosts_access(0);],
1005 [
1006 AC_MSG_RESULT(yes)
1007 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -08001008 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001009 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001010 ],
1011 [
1012 AC_MSG_ERROR([*** libwrap missing])
1013 ]
1014 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001015 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001016 fi
1017 ]
1018)
1019
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001020# Check whether user wants libedit support
1021LIBEDIT_MSG="no"
1022AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001023 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001024 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001025 if test "x$withval" != "xyes"; then
1026 CPPFLAGS="$CPPFLAGS -I$withval/include"
1027 LDFLAGS="$LDFLAGS -L$withval/lib"
1028 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001029 AC_CHECK_LIB(edit, el_init,
1030 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
1031 LIBEDIT="-ledit -lcurses"
1032 LIBEDIT_MSG="yes"
1033 AC_SUBST(LIBEDIT)
1034 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001035 [ AC_MSG_ERROR(libedit not found) ],
1036 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001037 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001038 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001039 AC_COMPILE_IFELSE(
1040 [AC_LANG_SOURCE([[
1041#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001042int main(void)
1043{
1044 int i = H_SETSIZE;
1045 el_init("", NULL, NULL, NULL);
1046 exit(0);
1047}
Tim Ricec1819c82005-08-15 17:48:40 -07001048 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001049 [ AC_MSG_RESULT(yes) ],
1050 [ AC_MSG_RESULT(no)
1051 AC_MSG_ERROR(libedit version is not compatible) ]
1052 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001053 fi ]
1054)
1055
Darren Tuckerd9f88912005-02-20 21:01:48 +11001056AUDIT_MODULE=none
1057AC_ARG_WITH(audit,
1058 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1059 [
1060 AC_MSG_CHECKING(for supported audit module)
1061 case "$withval" in
1062 bsm)
1063 AC_MSG_RESULT(bsm)
1064 AUDIT_MODULE=bsm
1065 dnl Checks for headers, libs and functions
1066 AC_CHECK_HEADERS(bsm/audit.h, [],
1067 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1068 AC_CHECK_LIB(bsm, getaudit, [],
1069 [AC_MSG_ERROR(BSM enabled and required library not found)])
1070 AC_CHECK_FUNCS(getaudit, [],
1071 [AC_MSG_ERROR(BSM enabled and required function not found)])
1072 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001073 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001074 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
1075 ;;
1076 debug)
1077 AUDIT_MODULE=debug
1078 AC_MSG_RESULT(debug)
1079 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
1080 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001081 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001082 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001083 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001084 *)
1085 AC_MSG_ERROR([Unknown audit module $withval])
1086 ;;
1087 esac ]
1088)
1089
Damien Millerfe1f1432003-02-24 15:45:42 +11001090dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001091AC_CHECK_FUNCS( \
1092 arc4random \
1093 b64_ntop \
1094 __b64_ntop \
1095 b64_pton \
1096 __b64_pton \
1097 bcopy \
1098 bindresvport_sa \
1099 clock \
1100 closefrom \
1101 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001102 fchmod \
1103 fchown \
1104 freeaddrinfo \
1105 futimes \
1106 getaddrinfo \
1107 getcwd \
1108 getgrouplist \
1109 getnameinfo \
1110 getopt \
1111 getpeereid \
1112 _getpty \
1113 getrlimit \
1114 getttyent \
1115 glob \
1116 inet_aton \
1117 inet_ntoa \
1118 inet_ntop \
1119 innetgr \
1120 login_getcapbool \
1121 md5_crypt \
1122 memmove \
1123 mkdtemp \
1124 mmap \
1125 ngetaddrinfo \
1126 nsleep \
1127 ogetaddrinfo \
1128 openlog_r \
1129 openpty \
1130 prctl \
1131 pstat \
1132 readpassphrase \
1133 realpath \
1134 recvmsg \
1135 rresvport_af \
1136 sendmsg \
1137 setdtablesize \
1138 setegid \
1139 setenv \
1140 seteuid \
1141 setgroups \
1142 setlogin \
1143 setpcred \
1144 setproctitle \
1145 setregid \
1146 setreuid \
1147 setrlimit \
1148 setsid \
1149 setvbuf \
1150 sigaction \
1151 sigvec \
1152 snprintf \
1153 socketpair \
1154 strdup \
1155 strerror \
1156 strlcat \
1157 strlcpy \
1158 strmode \
1159 strnvis \
1160 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001161 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001162 strtoul \
1163 sysconf \
1164 tcgetpgrp \
1165 truncate \
1166 unsetenv \
1167 updwtmpx \
1168 utimes \
1169 vhangup \
1170 vsnprintf \
1171 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001172)
Tim Rice13aae5e2001-10-21 17:53:58 -07001173
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001174# IRIX has a const char return value for gai_strerror()
1175AC_CHECK_FUNCS(gai_strerror,[
1176 AC_DEFINE(HAVE_GAI_STRERROR)
1177 AC_TRY_COMPILE([
1178#include <sys/types.h>
1179#include <sys/socket.h>
1180#include <netdb.h>
1181
1182const char *gai_strerror(int);],[
1183char *str;
1184
1185str = gai_strerror(0);],[
1186 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1187 [Define if gai_strerror() returns const char *])])])
1188
Damien Millercd6853c2003-01-28 11:33:42 +11001189AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1190
Darren Tuckerf1159b52003-07-07 19:44:01 +10001191dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001192AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001193AC_CHECK_DECL(strsep,
1194 [AC_CHECK_FUNCS(strsep)],
1195 [],
1196 [
1197#ifdef HAVE_STRING_H
1198# include <string.h>
1199#endif
1200 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001201
Darren Tuckerb2427c82003-09-10 15:22:44 +10001202dnl tcsendbreak might be a macro
1203AC_CHECK_DECL(tcsendbreak,
1204 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001205 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001206 [#include <termios.h>]
1207)
1208
Darren Tucker5bb14002004-04-23 18:53:10 +10001209AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1210
Darren Tucker2a6b0292003-12-31 14:59:17 +11001211AC_CHECK_FUNCS(setresuid, [
1212 dnl Some platorms have setresuid that isn't implemented, test for this
1213 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001214 AC_RUN_IFELSE(
1215 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001216#include <stdlib.h>
1217#include <errno.h>
1218int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001219 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001220 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +11001221 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001222 AC_MSG_RESULT(not implemented)],
1223 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001224 )
1225])
Darren Tuckere937be32003-12-17 18:53:26 +11001226
Darren Tucker2a6b0292003-12-31 14:59:17 +11001227AC_CHECK_FUNCS(setresgid, [
1228 dnl Some platorms have setresgid that isn't implemented, test for this
1229 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001230 AC_RUN_IFELSE(
1231 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001232#include <stdlib.h>
1233#include <errno.h>
1234int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001235 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001236 [AC_MSG_RESULT(yes)],
1237 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001238 AC_MSG_RESULT(not implemented)],
1239 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001240 )
1241])
Darren Tuckere937be32003-12-17 18:53:26 +11001242
Damien Millerad833b32000-08-23 10:46:23 +10001243dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001244AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001245dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001246AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001247AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001248dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001249AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001250AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001251
Damien Millera8e06ce2003-11-21 23:48:55 +11001252AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001253 [AC_DEFINE(HAVE_DAEMON)],
1254 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1255)
1256
Damien Millera8e06ce2003-11-21 23:48:55 +11001257AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001258 [AC_DEFINE(HAVE_GETPAGESIZE)],
1259 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1260)
1261
Damien Millercb170cb2000-07-01 16:52:55 +10001262# Check for broken snprintf
1263if test "x$ac_cv_func_snprintf" = "xyes" ; then
1264 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001265 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001266 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001267#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001268int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001269 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001270 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001271 [
1272 AC_MSG_RESULT(no)
1273 AC_DEFINE(BROKEN_SNPRINTF)
1274 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001275 ],
1276 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001277 )
1278fi
1279
Damien Millerb4097182004-05-23 14:09:40 +10001280# Check for missing getpeereid (or equiv) support
1281NO_PEERCHECK=""
1282if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1283 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1284 AC_TRY_COMPILE(
1285 [#include <sys/types.h>
1286 #include <sys/socket.h>],
1287 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001288 [ AC_MSG_RESULT(yes)
1289 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1290 ],
Damien Millerb4097182004-05-23 14:09:40 +10001291 [AC_MSG_RESULT(no)
1292 NO_PEERCHECK=1]
1293 )
1294fi
1295
Damien Millere8328192003-01-07 15:18:32 +11001296dnl see whether mkstemp() requires XXXXXX
1297if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1298AC_MSG_CHECKING([for (overly) strict mkstemp])
1299AC_TRY_RUN(
1300 [
1301#include <stdlib.h>
1302main() { char template[]="conftest.mkstemp-test";
1303if (mkstemp(template) == -1)
1304 exit(1);
1305unlink(template); exit(0);
1306}
1307 ],
1308 [
1309 AC_MSG_RESULT(no)
1310 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001311 [
Damien Millere8328192003-01-07 15:18:32 +11001312 AC_MSG_RESULT(yes)
1313 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1314 ],
1315 [
1316 AC_MSG_RESULT(yes)
1317 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001318 ]
Damien Millere8328192003-01-07 15:18:32 +11001319)
1320fi
1321
Darren Tucker70a3d552003-08-21 17:58:29 +10001322dnl make sure that openpty does not reacquire controlling terminal
1323if test ! -z "$check_for_openpty_ctty_bug"; then
1324 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1325 AC_TRY_RUN(
1326 [
1327#include <stdio.h>
1328#include <sys/fcntl.h>
1329#include <sys/types.h>
1330#include <sys/wait.h>
1331
1332int
1333main()
1334{
1335 pid_t pid;
1336 int fd, ptyfd, ttyfd, status;
1337
1338 pid = fork();
1339 if (pid < 0) { /* failed */
1340 exit(1);
1341 } else if (pid > 0) { /* parent */
1342 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001343 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001344 exit(WEXITSTATUS(status));
1345 else
1346 exit(2);
1347 } else { /* child */
1348 close(0); close(1); close(2);
1349 setsid();
1350 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1351 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1352 if (fd >= 0)
1353 exit(3); /* Acquired ctty: broken */
1354 else
1355 exit(0); /* Did not acquire ctty: OK */
1356 }
1357}
1358 ],
1359 [
1360 AC_MSG_RESULT(yes)
1361 ],
1362 [
1363 AC_MSG_RESULT(no)
1364 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1365 ]
1366 )
1367fi
1368
Tim Rice8bb561b2005-03-17 16:23:19 -08001369if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1370 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001371 AC_MSG_CHECKING(if getaddrinfo seems to work)
1372 AC_TRY_RUN(
1373 [
1374#include <stdio.h>
1375#include <sys/socket.h>
1376#include <netdb.h>
1377#include <errno.h>
1378#include <netinet/in.h>
1379
1380#define TEST_PORT "2222"
1381
1382int
1383main(void)
1384{
1385 int err, sock;
1386 struct addrinfo *gai_ai, *ai, hints;
1387 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1388
1389 memset(&hints, 0, sizeof(hints));
1390 hints.ai_family = PF_UNSPEC;
1391 hints.ai_socktype = SOCK_STREAM;
1392 hints.ai_flags = AI_PASSIVE;
1393
1394 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1395 if (err != 0) {
1396 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1397 exit(1);
1398 }
1399
1400 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1401 if (ai->ai_family != AF_INET6)
1402 continue;
1403
1404 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1405 sizeof(ntop), strport, sizeof(strport),
1406 NI_NUMERICHOST|NI_NUMERICSERV);
1407
1408 if (err != 0) {
1409 if (err == EAI_SYSTEM)
1410 perror("getnameinfo EAI_SYSTEM");
1411 else
1412 fprintf(stderr, "getnameinfo failed: %s\n",
1413 gai_strerror(err));
1414 exit(2);
1415 }
1416
1417 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1418 if (sock < 0)
1419 perror("socket");
1420 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1421 if (errno == EBADF)
1422 exit(3);
1423 }
1424 }
1425 exit(0);
1426}
1427 ],
1428 [
1429 AC_MSG_RESULT(yes)
1430 ],
1431 [
1432 AC_MSG_RESULT(no)
1433 AC_DEFINE(BROKEN_GETADDRINFO)
1434 ]
1435 )
1436fi
1437
Tim Rice8bb561b2005-03-17 16:23:19 -08001438if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1439 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001440 AC_MSG_CHECKING(if getaddrinfo seems to work)
1441 AC_TRY_RUN(
1442 [
1443#include <stdio.h>
1444#include <sys/socket.h>
1445#include <netdb.h>
1446#include <errno.h>
1447#include <netinet/in.h>
1448
1449#define TEST_PORT "2222"
1450
1451int
1452main(void)
1453{
1454 int err, sock;
1455 struct addrinfo *gai_ai, *ai, hints;
1456 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1457
1458 memset(&hints, 0, sizeof(hints));
1459 hints.ai_family = PF_UNSPEC;
1460 hints.ai_socktype = SOCK_STREAM;
1461 hints.ai_flags = AI_PASSIVE;
1462
1463 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1464 if (err != 0) {
1465 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1466 exit(1);
1467 }
1468
1469 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1470 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1471 continue;
1472
1473 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1474 sizeof(ntop), strport, sizeof(strport),
1475 NI_NUMERICHOST|NI_NUMERICSERV);
1476
1477 if (ai->ai_family == AF_INET && err != 0) {
1478 perror("getnameinfo");
1479 exit(2);
1480 }
1481 }
1482 exit(0);
1483}
1484 ],
1485 [
1486 AC_MSG_RESULT(yes)
1487 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1488[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1489 ],
1490 [
1491 AC_MSG_RESULT(no)
1492 AC_DEFINE(BROKEN_GETADDRINFO)
1493 ]
1494 )
1495fi
1496
Darren Tuckera56f1912004-11-02 20:30:54 +11001497if test "x$check_for_conflicting_getspnam" = "x1"; then
1498 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1499 AC_COMPILE_IFELSE(
1500 [
1501#include <shadow.h>
1502int main(void) {exit(0);}
1503 ],
1504 [
1505 AC_MSG_RESULT(no)
1506 ],
1507 [
1508 AC_MSG_RESULT(yes)
1509 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1510 [Conflicting defs for getspnam])
1511 ]
1512 )
1513fi
1514
Damien Miller606f8802000-09-16 15:39:56 +11001515AC_FUNC_GETPGRP
1516
Damien Millera64b57a2001-01-17 10:44:13 +11001517# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001518PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001519AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001520 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001521 [
Damien Millera64b57a2001-01-17 10:44:13 +11001522 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001523 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1524 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001525 AC_MSG_ERROR([PAM headers not found])
1526 fi
1527
1528 AC_CHECK_LIB(dl, dlopen, , )
1529 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1530 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001531 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001532
Damien Millera64b57a2001-01-17 10:44:13 +11001533 PAM_MSG="yes"
1534
1535 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001536 if test $ac_cv_lib_dl_dlopen = yes; then
1537 LIBPAM="-lpam -ldl"
1538 else
1539 LIBPAM="-lpam"
1540 fi
1541 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001542 fi
1543 ]
1544)
Damien Millera22ba012000-03-02 23:09:20 +11001545
Damien Millera64b57a2001-01-17 10:44:13 +11001546# Check for older PAM
1547if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001548 # Check PAM strerror arguments (old PAM)
1549 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1550 AC_TRY_COMPILE(
1551 [
Damien Miller81171112000-04-23 11:14:01 +10001552#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001553#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001554#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001555#elif defined (HAVE_PAM_PAM_APPL_H)
1556#include <pam/pam_appl.h>
1557#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001558 ],
1559 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001560 [AC_MSG_RESULT(no)],
1561 [
1562 AC_DEFINE(HAVE_OLD_PAM)
1563 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001564 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001565 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001566 )
Damien Millera22ba012000-03-02 23:09:20 +11001567fi
1568
Tim Riceaef73712002-05-11 13:17:42 -07001569# Search for OpenSSL
1570saved_CPPFLAGS="$CPPFLAGS"
1571saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001572AC_ARG_WITH(ssl-dir,
1573 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1574 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001575 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001576 case "$withval" in
1577 # Relative paths
1578 ./*|../*) withval="`pwd`/$withval"
1579 esac
Tim Riceaef73712002-05-11 13:17:42 -07001580 if test -d "$withval/lib"; then
1581 if test -n "${need_dash_r}"; then
1582 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1583 else
1584 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1585 fi
1586 else
1587 if test -n "${need_dash_r}"; then
1588 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1589 else
1590 LDFLAGS="-L${withval} ${LDFLAGS}"
1591 fi
1592 fi
1593 if test -d "$withval/include"; then
1594 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1595 else
1596 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1597 fi
Damien Millera22ba012000-03-02 23:09:20 +11001598 fi
1599 ]
1600)
Tim Rice3d5352e2004-02-12 09:27:21 -08001601LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001602AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001603 [
Tim Riceaef73712002-05-11 13:17:42 -07001604 dnl Check default openssl install dir
1605 if test -n "${need_dash_r}"; then
1606 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001607 else
Tim Riceaef73712002-05-11 13:17:42 -07001608 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001609 fi
Tim Riceaef73712002-05-11 13:17:42 -07001610 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1611 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1612 [
1613 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1614 ]
1615 )
1616 ]
1617)
1618
Tim Riced730b782002-08-13 18:52:10 -07001619# Determine OpenSSL header version
1620AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001621AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001622 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001623#include <stdio.h>
1624#include <string.h>
1625#include <openssl/opensslv.h>
1626#define DATA "conftest.sslincver"
1627int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001628 FILE *fd;
1629 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001630
Damien Millera8e06ce2003-11-21 23:48:55 +11001631 fd = fopen(DATA,"w");
1632 if(fd == NULL)
1633 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001634
1635 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1636 exit(1);
1637
1638 exit(0);
1639}
Darren Tucker623d92f2004-09-12 22:36:15 +10001640 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001641 [
1642 ssl_header_ver=`cat conftest.sslincver`
1643 AC_MSG_RESULT($ssl_header_ver)
1644 ],
1645 [
1646 AC_MSG_RESULT(not found)
1647 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001648 ],
1649 [
1650 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001651 ]
1652)
1653
1654# Determine OpenSSL library version
1655AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001656AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001657 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001658#include <stdio.h>
1659#include <string.h>
1660#include <openssl/opensslv.h>
1661#include <openssl/crypto.h>
1662#define DATA "conftest.ssllibver"
1663int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001664 FILE *fd;
1665 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001666
Damien Millera8e06ce2003-11-21 23:48:55 +11001667 fd = fopen(DATA,"w");
1668 if(fd == NULL)
1669 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001670
1671 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1672 exit(1);
1673
1674 exit(0);
1675}
Darren Tucker623d92f2004-09-12 22:36:15 +10001676 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001677 [
1678 ssl_library_ver=`cat conftest.ssllibver`
1679 AC_MSG_RESULT($ssl_library_ver)
1680 ],
1681 [
1682 AC_MSG_RESULT(not found)
1683 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001684 ],
1685 [
1686 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001687 ]
1688)
Damien Millera22ba012000-03-02 23:09:20 +11001689
Damien Millerec932372002-01-22 22:16:03 +11001690# Sanity check OpenSSL headers
1691AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001692AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001693 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001694#include <string.h>
1695#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001696int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001697 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001698 [
1699 AC_MSG_RESULT(yes)
1700 ],
1701 [
1702 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001703 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1704Check config.log for details.
1705Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001706 ],
1707 [
1708 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001709 ]
1710)
1711
Tim Rice3d5352e2004-02-12 09:27:21 -08001712# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1713# because the system crypt() is more featureful.
1714if test "x$check_for_libcrypt_before" = "x1"; then
1715 AC_CHECK_LIB(crypt, crypt)
1716fi
1717
Damien Millera8e06ce2003-11-21 23:48:55 +11001718# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001719# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001720if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001721 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001722fi
1723
Damien Miller6c21c512002-01-22 21:57:53 +11001724
1725### Configure cryptographic random number support
1726
1727# Check wheter OpenSSL seeds itself
1728AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001729AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001730 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001731#include <string.h>
1732#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001733int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001734 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001735 [
1736 OPENSSL_SEEDS_ITSELF=yes
1737 AC_MSG_RESULT(yes)
1738 ],
1739 [
1740 AC_MSG_RESULT(no)
1741 # Default to use of the rand helper if OpenSSL doesn't
1742 # seed itself
1743 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001744 ],
1745 [
1746 AC_MSG_WARN([cross compiling: assuming yes])
1747 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001748 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001749 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001750 ]
1751)
1752
1753
1754# Do we want to force the use of the rand helper?
1755AC_ARG_WITH(rand-helper,
1756 [ --with-rand-helper Use subprocess to gather strong randomness ],
1757 [
1758 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001759 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001760 # the previous test showed it to be unseeded.
1761 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1762 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1763 OPENSSL_SEEDS_ITSELF=yes
1764 USE_RAND_HELPER=""
1765 fi
1766 else
1767 USE_RAND_HELPER=yes
1768 fi
1769 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001770)
Damien Miller6c21c512002-01-22 21:57:53 +11001771
1772# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001773if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001774 # OpenSSL only
1775 AC_DEFINE(OPENSSL_PRNG_ONLY)
1776 RAND_MSG="OpenSSL internal ONLY"
1777 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001778elif test ! -z "$USE_RAND_HELPER" ; then
1779 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001780 RAND_MSG="ssh-rand-helper"
1781 INSTALL_SSH_RAND_HELPER="yes"
1782fi
1783AC_SUBST(INSTALL_SSH_RAND_HELPER)
1784
1785### Configuration of ssh-rand-helper
1786
1787# PRNGD TCP socket
1788AC_ARG_WITH(prngd-port,
1789 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1790 [
Damien Millere996d722002-01-23 11:20:59 +11001791 case "$withval" in
1792 no)
1793 withval=""
1794 ;;
1795 [[0-9]]*)
1796 ;;
1797 *)
1798 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1799 ;;
1800 esac
1801 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001802 PRNGD_PORT="$withval"
1803 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1804 fi
1805 ]
1806)
1807
1808# PRNGD Unix domain socket
1809AC_ARG_WITH(prngd-socket,
1810 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1811 [
Damien Millere996d722002-01-23 11:20:59 +11001812 case "$withval" in
1813 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001814 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001815 ;;
1816 no)
1817 withval=""
1818 ;;
1819 /*)
1820 ;;
1821 *)
1822 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1823 ;;
1824 esac
1825
1826 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001827 if test ! -z "$PRNGD_PORT" ; then
1828 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1829 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001830 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001831 AC_MSG_WARN(Entropy socket is not readable)
1832 fi
1833 PRNGD_SOCKET="$withval"
1834 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1835 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001836 ],
1837 [
1838 # Check for existing socket only if we don't have a random device already
1839 if test "$USE_RAND_HELPER" = yes ; then
1840 AC_MSG_CHECKING(for PRNGD/EGD socket)
1841 # Insert other locations here
1842 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1843 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1844 PRNGD_SOCKET="$sock"
1845 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1846 break;
1847 fi
1848 done
1849 if test ! -z "$PRNGD_SOCKET" ; then
1850 AC_MSG_RESULT($PRNGD_SOCKET)
1851 else
1852 AC_MSG_RESULT(not found)
1853 fi
1854 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001855 ]
1856)
1857
1858# Change default command timeout for hashing entropy source
1859entropy_timeout=200
1860AC_ARG_WITH(entropy-timeout,
1861 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1862 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001863 if test -n "$withval" && test "x$withval" != "xno" && \
1864 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001865 entropy_timeout=$withval
1866 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001867 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001868)
Damien Miller6c21c512002-01-22 21:57:53 +11001869AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1870
Damien Millerd3f6ad22002-06-25 10:24:47 +10001871SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001872AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001873 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001874 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001875 if test -n "$withval" && test "x$withval" != "xno" && \
1876 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001877 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001878 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001879 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001880)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001881AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1882AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001883
Tim Rice88f2ab52002-03-17 12:17:34 -08001884# We do this little dance with the search path to insure
1885# that programs that we select for use by installed programs
1886# (which may be run by the super-user) come from trusted
1887# locations before they come from the user's private area.
1888# This should help avoid accidentally configuring some
1889# random version of a program in someone's personal bin.
1890
1891OPATH=$PATH
1892PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001893test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001894test -d /sbin && PATH=$PATH:/sbin
1895test -d /usr/sbin && PATH=$PATH:/usr/sbin
1896PATH=$PATH:/etc:$OPATH
1897
Damien Millera8e06ce2003-11-21 23:48:55 +11001898# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001899OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1900OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1901OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1902OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1903OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1904OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1905OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1906OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1907OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1908OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1909OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1910OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1911OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1912OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1913OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1914OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001915# restore PATH
1916PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001917
1918# Where does ssh-rand-helper get its randomness from?
1919INSTALL_SSH_PRNG_CMDS=""
1920if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1921 if test ! -z "$PRNGD_PORT" ; then
1922 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1923 elif test ! -z "$PRNGD_SOCKET" ; then
1924 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1925 else
1926 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1927 RAND_HELPER_CMDHASH=yes
1928 INSTALL_SSH_PRNG_CMDS="yes"
1929 fi
1930fi
1931AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1932
1933
Ben Lindstromb5628642000-10-18 00:02:25 +00001934# Cheap hack to ensure NEWS-OS libraries are arranged right.
1935if test ! -z "$SONY" ; then
1936 LIBS="$LIBS -liberty";
1937fi
1938
Damien Millera22ba012000-03-02 23:09:20 +11001939# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001940AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001941AC_CHECK_SIZEOF(short int, 2)
1942AC_CHECK_SIZEOF(int, 4)
1943AC_CHECK_SIZEOF(long int, 4)
1944AC_CHECK_SIZEOF(long long int, 8)
1945
Damien Millerfa2bb692002-04-23 23:22:25 +10001946# Sanity check long long for some platforms (AIX)
1947if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1948 ac_cv_sizeof_long_long_int=0
1949fi
1950
Damien Millera22ba012000-03-02 23:09:20 +11001951# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001952AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1953 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001954 [ #include <sys/types.h> ],
1955 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001956 [ ac_cv_have_u_int="yes" ],
1957 [ ac_cv_have_u_int="no" ]
1958 )
1959])
1960if test "x$ac_cv_have_u_int" = "xyes" ; then
1961 AC_DEFINE(HAVE_U_INT)
1962 have_u_int=1
1963fi
1964
Damien Miller61e50f12000-05-08 20:49:37 +10001965AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1966 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001967 [ #include <sys/types.h> ],
1968 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001969 [ ac_cv_have_intxx_t="yes" ],
1970 [ ac_cv_have_intxx_t="no" ]
1971 )
1972])
1973if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1974 AC_DEFINE(HAVE_INTXX_T)
1975 have_intxx_t=1
1976fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001977
1978if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001979 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001980then
1981 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1982 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001983 [ #include <stdint.h> ],
1984 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001985 [
1986 AC_DEFINE(HAVE_INTXX_T)
1987 AC_MSG_RESULT(yes)
1988 ],
1989 [ AC_MSG_RESULT(no) ]
1990 )
1991fi
1992
Damien Miller578783e2000-09-23 14:12:24 +11001993AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1994 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001995 [
1996#include <sys/types.h>
1997#ifdef HAVE_STDINT_H
1998# include <stdint.h>
1999#endif
2000#include <sys/socket.h>
2001#ifdef HAVE_SYS_BITYPES_H
2002# include <sys/bitypes.h>
2003#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002004 ],
2005 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002006 [ ac_cv_have_int64_t="yes" ],
2007 [ ac_cv_have_int64_t="no" ]
2008 )
2009])
2010if test "x$ac_cv_have_int64_t" = "xyes" ; then
2011 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08002012fi
2013
Damien Miller61e50f12000-05-08 20:49:37 +10002014AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2015 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002016 [ #include <sys/types.h> ],
2017 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002018 [ ac_cv_have_u_intxx_t="yes" ],
2019 [ ac_cv_have_u_intxx_t="no" ]
2020 )
2021])
2022if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2023 AC_DEFINE(HAVE_U_INTXX_T)
2024 have_u_intxx_t=1
2025fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002026
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002027if test -z "$have_u_intxx_t" ; then
2028 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2029 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002030 [ #include <sys/socket.h> ],
2031 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002032 [
2033 AC_DEFINE(HAVE_U_INTXX_T)
2034 AC_MSG_RESULT(yes)
2035 ],
2036 [ AC_MSG_RESULT(no) ]
2037 )
2038fi
2039
Damien Miller578783e2000-09-23 14:12:24 +11002040AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2041 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002042 [ #include <sys/types.h> ],
2043 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002044 [ ac_cv_have_u_int64_t="yes" ],
2045 [ ac_cv_have_u_int64_t="no" ]
2046 )
2047])
2048if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2049 AC_DEFINE(HAVE_U_INT64_T)
2050 have_u_int64_t=1
2051fi
2052
Tim Rice4cec93f2002-02-26 08:40:48 -08002053if test -z "$have_u_int64_t" ; then
2054 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2055 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002056 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002057 [ u_int64_t a; a = 1],
2058 [
2059 AC_DEFINE(HAVE_U_INT64_T)
2060 AC_MSG_RESULT(yes)
2061 ],
2062 [ AC_MSG_RESULT(no) ]
2063 )
2064fi
2065
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002066if test -z "$have_u_intxx_t" ; then
2067 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2068 AC_TRY_COMPILE(
2069 [
2070#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002071 ],
2072 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002073 [ ac_cv_have_uintxx_t="yes" ],
2074 [ ac_cv_have_uintxx_t="no" ]
2075 )
2076 ])
2077 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2078 AC_DEFINE(HAVE_UINTXX_T)
2079 fi
2080fi
2081
2082if test -z "$have_uintxx_t" ; then
2083 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2084 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002085 [ #include <stdint.h> ],
2086 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002087 [
2088 AC_DEFINE(HAVE_UINTXX_T)
2089 AC_MSG_RESULT(yes)
2090 ],
2091 [ AC_MSG_RESULT(no) ]
2092 )
2093fi
2094
Damien Milleredb82922000-06-20 13:25:52 +10002095if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002096 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002097then
2098 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2099 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002100 [
2101#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002102 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002103 [
Damien Miller70494d12000-04-03 15:57:06 +10002104 int8_t a; int16_t b; int32_t c;
2105 u_int8_t e; u_int16_t f; u_int32_t g;
2106 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002107 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002108 [
2109 AC_DEFINE(HAVE_U_INTXX_T)
2110 AC_DEFINE(HAVE_INTXX_T)
2111 AC_MSG_RESULT(yes)
2112 ],
2113 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002114 )
Damien Millerb29ea912000-01-15 14:12:03 +11002115fi
2116
Damien Miller58be7382001-09-15 21:31:54 +10002117
2118AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2119 AC_TRY_COMPILE(
2120 [
2121#include <sys/types.h>
2122 ],
2123 [ u_char foo; foo = 125; ],
2124 [ ac_cv_have_u_char="yes" ],
2125 [ ac_cv_have_u_char="no" ]
2126 )
2127])
2128if test "x$ac_cv_have_u_char" = "xyes" ; then
2129 AC_DEFINE(HAVE_U_CHAR)
2130fi
2131
Tim Rice13aae5e2001-10-21 17:53:58 -07002132TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002133
Tim Rice200a5c02002-02-26 22:12:34 -08002134AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002135
Damien Miller848b9932005-02-24 12:12:34 +11002136AC_CHECK_TYPES(in_addr_t,,,
2137[#include <sys/types.h>
2138#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002139
Damien Miller61e50f12000-05-08 20:49:37 +10002140AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2141 AC_TRY_COMPILE(
2142 [
2143#include <sys/types.h>
2144 ],
2145 [ size_t foo; foo = 1235; ],
2146 [ ac_cv_have_size_t="yes" ],
2147 [ ac_cv_have_size_t="no" ]
2148 )
2149])
2150if test "x$ac_cv_have_size_t" = "xyes" ; then
2151 AC_DEFINE(HAVE_SIZE_T)
2152fi
Damien Miller95058511999-12-29 10:36:45 +11002153
Damien Miller615f9392000-05-17 22:53:33 +10002154AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2155 AC_TRY_COMPILE(
2156 [
2157#include <sys/types.h>
2158 ],
2159 [ ssize_t foo; foo = 1235; ],
2160 [ ac_cv_have_ssize_t="yes" ],
2161 [ ac_cv_have_ssize_t="no" ]
2162 )
2163])
2164if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2165 AC_DEFINE(HAVE_SSIZE_T)
2166fi
2167
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002168AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2169 AC_TRY_COMPILE(
2170 [
2171#include <time.h>
2172 ],
2173 [ clock_t foo; foo = 1235; ],
2174 [ ac_cv_have_clock_t="yes" ],
2175 [ ac_cv_have_clock_t="no" ]
2176 )
2177])
2178if test "x$ac_cv_have_clock_t" = "xyes" ; then
2179 AC_DEFINE(HAVE_CLOCK_T)
2180fi
2181
Damien Millerb54b40e2000-06-23 08:23:34 +10002182AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2183 AC_TRY_COMPILE(
2184 [
2185#include <sys/types.h>
2186#include <sys/socket.h>
2187 ],
2188 [ sa_family_t foo; foo = 1235; ],
2189 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002190 [ AC_TRY_COMPILE(
2191 [
2192#include <sys/types.h>
2193#include <sys/socket.h>
2194#include <netinet/in.h>
2195 ],
2196 [ sa_family_t foo; foo = 1235; ],
2197 [ ac_cv_have_sa_family_t="yes" ],
2198
Damien Millerb54b40e2000-06-23 08:23:34 +10002199 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002200 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002201 )
2202])
2203if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2204 AC_DEFINE(HAVE_SA_FAMILY_T)
2205fi
2206
Damien Miller0f91b4e2000-06-18 15:43:25 +10002207AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2208 AC_TRY_COMPILE(
2209 [
2210#include <sys/types.h>
2211 ],
2212 [ pid_t foo; foo = 1235; ],
2213 [ ac_cv_have_pid_t="yes" ],
2214 [ ac_cv_have_pid_t="no" ]
2215 )
2216])
2217if test "x$ac_cv_have_pid_t" = "xyes" ; then
2218 AC_DEFINE(HAVE_PID_T)
2219fi
2220
2221AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2222 AC_TRY_COMPILE(
2223 [
2224#include <sys/types.h>
2225 ],
2226 [ mode_t foo; foo = 1235; ],
2227 [ ac_cv_have_mode_t="yes" ],
2228 [ ac_cv_have_mode_t="no" ]
2229 )
2230])
2231if test "x$ac_cv_have_mode_t" = "xyes" ; then
2232 AC_DEFINE(HAVE_MODE_T)
2233fi
2234
Damien Miller61e50f12000-05-08 20:49:37 +10002235
2236AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2237 AC_TRY_COMPILE(
2238 [
Damien Miller81171112000-04-23 11:14:01 +10002239#include <sys/types.h>
2240#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002241 ],
2242 [ struct sockaddr_storage s; ],
2243 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2244 [ ac_cv_have_struct_sockaddr_storage="no" ]
2245 )
2246])
2247if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2248 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2249fi
Damien Miller34132e52000-01-14 15:45:46 +11002250
Damien Miller61e50f12000-05-08 20:49:37 +10002251AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2252 AC_TRY_COMPILE(
2253 [
Damien Miller7b22d652000-06-18 14:07:04 +10002254#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002255#include <netinet/in.h>
2256 ],
2257 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2258 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2259 [ ac_cv_have_struct_sockaddr_in6="no" ]
2260 )
2261])
2262if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2263 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2264fi
Damien Miller34132e52000-01-14 15:45:46 +11002265
Damien Miller61e50f12000-05-08 20:49:37 +10002266AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2267 AC_TRY_COMPILE(
2268 [
Damien Miller7b22d652000-06-18 14:07:04 +10002269#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002270#include <netinet/in.h>
2271 ],
2272 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2273 [ ac_cv_have_struct_in6_addr="yes" ],
2274 [ ac_cv_have_struct_in6_addr="no" ]
2275 )
2276])
2277if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2278 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2279fi
Damien Miller34132e52000-01-14 15:45:46 +11002280
Damien Miller61e50f12000-05-08 20:49:37 +10002281AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2282 AC_TRY_COMPILE(
2283 [
Damien Miller81171112000-04-23 11:14:01 +10002284#include <sys/types.h>
2285#include <sys/socket.h>
2286#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002287 ],
2288 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2289 [ ac_cv_have_struct_addrinfo="yes" ],
2290 [ ac_cv_have_struct_addrinfo="no" ]
2291 )
2292])
2293if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2294 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2295fi
2296
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002297AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2298 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002299 [ #include <sys/time.h> ],
2300 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002301 [ ac_cv_have_struct_timeval="yes" ],
2302 [ ac_cv_have_struct_timeval="no" ]
2303 )
2304])
2305if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2306 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2307 have_struct_timeval=1
2308fi
2309
Tim Rice4e4dc562003-03-18 10:21:40 -08002310AC_CHECK_TYPES(struct timespec)
2311
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002312# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002313if test "x$ac_cv_have_int64_t" = "xno" && \
2314 test "x$ac_cv_sizeof_long_int" != "x8" && \
2315 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002316 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2317 echo "an alternative compiler (I.E., GCC) before continuing."
2318 echo ""
2319 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002320else
2321dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002322 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002323 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002324#include <stdio.h>
2325#include <string.h>
2326#ifdef HAVE_SNPRINTF
2327main()
2328{
2329 char buf[50];
2330 char expected_out[50];
2331 int mazsize = 50 ;
2332#if (SIZEOF_LONG_INT == 8)
2333 long int num = 0x7fffffffffffffff;
2334#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002335 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002336#endif
2337 strcpy(expected_out, "9223372036854775807");
2338 snprintf(buf, mazsize, "%lld", num);
2339 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002340 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002341 exit(0);
2342}
2343#else
2344main() { exit(0); }
2345#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002346 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002347 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002348 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002349fi
2350
Damien Miller78315eb2000-09-29 23:01:36 +11002351dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002352OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2353OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2354OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2355OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2356OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002357OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002358OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2359OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002360OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002361OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2362OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2363OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2364OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002365OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2366OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2367OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2368OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002369
2370AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002371
Damien Miller61e50f12000-05-08 20:49:37 +10002372AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2373 ac_cv_have_ss_family_in_struct_ss, [
2374 AC_TRY_COMPILE(
2375 [
Damien Miller81171112000-04-23 11:14:01 +10002376#include <sys/types.h>
2377#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002378 ],
2379 [ struct sockaddr_storage s; s.ss_family = 1; ],
2380 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2381 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2382 )
2383])
2384if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2385 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2386fi
2387
Damien Miller61e50f12000-05-08 20:49:37 +10002388AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2389 ac_cv_have___ss_family_in_struct_ss, [
2390 AC_TRY_COMPILE(
2391 [
Damien Miller81171112000-04-23 11:14:01 +10002392#include <sys/types.h>
2393#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002394 ],
2395 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2396 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2397 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2398 )
2399])
2400if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2401 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2402fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002403
Damien Millerad833b32000-08-23 10:46:23 +10002404AC_CACHE_CHECK([for pw_class field in struct passwd],
2405 ac_cv_have_pw_class_in_struct_passwd, [
2406 AC_TRY_COMPILE(
2407 [
Damien Millerad833b32000-08-23 10:46:23 +10002408#include <pwd.h>
2409 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002410 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002411 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2412 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2413 )
2414])
2415if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2416 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2417fi
2418
Kevin Steves82456952001-06-22 21:14:18 +00002419AC_CACHE_CHECK([for pw_expire field in struct passwd],
2420 ac_cv_have_pw_expire_in_struct_passwd, [
2421 AC_TRY_COMPILE(
2422 [
2423#include <pwd.h>
2424 ],
2425 [ struct passwd p; p.pw_expire = 0; ],
2426 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2427 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2428 )
2429])
2430if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2431 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2432fi
2433
2434AC_CACHE_CHECK([for pw_change field in struct passwd],
2435 ac_cv_have_pw_change_in_struct_passwd, [
2436 AC_TRY_COMPILE(
2437 [
2438#include <pwd.h>
2439 ],
2440 [ struct passwd p; p.pw_change = 0; ],
2441 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2442 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2443 )
2444])
2445if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2446 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2447fi
Damien Miller61e50f12000-05-08 20:49:37 +10002448
Tim Rice28bbb0c2002-05-27 17:37:32 -07002449dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002450AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2451 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002452 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002453 [
Tim Riceae49fe62002-04-12 10:26:21 -07002454#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002455#include <sys/socket.h>
2456#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002457int main() {
2458#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002459#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002460exit(1);
2461#endif
2462struct msghdr m;
2463m.msg_accrights = 0;
2464exit(0);
2465}
Kevin Steves939c9db2002-03-22 17:23:25 +00002466 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002467 [ ac_cv_have_accrights_in_msghdr="yes" ],
2468 [ ac_cv_have_accrights_in_msghdr="no" ]
2469 )
2470])
2471if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2472 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2473fi
2474
Kevin Stevesa44e0352002-04-07 16:18:03 +00002475AC_CACHE_CHECK([for msg_control field in struct msghdr],
2476 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002477 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002478 [
Tim Riceae49fe62002-04-12 10:26:21 -07002479#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002480#include <sys/socket.h>
2481#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002482int main() {
2483#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002484#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002485exit(1);
2486#endif
2487struct msghdr m;
2488m.msg_control = 0;
2489exit(0);
2490}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002491 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002492 [ ac_cv_have_control_in_msghdr="yes" ],
2493 [ ac_cv_have_control_in_msghdr="no" ]
2494 )
2495])
2496if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2497 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2498fi
2499
Damien Miller61e50f12000-05-08 20:49:37 +10002500AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002501 AC_TRY_LINK([],
2502 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002503 [ ac_cv_libc_defines___progname="yes" ],
2504 [ ac_cv_libc_defines___progname="no" ]
2505 )
2506])
2507if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2508 AC_DEFINE(HAVE___PROGNAME)
2509fi
2510
Kevin Steves4846f4a2002-03-22 18:19:53 +00002511AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2512 AC_TRY_LINK([
2513#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002514],
2515 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002516 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2517 [ ac_cv_cc_implements___FUNCTION__="no" ]
2518 )
2519])
2520if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2521 AC_DEFINE(HAVE___FUNCTION__)
2522fi
2523
2524AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2525 AC_TRY_LINK([
2526#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002527],
2528 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002529 [ ac_cv_cc_implements___func__="yes" ],
2530 [ ac_cv_cc_implements___func__="no" ]
2531 )
2532])
2533if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2534 AC_DEFINE(HAVE___func__)
2535fi
2536
Damien Miller4f8e6692001-07-14 13:22:53 +10002537AC_CACHE_CHECK([whether getopt has optreset support],
2538 ac_cv_have_getopt_optreset, [
2539 AC_TRY_LINK(
2540 [
2541#include <getopt.h>
2542 ],
2543 [ extern int optreset; optreset = 0; ],
2544 [ ac_cv_have_getopt_optreset="yes" ],
2545 [ ac_cv_have_getopt_optreset="no" ]
2546 )
2547])
2548if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2549 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2550fi
Damien Millera22ba012000-03-02 23:09:20 +11002551
Damien Millerecbb26d2000-07-15 14:59:14 +10002552AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002553 AC_TRY_LINK([],
2554 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002555 [ ac_cv_libc_defines_sys_errlist="yes" ],
2556 [ ac_cv_libc_defines_sys_errlist="no" ]
2557 )
2558])
2559if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2560 AC_DEFINE(HAVE_SYS_ERRLIST)
2561fi
2562
2563
Damien Miller11fa2cc2000-08-16 10:35:58 +10002564AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002565 AC_TRY_LINK([],
2566 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002567 [ ac_cv_libc_defines_sys_nerr="yes" ],
2568 [ ac_cv_libc_defines_sys_nerr="no" ]
2569 )
2570])
2571if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2572 AC_DEFINE(HAVE_SYS_NERR)
2573fi
2574
Damien Millera8e06ce2003-11-21 23:48:55 +11002575SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002576# Check whether user wants sectok support
2577AC_ARG_WITH(sectok,
2578 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002579 [
2580 if test "x$withval" != "xno" ; then
2581 if test "x$withval" != "xyes" ; then
2582 CPPFLAGS="$CPPFLAGS -I${withval}"
2583 LDFLAGS="$LDFLAGS -L${withval}"
2584 if test ! -z "$need_dash_r" ; then
2585 LDFLAGS="$LDFLAGS -R${withval}"
2586 fi
2587 if test ! -z "$blibpath" ; then
2588 blibpath="$blibpath:${withval}"
2589 fi
2590 fi
2591 AC_CHECK_HEADERS(sectok.h)
2592 if test "$ac_cv_header_sectok_h" != yes; then
2593 AC_MSG_ERROR(Can't find sectok.h)
2594 fi
2595 AC_CHECK_LIB(sectok, sectok_open)
2596 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2597 AC_MSG_ERROR(Can't find libsectok)
2598 fi
2599 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002600 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002601 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002602 fi
2603 ]
2604)
2605
2606# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002607OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002608AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002609 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2610 [
2611 if test "x$withval" != "xno" ; then
2612 if test "x$withval" != "xyes" ; then
2613 OPENSC_CONFIG=$withval/bin/opensc-config
2614 else
2615 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2616 fi
2617 if test "$OPENSC_CONFIG" != "no"; then
2618 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2619 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2620 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2621 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2622 AC_DEFINE(SMARTCARD)
2623 AC_DEFINE(USE_OPENSC)
2624 SCARD_MSG="yes, using OpenSC"
2625 fi
2626 fi
2627 ]
2628)
Damien Miller85de5802001-09-18 14:01:11 +10002629
Darren Tucker5f88d342003-10-15 16:57:57 +10002630# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002631AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002632 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002633 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002634 # Needed by our getrrsetbyname()
2635 AC_SEARCH_LIBS(res_query, resolv)
2636 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002637 AC_MSG_CHECKING(if res_query will link)
2638 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2639 [AC_MSG_RESULT(no)
2640 saved_LIBS="$LIBS"
2641 LIBS="$LIBS -lresolv"
2642 AC_MSG_CHECKING(for res_query in -lresolv)
2643 AC_LINK_IFELSE([
2644#include <resolv.h>
2645int main()
2646{
2647 res_query (0, 0, 0, 0, 0);
2648 return 0;
2649}
2650 ],
2651 [LIBS="$LIBS -lresolv"
2652 AC_MSG_RESULT(yes)],
2653 [LIBS="$saved_LIBS"
2654 AC_MSG_RESULT(no)])
2655 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002656 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002657 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002658 [#include <sys/types.h>
2659 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002660 AC_CHECK_MEMBER(HEADER.ad,
2661 [AC_DEFINE(HAVE_HEADER_AD)],,
2662 [#include <arpa/nameser.h>])
2663 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002664
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002665# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002666KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002667AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002668 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002669 [ if test "x$withval" != "xno" ; then
2670 if test "x$withval" = "xyes" ; then
2671 KRB5ROOT="/usr/local"
2672 else
2673 KRB5ROOT=${withval}
2674 fi
2675
2676 AC_DEFINE(KRB5)
2677 KRB5_MSG="yes"
2678
2679 AC_MSG_CHECKING(for krb5-config)
2680 if test -x $KRB5ROOT/bin/krb5-config ; then
2681 KRB5CONF=$KRB5ROOT/bin/krb5-config
2682 AC_MSG_RESULT($KRB5CONF)
2683
2684 AC_MSG_CHECKING(for gssapi support)
2685 if $KRB5CONF | grep gssapi >/dev/null ; then
2686 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002687 AC_DEFINE(GSSAPI)
2688 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002689 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002690 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002691 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002692 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002693 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2694 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002695 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002696 AC_MSG_CHECKING(whether we are using Heimdal)
2697 AC_TRY_COMPILE([ #include <krb5.h> ],
2698 [ char *tmp = heimdal_version; ],
2699 [ AC_MSG_RESULT(yes)
2700 AC_DEFINE(HEIMDAL) ],
2701 AC_MSG_RESULT(no)
2702 )
2703 else
2704 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002705 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002706 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002707 AC_MSG_CHECKING(whether we are using Heimdal)
2708 AC_TRY_COMPILE([ #include <krb5.h> ],
2709 [ char *tmp = heimdal_version; ],
2710 [ AC_MSG_RESULT(yes)
2711 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002712 K5LIBS="-lkrb5 -ldes"
2713 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002714 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002715 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002716 ],
2717 [ AC_MSG_RESULT(no)
2718 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2719 ]
2720 )
Damien Miller200d0a72003-06-30 19:21:36 +10002721 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002722
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002723 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2724 [ AC_DEFINE(GSSAPI)
2725 K5LIBS="-lgssapi $K5LIBS" ],
2726 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2727 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002728 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002729 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2730 $K5LIBS)
2731 ],
2732 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002733
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002734 AC_CHECK_HEADER(gssapi.h, ,
2735 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002736 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002737 AC_CHECK_HEADERS(gssapi.h, ,
2738 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002739 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002740 ]
2741 )
2742
2743 oldCPP="$CPPFLAGS"
2744 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2745 AC_CHECK_HEADER(gssapi_krb5.h, ,
2746 [ CPPFLAGS="$oldCPP" ])
2747
Damien Millera8e06ce2003-11-21 23:48:55 +11002748 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002749 if test ! -z "$need_dash_r" ; then
2750 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2751 fi
2752 if test ! -z "$blibpath" ; then
2753 blibpath="$blibpath:${KRB5ROOT}/lib"
2754 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002755 fi
2756
2757 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2758 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2759 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2760
2761 LIBS="$LIBS $K5LIBS"
2762 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2763 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002764)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002765
Damien Millera22ba012000-03-02 23:09:20 +11002766# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002767
Damien Millerf58c6722002-05-13 13:15:42 +10002768PRIVSEP_PATH=/var/empty
2769AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002770 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002771 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002772 if test -n "$withval" && test "x$withval" != "xno" && \
2773 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002774 PRIVSEP_PATH=$withval
2775 fi
2776 ]
2777)
2778AC_SUBST(PRIVSEP_PATH)
2779
Damien Millera22ba012000-03-02 23:09:20 +11002780AC_ARG_WITH(xauth,
2781 [ --with-xauth=PATH Specify path to xauth program ],
2782 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002783 if test -n "$withval" && test "x$withval" != "xno" && \
2784 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002785 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002786 fi
2787 ],
2788 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002789 TestPath="$PATH"
2790 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2791 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2792 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2793 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2794 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002795 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002796 xauth_path="/usr/openwin/bin/xauth"
2797 fi
2798 ]
2799)
2800
Damien Miller7d901272003-01-13 16:55:22 +11002801STRIP_OPT=-s
2802AC_ARG_ENABLE(strip,
2803 [ --disable-strip Disable calling strip(1) on install],
2804 [
2805 if test "x$enableval" = "xno" ; then
2806 STRIP_OPT=
2807 fi
2808 ]
2809)
2810AC_SUBST(STRIP_OPT)
2811
Damien Millera19cf472000-11-29 13:28:50 +11002812if test -z "$xauth_path" ; then
2813 XAUTH_PATH="undefined"
2814 AC_SUBST(XAUTH_PATH)
2815else
Damien Millera22ba012000-03-02 23:09:20 +11002816 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002817 XAUTH_PATH=$xauth_path
2818 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002819fi
Damien Millera22ba012000-03-02 23:09:20 +11002820
2821# Check for mail directory (last resort if we cannot get it from headers)
2822if test ! -z "$MAIL" ; then
2823 maildir=`dirname $MAIL`
2824 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2825fi
2826
Darren Tucker623d92f2004-09-12 22:36:15 +10002827if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002828 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2829 disable_ptmx_check=yes
2830fi
Damien Millera22ba012000-03-02 23:09:20 +11002831if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002832 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002833 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002834 [
2835 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2836 have_dev_ptmx=1
2837 ]
2838 )
2839 fi
Damien Millera22ba012000-03-02 23:09:20 +11002840fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002841
Darren Tucker623d92f2004-09-12 22:36:15 +10002842if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002843 AC_CHECK_FILE("/dev/ptc",
2844 [
2845 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2846 have_dev_ptc=1
2847 ]
2848 )
2849else
2850 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2851fi
Damien Miller204ad072000-03-02 23:56:12 +11002852
Damien Millera22ba012000-03-02 23:09:20 +11002853# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002854AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002855 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002856 [
Damien Miller897741e2001-04-16 10:41:46 +10002857 case "$withval" in
2858 man|cat|doc)
2859 MANTYPE=$withval
2860 ;;
2861 *)
2862 AC_MSG_ERROR(invalid man type: $withval)
2863 ;;
2864 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002865 ]
2866)
Ben Lindstrombc709922001-04-18 18:04:21 +00002867if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002868 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2869 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002870 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2871 MANTYPE=doc
2872 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2873 MANTYPE=man
2874 else
2875 MANTYPE=cat
2876 fi
2877fi
Damien Miller670a4b82000-01-22 13:53:11 +11002878AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002879if test "$MANTYPE" = "doc"; then
2880 mansubdir=man;
2881else
2882 mansubdir=$MANTYPE;
2883fi
2884AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002885
Damien Millera22ba012000-03-02 23:09:20 +11002886# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002887MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002888AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002889 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002890 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002891 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002892 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002893 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002894 fi
2895 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002896)
2897
Damien Millera22ba012000-03-02 23:09:20 +11002898# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002899AC_ARG_WITH(shadow,
2900 [ --without-shadow Disable shadow password support],
2901 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002902 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002903 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002904 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002905 fi
2906 ]
2907)
2908
Damien Miller1f335fb2000-06-26 11:31:33 +10002909if test -z "$disable_shadow" ; then
2910 AC_MSG_CHECKING([if the systems has expire shadow information])
2911 AC_TRY_COMPILE(
2912 [
2913#include <sys/types.h>
2914#include <shadow.h>
2915 struct spwd sp;
2916 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2917 [ sp_expire_available=yes ], []
2918 )
2919
2920 if test "x$sp_expire_available" = "xyes" ; then
2921 AC_MSG_RESULT(yes)
2922 AC_DEFINE(HAS_SHADOW_EXPIRE)
2923 else
2924 AC_MSG_RESULT(no)
2925 fi
2926fi
2927
Damien Millera22ba012000-03-02 23:09:20 +11002928# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002929if test ! -z "$IPADDR_IN_DISPLAY" ; then
2930 DISPLAY_HACK_MSG="yes"
2931 AC_DEFINE(IPADDR_IN_DISPLAY)
2932else
Damien Millera8e06ce2003-11-21 23:48:55 +11002933 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002934 AC_ARG_WITH(ipaddr-display,
2935 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2936 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002937 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002938 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002939 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002940 fi
2941 ]
2942 )
2943fi
Damien Miller76112de1999-12-21 11:18:08 +11002944
Darren Tuckere1a790d2003-09-16 11:52:19 +10002945# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002946AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002947 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002948 [ if test "x$enableval" = "xno"; then
2949 AC_MSG_NOTICE([/etc/default/login handling disabled])
2950 etc_default_login=no
2951 else
2952 etc_default_login=yes
2953 fi ],
2954 [ etc_default_login=yes ]
2955)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002956
Darren Tucker2f9573d2005-02-10 22:28:54 +11002957if test "x$etc_default_login" != "xno"; then
2958 AC_CHECK_FILE("/etc/default/login",
2959 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002960 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2961 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002962 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2963 elif test "x$external_path_file" = "x/etc/default/login"; then
2964 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2965 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002966fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002967
Tim Rice43a1c132002-04-17 21:19:14 -07002968dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002969if test $ac_cv_func_login_getcapbool = "yes" && \
2970 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002971 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002972fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002973
Damien Millera22ba012000-03-02 23:09:20 +11002974# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002975SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002976AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002977 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002978 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002979 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002980 AC_MSG_WARN([
2981--with-default-path=PATH has no effect on this system.
2982Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002983 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002984 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002985 AC_MSG_WARN([
2986--with-default-path=PATH will only be used if PATH is not defined in
2987$external_path_file .])
2988 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002989 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002990 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002991 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002992 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002993 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2994 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002995 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002996 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002997 AC_MSG_WARN([
2998If PATH is defined in $external_path_file, ensure the path to scp is included,
2999otherwise scp will not work.])
3000 fi
3001 AC_TRY_RUN(
3002 [
Tim Rice59ea0a02001-03-10 13:50:45 -08003003/* find out what STDPATH is */
3004#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003005#ifdef HAVE_PATHS_H
3006# include <paths.h>
3007#endif
3008#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003009# ifdef _PATH_USERPATH /* Irix */
3010# define _PATH_STDPATH _PATH_USERPATH
3011# else
3012# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3013# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003014#endif
3015#include <sys/types.h>
3016#include <sys/stat.h>
3017#include <fcntl.h>
3018#define DATA "conftest.stdpath"
3019
3020main()
3021{
3022 FILE *fd;
3023 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003024
Tim Rice59ea0a02001-03-10 13:50:45 -08003025 fd = fopen(DATA,"w");
3026 if(fd == NULL)
3027 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003028
Tim Rice59ea0a02001-03-10 13:50:45 -08003029 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3030 exit(1);
3031
3032 exit(0);
3033}
3034 ], [ user_path=`cat conftest.stdpath` ],
3035 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3036 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3037 )
3038# make sure $bindir is in USER_PATH so scp will work
3039 t_bindir=`eval echo ${bindir}`
3040 case $t_bindir in
3041 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3042 esac
3043 case $t_bindir in
3044 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3045 esac
3046 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3047 if test $? -ne 0 ; then
3048 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3049 if test $? -ne 0 ; then
3050 user_path=$user_path:$t_bindir
3051 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3052 fi
3053 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003054 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003055)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003056if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003057 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
3058 AC_SUBST(user_path)
3059fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003060
Damien Millera18bbd32002-05-13 10:48:57 +10003061# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003062AC_ARG_WITH(superuser-path,
3063 [ --with-superuser-path= Specify different path for super-user],
3064 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003065 if test -n "$withval" && test "x$withval" != "xno" && \
3066 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10003067 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
3068 superuser_path=$withval
3069 fi
3070 ]
3071)
3072
3073
Damien Miller61e50f12000-05-08 20:49:37 +10003074AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003075IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003076AC_ARG_WITH(4in6,
3077 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3078 [
3079 if test "x$withval" != "xno" ; then
3080 AC_MSG_RESULT(yes)
3081 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003082 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003083 else
3084 AC_MSG_RESULT(no)
3085 fi
3086 ],[
3087 if test "x$inet6_default_4in6" = "xyes"; then
3088 AC_MSG_RESULT([yes (default)])
3089 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003090 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003091 else
3092 AC_MSG_RESULT([no (default)])
3093 fi
3094 ]
3095)
3096
Damien Miller60396b02001-02-18 17:01:00 +11003097# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003098BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003099AC_ARG_WITH(bsd-auth,
3100 [ --with-bsd-auth Enable BSD auth support],
3101 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003102 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11003103 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11003104 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003105 fi
3106 ]
3107)
3108
Damien Millera22ba012000-03-02 23:09:20 +11003109# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003110piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003111# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003112if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003113 piddir=`eval echo ${sysconfdir}`
3114 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003115 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003116 esac
3117fi
3118
Tim Rice88f2ab52002-03-17 12:17:34 -08003119AC_ARG_WITH(pid-dir,
3120 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3121 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003122 if test -n "$withval" && test "x$withval" != "xno" && \
3123 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003124 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003125 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003126 AC_MSG_WARN([** no $piddir directory on this system **])
3127 fi
3128 fi
3129 ]
3130)
3131
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003132AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11003133AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003134
andre2ff7b5d2000-06-03 14:57:40 +00003135dnl allow user to disable some login recording features
3136AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003137 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003138 [
3139 if test "x$enableval" = "xno" ; then
3140 AC_DEFINE(DISABLE_LASTLOG)
3141 fi
3142 ]
andre2ff7b5d2000-06-03 14:57:40 +00003143)
3144AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003145 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003146 [
3147 if test "x$enableval" = "xno" ; then
3148 AC_DEFINE(DISABLE_UTMP)
3149 fi
3150 ]
andre2ff7b5d2000-06-03 14:57:40 +00003151)
3152AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003153 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003154 [
3155 if test "x$enableval" = "xno" ; then
3156 AC_DEFINE(DISABLE_UTMPX)
3157 fi
3158 ]
andre2ff7b5d2000-06-03 14:57:40 +00003159)
3160AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003161 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003162 [
3163 if test "x$enableval" = "xno" ; then
3164 AC_DEFINE(DISABLE_WTMP)
3165 fi
3166 ]
andre2ff7b5d2000-06-03 14:57:40 +00003167)
3168AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003169 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003170 [
3171 if test "x$enableval" = "xno" ; then
3172 AC_DEFINE(DISABLE_WTMPX)
3173 fi
3174 ]
andre2ff7b5d2000-06-03 14:57:40 +00003175)
3176AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003177 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003178 [
3179 if test "x$enableval" = "xno" ; then
3180 AC_DEFINE(DISABLE_LOGIN)
3181 fi
3182 ]
andre2ff7b5d2000-06-03 14:57:40 +00003183)
3184AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003185 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003186 [
3187 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003188 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10003189 fi
3190 ]
andre2ff7b5d2000-06-03 14:57:40 +00003191)
3192AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003193 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003194 [
3195 if test "x$enableval" = "xno" ; then
3196 AC_DEFINE(DISABLE_PUTUTXLINE)
3197 fi
3198 ]
andre2ff7b5d2000-06-03 14:57:40 +00003199)
3200AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003201 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003202 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003203 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003204 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003205 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003206 conf_lastlog_location=$withval
3207 fi
3208 ]
3209)
andre2ff7b5d2000-06-03 14:57:40 +00003210
3211dnl lastlog, [uw]tmpx? detection
3212dnl NOTE: set the paths in the platform section to avoid the
3213dnl need for command-line parameters
3214dnl lastlog and [uw]tmp are subject to a file search if all else fails
3215
3216dnl lastlog detection
3217dnl NOTE: the code itself will detect if lastlog is a directory
3218AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3219AC_TRY_COMPILE([
3220#include <sys/types.h>
3221#include <utmp.h>
3222#ifdef HAVE_LASTLOG_H
3223# include <lastlog.h>
3224#endif
Damien Miller2994e082000-06-04 15:51:47 +10003225#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003226# include <paths.h>
3227#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003228#ifdef HAVE_LOGIN_H
3229# include <login.h>
3230#endif
andre2ff7b5d2000-06-03 14:57:40 +00003231 ],
3232 [ char *lastlog = LASTLOG_FILE; ],
3233 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003234 [
3235 AC_MSG_RESULT(no)
3236 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3237 AC_TRY_COMPILE([
3238#include <sys/types.h>
3239#include <utmp.h>
3240#ifdef HAVE_LASTLOG_H
3241# include <lastlog.h>
3242#endif
3243#ifdef HAVE_PATHS_H
3244# include <paths.h>
3245#endif
3246 ],
3247 [ char *lastlog = _PATH_LASTLOG; ],
3248 [ AC_MSG_RESULT(yes) ],
3249 [
andree441aa32000-06-12 22:34:38 +00003250 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003251 system_lastlog_path=no
3252 ])
3253 ]
andre2ff7b5d2000-06-03 14:57:40 +00003254)
Damien Miller2994e082000-06-04 15:51:47 +10003255
andre2ff7b5d2000-06-03 14:57:40 +00003256if test -z "$conf_lastlog_location"; then
3257 if test x"$system_lastlog_path" = x"no" ; then
3258 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003259 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003260 conf_lastlog_location=$f
3261 fi
3262 done
3263 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003264 AC_MSG_WARN([** Cannot find lastlog **])
3265 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003266 fi
3267 fi
3268fi
3269
3270if test -n "$conf_lastlog_location"; then
3271 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003272fi
andre2ff7b5d2000-06-03 14:57:40 +00003273
3274dnl utmp detection
3275AC_MSG_CHECKING([if your system defines UTMP_FILE])
3276AC_TRY_COMPILE([
3277#include <sys/types.h>
3278#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003279#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003280# include <paths.h>
3281#endif
3282 ],
3283 [ char *utmp = UTMP_FILE; ],
3284 [ AC_MSG_RESULT(yes) ],
3285 [ AC_MSG_RESULT(no)
3286 system_utmp_path=no ]
3287)
3288if test -z "$conf_utmp_location"; then
3289 if test x"$system_utmp_path" = x"no" ; then
3290 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3291 if test -f $f ; then
3292 conf_utmp_location=$f
3293 fi
3294 done
3295 if test -z "$conf_utmp_location"; then
3296 AC_DEFINE(DISABLE_UTMP)
3297 fi
3298 fi
3299fi
3300if test -n "$conf_utmp_location"; then
3301 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003302fi
andre2ff7b5d2000-06-03 14:57:40 +00003303
3304dnl wtmp detection
3305AC_MSG_CHECKING([if your system defines WTMP_FILE])
3306AC_TRY_COMPILE([
3307#include <sys/types.h>
3308#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003309#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003310# include <paths.h>
3311#endif
3312 ],
3313 [ char *wtmp = WTMP_FILE; ],
3314 [ AC_MSG_RESULT(yes) ],
3315 [ AC_MSG_RESULT(no)
3316 system_wtmp_path=no ]
3317)
3318if test -z "$conf_wtmp_location"; then
3319 if test x"$system_wtmp_path" = x"no" ; then
3320 for f in /usr/adm/wtmp /var/log/wtmp; do
3321 if test -f $f ; then
3322 conf_wtmp_location=$f
3323 fi
3324 done
3325 if test -z "$conf_wtmp_location"; then
3326 AC_DEFINE(DISABLE_WTMP)
3327 fi
3328 fi
3329fi
3330if test -n "$conf_wtmp_location"; then
3331 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003332fi
andre2ff7b5d2000-06-03 14:57:40 +00003333
3334
3335dnl utmpx detection - I don't know any system so perverse as to require
3336dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3337dnl there, though.
3338AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3339AC_TRY_COMPILE([
3340#include <sys/types.h>
3341#include <utmp.h>
3342#ifdef HAVE_UTMPX_H
3343#include <utmpx.h>
3344#endif
Damien Miller2994e082000-06-04 15:51:47 +10003345#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003346# include <paths.h>
3347#endif
3348 ],
3349 [ char *utmpx = UTMPX_FILE; ],
3350 [ AC_MSG_RESULT(yes) ],
3351 [ AC_MSG_RESULT(no)
3352 system_utmpx_path=no ]
3353)
3354if test -z "$conf_utmpx_location"; then
3355 if test x"$system_utmpx_path" = x"no" ; then
3356 AC_DEFINE(DISABLE_UTMPX)
3357 fi
3358else
3359 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003360fi
andre2ff7b5d2000-06-03 14:57:40 +00003361
3362dnl wtmpx detection
3363AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3364AC_TRY_COMPILE([
3365#include <sys/types.h>
3366#include <utmp.h>
3367#ifdef HAVE_UTMPX_H
3368#include <utmpx.h>
3369#endif
Damien Miller2994e082000-06-04 15:51:47 +10003370#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003371# include <paths.h>
3372#endif
3373 ],
3374 [ char *wtmpx = WTMPX_FILE; ],
3375 [ AC_MSG_RESULT(yes) ],
3376 [ AC_MSG_RESULT(no)
3377 system_wtmpx_path=no ]
3378)
3379if test -z "$conf_wtmpx_location"; then
3380 if test x"$system_wtmpx_path" = x"no" ; then
3381 AC_DEFINE(DISABLE_WTMPX)
3382 fi
3383else
3384 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003385fi
andre2ff7b5d2000-06-03 14:57:40 +00003386
Damien Miller4018c192000-04-30 09:30:44 +10003387
Damien Miller29ea30d2000-03-17 10:54:15 +11003388if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003389 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3390 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003391fi
3392
Tim Rice4cec93f2002-02-26 08:40:48 -08003393dnl remove pam and dl because they are in $LIBPAM
3394if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003395 LIBS=`echo $LIBS | sed 's/-lpam //'`
3396fi
3397if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3398 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003399fi
3400
Darren Tucker7da23cb2005-08-03 00:20:15 +10003401dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3402dnl Add now.
3403CFLAGS="$CFLAGS $werror_flags"
3404
Damien Millerbac2d8a2000-09-05 16:13:06 +11003405AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003406AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3407 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003408AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003409
Damien Miller7b22d652000-06-18 14:07:04 +10003410# Print summary of options
3411
Damien Miller7b22d652000-06-18 14:07:04 +10003412# Someone please show me a better way :)
3413A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3414B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3415C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3416D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003417E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003418F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003419G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003420H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3421I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3422J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003423
3424echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003425echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003426echo " User binaries: $B"
3427echo " System binaries: $C"
3428echo " Configuration files: $D"
3429echo " Askpass program: $E"
3430echo " Manual pages: $F"
3431echo " PID file: $G"
3432echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003433if test "x$external_path_file" = "x/etc/login.conf" ; then
3434echo " At runtime, sshd will use the path defined in $external_path_file"
3435echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003436else
Damien Millerf58c6722002-05-13 13:15:42 +10003437echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003438 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003439echo " (If PATH is set in $external_path_file it will be used instead. If"
3440echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3441 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003442fi
Damien Millera18bbd32002-05-13 10:48:57 +10003443if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003444echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003445fi
Damien Millerf58c6722002-05-13 13:15:42 +10003446echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003447echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003448echo " KerberosV support: $KRB5_MSG"
3449echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003450echo " S/KEY support: $SKEY_MSG"
3451echo " TCP Wrappers support: $TCPW_MSG"
3452echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003453echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003454echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003455echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3456echo " BSD Auth support: $BSD_AUTH_MSG"
3457echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003458if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003459echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003460fi
3461
Damien Miller7b22d652000-06-18 14:07:04 +10003462echo ""
3463
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003464echo " Host: ${host}"
3465echo " Compiler: ${CC}"
3466echo " Compiler flags: ${CFLAGS}"
3467echo "Preprocessor flags: ${CPPFLAGS}"
3468echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003469echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003470
3471echo ""
3472
Tim Rice6f1f7582004-05-30 21:38:51 -07003473if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003474 echo "SVR4 style packages are supported with \"make package\""
3475 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003476fi
3477
Damien Miller82cf0ce2000-12-20 13:34:48 +11003478if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003479 echo "PAM is enabled. You may need to install a PAM control file "
3480 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003481 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003482 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003483 echo ""
3484fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003485
Damien Miller6c21c512002-01-22 21:57:53 +11003486if test ! -z "$RAND_HELPER_CMDHASH" ; then
3487 echo "WARNING: you are using the builtin random number collection "
3488 echo "service. Please read WARNING.RNG and request that your OS "
3489 echo "vendor includes kernel-based random number collection in "
3490 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003491 echo ""
3492fi
Damien Miller60396b02001-02-18 17:01:00 +11003493
Damien Millerb4097182004-05-23 14:09:40 +10003494if test ! -z "$NO_PEERCHECK" ; then
3495 echo "WARNING: the operating system that you are using does not "
3496 echo "appear to support either the getpeereid() API nor the "
3497 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3498 echo "enforce security checks to prevent unauthorised connections to "
3499 echo "ssh-agent. Their absence increases the risk that a malicious "
3500 echo "user can connect to your agent. "
3501 echo ""
3502fi
3503
Darren Tuckerd9f88912005-02-20 21:01:48 +11003504if test "$AUDIT_MODULE" = "bsm" ; then
3505 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3506 echo "See the Solaris section in README.platform for details."
3507fi