blob: d20ec1507d96ae7b03191ef86d23e356ac1142a2 [file] [log] [blame]
Tim Rice20168652005-08-29 17:17:37 -07001# $Id: configure.ac,v 1.290 2005/08/30 00:17:38 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 ;;
Tim Rice20168652005-08-29 17:17:37 -0700458 *-*-sysv5*)
459 check_for_libcrypt_later=1
460 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
461 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700462 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100463 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100464*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100465 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800466# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100467*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800468 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100469 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800470# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100471*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800472 if test -z "$GCC"; then
473 CFLAGS="$CFLAGS -belf"
474 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100475 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000476 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100477 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000478 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000479 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700480 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700481 AC_DEFINE(SETEUID_BREAKS_SETUID)
482 AC_DEFINE(BROKEN_SETREUID)
483 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700484 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700485 AC_DEFINE(BROKEN_UPDWTMPX)
Darren Tucker33370e02005-02-09 22:17:28 +1100486 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller217f5672001-02-16 12:12:41 +1100487 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700488 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700489 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000490 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000491*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100492 AC_DEFINE(NO_SSH_LASTLOG)
493 AC_DEFINE(SETEUID_BREAKS_SETUID)
494 AC_DEFINE(BROKEN_SETREUID)
495 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000496 AC_DEFINE(USE_PIPES)
497 AC_DEFINE(DISABLE_FD_PASSING)
498 LDFLAGS="$LDFLAGS"
499 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
500 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000501 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000502*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100503 AC_DEFINE(SETEUID_BREAKS_SETUID)
504 AC_DEFINE(BROKEN_SETREUID)
505 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000506 AC_DEFINE(WITH_ABBREV_NO_TTY)
507 AC_DEFINE(USE_PIPES)
508 AC_DEFINE(DISABLE_FD_PASSING)
509 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100510 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000511 MANTYPE=cat
512 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000513*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100514 AC_DEFINE(SETEUID_BREAKS_SETUID)
515 AC_DEFINE(BROKEN_SETREUID)
516 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000517 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700518 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700519 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000520 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
521 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
522 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700523 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000524*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000525 AC_MSG_CHECKING(for Digital Unix SIA)
526 no_osfsia=""
527 AC_ARG_WITH(osfsia,
528 [ --with-osfsia Enable Digital Unix SIA],
529 [
530 if test "x$withval" = "xno" ; then
531 AC_MSG_RESULT(disabled)
532 no_osfsia=1
533 fi
534 ],
535 )
536 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000537 if test -f /etc/sia/matrix.conf; then
538 AC_MSG_RESULT(yes)
539 AC_DEFINE(HAVE_OSF_SIA)
540 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000541 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000542 LIBS="$LIBS -lsecurity -ldb -lm -laud"
543 else
544 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100545 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000546 fi
547 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000548 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700549 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000550 AC_DEFINE(BROKEN_SETREUID)
551 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000552 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000553
554*-*-nto-qnx)
555 AC_DEFINE(USE_PIPES)
556 AC_DEFINE(NO_X11_UNIX_SOCKETS)
557 AC_DEFINE(MISSING_NFDBITS)
558 AC_DEFINE(MISSING_HOWMANY)
559 AC_DEFINE(MISSING_FD_MASK)
560 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000561
562*-*-ultrix*)
563 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
564 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
565 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700566 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
567 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000568
569*-*-lynxos)
570 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
571 AC_DEFINE(MISSING_HOWMANY)
572 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
573 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100574esac
575
Damien Millere37bfc12000-06-05 09:37:43 +1000576# Allow user to specify flags
577AC_ARG_WITH(cflags,
578 [ --with-cflags Specify additional flags to pass to compiler],
579 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800580 if test -n "$withval" && test "x$withval" != "xno" && \
581 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000582 CFLAGS="$CFLAGS $withval"
583 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800584 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000585)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000586AC_ARG_WITH(cppflags,
587 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
588 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800589 if test -n "$withval" && test "x$withval" != "xno" && \
590 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000591 CPPFLAGS="$CPPFLAGS $withval"
592 fi
593 ]
594)
Damien Millere37bfc12000-06-05 09:37:43 +1000595AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000596 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000597 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800598 if test -n "$withval" && test "x$withval" != "xno" && \
599 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000600 LDFLAGS="$LDFLAGS $withval"
601 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800602 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000603)
604AC_ARG_WITH(libs,
605 [ --with-libs Specify additional libraries to link with],
606 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800607 if test -n "$withval" && test "x$withval" != "xno" && \
608 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000609 LIBS="$LIBS $withval"
610 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800611 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000612)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000613AC_ARG_WITH(Werror,
614 [ --with-Werror Build main code with -Werror],
615 [
616 if test -n "$withval" && test "x$withval" != "xno"; then
617 werror_flags="-Werror"
618 if "x${withval}" != "xyes"; then
619 werror_flags="$withval"
620 fi
621 fi
622 ]
623)
Damien Millere37bfc12000-06-05 09:37:43 +1000624
Darren Tucker6eb93042003-06-29 21:30:41 +1000625AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000626AC_RUN_IFELSE(
627 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000628#include <stdio.h>
629int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000630 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000631 [ AC_MSG_RESULT(yes) ],
632 [
633 AC_MSG_RESULT(no)
634 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000635 ],
636 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000637)
638
Darren Tucker0c9653f2005-05-28 15:58:14 +1000639dnl Checks for header files.
640AC_CHECK_HEADERS( \
641 bstring.h \
642 crypt.h \
643 dirent.h \
644 endian.h \
645 features.h \
646 floatingpoint.h \
647 getopt.h \
648 glob.h \
649 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700650 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000651 lastlog.h \
652 limits.h \
653 login.h \
654 login_cap.h \
655 maillock.h \
656 ndir.h \
657 netdb.h \
658 netgroup.h \
659 netinet/in_systm.h \
660 pam/pam_appl.h \
661 paths.h \
662 pty.h \
663 readpassphrase.h \
664 rpc/types.h \
665 security/pam_appl.h \
666 shadow.h \
667 stddef.h \
668 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000669 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000670 strings.h \
671 sys/audit.h \
672 sys/bitypes.h \
673 sys/bsdtty.h \
674 sys/cdefs.h \
675 sys/dir.h \
676 sys/mman.h \
677 sys/ndir.h \
678 sys/prctl.h \
679 sys/pstat.h \
680 sys/select.h \
681 sys/stat.h \
682 sys/stream.h \
683 sys/stropts.h \
684 sys/strtio.h \
685 sys/sysmacros.h \
686 sys/time.h \
687 sys/timers.h \
688 sys/un.h \
689 time.h \
690 tmpdir.h \
691 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000692 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000693 usersec.h \
694 util.h \
695 utime.h \
696 utmp.h \
697 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000698 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000699)
Tim Rice4cec93f2002-02-26 08:40:48 -0800700
Darren Tucker48d99d32004-08-29 17:04:50 +1000701# sys/ptms.h requires sys/stream.h to be included first on Solaris
702AC_CHECK_HEADERS(sys/ptms.h, [], [], [
703#ifdef HAVE_SYS_STREAM_H
704# include <sys/stream.h>
705#endif
706])
707
Damien Millera22ba012000-03-02 23:09:20 +1100708# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700709AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
710AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000711
Tim Rice1e1ef642003-09-11 22:19:31 -0700712dnl IRIX and Solaris 2.5.1 have dirname() in libgen
713AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
714 AC_CHECK_LIB(gen, dirname,[
715 AC_CACHE_CHECK([for broken dirname],
716 ac_cv_have_broken_dirname, [
717 save_LIBS="$LIBS"
718 LIBS="$LIBS -lgen"
719 AC_TRY_RUN(
720 [
721#include <libgen.h>
722#include <string.h>
723
724int main(int argc, char **argv) {
725 char *s, buf[32];
726
727 strncpy(buf,"/etc", 32);
728 s = dirname(buf);
729 if (!s || strncmp(s, "/", 32) != 0) {
730 exit(1);
731 } else {
732 exit(0);
733 }
734}
735 ],
736 [ ac_cv_have_broken_dirname="no" ],
737 [ ac_cv_have_broken_dirname="yes" ]
738 )
739 LIBS="$save_LIBS"
740 ])
741 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
742 LIBS="$LIBS -lgen"
743 AC_DEFINE(HAVE_DIRNAME)
744 AC_CHECK_HEADERS(libgen.h)
745 fi
746 ])
747])
748
749AC_CHECK_FUNC(getspnam, ,
750 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
751AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
752
Tim Rice13aae5e2001-10-21 17:53:58 -0700753dnl zlib is required
754AC_ARG_WITH(zlib,
755 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100756 [ if test "x$withval" = "xno" ; then
757 AC_MSG_ERROR([*** zlib is required ***])
758 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700759 if test -d "$withval/lib"; then
760 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700761 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700762 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700763 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700764 fi
765 else
766 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700767 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700768 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700769 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700770 fi
771 fi
772 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700773 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700774 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700775 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700776 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100777 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700778)
779
Tim Ricefcb62202004-01-23 18:35:16 -0800780AC_CHECK_LIB(z, deflate, ,
781 [
782 saved_CPPFLAGS="$CPPFLAGS"
783 saved_LDFLAGS="$LDFLAGS"
784 save_LIBS="$LIBS"
785 dnl Check default zlib install dir
786 if test -n "${need_dash_r}"; then
787 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
788 else
789 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
790 fi
791 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
792 LIBS="$LIBS -lz"
793 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
794 [
795 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
796 ]
797 )
798 ]
799)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100800AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100801
802AC_ARG_WITH(zlib-version-check,
803 [ --without-zlib-version-check Disable zlib version check],
804 [ if test "x$withval" = "xno" ; then
805 zlib_check_nonfatal=1
806 fi
807 ]
808)
809
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000810AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000811AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000812#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100813#include <zlib.h>
814int main()
815{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000816 int a=0, b=0, c=0, d=0, n, v;
817 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
818 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100819 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000820 v = a*1000000 + b*10000 + c*100 + d;
821 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
822
823 /* 1.1.4 is OK */
824 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100825 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000826
Darren Tucker41097ed2005-07-25 15:24:21 +1000827 /* 1.2.3 and up are OK */
828 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000829 exit(0);
830
Darren Tucker2dcd2392004-01-23 17:13:33 +1100831 exit(2);
832}
Darren Tucker623d92f2004-09-12 22:36:15 +1000833 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000834 AC_MSG_RESULT(no),
835 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100836 if test -z "$zlib_check_nonfatal" ; then
837 AC_MSG_ERROR([*** zlib too old - check config.log ***
838Your reported zlib version has known security problems. It's possible your
839vendor has fixed these problems without changing the version number. If you
840are sure this is the case, you can disable the check by running
841"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000842If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000843See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100844 else
845 AC_MSG_WARN([zlib version may have security problems])
846 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000847 ],
848 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100849)
Damien Miller6f9c3372000-10-25 10:06:04 +1100850
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000851dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100852AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000853 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
854)
Damien Millera8e06ce2003-11-21 23:48:55 +1100855AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700856 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
857 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000858)
Damien Millerab18c411999-11-11 10:40:23 +1100859
Tim Ricee589a292001-11-03 11:09:32 -0800860dnl Checks for libutil functions
861AC_CHECK_HEADERS(libutil.h)
862AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
863AC_CHECK_FUNCS(logout updwtmp logwtmp)
864
Ben Lindstrom8697e082001-02-24 21:41:10 +0000865AC_FUNC_STRFTIME
866
Damien Miller3c027682001-03-14 11:39:45 +1100867# Check for ALTDIRFUNC glob() extension
868AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
869AC_EGREP_CPP(FOUNDIT,
870 [
871 #include <glob.h>
872 #ifdef GLOB_ALTDIRFUNC
873 FOUNDIT
874 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100875 ],
Damien Miller3c027682001-03-14 11:39:45 +1100876 [
877 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
878 AC_MSG_RESULT(yes)
879 ],
880 [
881 AC_MSG_RESULT(no)
882 ]
883)
Damien Millerab18c411999-11-11 10:40:23 +1100884
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000885# Check for g.gl_matchc glob() extension
886AC_MSG_CHECKING(for gl_matchc field in glob_t)
887AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100888 [
889 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000890 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100891 ],
892 [
893 AC_DEFINE(GLOB_HAS_GL_MATCHC)
894 AC_MSG_RESULT(yes)
895 ],
896 [
897 AC_MSG_RESULT(no)
898 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000899)
900
Damien Miller18bb4732001-03-28 14:35:30 +1000901AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000902AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000903 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000904#include <sys/types.h>
905#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700906int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000907 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100908 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000909 [
910 AC_MSG_RESULT(no)
911 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000912 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800913 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000914 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
915 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000916 ]
917)
918
Damien Miller36f49652004-08-15 18:40:59 +1000919AC_MSG_CHECKING([for /proc/pid/fd directory])
920if test -d "/proc/$$/fd" ; then
921 AC_DEFINE(HAVE_PROC_PID)
922 AC_MSG_RESULT(yes)
923else
924 AC_MSG_RESULT(no)
925fi
926
Damien Millerc547bf12001-02-16 10:18:12 +1100927# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100928SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100929AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100930 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100931 [
932 if test "x$withval" != "xno" ; then
933
934 if test "x$withval" != "xyes" ; then
935 CPPFLAGS="$CPPFLAGS -I${withval}/include"
936 LDFLAGS="$LDFLAGS -L${withval}/lib"
937 fi
938
939 AC_DEFINE(SKEY)
940 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100941 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800942
Tim Rice4cec93f2002-02-26 08:40:48 -0800943 AC_MSG_CHECKING([for s/key support])
944 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100945 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800946#include <stdio.h>
947#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700948int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800949 ],
950 [AC_MSG_RESULT(yes)],
951 [
952 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100953 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
954 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000955 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
956 AC_TRY_COMPILE(
957 [#include <stdio.h>
958 #include <skey.h>],
959 [(void)skeychallenge(NULL,"name","",0);],
960 [AC_MSG_RESULT(yes)
961 AC_DEFINE(SKEYCHALLENGE_4ARG)],
962 [AC_MSG_RESULT(no)]
963 )
Damien Millerc547bf12001-02-16 10:18:12 +1100964 fi
965 ]
966)
967
968# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700969TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100970AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100971 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100972 [
973 if test "x$withval" != "xno" ; then
974 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700975 saved_LDFLAGS="$LDFLAGS"
976 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800977 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800978 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700979 if test -d "${withval}/lib"; then
980 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700981 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700982 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700983 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700984 fi
985 else
986 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700987 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700988 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700989 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700990 fi
991 fi
992 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700993 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700994 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700995 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700996 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700997 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800998 LIBWRAP="-lwrap"
999 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001000 AC_MSG_CHECKING(for libwrap)
1001 AC_TRY_LINK(
1002 [
Damien Miller0ac45002004-04-14 20:14:26 +10001003#include <sys/types.h>
1004#include <sys/socket.h>
1005#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001006#include <tcpd.h>
1007 int deny_severity = 0, allow_severity = 0;
1008 ],
1009 [hosts_access(0);],
1010 [
1011 AC_MSG_RESULT(yes)
1012 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -08001013 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001014 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001015 ],
1016 [
1017 AC_MSG_ERROR([*** libwrap missing])
1018 ]
1019 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001020 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001021 fi
1022 ]
1023)
1024
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001025# Check whether user wants libedit support
1026LIBEDIT_MSG="no"
1027AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001028 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001029 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001030 if test "x$withval" != "xyes"; then
1031 CPPFLAGS="$CPPFLAGS -I$withval/include"
1032 LDFLAGS="$LDFLAGS -L$withval/lib"
1033 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001034 AC_CHECK_LIB(edit, el_init,
1035 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
1036 LIBEDIT="-ledit -lcurses"
1037 LIBEDIT_MSG="yes"
1038 AC_SUBST(LIBEDIT)
1039 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001040 [ AC_MSG_ERROR(libedit not found) ],
1041 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001042 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001043 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001044 AC_COMPILE_IFELSE(
1045 [AC_LANG_SOURCE([[
1046#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001047int main(void)
1048{
1049 int i = H_SETSIZE;
1050 el_init("", NULL, NULL, NULL);
1051 exit(0);
1052}
Tim Ricec1819c82005-08-15 17:48:40 -07001053 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001054 [ AC_MSG_RESULT(yes) ],
1055 [ AC_MSG_RESULT(no)
1056 AC_MSG_ERROR(libedit version is not compatible) ]
1057 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001058 fi ]
1059)
1060
Darren Tuckerd9f88912005-02-20 21:01:48 +11001061AUDIT_MODULE=none
1062AC_ARG_WITH(audit,
1063 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1064 [
1065 AC_MSG_CHECKING(for supported audit module)
1066 case "$withval" in
1067 bsm)
1068 AC_MSG_RESULT(bsm)
1069 AUDIT_MODULE=bsm
1070 dnl Checks for headers, libs and functions
1071 AC_CHECK_HEADERS(bsm/audit.h, [],
1072 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1073 AC_CHECK_LIB(bsm, getaudit, [],
1074 [AC_MSG_ERROR(BSM enabled and required library not found)])
1075 AC_CHECK_FUNCS(getaudit, [],
1076 [AC_MSG_ERROR(BSM enabled and required function not found)])
1077 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001078 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001079 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
1080 ;;
1081 debug)
1082 AUDIT_MODULE=debug
1083 AC_MSG_RESULT(debug)
1084 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
1085 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001086 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001087 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001088 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001089 *)
1090 AC_MSG_ERROR([Unknown audit module $withval])
1091 ;;
1092 esac ]
1093)
1094
Damien Millerfe1f1432003-02-24 15:45:42 +11001095dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001096AC_CHECK_FUNCS( \
1097 arc4random \
1098 b64_ntop \
1099 __b64_ntop \
1100 b64_pton \
1101 __b64_pton \
1102 bcopy \
1103 bindresvport_sa \
1104 clock \
1105 closefrom \
1106 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001107 fchmod \
1108 fchown \
1109 freeaddrinfo \
1110 futimes \
1111 getaddrinfo \
1112 getcwd \
1113 getgrouplist \
1114 getnameinfo \
1115 getopt \
1116 getpeereid \
1117 _getpty \
1118 getrlimit \
1119 getttyent \
1120 glob \
1121 inet_aton \
1122 inet_ntoa \
1123 inet_ntop \
1124 innetgr \
1125 login_getcapbool \
1126 md5_crypt \
1127 memmove \
1128 mkdtemp \
1129 mmap \
1130 ngetaddrinfo \
1131 nsleep \
1132 ogetaddrinfo \
1133 openlog_r \
1134 openpty \
1135 prctl \
1136 pstat \
1137 readpassphrase \
1138 realpath \
1139 recvmsg \
1140 rresvport_af \
1141 sendmsg \
1142 setdtablesize \
1143 setegid \
1144 setenv \
1145 seteuid \
1146 setgroups \
1147 setlogin \
1148 setpcred \
1149 setproctitle \
1150 setregid \
1151 setreuid \
1152 setrlimit \
1153 setsid \
1154 setvbuf \
1155 sigaction \
1156 sigvec \
1157 snprintf \
1158 socketpair \
1159 strdup \
1160 strerror \
1161 strlcat \
1162 strlcpy \
1163 strmode \
1164 strnvis \
1165 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001166 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001167 strtoul \
1168 sysconf \
1169 tcgetpgrp \
1170 truncate \
1171 unsetenv \
1172 updwtmpx \
1173 utimes \
1174 vhangup \
1175 vsnprintf \
1176 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001177)
Tim Rice13aae5e2001-10-21 17:53:58 -07001178
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001179# IRIX has a const char return value for gai_strerror()
1180AC_CHECK_FUNCS(gai_strerror,[
1181 AC_DEFINE(HAVE_GAI_STRERROR)
1182 AC_TRY_COMPILE([
1183#include <sys/types.h>
1184#include <sys/socket.h>
1185#include <netdb.h>
1186
1187const char *gai_strerror(int);],[
1188char *str;
1189
1190str = gai_strerror(0);],[
1191 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1192 [Define if gai_strerror() returns const char *])])])
1193
Damien Millercd6853c2003-01-28 11:33:42 +11001194AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1195
Darren Tuckerf1159b52003-07-07 19:44:01 +10001196dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001197AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001198AC_CHECK_DECL(strsep,
1199 [AC_CHECK_FUNCS(strsep)],
1200 [],
1201 [
1202#ifdef HAVE_STRING_H
1203# include <string.h>
1204#endif
1205 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001206
Darren Tuckerb2427c82003-09-10 15:22:44 +10001207dnl tcsendbreak might be a macro
1208AC_CHECK_DECL(tcsendbreak,
1209 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001210 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001211 [#include <termios.h>]
1212)
1213
Darren Tucker5bb14002004-04-23 18:53:10 +10001214AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1215
Darren Tucker2a6b0292003-12-31 14:59:17 +11001216AC_CHECK_FUNCS(setresuid, [
1217 dnl Some platorms have setresuid that isn't implemented, test for this
1218 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001219 AC_RUN_IFELSE(
1220 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001221#include <stdlib.h>
1222#include <errno.h>
1223int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001224 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001225 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +11001226 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001227 AC_MSG_RESULT(not implemented)],
1228 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001229 )
1230])
Darren Tuckere937be32003-12-17 18:53:26 +11001231
Darren Tucker2a6b0292003-12-31 14:59:17 +11001232AC_CHECK_FUNCS(setresgid, [
1233 dnl Some platorms have setresgid that isn't implemented, test for this
1234 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001235 AC_RUN_IFELSE(
1236 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001237#include <stdlib.h>
1238#include <errno.h>
1239int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001240 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001241 [AC_MSG_RESULT(yes)],
1242 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001243 AC_MSG_RESULT(not implemented)],
1244 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001245 )
1246])
Darren Tuckere937be32003-12-17 18:53:26 +11001247
Damien Millerad833b32000-08-23 10:46:23 +10001248dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001249AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001250dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001251AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001252AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001253dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001254AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001255AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001256
Damien Millera8e06ce2003-11-21 23:48:55 +11001257AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001258 [AC_DEFINE(HAVE_DAEMON)],
1259 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1260)
1261
Damien Millera8e06ce2003-11-21 23:48:55 +11001262AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001263 [AC_DEFINE(HAVE_GETPAGESIZE)],
1264 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1265)
1266
Damien Millercb170cb2000-07-01 16:52:55 +10001267# Check for broken snprintf
1268if test "x$ac_cv_func_snprintf" = "xyes" ; then
1269 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001270 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001271 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001272#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001273int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001274 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001275 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001276 [
1277 AC_MSG_RESULT(no)
1278 AC_DEFINE(BROKEN_SNPRINTF)
1279 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001280 ],
1281 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001282 )
1283fi
1284
Damien Millerb4097182004-05-23 14:09:40 +10001285# Check for missing getpeereid (or equiv) support
1286NO_PEERCHECK=""
1287if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1288 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1289 AC_TRY_COMPILE(
1290 [#include <sys/types.h>
1291 #include <sys/socket.h>],
1292 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001293 [ AC_MSG_RESULT(yes)
1294 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1295 ],
Damien Millerb4097182004-05-23 14:09:40 +10001296 [AC_MSG_RESULT(no)
1297 NO_PEERCHECK=1]
1298 )
1299fi
1300
Damien Millere8328192003-01-07 15:18:32 +11001301dnl see whether mkstemp() requires XXXXXX
1302if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1303AC_MSG_CHECKING([for (overly) strict mkstemp])
1304AC_TRY_RUN(
1305 [
1306#include <stdlib.h>
1307main() { char template[]="conftest.mkstemp-test";
1308if (mkstemp(template) == -1)
1309 exit(1);
1310unlink(template); exit(0);
1311}
1312 ],
1313 [
1314 AC_MSG_RESULT(no)
1315 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001316 [
Damien Millere8328192003-01-07 15:18:32 +11001317 AC_MSG_RESULT(yes)
1318 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1319 ],
1320 [
1321 AC_MSG_RESULT(yes)
1322 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001323 ]
Damien Millere8328192003-01-07 15:18:32 +11001324)
1325fi
1326
Darren Tucker70a3d552003-08-21 17:58:29 +10001327dnl make sure that openpty does not reacquire controlling terminal
1328if test ! -z "$check_for_openpty_ctty_bug"; then
1329 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1330 AC_TRY_RUN(
1331 [
1332#include <stdio.h>
1333#include <sys/fcntl.h>
1334#include <sys/types.h>
1335#include <sys/wait.h>
1336
1337int
1338main()
1339{
1340 pid_t pid;
1341 int fd, ptyfd, ttyfd, status;
1342
1343 pid = fork();
1344 if (pid < 0) { /* failed */
1345 exit(1);
1346 } else if (pid > 0) { /* parent */
1347 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001348 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001349 exit(WEXITSTATUS(status));
1350 else
1351 exit(2);
1352 } else { /* child */
1353 close(0); close(1); close(2);
1354 setsid();
1355 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1356 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1357 if (fd >= 0)
1358 exit(3); /* Acquired ctty: broken */
1359 else
1360 exit(0); /* Did not acquire ctty: OK */
1361 }
1362}
1363 ],
1364 [
1365 AC_MSG_RESULT(yes)
1366 ],
1367 [
1368 AC_MSG_RESULT(no)
1369 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1370 ]
1371 )
1372fi
1373
Tim Rice8bb561b2005-03-17 16:23:19 -08001374if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1375 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001376 AC_MSG_CHECKING(if getaddrinfo seems to work)
1377 AC_TRY_RUN(
1378 [
1379#include <stdio.h>
1380#include <sys/socket.h>
1381#include <netdb.h>
1382#include <errno.h>
1383#include <netinet/in.h>
1384
1385#define TEST_PORT "2222"
1386
1387int
1388main(void)
1389{
1390 int err, sock;
1391 struct addrinfo *gai_ai, *ai, hints;
1392 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1393
1394 memset(&hints, 0, sizeof(hints));
1395 hints.ai_family = PF_UNSPEC;
1396 hints.ai_socktype = SOCK_STREAM;
1397 hints.ai_flags = AI_PASSIVE;
1398
1399 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1400 if (err != 0) {
1401 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1402 exit(1);
1403 }
1404
1405 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1406 if (ai->ai_family != AF_INET6)
1407 continue;
1408
1409 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1410 sizeof(ntop), strport, sizeof(strport),
1411 NI_NUMERICHOST|NI_NUMERICSERV);
1412
1413 if (err != 0) {
1414 if (err == EAI_SYSTEM)
1415 perror("getnameinfo EAI_SYSTEM");
1416 else
1417 fprintf(stderr, "getnameinfo failed: %s\n",
1418 gai_strerror(err));
1419 exit(2);
1420 }
1421
1422 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1423 if (sock < 0)
1424 perror("socket");
1425 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1426 if (errno == EBADF)
1427 exit(3);
1428 }
1429 }
1430 exit(0);
1431}
1432 ],
1433 [
1434 AC_MSG_RESULT(yes)
1435 ],
1436 [
1437 AC_MSG_RESULT(no)
1438 AC_DEFINE(BROKEN_GETADDRINFO)
1439 ]
1440 )
1441fi
1442
Tim Rice8bb561b2005-03-17 16:23:19 -08001443if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1444 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001445 AC_MSG_CHECKING(if getaddrinfo seems to work)
1446 AC_TRY_RUN(
1447 [
1448#include <stdio.h>
1449#include <sys/socket.h>
1450#include <netdb.h>
1451#include <errno.h>
1452#include <netinet/in.h>
1453
1454#define TEST_PORT "2222"
1455
1456int
1457main(void)
1458{
1459 int err, sock;
1460 struct addrinfo *gai_ai, *ai, hints;
1461 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1462
1463 memset(&hints, 0, sizeof(hints));
1464 hints.ai_family = PF_UNSPEC;
1465 hints.ai_socktype = SOCK_STREAM;
1466 hints.ai_flags = AI_PASSIVE;
1467
1468 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1469 if (err != 0) {
1470 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1471 exit(1);
1472 }
1473
1474 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1475 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1476 continue;
1477
1478 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1479 sizeof(ntop), strport, sizeof(strport),
1480 NI_NUMERICHOST|NI_NUMERICSERV);
1481
1482 if (ai->ai_family == AF_INET && err != 0) {
1483 perror("getnameinfo");
1484 exit(2);
1485 }
1486 }
1487 exit(0);
1488}
1489 ],
1490 [
1491 AC_MSG_RESULT(yes)
1492 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1493[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1494 ],
1495 [
1496 AC_MSG_RESULT(no)
1497 AC_DEFINE(BROKEN_GETADDRINFO)
1498 ]
1499 )
1500fi
1501
Darren Tuckera56f1912004-11-02 20:30:54 +11001502if test "x$check_for_conflicting_getspnam" = "x1"; then
1503 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1504 AC_COMPILE_IFELSE(
1505 [
1506#include <shadow.h>
1507int main(void) {exit(0);}
1508 ],
1509 [
1510 AC_MSG_RESULT(no)
1511 ],
1512 [
1513 AC_MSG_RESULT(yes)
1514 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1515 [Conflicting defs for getspnam])
1516 ]
1517 )
1518fi
1519
Damien Miller606f8802000-09-16 15:39:56 +11001520AC_FUNC_GETPGRP
1521
Damien Millera64b57a2001-01-17 10:44:13 +11001522# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001523PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001524AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001525 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001526 [
Damien Millera64b57a2001-01-17 10:44:13 +11001527 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001528 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1529 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001530 AC_MSG_ERROR([PAM headers not found])
1531 fi
1532
1533 AC_CHECK_LIB(dl, dlopen, , )
1534 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1535 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001536 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001537
Damien Millera64b57a2001-01-17 10:44:13 +11001538 PAM_MSG="yes"
1539
1540 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001541 if test $ac_cv_lib_dl_dlopen = yes; then
1542 LIBPAM="-lpam -ldl"
1543 else
1544 LIBPAM="-lpam"
1545 fi
1546 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001547 fi
1548 ]
1549)
Damien Millera22ba012000-03-02 23:09:20 +11001550
Damien Millera64b57a2001-01-17 10:44:13 +11001551# Check for older PAM
1552if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001553 # Check PAM strerror arguments (old PAM)
1554 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1555 AC_TRY_COMPILE(
1556 [
Damien Miller81171112000-04-23 11:14:01 +10001557#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001558#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001559#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001560#elif defined (HAVE_PAM_PAM_APPL_H)
1561#include <pam/pam_appl.h>
1562#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001563 ],
1564 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001565 [AC_MSG_RESULT(no)],
1566 [
1567 AC_DEFINE(HAVE_OLD_PAM)
1568 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001569 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001570 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001571 )
Damien Millera22ba012000-03-02 23:09:20 +11001572fi
1573
Tim Riceaef73712002-05-11 13:17:42 -07001574# Search for OpenSSL
1575saved_CPPFLAGS="$CPPFLAGS"
1576saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001577AC_ARG_WITH(ssl-dir,
1578 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1579 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001580 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001581 case "$withval" in
1582 # Relative paths
1583 ./*|../*) withval="`pwd`/$withval"
1584 esac
Tim Riceaef73712002-05-11 13:17:42 -07001585 if test -d "$withval/lib"; then
1586 if test -n "${need_dash_r}"; then
1587 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1588 else
1589 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1590 fi
1591 else
1592 if test -n "${need_dash_r}"; then
1593 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1594 else
1595 LDFLAGS="-L${withval} ${LDFLAGS}"
1596 fi
1597 fi
1598 if test -d "$withval/include"; then
1599 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1600 else
1601 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1602 fi
Damien Millera22ba012000-03-02 23:09:20 +11001603 fi
1604 ]
1605)
Tim Rice3d5352e2004-02-12 09:27:21 -08001606LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001607AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001608 [
Tim Riceaef73712002-05-11 13:17:42 -07001609 dnl Check default openssl install dir
1610 if test -n "${need_dash_r}"; then
1611 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001612 else
Tim Riceaef73712002-05-11 13:17:42 -07001613 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001614 fi
Tim Riceaef73712002-05-11 13:17:42 -07001615 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1616 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1617 [
1618 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1619 ]
1620 )
1621 ]
1622)
1623
Tim Riced730b782002-08-13 18:52:10 -07001624# Determine OpenSSL header version
1625AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001626AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001627 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001628#include <stdio.h>
1629#include <string.h>
1630#include <openssl/opensslv.h>
1631#define DATA "conftest.sslincver"
1632int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001633 FILE *fd;
1634 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001635
Damien Millera8e06ce2003-11-21 23:48:55 +11001636 fd = fopen(DATA,"w");
1637 if(fd == NULL)
1638 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001639
1640 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1641 exit(1);
1642
1643 exit(0);
1644}
Darren Tucker623d92f2004-09-12 22:36:15 +10001645 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001646 [
1647 ssl_header_ver=`cat conftest.sslincver`
1648 AC_MSG_RESULT($ssl_header_ver)
1649 ],
1650 [
1651 AC_MSG_RESULT(not found)
1652 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001653 ],
1654 [
1655 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001656 ]
1657)
1658
1659# Determine OpenSSL library version
1660AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001661AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001662 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001663#include <stdio.h>
1664#include <string.h>
1665#include <openssl/opensslv.h>
1666#include <openssl/crypto.h>
1667#define DATA "conftest.ssllibver"
1668int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001669 FILE *fd;
1670 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001671
Damien Millera8e06ce2003-11-21 23:48:55 +11001672 fd = fopen(DATA,"w");
1673 if(fd == NULL)
1674 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001675
1676 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1677 exit(1);
1678
1679 exit(0);
1680}
Darren Tucker623d92f2004-09-12 22:36:15 +10001681 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001682 [
1683 ssl_library_ver=`cat conftest.ssllibver`
1684 AC_MSG_RESULT($ssl_library_ver)
1685 ],
1686 [
1687 AC_MSG_RESULT(not found)
1688 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001689 ],
1690 [
1691 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001692 ]
1693)
Damien Millera22ba012000-03-02 23:09:20 +11001694
Damien Millerec932372002-01-22 22:16:03 +11001695# Sanity check OpenSSL headers
1696AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001697AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001698 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001699#include <string.h>
1700#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001701int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001702 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001703 [
1704 AC_MSG_RESULT(yes)
1705 ],
1706 [
1707 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001708 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1709Check config.log for details.
1710Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001711 ],
1712 [
1713 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001714 ]
1715)
1716
Tim Rice3d5352e2004-02-12 09:27:21 -08001717# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1718# because the system crypt() is more featureful.
1719if test "x$check_for_libcrypt_before" = "x1"; then
1720 AC_CHECK_LIB(crypt, crypt)
1721fi
1722
Damien Millera8e06ce2003-11-21 23:48:55 +11001723# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001724# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001725if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001726 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001727fi
1728
Tim Rice2291c002005-08-26 13:15:19 -07001729AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001730
1731### Configure cryptographic random number support
1732
1733# Check wheter OpenSSL seeds itself
1734AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001735AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001736 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001737#include <string.h>
1738#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001739int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001740 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001741 [
1742 OPENSSL_SEEDS_ITSELF=yes
1743 AC_MSG_RESULT(yes)
1744 ],
1745 [
1746 AC_MSG_RESULT(no)
1747 # Default to use of the rand helper if OpenSSL doesn't
1748 # seed itself
1749 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001750 ],
1751 [
1752 AC_MSG_WARN([cross compiling: assuming yes])
1753 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001754 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001755 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001756 ]
1757)
1758
1759
1760# Do we want to force the use of the rand helper?
1761AC_ARG_WITH(rand-helper,
1762 [ --with-rand-helper Use subprocess to gather strong randomness ],
1763 [
1764 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001765 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001766 # the previous test showed it to be unseeded.
1767 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1768 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1769 OPENSSL_SEEDS_ITSELF=yes
1770 USE_RAND_HELPER=""
1771 fi
1772 else
1773 USE_RAND_HELPER=yes
1774 fi
1775 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001776)
Damien Miller6c21c512002-01-22 21:57:53 +11001777
1778# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001779if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001780 # OpenSSL only
1781 AC_DEFINE(OPENSSL_PRNG_ONLY)
1782 RAND_MSG="OpenSSL internal ONLY"
1783 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001784elif test ! -z "$USE_RAND_HELPER" ; then
1785 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001786 RAND_MSG="ssh-rand-helper"
1787 INSTALL_SSH_RAND_HELPER="yes"
1788fi
1789AC_SUBST(INSTALL_SSH_RAND_HELPER)
1790
1791### Configuration of ssh-rand-helper
1792
1793# PRNGD TCP socket
1794AC_ARG_WITH(prngd-port,
1795 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1796 [
Damien Millere996d722002-01-23 11:20:59 +11001797 case "$withval" in
1798 no)
1799 withval=""
1800 ;;
1801 [[0-9]]*)
1802 ;;
1803 *)
1804 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1805 ;;
1806 esac
1807 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001808 PRNGD_PORT="$withval"
1809 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1810 fi
1811 ]
1812)
1813
1814# PRNGD Unix domain socket
1815AC_ARG_WITH(prngd-socket,
1816 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1817 [
Damien Millere996d722002-01-23 11:20:59 +11001818 case "$withval" in
1819 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001820 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001821 ;;
1822 no)
1823 withval=""
1824 ;;
1825 /*)
1826 ;;
1827 *)
1828 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1829 ;;
1830 esac
1831
1832 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001833 if test ! -z "$PRNGD_PORT" ; then
1834 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1835 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001836 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001837 AC_MSG_WARN(Entropy socket is not readable)
1838 fi
1839 PRNGD_SOCKET="$withval"
1840 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1841 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001842 ],
1843 [
1844 # Check for existing socket only if we don't have a random device already
1845 if test "$USE_RAND_HELPER" = yes ; then
1846 AC_MSG_CHECKING(for PRNGD/EGD socket)
1847 # Insert other locations here
1848 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1849 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1850 PRNGD_SOCKET="$sock"
1851 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1852 break;
1853 fi
1854 done
1855 if test ! -z "$PRNGD_SOCKET" ; then
1856 AC_MSG_RESULT($PRNGD_SOCKET)
1857 else
1858 AC_MSG_RESULT(not found)
1859 fi
1860 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001861 ]
1862)
1863
1864# Change default command timeout for hashing entropy source
1865entropy_timeout=200
1866AC_ARG_WITH(entropy-timeout,
1867 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1868 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001869 if test -n "$withval" && test "x$withval" != "xno" && \
1870 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001871 entropy_timeout=$withval
1872 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001873 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001874)
Damien Miller6c21c512002-01-22 21:57:53 +11001875AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1876
Damien Millerd3f6ad22002-06-25 10:24:47 +10001877SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001878AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001879 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001880 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001881 if test -n "$withval" && test "x$withval" != "xno" && \
1882 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001883 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001884 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001885 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001886)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001887AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1888AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001889
Tim Rice88f2ab52002-03-17 12:17:34 -08001890# We do this little dance with the search path to insure
1891# that programs that we select for use by installed programs
1892# (which may be run by the super-user) come from trusted
1893# locations before they come from the user's private area.
1894# This should help avoid accidentally configuring some
1895# random version of a program in someone's personal bin.
1896
1897OPATH=$PATH
1898PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001899test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001900test -d /sbin && PATH=$PATH:/sbin
1901test -d /usr/sbin && PATH=$PATH:/usr/sbin
1902PATH=$PATH:/etc:$OPATH
1903
Damien Millera8e06ce2003-11-21 23:48:55 +11001904# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001905OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1906OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1907OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1908OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1909OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1910OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1911OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1912OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1913OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1914OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1915OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1916OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1917OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1918OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1919OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1920OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001921# restore PATH
1922PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001923
1924# Where does ssh-rand-helper get its randomness from?
1925INSTALL_SSH_PRNG_CMDS=""
1926if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1927 if test ! -z "$PRNGD_PORT" ; then
1928 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1929 elif test ! -z "$PRNGD_SOCKET" ; then
1930 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1931 else
1932 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1933 RAND_HELPER_CMDHASH=yes
1934 INSTALL_SSH_PRNG_CMDS="yes"
1935 fi
1936fi
1937AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1938
1939
Ben Lindstromb5628642000-10-18 00:02:25 +00001940# Cheap hack to ensure NEWS-OS libraries are arranged right.
1941if test ! -z "$SONY" ; then
1942 LIBS="$LIBS -liberty";
1943fi
1944
Damien Millera22ba012000-03-02 23:09:20 +11001945# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001946AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001947AC_CHECK_SIZEOF(short int, 2)
1948AC_CHECK_SIZEOF(int, 4)
1949AC_CHECK_SIZEOF(long int, 4)
1950AC_CHECK_SIZEOF(long long int, 8)
1951
Damien Millerfa2bb692002-04-23 23:22:25 +10001952# Sanity check long long for some platforms (AIX)
1953if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1954 ac_cv_sizeof_long_long_int=0
1955fi
1956
Damien Millera22ba012000-03-02 23:09:20 +11001957# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001958AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1959 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001960 [ #include <sys/types.h> ],
1961 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001962 [ ac_cv_have_u_int="yes" ],
1963 [ ac_cv_have_u_int="no" ]
1964 )
1965])
1966if test "x$ac_cv_have_u_int" = "xyes" ; then
1967 AC_DEFINE(HAVE_U_INT)
1968 have_u_int=1
1969fi
1970
Damien Miller61e50f12000-05-08 20:49:37 +10001971AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1972 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001973 [ #include <sys/types.h> ],
1974 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001975 [ ac_cv_have_intxx_t="yes" ],
1976 [ ac_cv_have_intxx_t="no" ]
1977 )
1978])
1979if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1980 AC_DEFINE(HAVE_INTXX_T)
1981 have_intxx_t=1
1982fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001983
1984if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001985 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001986then
1987 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1988 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001989 [ #include <stdint.h> ],
1990 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001991 [
1992 AC_DEFINE(HAVE_INTXX_T)
1993 AC_MSG_RESULT(yes)
1994 ],
1995 [ AC_MSG_RESULT(no) ]
1996 )
1997fi
1998
Damien Miller578783e2000-09-23 14:12:24 +11001999AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2000 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002001 [
2002#include <sys/types.h>
2003#ifdef HAVE_STDINT_H
2004# include <stdint.h>
2005#endif
2006#include <sys/socket.h>
2007#ifdef HAVE_SYS_BITYPES_H
2008# include <sys/bitypes.h>
2009#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002010 ],
2011 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002012 [ ac_cv_have_int64_t="yes" ],
2013 [ ac_cv_have_int64_t="no" ]
2014 )
2015])
2016if test "x$ac_cv_have_int64_t" = "xyes" ; then
2017 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08002018fi
2019
Damien Miller61e50f12000-05-08 20:49:37 +10002020AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2021 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002022 [ #include <sys/types.h> ],
2023 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002024 [ ac_cv_have_u_intxx_t="yes" ],
2025 [ ac_cv_have_u_intxx_t="no" ]
2026 )
2027])
2028if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2029 AC_DEFINE(HAVE_U_INTXX_T)
2030 have_u_intxx_t=1
2031fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002032
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002033if test -z "$have_u_intxx_t" ; then
2034 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2035 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002036 [ #include <sys/socket.h> ],
2037 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002038 [
2039 AC_DEFINE(HAVE_U_INTXX_T)
2040 AC_MSG_RESULT(yes)
2041 ],
2042 [ AC_MSG_RESULT(no) ]
2043 )
2044fi
2045
Damien Miller578783e2000-09-23 14:12:24 +11002046AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2047 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002048 [ #include <sys/types.h> ],
2049 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002050 [ ac_cv_have_u_int64_t="yes" ],
2051 [ ac_cv_have_u_int64_t="no" ]
2052 )
2053])
2054if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2055 AC_DEFINE(HAVE_U_INT64_T)
2056 have_u_int64_t=1
2057fi
2058
Tim Rice4cec93f2002-02-26 08:40:48 -08002059if test -z "$have_u_int64_t" ; then
2060 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2061 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002062 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002063 [ u_int64_t a; a = 1],
2064 [
2065 AC_DEFINE(HAVE_U_INT64_T)
2066 AC_MSG_RESULT(yes)
2067 ],
2068 [ AC_MSG_RESULT(no) ]
2069 )
2070fi
2071
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002072if test -z "$have_u_intxx_t" ; then
2073 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2074 AC_TRY_COMPILE(
2075 [
2076#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002077 ],
2078 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002079 [ ac_cv_have_uintxx_t="yes" ],
2080 [ ac_cv_have_uintxx_t="no" ]
2081 )
2082 ])
2083 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2084 AC_DEFINE(HAVE_UINTXX_T)
2085 fi
2086fi
2087
2088if test -z "$have_uintxx_t" ; then
2089 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2090 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002091 [ #include <stdint.h> ],
2092 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002093 [
2094 AC_DEFINE(HAVE_UINTXX_T)
2095 AC_MSG_RESULT(yes)
2096 ],
2097 [ AC_MSG_RESULT(no) ]
2098 )
2099fi
2100
Damien Milleredb82922000-06-20 13:25:52 +10002101if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002102 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002103then
2104 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2105 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002106 [
2107#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002108 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002109 [
Damien Miller70494d12000-04-03 15:57:06 +10002110 int8_t a; int16_t b; int32_t c;
2111 u_int8_t e; u_int16_t f; u_int32_t g;
2112 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002113 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002114 [
2115 AC_DEFINE(HAVE_U_INTXX_T)
2116 AC_DEFINE(HAVE_INTXX_T)
2117 AC_MSG_RESULT(yes)
2118 ],
2119 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002120 )
Damien Millerb29ea912000-01-15 14:12:03 +11002121fi
2122
Damien Miller58be7382001-09-15 21:31:54 +10002123
2124AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2125 AC_TRY_COMPILE(
2126 [
2127#include <sys/types.h>
2128 ],
2129 [ u_char foo; foo = 125; ],
2130 [ ac_cv_have_u_char="yes" ],
2131 [ ac_cv_have_u_char="no" ]
2132 )
2133])
2134if test "x$ac_cv_have_u_char" = "xyes" ; then
2135 AC_DEFINE(HAVE_U_CHAR)
2136fi
2137
Tim Rice13aae5e2001-10-21 17:53:58 -07002138TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002139
Tim Rice200a5c02002-02-26 22:12:34 -08002140AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002141
Damien Miller848b9932005-02-24 12:12:34 +11002142AC_CHECK_TYPES(in_addr_t,,,
2143[#include <sys/types.h>
2144#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002145
Damien Miller61e50f12000-05-08 20:49:37 +10002146AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2147 AC_TRY_COMPILE(
2148 [
2149#include <sys/types.h>
2150 ],
2151 [ size_t foo; foo = 1235; ],
2152 [ ac_cv_have_size_t="yes" ],
2153 [ ac_cv_have_size_t="no" ]
2154 )
2155])
2156if test "x$ac_cv_have_size_t" = "xyes" ; then
2157 AC_DEFINE(HAVE_SIZE_T)
2158fi
Damien Miller95058511999-12-29 10:36:45 +11002159
Damien Miller615f9392000-05-17 22:53:33 +10002160AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2161 AC_TRY_COMPILE(
2162 [
2163#include <sys/types.h>
2164 ],
2165 [ ssize_t foo; foo = 1235; ],
2166 [ ac_cv_have_ssize_t="yes" ],
2167 [ ac_cv_have_ssize_t="no" ]
2168 )
2169])
2170if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2171 AC_DEFINE(HAVE_SSIZE_T)
2172fi
2173
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002174AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2175 AC_TRY_COMPILE(
2176 [
2177#include <time.h>
2178 ],
2179 [ clock_t foo; foo = 1235; ],
2180 [ ac_cv_have_clock_t="yes" ],
2181 [ ac_cv_have_clock_t="no" ]
2182 )
2183])
2184if test "x$ac_cv_have_clock_t" = "xyes" ; then
2185 AC_DEFINE(HAVE_CLOCK_T)
2186fi
2187
Damien Millerb54b40e2000-06-23 08:23:34 +10002188AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2189 AC_TRY_COMPILE(
2190 [
2191#include <sys/types.h>
2192#include <sys/socket.h>
2193 ],
2194 [ sa_family_t foo; foo = 1235; ],
2195 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002196 [ AC_TRY_COMPILE(
2197 [
2198#include <sys/types.h>
2199#include <sys/socket.h>
2200#include <netinet/in.h>
2201 ],
2202 [ sa_family_t foo; foo = 1235; ],
2203 [ ac_cv_have_sa_family_t="yes" ],
2204
Damien Millerb54b40e2000-06-23 08:23:34 +10002205 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002206 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002207 )
2208])
2209if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2210 AC_DEFINE(HAVE_SA_FAMILY_T)
2211fi
2212
Damien Miller0f91b4e2000-06-18 15:43:25 +10002213AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2214 AC_TRY_COMPILE(
2215 [
2216#include <sys/types.h>
2217 ],
2218 [ pid_t foo; foo = 1235; ],
2219 [ ac_cv_have_pid_t="yes" ],
2220 [ ac_cv_have_pid_t="no" ]
2221 )
2222])
2223if test "x$ac_cv_have_pid_t" = "xyes" ; then
2224 AC_DEFINE(HAVE_PID_T)
2225fi
2226
2227AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2228 AC_TRY_COMPILE(
2229 [
2230#include <sys/types.h>
2231 ],
2232 [ mode_t foo; foo = 1235; ],
2233 [ ac_cv_have_mode_t="yes" ],
2234 [ ac_cv_have_mode_t="no" ]
2235 )
2236])
2237if test "x$ac_cv_have_mode_t" = "xyes" ; then
2238 AC_DEFINE(HAVE_MODE_T)
2239fi
2240
Damien Miller61e50f12000-05-08 20:49:37 +10002241
2242AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2243 AC_TRY_COMPILE(
2244 [
Damien Miller81171112000-04-23 11:14:01 +10002245#include <sys/types.h>
2246#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002247 ],
2248 [ struct sockaddr_storage s; ],
2249 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2250 [ ac_cv_have_struct_sockaddr_storage="no" ]
2251 )
2252])
2253if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2254 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2255fi
Damien Miller34132e52000-01-14 15:45:46 +11002256
Damien Miller61e50f12000-05-08 20:49:37 +10002257AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2258 AC_TRY_COMPILE(
2259 [
Damien Miller7b22d652000-06-18 14:07:04 +10002260#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002261#include <netinet/in.h>
2262 ],
2263 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2264 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2265 [ ac_cv_have_struct_sockaddr_in6="no" ]
2266 )
2267])
2268if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2269 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2270fi
Damien Miller34132e52000-01-14 15:45:46 +11002271
Damien Miller61e50f12000-05-08 20:49:37 +10002272AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2273 AC_TRY_COMPILE(
2274 [
Damien Miller7b22d652000-06-18 14:07:04 +10002275#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002276#include <netinet/in.h>
2277 ],
2278 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2279 [ ac_cv_have_struct_in6_addr="yes" ],
2280 [ ac_cv_have_struct_in6_addr="no" ]
2281 )
2282])
2283if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2284 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2285fi
Damien Miller34132e52000-01-14 15:45:46 +11002286
Damien Miller61e50f12000-05-08 20:49:37 +10002287AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2288 AC_TRY_COMPILE(
2289 [
Damien Miller81171112000-04-23 11:14:01 +10002290#include <sys/types.h>
2291#include <sys/socket.h>
2292#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002293 ],
2294 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2295 [ ac_cv_have_struct_addrinfo="yes" ],
2296 [ ac_cv_have_struct_addrinfo="no" ]
2297 )
2298])
2299if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2300 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2301fi
2302
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002303AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2304 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002305 [ #include <sys/time.h> ],
2306 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002307 [ ac_cv_have_struct_timeval="yes" ],
2308 [ ac_cv_have_struct_timeval="no" ]
2309 )
2310])
2311if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2312 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2313 have_struct_timeval=1
2314fi
2315
Tim Rice4e4dc562003-03-18 10:21:40 -08002316AC_CHECK_TYPES(struct timespec)
2317
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002318# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002319if test "x$ac_cv_have_int64_t" = "xno" && \
2320 test "x$ac_cv_sizeof_long_int" != "x8" && \
2321 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002322 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2323 echo "an alternative compiler (I.E., GCC) before continuing."
2324 echo ""
2325 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002326else
2327dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002328 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002329 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002330#include <stdio.h>
2331#include <string.h>
2332#ifdef HAVE_SNPRINTF
2333main()
2334{
2335 char buf[50];
2336 char expected_out[50];
2337 int mazsize = 50 ;
2338#if (SIZEOF_LONG_INT == 8)
2339 long int num = 0x7fffffffffffffff;
2340#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002341 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002342#endif
2343 strcpy(expected_out, "9223372036854775807");
2344 snprintf(buf, mazsize, "%lld", num);
2345 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002346 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002347 exit(0);
2348}
2349#else
2350main() { exit(0); }
2351#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002352 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002353 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002354 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002355fi
2356
Damien Miller78315eb2000-09-29 23:01:36 +11002357dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002358OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2359OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2360OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2361OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2362OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002363OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002364OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2365OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002366OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002367OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2368OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2369OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2370OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002371OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2372OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2373OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2374OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002375
2376AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002377
Damien Miller61e50f12000-05-08 20:49:37 +10002378AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2379 ac_cv_have_ss_family_in_struct_ss, [
2380 AC_TRY_COMPILE(
2381 [
Damien Miller81171112000-04-23 11:14:01 +10002382#include <sys/types.h>
2383#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002384 ],
2385 [ struct sockaddr_storage s; s.ss_family = 1; ],
2386 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2387 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2388 )
2389])
2390if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2391 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2392fi
2393
Damien Miller61e50f12000-05-08 20:49:37 +10002394AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2395 ac_cv_have___ss_family_in_struct_ss, [
2396 AC_TRY_COMPILE(
2397 [
Damien Miller81171112000-04-23 11:14:01 +10002398#include <sys/types.h>
2399#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002400 ],
2401 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2402 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2403 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2404 )
2405])
2406if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2407 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2408fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002409
Damien Millerad833b32000-08-23 10:46:23 +10002410AC_CACHE_CHECK([for pw_class field in struct passwd],
2411 ac_cv_have_pw_class_in_struct_passwd, [
2412 AC_TRY_COMPILE(
2413 [
Damien Millerad833b32000-08-23 10:46:23 +10002414#include <pwd.h>
2415 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002416 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002417 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2418 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2419 )
2420])
2421if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2422 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2423fi
2424
Kevin Steves82456952001-06-22 21:14:18 +00002425AC_CACHE_CHECK([for pw_expire field in struct passwd],
2426 ac_cv_have_pw_expire_in_struct_passwd, [
2427 AC_TRY_COMPILE(
2428 [
2429#include <pwd.h>
2430 ],
2431 [ struct passwd p; p.pw_expire = 0; ],
2432 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2433 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2434 )
2435])
2436if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2437 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2438fi
2439
2440AC_CACHE_CHECK([for pw_change field in struct passwd],
2441 ac_cv_have_pw_change_in_struct_passwd, [
2442 AC_TRY_COMPILE(
2443 [
2444#include <pwd.h>
2445 ],
2446 [ struct passwd p; p.pw_change = 0; ],
2447 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2448 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2449 )
2450])
2451if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2452 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2453fi
Damien Miller61e50f12000-05-08 20:49:37 +10002454
Tim Rice28bbb0c2002-05-27 17:37:32 -07002455dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002456AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2457 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002458 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002459 [
Tim Riceae49fe62002-04-12 10:26:21 -07002460#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002461#include <sys/socket.h>
2462#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002463int main() {
2464#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002465#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002466exit(1);
2467#endif
2468struct msghdr m;
2469m.msg_accrights = 0;
2470exit(0);
2471}
Kevin Steves939c9db2002-03-22 17:23:25 +00002472 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002473 [ ac_cv_have_accrights_in_msghdr="yes" ],
2474 [ ac_cv_have_accrights_in_msghdr="no" ]
2475 )
2476])
2477if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2478 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2479fi
2480
Kevin Stevesa44e0352002-04-07 16:18:03 +00002481AC_CACHE_CHECK([for msg_control field in struct msghdr],
2482 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002483 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002484 [
Tim Riceae49fe62002-04-12 10:26:21 -07002485#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002486#include <sys/socket.h>
2487#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002488int main() {
2489#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002490#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002491exit(1);
2492#endif
2493struct msghdr m;
2494m.msg_control = 0;
2495exit(0);
2496}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002497 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002498 [ ac_cv_have_control_in_msghdr="yes" ],
2499 [ ac_cv_have_control_in_msghdr="no" ]
2500 )
2501])
2502if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2503 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2504fi
2505
Damien Miller61e50f12000-05-08 20:49:37 +10002506AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002507 AC_TRY_LINK([],
2508 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002509 [ ac_cv_libc_defines___progname="yes" ],
2510 [ ac_cv_libc_defines___progname="no" ]
2511 )
2512])
2513if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2514 AC_DEFINE(HAVE___PROGNAME)
2515fi
2516
Kevin Steves4846f4a2002-03-22 18:19:53 +00002517AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2518 AC_TRY_LINK([
2519#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002520],
2521 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002522 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2523 [ ac_cv_cc_implements___FUNCTION__="no" ]
2524 )
2525])
2526if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2527 AC_DEFINE(HAVE___FUNCTION__)
2528fi
2529
2530AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2531 AC_TRY_LINK([
2532#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002533],
2534 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002535 [ ac_cv_cc_implements___func__="yes" ],
2536 [ ac_cv_cc_implements___func__="no" ]
2537 )
2538])
2539if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2540 AC_DEFINE(HAVE___func__)
2541fi
2542
Damien Miller4f8e6692001-07-14 13:22:53 +10002543AC_CACHE_CHECK([whether getopt has optreset support],
2544 ac_cv_have_getopt_optreset, [
2545 AC_TRY_LINK(
2546 [
2547#include <getopt.h>
2548 ],
2549 [ extern int optreset; optreset = 0; ],
2550 [ ac_cv_have_getopt_optreset="yes" ],
2551 [ ac_cv_have_getopt_optreset="no" ]
2552 )
2553])
2554if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2555 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2556fi
Damien Millera22ba012000-03-02 23:09:20 +11002557
Damien Millerecbb26d2000-07-15 14:59:14 +10002558AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002559 AC_TRY_LINK([],
2560 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002561 [ ac_cv_libc_defines_sys_errlist="yes" ],
2562 [ ac_cv_libc_defines_sys_errlist="no" ]
2563 )
2564])
2565if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2566 AC_DEFINE(HAVE_SYS_ERRLIST)
2567fi
2568
2569
Damien Miller11fa2cc2000-08-16 10:35:58 +10002570AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002571 AC_TRY_LINK([],
2572 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002573 [ ac_cv_libc_defines_sys_nerr="yes" ],
2574 [ ac_cv_libc_defines_sys_nerr="no" ]
2575 )
2576])
2577if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2578 AC_DEFINE(HAVE_SYS_NERR)
2579fi
2580
Damien Millera8e06ce2003-11-21 23:48:55 +11002581SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002582# Check whether user wants sectok support
2583AC_ARG_WITH(sectok,
2584 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002585 [
2586 if test "x$withval" != "xno" ; then
2587 if test "x$withval" != "xyes" ; then
2588 CPPFLAGS="$CPPFLAGS -I${withval}"
2589 LDFLAGS="$LDFLAGS -L${withval}"
2590 if test ! -z "$need_dash_r" ; then
2591 LDFLAGS="$LDFLAGS -R${withval}"
2592 fi
2593 if test ! -z "$blibpath" ; then
2594 blibpath="$blibpath:${withval}"
2595 fi
2596 fi
2597 AC_CHECK_HEADERS(sectok.h)
2598 if test "$ac_cv_header_sectok_h" != yes; then
2599 AC_MSG_ERROR(Can't find sectok.h)
2600 fi
2601 AC_CHECK_LIB(sectok, sectok_open)
2602 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2603 AC_MSG_ERROR(Can't find libsectok)
2604 fi
2605 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002606 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002607 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002608 fi
2609 ]
2610)
2611
2612# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002613OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002614AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002615 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2616 [
2617 if test "x$withval" != "xno" ; then
2618 if test "x$withval" != "xyes" ; then
2619 OPENSC_CONFIG=$withval/bin/opensc-config
2620 else
2621 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2622 fi
2623 if test "$OPENSC_CONFIG" != "no"; then
2624 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2625 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2626 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2627 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2628 AC_DEFINE(SMARTCARD)
2629 AC_DEFINE(USE_OPENSC)
2630 SCARD_MSG="yes, using OpenSC"
2631 fi
2632 fi
2633 ]
2634)
Damien Miller85de5802001-09-18 14:01:11 +10002635
Darren Tucker5f88d342003-10-15 16:57:57 +10002636# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002637AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002638 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002639 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002640 # Needed by our getrrsetbyname()
2641 AC_SEARCH_LIBS(res_query, resolv)
2642 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002643 AC_MSG_CHECKING(if res_query will link)
2644 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2645 [AC_MSG_RESULT(no)
2646 saved_LIBS="$LIBS"
2647 LIBS="$LIBS -lresolv"
2648 AC_MSG_CHECKING(for res_query in -lresolv)
2649 AC_LINK_IFELSE([
2650#include <resolv.h>
2651int main()
2652{
2653 res_query (0, 0, 0, 0, 0);
2654 return 0;
2655}
2656 ],
2657 [LIBS="$LIBS -lresolv"
2658 AC_MSG_RESULT(yes)],
2659 [LIBS="$saved_LIBS"
2660 AC_MSG_RESULT(no)])
2661 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002662 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002663 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002664 [#include <sys/types.h>
2665 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002666 AC_CHECK_MEMBER(HEADER.ad,
2667 [AC_DEFINE(HAVE_HEADER_AD)],,
2668 [#include <arpa/nameser.h>])
2669 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002670
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002671# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002672KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002673AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002674 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002675 [ if test "x$withval" != "xno" ; then
2676 if test "x$withval" = "xyes" ; then
2677 KRB5ROOT="/usr/local"
2678 else
2679 KRB5ROOT=${withval}
2680 fi
2681
2682 AC_DEFINE(KRB5)
2683 KRB5_MSG="yes"
2684
2685 AC_MSG_CHECKING(for krb5-config)
2686 if test -x $KRB5ROOT/bin/krb5-config ; then
2687 KRB5CONF=$KRB5ROOT/bin/krb5-config
2688 AC_MSG_RESULT($KRB5CONF)
2689
2690 AC_MSG_CHECKING(for gssapi support)
2691 if $KRB5CONF | grep gssapi >/dev/null ; then
2692 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002693 AC_DEFINE(GSSAPI)
2694 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002695 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002696 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002697 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002698 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002699 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2700 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002701 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002702 AC_MSG_CHECKING(whether we are using Heimdal)
2703 AC_TRY_COMPILE([ #include <krb5.h> ],
2704 [ char *tmp = heimdal_version; ],
2705 [ AC_MSG_RESULT(yes)
2706 AC_DEFINE(HEIMDAL) ],
2707 AC_MSG_RESULT(no)
2708 )
2709 else
2710 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002711 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002712 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002713 AC_MSG_CHECKING(whether we are using Heimdal)
2714 AC_TRY_COMPILE([ #include <krb5.h> ],
2715 [ char *tmp = heimdal_version; ],
2716 [ AC_MSG_RESULT(yes)
2717 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002718 K5LIBS="-lkrb5 -ldes"
2719 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002720 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002721 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002722 ],
2723 [ AC_MSG_RESULT(no)
2724 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2725 ]
2726 )
Damien Miller200d0a72003-06-30 19:21:36 +10002727 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002728
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002729 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2730 [ AC_DEFINE(GSSAPI)
2731 K5LIBS="-lgssapi $K5LIBS" ],
2732 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2733 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002734 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002735 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2736 $K5LIBS)
2737 ],
2738 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002739
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002740 AC_CHECK_HEADER(gssapi.h, ,
2741 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002742 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002743 AC_CHECK_HEADERS(gssapi.h, ,
2744 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002745 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002746 ]
2747 )
2748
2749 oldCPP="$CPPFLAGS"
2750 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2751 AC_CHECK_HEADER(gssapi_krb5.h, ,
2752 [ CPPFLAGS="$oldCPP" ])
2753
Damien Millera8e06ce2003-11-21 23:48:55 +11002754 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002755 if test ! -z "$need_dash_r" ; then
2756 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2757 fi
2758 if test ! -z "$blibpath" ; then
2759 blibpath="$blibpath:${KRB5ROOT}/lib"
2760 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002761 fi
2762
2763 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2764 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2765 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2766
2767 LIBS="$LIBS $K5LIBS"
2768 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2769 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002770)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002771
Damien Millera22ba012000-03-02 23:09:20 +11002772# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002773
Damien Millerf58c6722002-05-13 13:15:42 +10002774PRIVSEP_PATH=/var/empty
2775AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002776 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002777 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002778 if test -n "$withval" && test "x$withval" != "xno" && \
2779 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002780 PRIVSEP_PATH=$withval
2781 fi
2782 ]
2783)
2784AC_SUBST(PRIVSEP_PATH)
2785
Damien Millera22ba012000-03-02 23:09:20 +11002786AC_ARG_WITH(xauth,
2787 [ --with-xauth=PATH Specify path to xauth program ],
2788 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002789 if test -n "$withval" && test "x$withval" != "xno" && \
2790 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002791 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002792 fi
2793 ],
2794 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002795 TestPath="$PATH"
2796 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2797 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2798 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2799 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2800 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002801 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002802 xauth_path="/usr/openwin/bin/xauth"
2803 fi
2804 ]
2805)
2806
Damien Miller7d901272003-01-13 16:55:22 +11002807STRIP_OPT=-s
2808AC_ARG_ENABLE(strip,
2809 [ --disable-strip Disable calling strip(1) on install],
2810 [
2811 if test "x$enableval" = "xno" ; then
2812 STRIP_OPT=
2813 fi
2814 ]
2815)
2816AC_SUBST(STRIP_OPT)
2817
Damien Millera19cf472000-11-29 13:28:50 +11002818if test -z "$xauth_path" ; then
2819 XAUTH_PATH="undefined"
2820 AC_SUBST(XAUTH_PATH)
2821else
Damien Millera22ba012000-03-02 23:09:20 +11002822 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002823 XAUTH_PATH=$xauth_path
2824 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002825fi
Damien Millera22ba012000-03-02 23:09:20 +11002826
2827# Check for mail directory (last resort if we cannot get it from headers)
2828if test ! -z "$MAIL" ; then
2829 maildir=`dirname $MAIL`
2830 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2831fi
2832
Darren Tucker623d92f2004-09-12 22:36:15 +10002833if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002834 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2835 disable_ptmx_check=yes
2836fi
Damien Millera22ba012000-03-02 23:09:20 +11002837if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002838 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002839 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002840 [
2841 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2842 have_dev_ptmx=1
2843 ]
2844 )
2845 fi
Damien Millera22ba012000-03-02 23:09:20 +11002846fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002847
Darren Tucker623d92f2004-09-12 22:36:15 +10002848if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002849 AC_CHECK_FILE("/dev/ptc",
2850 [
2851 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2852 have_dev_ptc=1
2853 ]
2854 )
2855else
2856 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2857fi
Damien Miller204ad072000-03-02 23:56:12 +11002858
Damien Millera22ba012000-03-02 23:09:20 +11002859# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002860AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002861 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002862 [
Damien Miller897741e2001-04-16 10:41:46 +10002863 case "$withval" in
2864 man|cat|doc)
2865 MANTYPE=$withval
2866 ;;
2867 *)
2868 AC_MSG_ERROR(invalid man type: $withval)
2869 ;;
2870 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002871 ]
2872)
Ben Lindstrombc709922001-04-18 18:04:21 +00002873if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002874 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2875 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002876 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2877 MANTYPE=doc
2878 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2879 MANTYPE=man
2880 else
2881 MANTYPE=cat
2882 fi
2883fi
Damien Miller670a4b82000-01-22 13:53:11 +11002884AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002885if test "$MANTYPE" = "doc"; then
2886 mansubdir=man;
2887else
2888 mansubdir=$MANTYPE;
2889fi
2890AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002891
Damien Millera22ba012000-03-02 23:09:20 +11002892# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002893MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002894AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002895 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002896 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002897 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002898 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002899 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002900 fi
2901 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002902)
2903
Damien Millera22ba012000-03-02 23:09:20 +11002904# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002905AC_ARG_WITH(shadow,
2906 [ --without-shadow Disable shadow password support],
2907 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002908 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002909 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002910 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002911 fi
2912 ]
2913)
2914
Damien Miller1f335fb2000-06-26 11:31:33 +10002915if test -z "$disable_shadow" ; then
2916 AC_MSG_CHECKING([if the systems has expire shadow information])
2917 AC_TRY_COMPILE(
2918 [
2919#include <sys/types.h>
2920#include <shadow.h>
2921 struct spwd sp;
2922 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2923 [ sp_expire_available=yes ], []
2924 )
2925
2926 if test "x$sp_expire_available" = "xyes" ; then
2927 AC_MSG_RESULT(yes)
2928 AC_DEFINE(HAS_SHADOW_EXPIRE)
2929 else
2930 AC_MSG_RESULT(no)
2931 fi
2932fi
2933
Damien Millera22ba012000-03-02 23:09:20 +11002934# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002935if test ! -z "$IPADDR_IN_DISPLAY" ; then
2936 DISPLAY_HACK_MSG="yes"
2937 AC_DEFINE(IPADDR_IN_DISPLAY)
2938else
Damien Millera8e06ce2003-11-21 23:48:55 +11002939 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002940 AC_ARG_WITH(ipaddr-display,
2941 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2942 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002943 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002944 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002945 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002946 fi
2947 ]
2948 )
2949fi
Damien Miller76112de1999-12-21 11:18:08 +11002950
Darren Tuckere1a790d2003-09-16 11:52:19 +10002951# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002952AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002953 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002954 [ if test "x$enableval" = "xno"; then
2955 AC_MSG_NOTICE([/etc/default/login handling disabled])
2956 etc_default_login=no
2957 else
2958 etc_default_login=yes
2959 fi ],
2960 [ etc_default_login=yes ]
2961)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002962
Darren Tucker2f9573d2005-02-10 22:28:54 +11002963if test "x$etc_default_login" != "xno"; then
2964 AC_CHECK_FILE("/etc/default/login",
2965 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002966 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2967 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002968 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2969 elif test "x$external_path_file" = "x/etc/default/login"; then
2970 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2971 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002972fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002973
Tim Rice43a1c132002-04-17 21:19:14 -07002974dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002975if test $ac_cv_func_login_getcapbool = "yes" && \
2976 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002977 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002978fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002979
Damien Millera22ba012000-03-02 23:09:20 +11002980# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002981SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002982AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002983 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002984 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002985 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002986 AC_MSG_WARN([
2987--with-default-path=PATH has no effect on this system.
2988Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002989 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002990 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002991 AC_MSG_WARN([
2992--with-default-path=PATH will only be used if PATH is not defined in
2993$external_path_file .])
2994 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002995 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002996 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002997 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002998 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002999 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3000 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003001 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003002 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003003 AC_MSG_WARN([
3004If PATH is defined in $external_path_file, ensure the path to scp is included,
3005otherwise scp will not work.])
3006 fi
3007 AC_TRY_RUN(
3008 [
Tim Rice59ea0a02001-03-10 13:50:45 -08003009/* find out what STDPATH is */
3010#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003011#ifdef HAVE_PATHS_H
3012# include <paths.h>
3013#endif
3014#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003015# ifdef _PATH_USERPATH /* Irix */
3016# define _PATH_STDPATH _PATH_USERPATH
3017# else
3018# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3019# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003020#endif
3021#include <sys/types.h>
3022#include <sys/stat.h>
3023#include <fcntl.h>
3024#define DATA "conftest.stdpath"
3025
3026main()
3027{
3028 FILE *fd;
3029 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003030
Tim Rice59ea0a02001-03-10 13:50:45 -08003031 fd = fopen(DATA,"w");
3032 if(fd == NULL)
3033 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003034
Tim Rice59ea0a02001-03-10 13:50:45 -08003035 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3036 exit(1);
3037
3038 exit(0);
3039}
3040 ], [ user_path=`cat conftest.stdpath` ],
3041 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3042 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3043 )
3044# make sure $bindir is in USER_PATH so scp will work
3045 t_bindir=`eval echo ${bindir}`
3046 case $t_bindir in
3047 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3048 esac
3049 case $t_bindir in
3050 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3051 esac
3052 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3053 if test $? -ne 0 ; then
3054 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3055 if test $? -ne 0 ; then
3056 user_path=$user_path:$t_bindir
3057 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3058 fi
3059 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003060 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003061)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003062if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003063 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
3064 AC_SUBST(user_path)
3065fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003066
Damien Millera18bbd32002-05-13 10:48:57 +10003067# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003068AC_ARG_WITH(superuser-path,
3069 [ --with-superuser-path= Specify different path for super-user],
3070 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003071 if test -n "$withval" && test "x$withval" != "xno" && \
3072 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10003073 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
3074 superuser_path=$withval
3075 fi
3076 ]
3077)
3078
3079
Damien Miller61e50f12000-05-08 20:49:37 +10003080AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003081IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003082AC_ARG_WITH(4in6,
3083 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3084 [
3085 if test "x$withval" != "xno" ; then
3086 AC_MSG_RESULT(yes)
3087 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003088 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003089 else
3090 AC_MSG_RESULT(no)
3091 fi
3092 ],[
3093 if test "x$inet6_default_4in6" = "xyes"; then
3094 AC_MSG_RESULT([yes (default)])
3095 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003096 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003097 else
3098 AC_MSG_RESULT([no (default)])
3099 fi
3100 ]
3101)
3102
Damien Miller60396b02001-02-18 17:01:00 +11003103# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003104BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003105AC_ARG_WITH(bsd-auth,
3106 [ --with-bsd-auth Enable BSD auth support],
3107 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003108 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11003109 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11003110 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003111 fi
3112 ]
3113)
3114
Damien Millera22ba012000-03-02 23:09:20 +11003115# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003116piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003117# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003118if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003119 piddir=`eval echo ${sysconfdir}`
3120 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003121 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003122 esac
3123fi
3124
Tim Rice88f2ab52002-03-17 12:17:34 -08003125AC_ARG_WITH(pid-dir,
3126 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3127 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003128 if test -n "$withval" && test "x$withval" != "xno" && \
3129 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003130 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003131 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003132 AC_MSG_WARN([** no $piddir directory on this system **])
3133 fi
3134 fi
3135 ]
3136)
3137
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003138AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11003139AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003140
andre2ff7b5d2000-06-03 14:57:40 +00003141dnl allow user to disable some login recording features
3142AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003143 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003144 [
3145 if test "x$enableval" = "xno" ; then
3146 AC_DEFINE(DISABLE_LASTLOG)
3147 fi
3148 ]
andre2ff7b5d2000-06-03 14:57:40 +00003149)
3150AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003151 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003152 [
3153 if test "x$enableval" = "xno" ; then
3154 AC_DEFINE(DISABLE_UTMP)
3155 fi
3156 ]
andre2ff7b5d2000-06-03 14:57:40 +00003157)
3158AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003159 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003160 [
3161 if test "x$enableval" = "xno" ; then
3162 AC_DEFINE(DISABLE_UTMPX)
3163 fi
3164 ]
andre2ff7b5d2000-06-03 14:57:40 +00003165)
3166AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003167 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003168 [
3169 if test "x$enableval" = "xno" ; then
3170 AC_DEFINE(DISABLE_WTMP)
3171 fi
3172 ]
andre2ff7b5d2000-06-03 14:57:40 +00003173)
3174AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003175 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003176 [
3177 if test "x$enableval" = "xno" ; then
3178 AC_DEFINE(DISABLE_WTMPX)
3179 fi
3180 ]
andre2ff7b5d2000-06-03 14:57:40 +00003181)
3182AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003183 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003184 [
3185 if test "x$enableval" = "xno" ; then
3186 AC_DEFINE(DISABLE_LOGIN)
3187 fi
3188 ]
andre2ff7b5d2000-06-03 14:57:40 +00003189)
3190AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003191 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003192 [
3193 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003194 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10003195 fi
3196 ]
andre2ff7b5d2000-06-03 14:57:40 +00003197)
3198AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003199 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003200 [
3201 if test "x$enableval" = "xno" ; then
3202 AC_DEFINE(DISABLE_PUTUTXLINE)
3203 fi
3204 ]
andre2ff7b5d2000-06-03 14:57:40 +00003205)
3206AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003207 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003208 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003209 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003210 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003211 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003212 conf_lastlog_location=$withval
3213 fi
3214 ]
3215)
andre2ff7b5d2000-06-03 14:57:40 +00003216
3217dnl lastlog, [uw]tmpx? detection
3218dnl NOTE: set the paths in the platform section to avoid the
3219dnl need for command-line parameters
3220dnl lastlog and [uw]tmp are subject to a file search if all else fails
3221
3222dnl lastlog detection
3223dnl NOTE: the code itself will detect if lastlog is a directory
3224AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3225AC_TRY_COMPILE([
3226#include <sys/types.h>
3227#include <utmp.h>
3228#ifdef HAVE_LASTLOG_H
3229# include <lastlog.h>
3230#endif
Damien Miller2994e082000-06-04 15:51:47 +10003231#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003232# include <paths.h>
3233#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003234#ifdef HAVE_LOGIN_H
3235# include <login.h>
3236#endif
andre2ff7b5d2000-06-03 14:57:40 +00003237 ],
3238 [ char *lastlog = LASTLOG_FILE; ],
3239 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003240 [
3241 AC_MSG_RESULT(no)
3242 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3243 AC_TRY_COMPILE([
3244#include <sys/types.h>
3245#include <utmp.h>
3246#ifdef HAVE_LASTLOG_H
3247# include <lastlog.h>
3248#endif
3249#ifdef HAVE_PATHS_H
3250# include <paths.h>
3251#endif
3252 ],
3253 [ char *lastlog = _PATH_LASTLOG; ],
3254 [ AC_MSG_RESULT(yes) ],
3255 [
andree441aa32000-06-12 22:34:38 +00003256 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003257 system_lastlog_path=no
3258 ])
3259 ]
andre2ff7b5d2000-06-03 14:57:40 +00003260)
Damien Miller2994e082000-06-04 15:51:47 +10003261
andre2ff7b5d2000-06-03 14:57:40 +00003262if test -z "$conf_lastlog_location"; then
3263 if test x"$system_lastlog_path" = x"no" ; then
3264 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003265 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003266 conf_lastlog_location=$f
3267 fi
3268 done
3269 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003270 AC_MSG_WARN([** Cannot find lastlog **])
3271 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003272 fi
3273 fi
3274fi
3275
3276if test -n "$conf_lastlog_location"; then
3277 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003278fi
andre2ff7b5d2000-06-03 14:57:40 +00003279
3280dnl utmp detection
3281AC_MSG_CHECKING([if your system defines UTMP_FILE])
3282AC_TRY_COMPILE([
3283#include <sys/types.h>
3284#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003285#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003286# include <paths.h>
3287#endif
3288 ],
3289 [ char *utmp = UTMP_FILE; ],
3290 [ AC_MSG_RESULT(yes) ],
3291 [ AC_MSG_RESULT(no)
3292 system_utmp_path=no ]
3293)
3294if test -z "$conf_utmp_location"; then
3295 if test x"$system_utmp_path" = x"no" ; then
3296 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3297 if test -f $f ; then
3298 conf_utmp_location=$f
3299 fi
3300 done
3301 if test -z "$conf_utmp_location"; then
3302 AC_DEFINE(DISABLE_UTMP)
3303 fi
3304 fi
3305fi
3306if test -n "$conf_utmp_location"; then
3307 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003308fi
andre2ff7b5d2000-06-03 14:57:40 +00003309
3310dnl wtmp detection
3311AC_MSG_CHECKING([if your system defines WTMP_FILE])
3312AC_TRY_COMPILE([
3313#include <sys/types.h>
3314#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003315#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003316# include <paths.h>
3317#endif
3318 ],
3319 [ char *wtmp = WTMP_FILE; ],
3320 [ AC_MSG_RESULT(yes) ],
3321 [ AC_MSG_RESULT(no)
3322 system_wtmp_path=no ]
3323)
3324if test -z "$conf_wtmp_location"; then
3325 if test x"$system_wtmp_path" = x"no" ; then
3326 for f in /usr/adm/wtmp /var/log/wtmp; do
3327 if test -f $f ; then
3328 conf_wtmp_location=$f
3329 fi
3330 done
3331 if test -z "$conf_wtmp_location"; then
3332 AC_DEFINE(DISABLE_WTMP)
3333 fi
3334 fi
3335fi
3336if test -n "$conf_wtmp_location"; then
3337 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003338fi
andre2ff7b5d2000-06-03 14:57:40 +00003339
3340
3341dnl utmpx detection - I don't know any system so perverse as to require
3342dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3343dnl there, though.
3344AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3345AC_TRY_COMPILE([
3346#include <sys/types.h>
3347#include <utmp.h>
3348#ifdef HAVE_UTMPX_H
3349#include <utmpx.h>
3350#endif
Damien Miller2994e082000-06-04 15:51:47 +10003351#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003352# include <paths.h>
3353#endif
3354 ],
3355 [ char *utmpx = UTMPX_FILE; ],
3356 [ AC_MSG_RESULT(yes) ],
3357 [ AC_MSG_RESULT(no)
3358 system_utmpx_path=no ]
3359)
3360if test -z "$conf_utmpx_location"; then
3361 if test x"$system_utmpx_path" = x"no" ; then
3362 AC_DEFINE(DISABLE_UTMPX)
3363 fi
3364else
3365 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003366fi
andre2ff7b5d2000-06-03 14:57:40 +00003367
3368dnl wtmpx detection
3369AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3370AC_TRY_COMPILE([
3371#include <sys/types.h>
3372#include <utmp.h>
3373#ifdef HAVE_UTMPX_H
3374#include <utmpx.h>
3375#endif
Damien Miller2994e082000-06-04 15:51:47 +10003376#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003377# include <paths.h>
3378#endif
3379 ],
3380 [ char *wtmpx = WTMPX_FILE; ],
3381 [ AC_MSG_RESULT(yes) ],
3382 [ AC_MSG_RESULT(no)
3383 system_wtmpx_path=no ]
3384)
3385if test -z "$conf_wtmpx_location"; then
3386 if test x"$system_wtmpx_path" = x"no" ; then
3387 AC_DEFINE(DISABLE_WTMPX)
3388 fi
3389else
3390 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003391fi
andre2ff7b5d2000-06-03 14:57:40 +00003392
Damien Miller4018c192000-04-30 09:30:44 +10003393
Damien Miller29ea30d2000-03-17 10:54:15 +11003394if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003395 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3396 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003397fi
3398
Tim Rice4cec93f2002-02-26 08:40:48 -08003399dnl remove pam and dl because they are in $LIBPAM
3400if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003401 LIBS=`echo $LIBS | sed 's/-lpam //'`
3402fi
3403if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3404 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003405fi
3406
Darren Tucker7da23cb2005-08-03 00:20:15 +10003407dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3408dnl Add now.
3409CFLAGS="$CFLAGS $werror_flags"
3410
Damien Millerbac2d8a2000-09-05 16:13:06 +11003411AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003412AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3413 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003414AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003415
Damien Miller7b22d652000-06-18 14:07:04 +10003416# Print summary of options
3417
Damien Miller7b22d652000-06-18 14:07:04 +10003418# Someone please show me a better way :)
3419A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3420B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3421C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3422D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003423E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003424F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003425G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003426H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3427I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3428J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003429
3430echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003431echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003432echo " User binaries: $B"
3433echo " System binaries: $C"
3434echo " Configuration files: $D"
3435echo " Askpass program: $E"
3436echo " Manual pages: $F"
3437echo " PID file: $G"
3438echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003439if test "x$external_path_file" = "x/etc/login.conf" ; then
3440echo " At runtime, sshd will use the path defined in $external_path_file"
3441echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003442else
Damien Millerf58c6722002-05-13 13:15:42 +10003443echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003444 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003445echo " (If PATH is set in $external_path_file it will be used instead. If"
3446echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3447 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003448fi
Damien Millera18bbd32002-05-13 10:48:57 +10003449if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003450echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003451fi
Damien Millerf58c6722002-05-13 13:15:42 +10003452echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003453echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003454echo " KerberosV support: $KRB5_MSG"
3455echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003456echo " S/KEY support: $SKEY_MSG"
3457echo " TCP Wrappers support: $TCPW_MSG"
3458echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003459echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003460echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003461echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3462echo " BSD Auth support: $BSD_AUTH_MSG"
3463echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003464if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003465echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003466fi
3467
Damien Miller7b22d652000-06-18 14:07:04 +10003468echo ""
3469
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003470echo " Host: ${host}"
3471echo " Compiler: ${CC}"
3472echo " Compiler flags: ${CFLAGS}"
3473echo "Preprocessor flags: ${CPPFLAGS}"
3474echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003475echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003476
3477echo ""
3478
Tim Rice6f1f7582004-05-30 21:38:51 -07003479if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003480 echo "SVR4 style packages are supported with \"make package\""
3481 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003482fi
3483
Damien Miller82cf0ce2000-12-20 13:34:48 +11003484if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003485 echo "PAM is enabled. You may need to install a PAM control file "
3486 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003487 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003488 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003489 echo ""
3490fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003491
Damien Miller6c21c512002-01-22 21:57:53 +11003492if test ! -z "$RAND_HELPER_CMDHASH" ; then
3493 echo "WARNING: you are using the builtin random number collection "
3494 echo "service. Please read WARNING.RNG and request that your OS "
3495 echo "vendor includes kernel-based random number collection in "
3496 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003497 echo ""
3498fi
Damien Miller60396b02001-02-18 17:01:00 +11003499
Damien Millerb4097182004-05-23 14:09:40 +10003500if test ! -z "$NO_PEERCHECK" ; then
3501 echo "WARNING: the operating system that you are using does not "
3502 echo "appear to support either the getpeereid() API nor the "
3503 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3504 echo "enforce security checks to prevent unauthorised connections to "
3505 echo "ssh-agent. Their absence increases the risk that a malicious "
3506 echo "user can connect to your agent. "
3507 echo ""
3508fi
3509
Darren Tuckerd9f88912005-02-20 21:01:48 +11003510if test "$AUDIT_MODULE" = "bsm" ; then
3511 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3512 echo "See the Solaris section in README.platform for details."
3513fi