blob: 44b54705b3138293f1b3c53002de8d8e0d3752ab [file] [log] [blame]
Darren Tuckerac7e6302005-10-06 01:39:58 +10001# $Id: configure.ac,v 1.298 2005/10/05 15:39:58 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070060 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
61 [If your header files don't define LOGIN_PROGRAM,
62 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100063else
64 # Search for login
65 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
66 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
67 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
68 fi
69fi
70
Darren Tucker23bc8d02004-02-06 16:24:31 +110071AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
72if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070073 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
74 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110075fi
76
Damien Miller166bd442000-03-16 10:48:25 +110077if test -z "$LD" ; then
78 LD=$CC
79fi
80AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080081
Damien Miller166bd442000-03-16 10:48:25 +110082AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100083
84AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
85
Damien Millera8e06ce2003-11-21 23:48:55 +110086if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100087 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Tim Rice3db1e3f2005-08-23 17:11:26 -070088 GCC_VER=`$CC --version`
89 case $GCC_VER in
90 1.*) ;;
91 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
92 2.*) ;;
93 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
94 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +100095
Darren Tucker67b37032005-06-03 17:58:31 +100096 if test -z "$have_llong_max"; then
97 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
98 unset ac_cv_have_decl_LLONG_MAX
99 saved_CFLAGS="$CFLAGS"
100 CFLAGS="$CFLAGS -std=gnu99"
101 AC_CHECK_DECL(LLONG_MAX,
102 [have_llong_max=1],
103 [CFLAGS="$saved_CFLAGS"],
104 [#include <limits.h>]
105 )
106 fi
Damien Miller166bd442000-03-16 10:48:25 +1100107fi
108
Darren Tucker431f0222005-06-07 17:53:40 +1000109if test -z "$have_llong_max"; then
110 AC_MSG_CHECKING([for max value of long long])
111 AC_RUN_IFELSE(
112 [AC_LANG_SOURCE([[
113#include <stdio.h>
114/* Why is this so damn hard? */
115#ifdef __GNUC__
116# undef __GNUC__
117#endif
118#define __USE_ISOC99
119#include <limits.h>
120#define DATA "conftest.llminmax"
121int main(void) {
122 FILE *f;
123 long long i, llmin, llmax = 0;
124
125 if((f = fopen(DATA,"w")) == NULL)
126 exit(1);
127
128#if defined(LLONG_MIN) && defined(LLONG_MAX)
129 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
130 llmin = LLONG_MIN;
131 llmax = LLONG_MAX;
132#else
133 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
134 /* This will work on one's complement and two's complement */
135 for (i = 1; i > llmax; i <<= 1, i++)
136 llmax = i;
137 llmin = llmax + 1LL; /* wrap */
138#endif
139
140 /* Sanity check */
141 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
142 || llmax - 1 > llmax) {
143 fprintf(f, "unknown unknown\n");
144 exit(2);
145 }
146
147 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
148 exit(3);
149
150 exit(0);
151}
152 ]])],
153 [
154 llong_min=`$AWK '{print $1}' conftest.llminmax`
155 llong_max=`$AWK '{print $2}' conftest.llminmax`
156 AC_MSG_RESULT($llong_max)
157 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
158 [max value of long long calculated by configure])
159 AC_MSG_CHECKING([for min value of long long])
160 AC_MSG_RESULT($llong_min)
161 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
162 [min value of long long calculated by configure])
163 ],
164 [
165 AC_MSG_RESULT(not found)
166 ],
167 [
168 AC_MSG_WARN([cross compiling: not checking])
169 ]
170 )
171fi
172
Tim Rice88368a32003-12-08 12:35:59 -0800173AC_ARG_WITH(rpath,
174 [ --without-rpath Disable auto-added -R linker paths],
175 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800176 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800177 need_dash_r=""
178 fi
179 if test "x$withval" = "xyes" ; then
180 need_dash_r=1
181 fi
182 ]
183)
184
Damien Millera22ba012000-03-02 23:09:20 +1100185# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100186case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100187*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100188 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000189 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800190 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100191 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000192 saved_LDFLAGS="$LDFLAGS"
193 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
194 if (test -z "$blibflags"); then
195 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
196 AC_TRY_LINK([], [], [blibflags=$tryflags])
197 fi
198 done
199 if (test -z "$blibflags"); then
200 AC_MSG_RESULT(not found)
201 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
202 else
203 AC_MSG_RESULT($blibflags)
204 fi
205 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000206 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700207 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
208 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700209 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000210 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700211 LIBS="$LIBS -ls"
212 ])
213 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100214 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100215 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100216 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000217 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100218 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000219 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
220 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000221 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000222 [(void)loginfailed("user","host","tty",0);],
223 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700224 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
225 [Define if your AIX loginfailed() function
226 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000227 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000228 )],
229 [],
230 [#include <usersec.h>]
231 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000232 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100233 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700234 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
235 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
236 [Define if your platform breaks doing a seteuid before a setuid])
237 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
238 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000239 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700240 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
241 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
242 [Some systems need a utmpx entry for /bin/login to work])
243 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
244 [Define to a Set Process Title type if your system is
245 supported by bsd-setproctitle.c])
Damien Miller75b1d102000-01-07 14:01:41 +1100246 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100247*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100248 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800249 LIBS="$LIBS /usr/lib/textmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700250 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
251 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
252 AC_DEFINE(DISABLE_SHADOW, 1,
253 [Define if you want to disable shadow passwords])
254 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
255 [Define if your system choked on IP TOS setting])
256 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
257 [Define if X11 doesn't support AF_UNIX sockets on that system])
258 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
259 [Define if the concept of ports only accessible to
260 superusers isn't known])
261 AC_DEFINE(DISABLE_FD_PASSING, 1,
262 [Define if your platform needs to skip post auth
263 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100264 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000265*-*-dgux*)
266 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100267 AC_DEFINE(SETEUID_BREAKS_SETUID)
268 AC_DEFINE(BROKEN_SETREUID)
269 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000270 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000271*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000272 AC_MSG_CHECKING(if we have working getaddrinfo)
273 AC_TRY_RUN([#include <mach-o/dyld.h>
274main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
275 exit(0);
276 else
277 exit(1);
278}], [AC_MSG_RESULT(working)],
279 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700280 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700281 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000282 AC_DEFINE(SETEUID_BREAKS_SETUID)
283 AC_DEFINE(BROKEN_SETREUID)
284 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700285 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
286 [Define if your resolver libs need this for getrrsetbyname])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000287 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000288*-*-hpux*)
289 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000290 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100291 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000292 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700293 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
294 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000295 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700296 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
297 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000298 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700299 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000300 AC_CHECK_LIB(xnet, t_error, ,
301 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
302
303 # next, we define all of the options specific to major releases
304 case "$host" in
305 *-*-hpux10*)
306 if test -z "$GCC"; then
307 CFLAGS="$CFLAGS -Ae"
308 fi
309 ;;
310 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700311 AC_DEFINE(PAM_SUN_CODEBASE, 1,
312 [Define if you are using Solaris-derived PAM which
313 passes pam_messages to the conversation function
314 with an extra level of indirection])
315 AC_DEFINE(DISABLE_UTMP, 1,
316 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000317 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
318 check_for_hpux_broken_getaddrinfo=1
319 check_for_conflicting_getspnam=1
320 ;;
321 esac
322
323 # lastly, we define options specific to minor releases
324 case "$host" in
325 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700326 AC_DEFINE(HAVE_SECUREWARE, 1,
327 [Define if you have SecureWare-based
328 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000329 disable_ptmx_check=yes
330 LIBS="$LIBS -lsecpw"
331 ;;
332 esac
Damien Miller1bead332000-04-30 00:47:29 +1000333 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100334*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100335 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700336 AC_DEFINE(BROKEN_INET_NTOA, 1,
337 [Define if you system's inet_ntoa is busted
338 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000339 AC_DEFINE(SETEUID_BREAKS_SETUID)
340 AC_DEFINE(BROKEN_SETREUID)
341 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700342 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
343 [Define if you shouldn't strip 'tty' from your
344 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000345 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100346 ;;
347*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100348 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700349 AC_DEFINE(WITH_IRIX_ARRAY, 1,
350 [Define if you have/want arrays
351 (cluster-wide session managment, not C arrays)])
352 AC_DEFINE(WITH_IRIX_PROJECT, 1,
353 [Define if you want IRIX project management])
354 AC_DEFINE(WITH_IRIX_AUDIT, 1,
355 [Define if you want IRIX audit trails])
356 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
357 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000358 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000359 AC_DEFINE(SETEUID_BREAKS_SETUID)
360 AC_DEFINE(BROKEN_SETREUID)
361 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700362 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000363 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000364 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100365 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100366*-*-linux*)
367 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100368 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000369 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700370 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
371 AC_DEFINE(PAM_TTY_KLUDGE, 1,
372 [Work around problematic Linux PAM modules handling of PAM_TTY])
373 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
374 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000375 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700376 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
377 [Define to whatever link() returns for "not supported"
378 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100379 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700380 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100381 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000382 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000383 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700384 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
385 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000386 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000387 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100388 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000389mips-sony-bsd|mips-sony-newsos4)
Tim Rice7df8d392005-09-19 09:33:39 -0700390 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000391 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000392 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100393*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000394 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800395 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800396 need_dash_r=1
397 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100398 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100399*-*-freebsd*)
400 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000401 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Millerfbd884a2001-02-27 08:39:07 +1100402 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000403*-*-bsdi*)
404 AC_DEFINE(SETEUID_BREAKS_SETUID)
405 AC_DEFINE(BROKEN_SETREUID)
406 AC_DEFINE(BROKEN_SETREGID)
407 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000408*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000409 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100410 conf_utmp_location=/etc/utmp
411 conf_wtmp_location=/usr/adm/wtmp
412 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700413 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000414 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000415 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700416 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000417 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000418*-*-openbsd*)
419 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
420 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100421*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800422 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800423 need_dash_r=1
424 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100425 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000426 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700427 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
428 [Some versions of /bin/login need the TERM supplied
429 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000430 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700431 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
432 [Define if pam_chauthtok wants real uid set
433 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000434 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000435 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700436 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
437 [Define if sshd somehow reacquires a controlling TTY
438 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000439 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000440 # hardwire lastlog location (can't detect it on some versions)
441 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000442 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
443 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
444 if test "$sol2ver" -ge 8; then
445 AC_MSG_RESULT(yes)
446 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700447 AC_DEFINE(DISABLE_WTMP, 1,
448 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000449 else
450 AC_MSG_RESULT(no)
451 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100452 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000453*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000454 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000455 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100456 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000457 conf_utmp_location=/etc/utmp
458 conf_wtmp_location=/var/adm/wtmp
459 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000460 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000461 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000462*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700463 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000464 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000465 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000466 AC_DEFINE(SETEUID_BREAKS_SETUID)
467 AC_DEFINE(BROKEN_SETREUID)
468 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000469 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000470*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700471 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000472 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100473 # -lresolv needs to be at then end of LIBS or DNS lookups break
474 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100475 IPADDR_IN_DISPLAY=yes
476 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000477 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000478 AC_DEFINE(SETEUID_BREAKS_SETUID)
479 AC_DEFINE(BROKEN_SETREUID)
480 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000481 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000482 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700483 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
484 # Attention: always take care to bind libsocket and libnsl before libc,
485 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000486 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800487# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100488*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100489 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700490 AC_DEFINE(SETEUID_BREAKS_SETUID)
491 AC_DEFINE(BROKEN_SETREUID)
492 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700493 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100494 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800495# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100496*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700497 check_for_libcrypt_later=1
498 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100499 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700500 AC_DEFINE(SETEUID_BREAKS_SETUID)
501 AC_DEFINE(BROKEN_SETREUID)
502 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700503 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700504 case "$host" in
505 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
506 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700507 AC_DEFINE(BROKEN_LIBIAF, 1,
508 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700509 ;;
510 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100511 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100512*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100513 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800514# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100515*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800516 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100517 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800518# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100519*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800520 if test -z "$GCC"; then
521 CFLAGS="$CFLAGS -belf"
522 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100523 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000524 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100525 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000526 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000527 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700528 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700529 AC_DEFINE(SETEUID_BREAKS_SETUID)
530 AC_DEFINE(BROKEN_SETREUID)
531 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700532 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700533 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700534 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100535 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700536 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700537 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000538 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000539*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700540 AC_DEFINE(NO_SSH_LASTLOG, 1,
541 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100542 AC_DEFINE(SETEUID_BREAKS_SETUID)
543 AC_DEFINE(BROKEN_SETREUID)
544 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000545 AC_DEFINE(USE_PIPES)
546 AC_DEFINE(DISABLE_FD_PASSING)
547 LDFLAGS="$LDFLAGS"
548 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
549 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000550 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000551*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100552 AC_DEFINE(SETEUID_BREAKS_SETUID)
553 AC_DEFINE(BROKEN_SETREUID)
554 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000555 AC_DEFINE(WITH_ABBREV_NO_TTY)
556 AC_DEFINE(USE_PIPES)
557 AC_DEFINE(DISABLE_FD_PASSING)
558 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100559 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000560 MANTYPE=cat
561 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000562*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100563 AC_DEFINE(SETEUID_BREAKS_SETUID)
564 AC_DEFINE(BROKEN_SETREUID)
565 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000566 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700567 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700568 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000569 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
570 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
571 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700572 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000573*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000574 AC_MSG_CHECKING(for Digital Unix SIA)
575 no_osfsia=""
576 AC_ARG_WITH(osfsia,
577 [ --with-osfsia Enable Digital Unix SIA],
578 [
579 if test "x$withval" = "xno" ; then
580 AC_MSG_RESULT(disabled)
581 no_osfsia=1
582 fi
583 ],
584 )
585 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000586 if test -f /etc/sia/matrix.conf; then
587 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700588 AC_DEFINE(HAVE_OSF_SIA, 1,
589 [Define if you have Digital Unix Security
590 Integration Architecture])
591 AC_DEFINE(DISABLE_LOGIN, 1,
592 [Define if you don't want to use your
593 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000594 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000595 LIBS="$LIBS -lsecurity -ldb -lm -laud"
596 else
597 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700598 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
599 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000600 fi
601 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000602 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700603 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000604 AC_DEFINE(BROKEN_SETREUID)
605 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000606 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000607
608*-*-nto-qnx)
609 AC_DEFINE(USE_PIPES)
610 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700611 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
612 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
613 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000614 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000615
616*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700617 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
618 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
619 AC_DEFINE(NEED_SETPRGP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700620 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
621 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000622
623*-*-lynxos)
624 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700625 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000626 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
627 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100628esac
629
Damien Millere37bfc12000-06-05 09:37:43 +1000630# Allow user to specify flags
631AC_ARG_WITH(cflags,
632 [ --with-cflags Specify additional flags to pass to compiler],
633 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800634 if test -n "$withval" && test "x$withval" != "xno" && \
635 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000636 CFLAGS="$CFLAGS $withval"
637 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800638 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000639)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000640AC_ARG_WITH(cppflags,
641 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
642 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800643 if test -n "$withval" && test "x$withval" != "xno" && \
644 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000645 CPPFLAGS="$CPPFLAGS $withval"
646 fi
647 ]
648)
Damien Millere37bfc12000-06-05 09:37:43 +1000649AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000650 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000651 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800652 if test -n "$withval" && test "x$withval" != "xno" && \
653 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000654 LDFLAGS="$LDFLAGS $withval"
655 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800656 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000657)
658AC_ARG_WITH(libs,
659 [ --with-libs Specify additional libraries to link with],
660 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800661 if test -n "$withval" && test "x$withval" != "xno" && \
662 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000663 LIBS="$LIBS $withval"
664 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800665 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000666)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000667AC_ARG_WITH(Werror,
668 [ --with-Werror Build main code with -Werror],
669 [
670 if test -n "$withval" && test "x$withval" != "xno"; then
671 werror_flags="-Werror"
672 if "x${withval}" != "xyes"; then
673 werror_flags="$withval"
674 fi
675 fi
676 ]
677)
Damien Millere37bfc12000-06-05 09:37:43 +1000678
Darren Tucker6eb93042003-06-29 21:30:41 +1000679AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000680AC_RUN_IFELSE(
681 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000682#include <stdio.h>
683int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000684 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000685 [ AC_MSG_RESULT(yes) ],
686 [
687 AC_MSG_RESULT(no)
688 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000689 ],
690 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000691)
692
Darren Tucker0c9653f2005-05-28 15:58:14 +1000693dnl Checks for header files.
694AC_CHECK_HEADERS( \
695 bstring.h \
696 crypt.h \
697 dirent.h \
698 endian.h \
699 features.h \
700 floatingpoint.h \
701 getopt.h \
702 glob.h \
703 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700704 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000705 lastlog.h \
706 limits.h \
707 login.h \
708 login_cap.h \
709 maillock.h \
710 ndir.h \
711 netdb.h \
712 netgroup.h \
713 netinet/in_systm.h \
714 pam/pam_appl.h \
715 paths.h \
716 pty.h \
717 readpassphrase.h \
718 rpc/types.h \
719 security/pam_appl.h \
720 shadow.h \
721 stddef.h \
722 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000723 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000724 strings.h \
725 sys/audit.h \
726 sys/bitypes.h \
727 sys/bsdtty.h \
728 sys/cdefs.h \
729 sys/dir.h \
730 sys/mman.h \
731 sys/ndir.h \
732 sys/prctl.h \
733 sys/pstat.h \
734 sys/select.h \
735 sys/stat.h \
736 sys/stream.h \
737 sys/stropts.h \
738 sys/strtio.h \
739 sys/sysmacros.h \
740 sys/time.h \
741 sys/timers.h \
742 sys/un.h \
743 time.h \
744 tmpdir.h \
745 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000746 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000747 usersec.h \
748 util.h \
749 utime.h \
750 utmp.h \
751 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000752 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000753)
Tim Rice4cec93f2002-02-26 08:40:48 -0800754
Darren Tucker48d99d32004-08-29 17:04:50 +1000755# sys/ptms.h requires sys/stream.h to be included first on Solaris
756AC_CHECK_HEADERS(sys/ptms.h, [], [], [
757#ifdef HAVE_SYS_STREAM_H
758# include <sys/stream.h>
759#endif
760])
761
Damien Millera22ba012000-03-02 23:09:20 +1100762# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700763AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
764AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000765
Tim Rice1e1ef642003-09-11 22:19:31 -0700766dnl IRIX and Solaris 2.5.1 have dirname() in libgen
767AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
768 AC_CHECK_LIB(gen, dirname,[
769 AC_CACHE_CHECK([for broken dirname],
770 ac_cv_have_broken_dirname, [
771 save_LIBS="$LIBS"
772 LIBS="$LIBS -lgen"
773 AC_TRY_RUN(
774 [
775#include <libgen.h>
776#include <string.h>
777
778int main(int argc, char **argv) {
779 char *s, buf[32];
780
781 strncpy(buf,"/etc", 32);
782 s = dirname(buf);
783 if (!s || strncmp(s, "/", 32) != 0) {
784 exit(1);
785 } else {
786 exit(0);
787 }
788}
789 ],
790 [ ac_cv_have_broken_dirname="no" ],
791 [ ac_cv_have_broken_dirname="yes" ]
792 )
793 LIBS="$save_LIBS"
794 ])
795 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
796 LIBS="$LIBS -lgen"
797 AC_DEFINE(HAVE_DIRNAME)
798 AC_CHECK_HEADERS(libgen.h)
799 fi
800 ])
801])
802
803AC_CHECK_FUNC(getspnam, ,
804 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700805AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
806 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700807
Tim Rice13aae5e2001-10-21 17:53:58 -0700808dnl zlib is required
809AC_ARG_WITH(zlib,
810 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100811 [ if test "x$withval" = "xno" ; then
812 AC_MSG_ERROR([*** zlib is required ***])
813 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700814 if test -d "$withval/lib"; then
815 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700816 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700817 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700818 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700819 fi
820 else
821 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700822 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700823 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700824 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700825 fi
826 fi
827 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700828 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700829 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700830 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700831 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100832 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700833)
834
Tim Ricefcb62202004-01-23 18:35:16 -0800835AC_CHECK_LIB(z, deflate, ,
836 [
837 saved_CPPFLAGS="$CPPFLAGS"
838 saved_LDFLAGS="$LDFLAGS"
839 save_LIBS="$LIBS"
840 dnl Check default zlib install dir
841 if test -n "${need_dash_r}"; then
842 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
843 else
844 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
845 fi
846 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
847 LIBS="$LIBS -lz"
848 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
849 [
850 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
851 ]
852 )
853 ]
854)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100855AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100856
857AC_ARG_WITH(zlib-version-check,
858 [ --without-zlib-version-check Disable zlib version check],
859 [ if test "x$withval" = "xno" ; then
860 zlib_check_nonfatal=1
861 fi
862 ]
863)
864
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000865AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000866AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000867#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100868#include <zlib.h>
869int main()
870{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000871 int a=0, b=0, c=0, d=0, n, v;
872 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
873 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100874 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000875 v = a*1000000 + b*10000 + c*100 + d;
876 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
877
878 /* 1.1.4 is OK */
879 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100880 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000881
Darren Tucker41097ed2005-07-25 15:24:21 +1000882 /* 1.2.3 and up are OK */
883 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000884 exit(0);
885
Darren Tucker2dcd2392004-01-23 17:13:33 +1100886 exit(2);
887}
Darren Tucker623d92f2004-09-12 22:36:15 +1000888 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000889 AC_MSG_RESULT(no),
890 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100891 if test -z "$zlib_check_nonfatal" ; then
892 AC_MSG_ERROR([*** zlib too old - check config.log ***
893Your reported zlib version has known security problems. It's possible your
894vendor has fixed these problems without changing the version number. If you
895are sure this is the case, you can disable the check by running
896"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000897If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000898See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100899 else
900 AC_MSG_WARN([zlib version may have security problems])
901 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000902 ],
903 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100904)
Damien Miller6f9c3372000-10-25 10:06:04 +1100905
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000906dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100907AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000908 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
909)
Damien Millera8e06ce2003-11-21 23:48:55 +1100910AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700911 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
912 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000913)
Damien Millerab18c411999-11-11 10:40:23 +1100914
Tim Ricee589a292001-11-03 11:09:32 -0800915dnl Checks for libutil functions
916AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700917AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
918 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800919AC_CHECK_FUNCS(logout updwtmp logwtmp)
920
Ben Lindstrom8697e082001-02-24 21:41:10 +0000921AC_FUNC_STRFTIME
922
Damien Miller3c027682001-03-14 11:39:45 +1100923# Check for ALTDIRFUNC glob() extension
924AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
925AC_EGREP_CPP(FOUNDIT,
926 [
927 #include <glob.h>
928 #ifdef GLOB_ALTDIRFUNC
929 FOUNDIT
930 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100931 ],
Damien Miller3c027682001-03-14 11:39:45 +1100932 [
Tim Rice7df8d392005-09-19 09:33:39 -0700933 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
934 [Define if your system glob() function has
935 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100936 AC_MSG_RESULT(yes)
937 ],
938 [
939 AC_MSG_RESULT(no)
940 ]
941)
Damien Millerab18c411999-11-11 10:40:23 +1100942
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000943# Check for g.gl_matchc glob() extension
944AC_MSG_CHECKING(for gl_matchc field in glob_t)
945AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100946 [
947 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000948 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100949 ],
950 [
Tim Rice7df8d392005-09-19 09:33:39 -0700951 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
952 [Define if your system glob() function has
953 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100954 AC_MSG_RESULT(yes)
955 ],
956 [
957 AC_MSG_RESULT(no)
958 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000959)
960
Damien Miller18bb4732001-03-28 14:35:30 +1000961AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000962AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000963 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000964#include <sys/types.h>
965#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700966int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000967 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100968 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000969 [
970 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700971 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
972 [Define in your struct dirent expects you to
973 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000974 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800975 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000976 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
977 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000978 ]
979)
980
Damien Miller36f49652004-08-15 18:40:59 +1000981AC_MSG_CHECKING([for /proc/pid/fd directory])
982if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700983 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000984 AC_MSG_RESULT(yes)
985else
986 AC_MSG_RESULT(no)
987fi
988
Damien Millerc547bf12001-02-16 10:18:12 +1100989# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100990SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100991AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100992 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100993 [
994 if test "x$withval" != "xno" ; then
995
996 if test "x$withval" != "xyes" ; then
997 CPPFLAGS="$CPPFLAGS -I${withval}/include"
998 LDFLAGS="$LDFLAGS -L${withval}/lib"
999 fi
1000
Tim Rice7df8d392005-09-19 09:33:39 -07001001 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001002 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001003 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001004
Tim Rice4cec93f2002-02-26 08:40:48 -08001005 AC_MSG_CHECKING([for s/key support])
1006 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +11001007 [
Tim Rice4cec93f2002-02-26 08:40:48 -08001008#include <stdio.h>
1009#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001010int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -08001011 ],
1012 [AC_MSG_RESULT(yes)],
1013 [
1014 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001015 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1016 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001017 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1018 AC_TRY_COMPILE(
1019 [#include <stdio.h>
1020 #include <skey.h>],
1021 [(void)skeychallenge(NULL,"name","",0);],
1022 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001023 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1024 [Define if your skeychallenge()
1025 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001026 [AC_MSG_RESULT(no)]
1027 )
Damien Millerc547bf12001-02-16 10:18:12 +11001028 fi
1029 ]
1030)
1031
1032# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001033TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001034AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001035 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001036 [
1037 if test "x$withval" != "xno" ; then
1038 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001039 saved_LDFLAGS="$LDFLAGS"
1040 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001041 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001042 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001043 if test -d "${withval}/lib"; then
1044 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001045 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001046 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001047 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001048 fi
1049 else
1050 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001051 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001052 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001053 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001054 fi
1055 fi
1056 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001057 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001058 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001059 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001060 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001061 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001062 LIBWRAP="-lwrap"
1063 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001064 AC_MSG_CHECKING(for libwrap)
1065 AC_TRY_LINK(
1066 [
Damien Miller0ac45002004-04-14 20:14:26 +10001067#include <sys/types.h>
1068#include <sys/socket.h>
1069#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001070#include <tcpd.h>
1071 int deny_severity = 0, allow_severity = 0;
1072 ],
1073 [hosts_access(0);],
1074 [
1075 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001076 AC_DEFINE(LIBWRAP, 1,
1077 [Define if you want
1078 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001079 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001080 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001081 ],
1082 [
1083 AC_MSG_ERROR([*** libwrap missing])
1084 ]
1085 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001086 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001087 fi
1088 ]
1089)
1090
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001091# Check whether user wants libedit support
1092LIBEDIT_MSG="no"
1093AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001094 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001095 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001096 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001097 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1098 if test -n "${need_dash_r}"; then
1099 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1100 else
1101 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1102 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001103 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001104 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001105 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001106 LIBEDIT="-ledit -lcurses"
1107 LIBEDIT_MSG="yes"
1108 AC_SUBST(LIBEDIT)
1109 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001110 [ AC_MSG_ERROR(libedit not found) ],
1111 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001112 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001113 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001114 AC_COMPILE_IFELSE(
1115 [AC_LANG_SOURCE([[
1116#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001117int main(void)
1118{
1119 int i = H_SETSIZE;
1120 el_init("", NULL, NULL, NULL);
1121 exit(0);
1122}
Tim Ricec1819c82005-08-15 17:48:40 -07001123 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001124 [ AC_MSG_RESULT(yes) ],
1125 [ AC_MSG_RESULT(no)
1126 AC_MSG_ERROR(libedit version is not compatible) ]
1127 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001128 fi ]
1129)
1130
Darren Tuckerd9f88912005-02-20 21:01:48 +11001131AUDIT_MODULE=none
1132AC_ARG_WITH(audit,
1133 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1134 [
1135 AC_MSG_CHECKING(for supported audit module)
1136 case "$withval" in
1137 bsm)
1138 AC_MSG_RESULT(bsm)
1139 AUDIT_MODULE=bsm
1140 dnl Checks for headers, libs and functions
1141 AC_CHECK_HEADERS(bsm/audit.h, [],
1142 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1143 AC_CHECK_LIB(bsm, getaudit, [],
1144 [AC_MSG_ERROR(BSM enabled and required library not found)])
1145 AC_CHECK_FUNCS(getaudit, [],
1146 [AC_MSG_ERROR(BSM enabled and required function not found)])
1147 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001148 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001149 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001150 ;;
1151 debug)
1152 AUDIT_MODULE=debug
1153 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001154 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001155 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001156 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001157 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001158 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001159 *)
1160 AC_MSG_ERROR([Unknown audit module $withval])
1161 ;;
1162 esac ]
1163)
1164
Damien Millerfe1f1432003-02-24 15:45:42 +11001165dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001166AC_CHECK_FUNCS( \
1167 arc4random \
1168 b64_ntop \
1169 __b64_ntop \
1170 b64_pton \
1171 __b64_pton \
1172 bcopy \
1173 bindresvport_sa \
1174 clock \
1175 closefrom \
1176 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001177 fchmod \
1178 fchown \
1179 freeaddrinfo \
1180 futimes \
1181 getaddrinfo \
1182 getcwd \
1183 getgrouplist \
1184 getnameinfo \
1185 getopt \
1186 getpeereid \
1187 _getpty \
1188 getrlimit \
1189 getttyent \
1190 glob \
1191 inet_aton \
1192 inet_ntoa \
1193 inet_ntop \
1194 innetgr \
1195 login_getcapbool \
1196 md5_crypt \
1197 memmove \
1198 mkdtemp \
1199 mmap \
1200 ngetaddrinfo \
1201 nsleep \
1202 ogetaddrinfo \
1203 openlog_r \
1204 openpty \
1205 prctl \
1206 pstat \
1207 readpassphrase \
1208 realpath \
1209 recvmsg \
1210 rresvport_af \
1211 sendmsg \
1212 setdtablesize \
1213 setegid \
1214 setenv \
1215 seteuid \
1216 setgroups \
1217 setlogin \
1218 setpcred \
1219 setproctitle \
1220 setregid \
1221 setreuid \
1222 setrlimit \
1223 setsid \
1224 setvbuf \
1225 sigaction \
1226 sigvec \
1227 snprintf \
1228 socketpair \
1229 strdup \
1230 strerror \
1231 strlcat \
1232 strlcpy \
1233 strmode \
1234 strnvis \
1235 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001236 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001237 strtoul \
1238 sysconf \
1239 tcgetpgrp \
1240 truncate \
1241 unsetenv \
1242 updwtmpx \
1243 utimes \
1244 vhangup \
1245 vsnprintf \
1246 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001247)
Tim Rice13aae5e2001-10-21 17:53:58 -07001248
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001249# IRIX has a const char return value for gai_strerror()
1250AC_CHECK_FUNCS(gai_strerror,[
1251 AC_DEFINE(HAVE_GAI_STRERROR)
1252 AC_TRY_COMPILE([
1253#include <sys/types.h>
1254#include <sys/socket.h>
1255#include <netdb.h>
1256
1257const char *gai_strerror(int);],[
1258char *str;
1259
1260str = gai_strerror(0);],[
1261 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1262 [Define if gai_strerror() returns const char *])])])
1263
Tim Rice7df8d392005-09-19 09:33:39 -07001264AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1265 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001266
Darren Tuckerf1159b52003-07-07 19:44:01 +10001267dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001268AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001269AC_CHECK_DECL(strsep,
1270 [AC_CHECK_FUNCS(strsep)],
1271 [],
1272 [
1273#ifdef HAVE_STRING_H
1274# include <string.h>
1275#endif
1276 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001277
Darren Tuckerb2427c82003-09-10 15:22:44 +10001278dnl tcsendbreak might be a macro
1279AC_CHECK_DECL(tcsendbreak,
1280 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001281 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001282 [#include <termios.h>]
1283)
1284
Darren Tucker5bb14002004-04-23 18:53:10 +10001285AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1286
Darren Tucker2a6b0292003-12-31 14:59:17 +11001287AC_CHECK_FUNCS(setresuid, [
1288 dnl Some platorms have setresuid that isn't implemented, test for this
1289 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001290 AC_RUN_IFELSE(
1291 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001292#include <stdlib.h>
1293#include <errno.h>
1294int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001295 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001296 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001297 [AC_DEFINE(BROKEN_SETRESUID, 1,
1298 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001299 AC_MSG_RESULT(not implemented)],
1300 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001301 )
1302])
Darren Tuckere937be32003-12-17 18:53:26 +11001303
Darren Tucker2a6b0292003-12-31 14:59:17 +11001304AC_CHECK_FUNCS(setresgid, [
1305 dnl Some platorms have setresgid that isn't implemented, test for this
1306 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001307 AC_RUN_IFELSE(
1308 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001309#include <stdlib.h>
1310#include <errno.h>
1311int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001312 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001313 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001314 [AC_DEFINE(BROKEN_SETRESGID, 1,
1315 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001316 AC_MSG_RESULT(not implemented)],
1317 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001318 )
1319])
Darren Tuckere937be32003-12-17 18:53:26 +11001320
Damien Millerad833b32000-08-23 10:46:23 +10001321dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001322AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001323dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001324AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001325AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001326dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001327AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001328AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001329
Damien Millera8e06ce2003-11-21 23:48:55 +11001330AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001331 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1332 [AC_CHECK_LIB(bsd, daemon,
1333 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001334)
1335
Damien Millera8e06ce2003-11-21 23:48:55 +11001336AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001337 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1338 [Define if your libraries define getpagesize()])],
1339 [AC_CHECK_LIB(ucb, getpagesize,
1340 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001341)
1342
Damien Millercb170cb2000-07-01 16:52:55 +10001343# Check for broken snprintf
1344if test "x$ac_cv_func_snprintf" = "xyes" ; then
1345 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001346 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001347 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001348#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001349int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001350 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001351 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001352 [
1353 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001354 AC_DEFINE(BROKEN_SNPRINTF, 1,
1355 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001356 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001357 ],
1358 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001359 )
1360fi
1361
Damien Millerb4097182004-05-23 14:09:40 +10001362# Check for missing getpeereid (or equiv) support
1363NO_PEERCHECK=""
1364if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1365 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1366 AC_TRY_COMPILE(
1367 [#include <sys/types.h>
1368 #include <sys/socket.h>],
1369 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001370 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001371 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001372 ],
Damien Millerb4097182004-05-23 14:09:40 +10001373 [AC_MSG_RESULT(no)
1374 NO_PEERCHECK=1]
1375 )
1376fi
1377
Damien Millere8328192003-01-07 15:18:32 +11001378dnl see whether mkstemp() requires XXXXXX
1379if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1380AC_MSG_CHECKING([for (overly) strict mkstemp])
1381AC_TRY_RUN(
1382 [
1383#include <stdlib.h>
1384main() { char template[]="conftest.mkstemp-test";
1385if (mkstemp(template) == -1)
1386 exit(1);
1387unlink(template); exit(0);
1388}
1389 ],
1390 [
1391 AC_MSG_RESULT(no)
1392 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001393 [
Damien Millere8328192003-01-07 15:18:32 +11001394 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001395 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001396 ],
1397 [
1398 AC_MSG_RESULT(yes)
1399 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001400 ]
Damien Millere8328192003-01-07 15:18:32 +11001401)
1402fi
1403
Darren Tucker70a3d552003-08-21 17:58:29 +10001404dnl make sure that openpty does not reacquire controlling terminal
1405if test ! -z "$check_for_openpty_ctty_bug"; then
1406 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1407 AC_TRY_RUN(
1408 [
1409#include <stdio.h>
1410#include <sys/fcntl.h>
1411#include <sys/types.h>
1412#include <sys/wait.h>
1413
1414int
1415main()
1416{
1417 pid_t pid;
1418 int fd, ptyfd, ttyfd, status;
1419
1420 pid = fork();
1421 if (pid < 0) { /* failed */
1422 exit(1);
1423 } else if (pid > 0) { /* parent */
1424 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001425 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001426 exit(WEXITSTATUS(status));
1427 else
1428 exit(2);
1429 } else { /* child */
1430 close(0); close(1); close(2);
1431 setsid();
1432 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1433 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1434 if (fd >= 0)
1435 exit(3); /* Acquired ctty: broken */
1436 else
1437 exit(0); /* Did not acquire ctty: OK */
1438 }
1439}
1440 ],
1441 [
1442 AC_MSG_RESULT(yes)
1443 ],
1444 [
1445 AC_MSG_RESULT(no)
1446 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1447 ]
1448 )
1449fi
1450
Tim Rice8bb561b2005-03-17 16:23:19 -08001451if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1452 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001453 AC_MSG_CHECKING(if getaddrinfo seems to work)
1454 AC_TRY_RUN(
1455 [
1456#include <stdio.h>
1457#include <sys/socket.h>
1458#include <netdb.h>
1459#include <errno.h>
1460#include <netinet/in.h>
1461
1462#define TEST_PORT "2222"
1463
1464int
1465main(void)
1466{
1467 int err, sock;
1468 struct addrinfo *gai_ai, *ai, hints;
1469 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1470
1471 memset(&hints, 0, sizeof(hints));
1472 hints.ai_family = PF_UNSPEC;
1473 hints.ai_socktype = SOCK_STREAM;
1474 hints.ai_flags = AI_PASSIVE;
1475
1476 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1477 if (err != 0) {
1478 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1479 exit(1);
1480 }
1481
1482 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1483 if (ai->ai_family != AF_INET6)
1484 continue;
1485
1486 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1487 sizeof(ntop), strport, sizeof(strport),
1488 NI_NUMERICHOST|NI_NUMERICSERV);
1489
1490 if (err != 0) {
1491 if (err == EAI_SYSTEM)
1492 perror("getnameinfo EAI_SYSTEM");
1493 else
1494 fprintf(stderr, "getnameinfo failed: %s\n",
1495 gai_strerror(err));
1496 exit(2);
1497 }
1498
1499 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1500 if (sock < 0)
1501 perror("socket");
1502 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1503 if (errno == EBADF)
1504 exit(3);
1505 }
1506 }
1507 exit(0);
1508}
1509 ],
1510 [
1511 AC_MSG_RESULT(yes)
1512 ],
1513 [
1514 AC_MSG_RESULT(no)
1515 AC_DEFINE(BROKEN_GETADDRINFO)
1516 ]
1517 )
1518fi
1519
Tim Rice8bb561b2005-03-17 16:23:19 -08001520if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1521 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001522 AC_MSG_CHECKING(if getaddrinfo seems to work)
1523 AC_TRY_RUN(
1524 [
1525#include <stdio.h>
1526#include <sys/socket.h>
1527#include <netdb.h>
1528#include <errno.h>
1529#include <netinet/in.h>
1530
1531#define TEST_PORT "2222"
1532
1533int
1534main(void)
1535{
1536 int err, sock;
1537 struct addrinfo *gai_ai, *ai, hints;
1538 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1539
1540 memset(&hints, 0, sizeof(hints));
1541 hints.ai_family = PF_UNSPEC;
1542 hints.ai_socktype = SOCK_STREAM;
1543 hints.ai_flags = AI_PASSIVE;
1544
1545 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1546 if (err != 0) {
1547 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1548 exit(1);
1549 }
1550
1551 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1552 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1553 continue;
1554
1555 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1556 sizeof(ntop), strport, sizeof(strport),
1557 NI_NUMERICHOST|NI_NUMERICSERV);
1558
1559 if (ai->ai_family == AF_INET && err != 0) {
1560 perror("getnameinfo");
1561 exit(2);
1562 }
1563 }
1564 exit(0);
1565}
1566 ],
1567 [
1568 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001569 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1570 [Define if you have a getaddrinfo that fails
1571 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001572 ],
1573 [
1574 AC_MSG_RESULT(no)
1575 AC_DEFINE(BROKEN_GETADDRINFO)
1576 ]
1577 )
1578fi
1579
Darren Tuckera56f1912004-11-02 20:30:54 +11001580if test "x$check_for_conflicting_getspnam" = "x1"; then
1581 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1582 AC_COMPILE_IFELSE(
1583 [
1584#include <shadow.h>
1585int main(void) {exit(0);}
1586 ],
1587 [
1588 AC_MSG_RESULT(no)
1589 ],
1590 [
1591 AC_MSG_RESULT(yes)
1592 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1593 [Conflicting defs for getspnam])
1594 ]
1595 )
1596fi
1597
Damien Miller606f8802000-09-16 15:39:56 +11001598AC_FUNC_GETPGRP
1599
Damien Millera64b57a2001-01-17 10:44:13 +11001600# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001601PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001602AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001603 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001604 [
Damien Millera64b57a2001-01-17 10:44:13 +11001605 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001606 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1607 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001608 AC_MSG_ERROR([PAM headers not found])
1609 fi
1610
1611 AC_CHECK_LIB(dl, dlopen, , )
1612 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1613 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001614 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001615
Damien Millera64b57a2001-01-17 10:44:13 +11001616 PAM_MSG="yes"
1617
Tim Rice7df8d392005-09-19 09:33:39 -07001618 AC_DEFINE(USE_PAM, 1,
1619 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001620 if test $ac_cv_lib_dl_dlopen = yes; then
1621 LIBPAM="-lpam -ldl"
1622 else
1623 LIBPAM="-lpam"
1624 fi
1625 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001626 fi
1627 ]
1628)
Damien Millera22ba012000-03-02 23:09:20 +11001629
Damien Millera64b57a2001-01-17 10:44:13 +11001630# Check for older PAM
1631if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001632 # Check PAM strerror arguments (old PAM)
1633 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1634 AC_TRY_COMPILE(
1635 [
Damien Miller81171112000-04-23 11:14:01 +10001636#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001637#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001638#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001639#elif defined (HAVE_PAM_PAM_APPL_H)
1640#include <pam/pam_appl.h>
1641#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001642 ],
1643 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001644 [AC_MSG_RESULT(no)],
1645 [
Tim Rice7df8d392005-09-19 09:33:39 -07001646 AC_DEFINE(HAVE_OLD_PAM, 1,
1647 [Define if you have an old version of PAM
1648 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001649 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001650 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001651 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001652 )
Damien Millera22ba012000-03-02 23:09:20 +11001653fi
1654
Tim Riceaef73712002-05-11 13:17:42 -07001655# Search for OpenSSL
1656saved_CPPFLAGS="$CPPFLAGS"
1657saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001658AC_ARG_WITH(ssl-dir,
1659 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1660 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001661 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001662 case "$withval" in
1663 # Relative paths
1664 ./*|../*) withval="`pwd`/$withval"
1665 esac
Tim Riceaef73712002-05-11 13:17:42 -07001666 if test -d "$withval/lib"; then
1667 if test -n "${need_dash_r}"; then
1668 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1669 else
1670 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1671 fi
1672 else
1673 if test -n "${need_dash_r}"; then
1674 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1675 else
1676 LDFLAGS="-L${withval} ${LDFLAGS}"
1677 fi
1678 fi
1679 if test -d "$withval/include"; then
1680 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1681 else
1682 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1683 fi
Damien Millera22ba012000-03-02 23:09:20 +11001684 fi
1685 ]
1686)
Tim Rice3d5352e2004-02-12 09:27:21 -08001687LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001688AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1689 [Define if your ssl headers are included
1690 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001691 [
Tim Riceaef73712002-05-11 13:17:42 -07001692 dnl Check default openssl install dir
1693 if test -n "${need_dash_r}"; then
1694 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001695 else
Tim Riceaef73712002-05-11 13:17:42 -07001696 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001697 fi
Tim Riceaef73712002-05-11 13:17:42 -07001698 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1699 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1700 [
1701 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1702 ]
1703 )
1704 ]
1705)
1706
Tim Riced730b782002-08-13 18:52:10 -07001707# Determine OpenSSL header version
1708AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001709AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001710 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001711#include <stdio.h>
1712#include <string.h>
1713#include <openssl/opensslv.h>
1714#define DATA "conftest.sslincver"
1715int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001716 FILE *fd;
1717 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001718
Damien Millera8e06ce2003-11-21 23:48:55 +11001719 fd = fopen(DATA,"w");
1720 if(fd == NULL)
1721 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001722
1723 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1724 exit(1);
1725
1726 exit(0);
1727}
Darren Tucker623d92f2004-09-12 22:36:15 +10001728 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001729 [
1730 ssl_header_ver=`cat conftest.sslincver`
1731 AC_MSG_RESULT($ssl_header_ver)
1732 ],
1733 [
1734 AC_MSG_RESULT(not found)
1735 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001736 ],
1737 [
1738 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001739 ]
1740)
1741
1742# Determine OpenSSL library version
1743AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001744AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001745 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001746#include <stdio.h>
1747#include <string.h>
1748#include <openssl/opensslv.h>
1749#include <openssl/crypto.h>
1750#define DATA "conftest.ssllibver"
1751int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001752 FILE *fd;
1753 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001754
Damien Millera8e06ce2003-11-21 23:48:55 +11001755 fd = fopen(DATA,"w");
1756 if(fd == NULL)
1757 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001758
1759 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1760 exit(1);
1761
1762 exit(0);
1763}
Darren Tucker623d92f2004-09-12 22:36:15 +10001764 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001765 [
1766 ssl_library_ver=`cat conftest.ssllibver`
1767 AC_MSG_RESULT($ssl_library_ver)
1768 ],
1769 [
1770 AC_MSG_RESULT(not found)
1771 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001772 ],
1773 [
1774 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001775 ]
1776)
Damien Millera22ba012000-03-02 23:09:20 +11001777
Damien Millerec932372002-01-22 22:16:03 +11001778# Sanity check OpenSSL headers
1779AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001780AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001781 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001782#include <string.h>
1783#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001784int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001785 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001786 [
1787 AC_MSG_RESULT(yes)
1788 ],
1789 [
1790 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001791 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1792Check config.log for details.
1793Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001794 ],
1795 [
1796 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001797 ]
1798)
1799
Tim Rice3d5352e2004-02-12 09:27:21 -08001800# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1801# because the system crypt() is more featureful.
1802if test "x$check_for_libcrypt_before" = "x1"; then
1803 AC_CHECK_LIB(crypt, crypt)
1804fi
1805
Damien Millera8e06ce2003-11-21 23:48:55 +11001806# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001807# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001808if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001809 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001810fi
1811
Tim Rice2291c002005-08-26 13:15:19 -07001812AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001813
1814### Configure cryptographic random number support
1815
1816# Check wheter OpenSSL seeds itself
1817AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001818AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001819 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001820#include <string.h>
1821#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001822int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001823 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001824 [
1825 OPENSSL_SEEDS_ITSELF=yes
1826 AC_MSG_RESULT(yes)
1827 ],
1828 [
1829 AC_MSG_RESULT(no)
1830 # Default to use of the rand helper if OpenSSL doesn't
1831 # seed itself
1832 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001833 ],
1834 [
1835 AC_MSG_WARN([cross compiling: assuming yes])
1836 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001837 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001838 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001839 ]
1840)
1841
1842
1843# Do we want to force the use of the rand helper?
1844AC_ARG_WITH(rand-helper,
1845 [ --with-rand-helper Use subprocess to gather strong randomness ],
1846 [
1847 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001848 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001849 # the previous test showed it to be unseeded.
1850 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1851 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1852 OPENSSL_SEEDS_ITSELF=yes
1853 USE_RAND_HELPER=""
1854 fi
1855 else
1856 USE_RAND_HELPER=yes
1857 fi
1858 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001859)
Damien Miller6c21c512002-01-22 21:57:53 +11001860
1861# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001862if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001863 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001864 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1865 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001866 RAND_MSG="OpenSSL internal ONLY"
1867 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001868elif test ! -z "$USE_RAND_HELPER" ; then
1869 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001870 RAND_MSG="ssh-rand-helper"
1871 INSTALL_SSH_RAND_HELPER="yes"
1872fi
1873AC_SUBST(INSTALL_SSH_RAND_HELPER)
1874
1875### Configuration of ssh-rand-helper
1876
1877# PRNGD TCP socket
1878AC_ARG_WITH(prngd-port,
1879 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1880 [
Damien Millere996d722002-01-23 11:20:59 +11001881 case "$withval" in
1882 no)
1883 withval=""
1884 ;;
1885 [[0-9]]*)
1886 ;;
1887 *)
1888 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1889 ;;
1890 esac
1891 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001892 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001893 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1894 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001895 fi
1896 ]
1897)
1898
1899# PRNGD Unix domain socket
1900AC_ARG_WITH(prngd-socket,
1901 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1902 [
Damien Millere996d722002-01-23 11:20:59 +11001903 case "$withval" in
1904 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001905 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001906 ;;
1907 no)
1908 withval=""
1909 ;;
1910 /*)
1911 ;;
1912 *)
1913 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1914 ;;
1915 esac
1916
1917 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001918 if test ! -z "$PRNGD_PORT" ; then
1919 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1920 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001921 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001922 AC_MSG_WARN(Entropy socket is not readable)
1923 fi
1924 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001925 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1926 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001927 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001928 ],
1929 [
1930 # Check for existing socket only if we don't have a random device already
1931 if test "$USE_RAND_HELPER" = yes ; then
1932 AC_MSG_CHECKING(for PRNGD/EGD socket)
1933 # Insert other locations here
1934 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1935 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1936 PRNGD_SOCKET="$sock"
1937 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1938 break;
1939 fi
1940 done
1941 if test ! -z "$PRNGD_SOCKET" ; then
1942 AC_MSG_RESULT($PRNGD_SOCKET)
1943 else
1944 AC_MSG_RESULT(not found)
1945 fi
1946 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001947 ]
1948)
1949
1950# Change default command timeout for hashing entropy source
1951entropy_timeout=200
1952AC_ARG_WITH(entropy-timeout,
1953 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1954 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001955 if test -n "$withval" && test "x$withval" != "xno" && \
1956 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001957 entropy_timeout=$withval
1958 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001959 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001960)
Tim Rice7df8d392005-09-19 09:33:39 -07001961AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1962 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11001963
Damien Millerd3f6ad22002-06-25 10:24:47 +10001964SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001965AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001966 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001967 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001968 if test -n "$withval" && test "x$withval" != "xno" && \
1969 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001970 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001971 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001972 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001973)
Tim Rice7df8d392005-09-19 09:33:39 -07001974AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
1975 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10001976AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001977
Tim Rice88f2ab52002-03-17 12:17:34 -08001978# We do this little dance with the search path to insure
1979# that programs that we select for use by installed programs
1980# (which may be run by the super-user) come from trusted
1981# locations before they come from the user's private area.
1982# This should help avoid accidentally configuring some
1983# random version of a program in someone's personal bin.
1984
1985OPATH=$PATH
1986PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001987test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001988test -d /sbin && PATH=$PATH:/sbin
1989test -d /usr/sbin && PATH=$PATH:/usr/sbin
1990PATH=$PATH:/etc:$OPATH
1991
Damien Millera8e06ce2003-11-21 23:48:55 +11001992# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001993OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1994OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1995OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1996OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1997OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1998OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1999OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2000OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2001OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2002OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2003OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2004OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2005OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2006OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2007OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2008OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002009# restore PATH
2010PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002011
2012# Where does ssh-rand-helper get its randomness from?
2013INSTALL_SSH_PRNG_CMDS=""
2014if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2015 if test ! -z "$PRNGD_PORT" ; then
2016 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2017 elif test ! -z "$PRNGD_SOCKET" ; then
2018 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2019 else
2020 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2021 RAND_HELPER_CMDHASH=yes
2022 INSTALL_SSH_PRNG_CMDS="yes"
2023 fi
2024fi
2025AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2026
2027
Ben Lindstromb5628642000-10-18 00:02:25 +00002028# Cheap hack to ensure NEWS-OS libraries are arranged right.
2029if test ! -z "$SONY" ; then
2030 LIBS="$LIBS -liberty";
2031fi
2032
Damien Millera22ba012000-03-02 23:09:20 +11002033# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11002034AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002035AC_CHECK_SIZEOF(short int, 2)
2036AC_CHECK_SIZEOF(int, 4)
2037AC_CHECK_SIZEOF(long int, 4)
2038AC_CHECK_SIZEOF(long long int, 8)
2039
Damien Millerfa2bb692002-04-23 23:22:25 +10002040# Sanity check long long for some platforms (AIX)
2041if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2042 ac_cv_sizeof_long_long_int=0
2043fi
2044
Damien Millera22ba012000-03-02 23:09:20 +11002045# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002046AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2047 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002048 [ #include <sys/types.h> ],
2049 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002050 [ ac_cv_have_u_int="yes" ],
2051 [ ac_cv_have_u_int="no" ]
2052 )
2053])
2054if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002055 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002056 have_u_int=1
2057fi
2058
Damien Miller61e50f12000-05-08 20:49:37 +10002059AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2060 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002061 [ #include <sys/types.h> ],
2062 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002063 [ ac_cv_have_intxx_t="yes" ],
2064 [ ac_cv_have_intxx_t="no" ]
2065 )
2066])
2067if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002068 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002069 have_intxx_t=1
2070fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002071
2072if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002073 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002074then
2075 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2076 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002077 [ #include <stdint.h> ],
2078 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002079 [
2080 AC_DEFINE(HAVE_INTXX_T)
2081 AC_MSG_RESULT(yes)
2082 ],
2083 [ AC_MSG_RESULT(no) ]
2084 )
2085fi
2086
Damien Miller578783e2000-09-23 14:12:24 +11002087AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2088 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002089 [
2090#include <sys/types.h>
2091#ifdef HAVE_STDINT_H
2092# include <stdint.h>
2093#endif
2094#include <sys/socket.h>
2095#ifdef HAVE_SYS_BITYPES_H
2096# include <sys/bitypes.h>
2097#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002098 ],
2099 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002100 [ ac_cv_have_int64_t="yes" ],
2101 [ ac_cv_have_int64_t="no" ]
2102 )
2103])
2104if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002105 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002106fi
2107
Damien Miller61e50f12000-05-08 20:49:37 +10002108AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2109 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002110 [ #include <sys/types.h> ],
2111 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002112 [ ac_cv_have_u_intxx_t="yes" ],
2113 [ ac_cv_have_u_intxx_t="no" ]
2114 )
2115])
2116if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002117 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002118 have_u_intxx_t=1
2119fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002120
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002121if test -z "$have_u_intxx_t" ; then
2122 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2123 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002124 [ #include <sys/socket.h> ],
2125 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002126 [
2127 AC_DEFINE(HAVE_U_INTXX_T)
2128 AC_MSG_RESULT(yes)
2129 ],
2130 [ AC_MSG_RESULT(no) ]
2131 )
2132fi
2133
Damien Miller578783e2000-09-23 14:12:24 +11002134AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2135 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002136 [ #include <sys/types.h> ],
2137 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002138 [ ac_cv_have_u_int64_t="yes" ],
2139 [ ac_cv_have_u_int64_t="no" ]
2140 )
2141])
2142if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002143 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002144 have_u_int64_t=1
2145fi
2146
Tim Rice4cec93f2002-02-26 08:40:48 -08002147if test -z "$have_u_int64_t" ; then
2148 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2149 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002150 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002151 [ u_int64_t a; a = 1],
2152 [
2153 AC_DEFINE(HAVE_U_INT64_T)
2154 AC_MSG_RESULT(yes)
2155 ],
2156 [ AC_MSG_RESULT(no) ]
2157 )
2158fi
2159
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002160if test -z "$have_u_intxx_t" ; then
2161 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2162 AC_TRY_COMPILE(
2163 [
2164#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002165 ],
2166 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002167 [ ac_cv_have_uintxx_t="yes" ],
2168 [ ac_cv_have_uintxx_t="no" ]
2169 )
2170 ])
2171 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002172 AC_DEFINE(HAVE_UINTXX_T, 1,
2173 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002174 fi
2175fi
2176
2177if test -z "$have_uintxx_t" ; then
2178 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2179 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002180 [ #include <stdint.h> ],
2181 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002182 [
2183 AC_DEFINE(HAVE_UINTXX_T)
2184 AC_MSG_RESULT(yes)
2185 ],
2186 [ AC_MSG_RESULT(no) ]
2187 )
2188fi
2189
Damien Milleredb82922000-06-20 13:25:52 +10002190if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002191 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002192then
2193 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2194 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002195 [
2196#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002197 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002198 [
Damien Miller70494d12000-04-03 15:57:06 +10002199 int8_t a; int16_t b; int32_t c;
2200 u_int8_t e; u_int16_t f; u_int32_t g;
2201 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002202 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002203 [
2204 AC_DEFINE(HAVE_U_INTXX_T)
2205 AC_DEFINE(HAVE_INTXX_T)
2206 AC_MSG_RESULT(yes)
2207 ],
2208 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002209 )
Damien Millerb29ea912000-01-15 14:12:03 +11002210fi
2211
Damien Miller58be7382001-09-15 21:31:54 +10002212
2213AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2214 AC_TRY_COMPILE(
2215 [
2216#include <sys/types.h>
2217 ],
2218 [ u_char foo; foo = 125; ],
2219 [ ac_cv_have_u_char="yes" ],
2220 [ ac_cv_have_u_char="no" ]
2221 )
2222])
2223if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002224 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002225fi
2226
Tim Rice13aae5e2001-10-21 17:53:58 -07002227TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002228
Tim Rice200a5c02002-02-26 22:12:34 -08002229AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002230
Damien Miller848b9932005-02-24 12:12:34 +11002231AC_CHECK_TYPES(in_addr_t,,,
2232[#include <sys/types.h>
2233#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002234
Damien Miller61e50f12000-05-08 20:49:37 +10002235AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2236 AC_TRY_COMPILE(
2237 [
2238#include <sys/types.h>
2239 ],
2240 [ size_t foo; foo = 1235; ],
2241 [ ac_cv_have_size_t="yes" ],
2242 [ ac_cv_have_size_t="no" ]
2243 )
2244])
2245if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002246 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002247fi
Damien Miller95058511999-12-29 10:36:45 +11002248
Damien Miller615f9392000-05-17 22:53:33 +10002249AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2250 AC_TRY_COMPILE(
2251 [
2252#include <sys/types.h>
2253 ],
2254 [ ssize_t foo; foo = 1235; ],
2255 [ ac_cv_have_ssize_t="yes" ],
2256 [ ac_cv_have_ssize_t="no" ]
2257 )
2258])
2259if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002260 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002261fi
2262
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002263AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2264 AC_TRY_COMPILE(
2265 [
2266#include <time.h>
2267 ],
2268 [ clock_t foo; foo = 1235; ],
2269 [ ac_cv_have_clock_t="yes" ],
2270 [ ac_cv_have_clock_t="no" ]
2271 )
2272])
2273if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002274 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002275fi
2276
Damien Millerb54b40e2000-06-23 08:23:34 +10002277AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2278 AC_TRY_COMPILE(
2279 [
2280#include <sys/types.h>
2281#include <sys/socket.h>
2282 ],
2283 [ sa_family_t foo; foo = 1235; ],
2284 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002285 [ AC_TRY_COMPILE(
2286 [
2287#include <sys/types.h>
2288#include <sys/socket.h>
2289#include <netinet/in.h>
2290 ],
2291 [ sa_family_t foo; foo = 1235; ],
2292 [ ac_cv_have_sa_family_t="yes" ],
2293
Damien Millerb54b40e2000-06-23 08:23:34 +10002294 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002295 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002296 )
2297])
2298if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002299 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2300 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002301fi
2302
Damien Miller0f91b4e2000-06-18 15:43:25 +10002303AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2304 AC_TRY_COMPILE(
2305 [
2306#include <sys/types.h>
2307 ],
2308 [ pid_t foo; foo = 1235; ],
2309 [ ac_cv_have_pid_t="yes" ],
2310 [ ac_cv_have_pid_t="no" ]
2311 )
2312])
2313if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002314 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002315fi
2316
2317AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2318 AC_TRY_COMPILE(
2319 [
2320#include <sys/types.h>
2321 ],
2322 [ mode_t foo; foo = 1235; ],
2323 [ ac_cv_have_mode_t="yes" ],
2324 [ ac_cv_have_mode_t="no" ]
2325 )
2326])
2327if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002328 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002329fi
2330
Damien Miller61e50f12000-05-08 20:49:37 +10002331
2332AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2333 AC_TRY_COMPILE(
2334 [
Damien Miller81171112000-04-23 11:14:01 +10002335#include <sys/types.h>
2336#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002337 ],
2338 [ struct sockaddr_storage s; ],
2339 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2340 [ ac_cv_have_struct_sockaddr_storage="no" ]
2341 )
2342])
2343if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002344 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2345 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002346fi
Damien Miller34132e52000-01-14 15:45:46 +11002347
Damien Miller61e50f12000-05-08 20:49:37 +10002348AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2349 AC_TRY_COMPILE(
2350 [
Damien Miller7b22d652000-06-18 14:07:04 +10002351#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002352#include <netinet/in.h>
2353 ],
2354 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2355 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2356 [ ac_cv_have_struct_sockaddr_in6="no" ]
2357 )
2358])
2359if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002360 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2361 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002362fi
Damien Miller34132e52000-01-14 15:45:46 +11002363
Damien Miller61e50f12000-05-08 20:49:37 +10002364AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2365 AC_TRY_COMPILE(
2366 [
Damien Miller7b22d652000-06-18 14:07:04 +10002367#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002368#include <netinet/in.h>
2369 ],
2370 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2371 [ ac_cv_have_struct_in6_addr="yes" ],
2372 [ ac_cv_have_struct_in6_addr="no" ]
2373 )
2374])
2375if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002376 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2377 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002378fi
Damien Miller34132e52000-01-14 15:45:46 +11002379
Damien Miller61e50f12000-05-08 20:49:37 +10002380AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2381 AC_TRY_COMPILE(
2382 [
Damien Miller81171112000-04-23 11:14:01 +10002383#include <sys/types.h>
2384#include <sys/socket.h>
2385#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002386 ],
2387 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2388 [ ac_cv_have_struct_addrinfo="yes" ],
2389 [ ac_cv_have_struct_addrinfo="no" ]
2390 )
2391])
2392if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002393 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2394 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002395fi
2396
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002397AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2398 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002399 [ #include <sys/time.h> ],
2400 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002401 [ ac_cv_have_struct_timeval="yes" ],
2402 [ ac_cv_have_struct_timeval="no" ]
2403 )
2404])
2405if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002406 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002407 have_struct_timeval=1
2408fi
2409
Tim Rice4e4dc562003-03-18 10:21:40 -08002410AC_CHECK_TYPES(struct timespec)
2411
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002412# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002413if test "x$ac_cv_have_int64_t" = "xno" && \
2414 test "x$ac_cv_sizeof_long_int" != "x8" && \
2415 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002416 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2417 echo "an alternative compiler (I.E., GCC) before continuing."
2418 echo ""
2419 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002420else
2421dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002422 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002423 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002424#include <stdio.h>
2425#include <string.h>
2426#ifdef HAVE_SNPRINTF
2427main()
2428{
2429 char buf[50];
2430 char expected_out[50];
2431 int mazsize = 50 ;
2432#if (SIZEOF_LONG_INT == 8)
2433 long int num = 0x7fffffffffffffff;
2434#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002435 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002436#endif
2437 strcpy(expected_out, "9223372036854775807");
2438 snprintf(buf, mazsize, "%lld", num);
2439 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002440 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002441 exit(0);
2442}
2443#else
2444main() { exit(0); }
2445#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002446 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002447 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002448 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002449fi
2450
Damien Miller78315eb2000-09-29 23:01:36 +11002451dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002452OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2453OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2454OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2455OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2456OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002457OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002458OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2459OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002460OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002461OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2462OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2463OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2464OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002465OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2466OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2467OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2468OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002469
2470AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002471
Damien Miller61e50f12000-05-08 20:49:37 +10002472AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2473 ac_cv_have_ss_family_in_struct_ss, [
2474 AC_TRY_COMPILE(
2475 [
Damien Miller81171112000-04-23 11:14:01 +10002476#include <sys/types.h>
2477#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002478 ],
2479 [ struct sockaddr_storage s; s.ss_family = 1; ],
2480 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2481 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2482 )
2483])
2484if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002485 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002486fi
2487
Damien Miller61e50f12000-05-08 20:49:37 +10002488AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2489 ac_cv_have___ss_family_in_struct_ss, [
2490 AC_TRY_COMPILE(
2491 [
Damien Miller81171112000-04-23 11:14:01 +10002492#include <sys/types.h>
2493#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002494 ],
2495 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2496 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2497 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2498 )
2499])
2500if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002501 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2502 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002503fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002504
Damien Millerad833b32000-08-23 10:46:23 +10002505AC_CACHE_CHECK([for pw_class field in struct passwd],
2506 ac_cv_have_pw_class_in_struct_passwd, [
2507 AC_TRY_COMPILE(
2508 [
Damien Millerad833b32000-08-23 10:46:23 +10002509#include <pwd.h>
2510 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002511 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002512 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2513 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2514 )
2515])
2516if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002517 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2518 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002519fi
2520
Kevin Steves82456952001-06-22 21:14:18 +00002521AC_CACHE_CHECK([for pw_expire field in struct passwd],
2522 ac_cv_have_pw_expire_in_struct_passwd, [
2523 AC_TRY_COMPILE(
2524 [
2525#include <pwd.h>
2526 ],
2527 [ struct passwd p; p.pw_expire = 0; ],
2528 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2529 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2530 )
2531])
2532if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002533 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2534 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002535fi
2536
2537AC_CACHE_CHECK([for pw_change field in struct passwd],
2538 ac_cv_have_pw_change_in_struct_passwd, [
2539 AC_TRY_COMPILE(
2540 [
2541#include <pwd.h>
2542 ],
2543 [ struct passwd p; p.pw_change = 0; ],
2544 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2545 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2546 )
2547])
2548if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002549 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2550 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002551fi
Damien Miller61e50f12000-05-08 20:49:37 +10002552
Tim Rice28bbb0c2002-05-27 17:37:32 -07002553dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002554AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2555 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002556 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002557 [
Tim Riceae49fe62002-04-12 10:26:21 -07002558#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002559#include <sys/socket.h>
2560#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002561int main() {
2562#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002563#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002564exit(1);
2565#endif
2566struct msghdr m;
2567m.msg_accrights = 0;
2568exit(0);
2569}
Kevin Steves939c9db2002-03-22 17:23:25 +00002570 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002571 [ ac_cv_have_accrights_in_msghdr="yes" ],
2572 [ ac_cv_have_accrights_in_msghdr="no" ]
2573 )
2574])
2575if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002576 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2577 [Define if your system uses access rights style
2578 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002579fi
2580
Kevin Stevesa44e0352002-04-07 16:18:03 +00002581AC_CACHE_CHECK([for msg_control field in struct msghdr],
2582 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002583 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002584 [
Tim Riceae49fe62002-04-12 10:26:21 -07002585#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002586#include <sys/socket.h>
2587#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002588int main() {
2589#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002590#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002591exit(1);
2592#endif
2593struct msghdr m;
2594m.msg_control = 0;
2595exit(0);
2596}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002597 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002598 [ ac_cv_have_control_in_msghdr="yes" ],
2599 [ ac_cv_have_control_in_msghdr="no" ]
2600 )
2601])
2602if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002603 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2604 [Define if your system uses ancillary data style
2605 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002606fi
2607
Damien Miller61e50f12000-05-08 20:49:37 +10002608AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002609 AC_TRY_LINK([],
2610 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002611 [ ac_cv_libc_defines___progname="yes" ],
2612 [ ac_cv_libc_defines___progname="no" ]
2613 )
2614])
2615if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002616 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002617fi
2618
Kevin Steves4846f4a2002-03-22 18:19:53 +00002619AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2620 AC_TRY_LINK([
2621#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002622],
2623 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002624 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2625 [ ac_cv_cc_implements___FUNCTION__="no" ]
2626 )
2627])
2628if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002629 AC_DEFINE(HAVE___FUNCTION__, 1,
2630 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002631fi
2632
2633AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2634 AC_TRY_LINK([
2635#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002636],
2637 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002638 [ ac_cv_cc_implements___func__="yes" ],
2639 [ ac_cv_cc_implements___func__="no" ]
2640 )
2641])
2642if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002643 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002644fi
2645
Damien Miller4f8e6692001-07-14 13:22:53 +10002646AC_CACHE_CHECK([whether getopt has optreset support],
2647 ac_cv_have_getopt_optreset, [
2648 AC_TRY_LINK(
2649 [
2650#include <getopt.h>
2651 ],
2652 [ extern int optreset; optreset = 0; ],
2653 [ ac_cv_have_getopt_optreset="yes" ],
2654 [ ac_cv_have_getopt_optreset="no" ]
2655 )
2656])
2657if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002658 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2659 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002660fi
Damien Millera22ba012000-03-02 23:09:20 +11002661
Damien Millerecbb26d2000-07-15 14:59:14 +10002662AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002663 AC_TRY_LINK([],
2664 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002665 [ ac_cv_libc_defines_sys_errlist="yes" ],
2666 [ ac_cv_libc_defines_sys_errlist="no" ]
2667 )
2668])
2669if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002670 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2671 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002672fi
2673
2674
Damien Miller11fa2cc2000-08-16 10:35:58 +10002675AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002676 AC_TRY_LINK([],
2677 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002678 [ ac_cv_libc_defines_sys_nerr="yes" ],
2679 [ ac_cv_libc_defines_sys_nerr="no" ]
2680 )
2681])
2682if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002683 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002684fi
2685
Damien Millera8e06ce2003-11-21 23:48:55 +11002686SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002687# Check whether user wants sectok support
2688AC_ARG_WITH(sectok,
2689 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002690 [
2691 if test "x$withval" != "xno" ; then
2692 if test "x$withval" != "xyes" ; then
2693 CPPFLAGS="$CPPFLAGS -I${withval}"
2694 LDFLAGS="$LDFLAGS -L${withval}"
2695 if test ! -z "$need_dash_r" ; then
2696 LDFLAGS="$LDFLAGS -R${withval}"
2697 fi
2698 if test ! -z "$blibpath" ; then
2699 blibpath="$blibpath:${withval}"
2700 fi
2701 fi
2702 AC_CHECK_HEADERS(sectok.h)
2703 if test "$ac_cv_header_sectok_h" != yes; then
2704 AC_MSG_ERROR(Can't find sectok.h)
2705 fi
2706 AC_CHECK_LIB(sectok, sectok_open)
2707 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2708 AC_MSG_ERROR(Can't find libsectok)
2709 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002710 AC_DEFINE(SMARTCARD, 1,
2711 [Define if you want smartcard support])
2712 AC_DEFINE(USE_SECTOK, 1,
2713 [Define if you want smartcard support
2714 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002715 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002716 fi
2717 ]
2718)
2719
2720# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002721OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002722AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10002723 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08002724 [
2725 if test "x$withval" != "xno" ; then
2726 if test "x$withval" != "xyes" ; then
2727 OPENSC_CONFIG=$withval/bin/opensc-config
2728 else
2729 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2730 fi
2731 if test "$OPENSC_CONFIG" != "no"; then
2732 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2733 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2734 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2735 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2736 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002737 AC_DEFINE(USE_OPENSC, 1,
2738 [Define if you want smartcard support
2739 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002740 SCARD_MSG="yes, using OpenSC"
2741 fi
2742 fi
2743 ]
2744)
Damien Miller85de5802001-09-18 14:01:11 +10002745
Darren Tucker5f88d342003-10-15 16:57:57 +10002746# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002747AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002748 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2749 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002750 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002751 # Needed by our getrrsetbyname()
2752 AC_SEARCH_LIBS(res_query, resolv)
2753 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002754 AC_MSG_CHECKING(if res_query will link)
2755 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2756 [AC_MSG_RESULT(no)
2757 saved_LIBS="$LIBS"
2758 LIBS="$LIBS -lresolv"
2759 AC_MSG_CHECKING(for res_query in -lresolv)
2760 AC_LINK_IFELSE([
2761#include <resolv.h>
2762int main()
2763{
2764 res_query (0, 0, 0, 0, 0);
2765 return 0;
2766}
2767 ],
2768 [LIBS="$LIBS -lresolv"
2769 AC_MSG_RESULT(yes)],
2770 [LIBS="$saved_LIBS"
2771 AC_MSG_RESULT(no)])
2772 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002773 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002774 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002775 [#include <sys/types.h>
2776 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002777 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07002778 [AC_DEFINE(HAVE_HEADER_AD, 1,
2779 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10002780 [#include <arpa/nameser.h>])
2781 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002782
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002783# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002784KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002785AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002786 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002787 [ if test "x$withval" != "xno" ; then
2788 if test "x$withval" = "xyes" ; then
2789 KRB5ROOT="/usr/local"
2790 else
2791 KRB5ROOT=${withval}
2792 fi
2793
Tim Rice7df8d392005-09-19 09:33:39 -07002794 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11002795 KRB5_MSG="yes"
2796
2797 AC_MSG_CHECKING(for krb5-config)
2798 if test -x $KRB5ROOT/bin/krb5-config ; then
2799 KRB5CONF=$KRB5ROOT/bin/krb5-config
2800 AC_MSG_RESULT($KRB5CONF)
2801
2802 AC_MSG_CHECKING(for gssapi support)
2803 if $KRB5CONF | grep gssapi >/dev/null ; then
2804 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002805 AC_DEFINE(GSSAPI, 1,
2806 [Define this if you want GSSAPI
2807 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11002808 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002809 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002810 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002811 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002812 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002813 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2814 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002815 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002816 AC_MSG_CHECKING(whether we are using Heimdal)
2817 AC_TRY_COMPILE([ #include <krb5.h> ],
2818 [ char *tmp = heimdal_version; ],
2819 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002820 AC_DEFINE(HEIMDAL, 1,
2821 [Define this if you are using the
2822 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002823 AC_MSG_RESULT(no)
2824 )
2825 else
2826 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002827 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002828 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002829 AC_MSG_CHECKING(whether we are using Heimdal)
2830 AC_TRY_COMPILE([ #include <krb5.h> ],
2831 [ char *tmp = heimdal_version; ],
2832 [ AC_MSG_RESULT(yes)
2833 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002834 K5LIBS="-lkrb5 -ldes"
2835 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002836 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002837 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002838 ],
2839 [ AC_MSG_RESULT(no)
2840 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2841 ]
2842 )
Damien Miller200d0a72003-06-30 19:21:36 +10002843 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002844
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002845 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2846 [ AC_DEFINE(GSSAPI)
2847 K5LIBS="-lgssapi $K5LIBS" ],
2848 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2849 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002850 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002851 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2852 $K5LIBS)
2853 ],
2854 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002855
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002856 AC_CHECK_HEADER(gssapi.h, ,
2857 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002858 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002859 AC_CHECK_HEADERS(gssapi.h, ,
2860 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002861 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002862 ]
2863 )
2864
2865 oldCPP="$CPPFLAGS"
2866 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2867 AC_CHECK_HEADER(gssapi_krb5.h, ,
2868 [ CPPFLAGS="$oldCPP" ])
2869
Damien Millera8e06ce2003-11-21 23:48:55 +11002870 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002871 if test ! -z "$need_dash_r" ; then
2872 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2873 fi
2874 if test ! -z "$blibpath" ; then
2875 blibpath="$blibpath:${KRB5ROOT}/lib"
2876 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07002877
2878 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2879 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2880 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2881
2882 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07002883 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
2884 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002885 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002886 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002887)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002888
Damien Millera22ba012000-03-02 23:09:20 +11002889# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002890
Damien Millerf58c6722002-05-13 13:15:42 +10002891PRIVSEP_PATH=/var/empty
2892AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002893 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002894 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002895 if test -n "$withval" && test "x$withval" != "xno" && \
2896 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002897 PRIVSEP_PATH=$withval
2898 fi
2899 ]
2900)
2901AC_SUBST(PRIVSEP_PATH)
2902
Damien Millera22ba012000-03-02 23:09:20 +11002903AC_ARG_WITH(xauth,
2904 [ --with-xauth=PATH Specify path to xauth program ],
2905 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002906 if test -n "$withval" && test "x$withval" != "xno" && \
2907 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002908 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002909 fi
2910 ],
2911 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002912 TestPath="$PATH"
2913 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2914 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2915 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2916 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2917 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002918 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002919 xauth_path="/usr/openwin/bin/xauth"
2920 fi
2921 ]
2922)
2923
Damien Miller7d901272003-01-13 16:55:22 +11002924STRIP_OPT=-s
2925AC_ARG_ENABLE(strip,
2926 [ --disable-strip Disable calling strip(1) on install],
2927 [
2928 if test "x$enableval" = "xno" ; then
2929 STRIP_OPT=
2930 fi
2931 ]
2932)
2933AC_SUBST(STRIP_OPT)
2934
Damien Millera19cf472000-11-29 13:28:50 +11002935if test -z "$xauth_path" ; then
2936 XAUTH_PATH="undefined"
2937 AC_SUBST(XAUTH_PATH)
2938else
Tim Rice7df8d392005-09-19 09:33:39 -07002939 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
2940 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11002941 XAUTH_PATH=$xauth_path
2942 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002943fi
Damien Millera22ba012000-03-02 23:09:20 +11002944
2945# Check for mail directory (last resort if we cannot get it from headers)
2946if test ! -z "$MAIL" ; then
2947 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07002948 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
2949 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11002950fi
2951
Darren Tucker623d92f2004-09-12 22:36:15 +10002952if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002953 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2954 disable_ptmx_check=yes
2955fi
Damien Millera22ba012000-03-02 23:09:20 +11002956if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002957 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002958 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002959 [
Tim Rice7df8d392005-09-19 09:33:39 -07002960 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
2961 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002962 have_dev_ptmx=1
2963 ]
2964 )
2965 fi
Damien Millera22ba012000-03-02 23:09:20 +11002966fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002967
Darren Tucker623d92f2004-09-12 22:36:15 +10002968if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002969 AC_CHECK_FILE("/dev/ptc",
2970 [
Tim Rice7df8d392005-09-19 09:33:39 -07002971 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
2972 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002973 have_dev_ptc=1
2974 ]
2975 )
2976else
2977 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2978fi
Damien Miller204ad072000-03-02 23:56:12 +11002979
Damien Millera22ba012000-03-02 23:09:20 +11002980# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002981AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002982 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002983 [
Damien Miller897741e2001-04-16 10:41:46 +10002984 case "$withval" in
2985 man|cat|doc)
2986 MANTYPE=$withval
2987 ;;
2988 *)
2989 AC_MSG_ERROR(invalid man type: $withval)
2990 ;;
2991 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002992 ]
2993)
Ben Lindstrombc709922001-04-18 18:04:21 +00002994if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002995 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2996 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002997 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2998 MANTYPE=doc
2999 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3000 MANTYPE=man
3001 else
3002 MANTYPE=cat
3003 fi
3004fi
Damien Miller670a4b82000-01-22 13:53:11 +11003005AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003006if test "$MANTYPE" = "doc"; then
3007 mansubdir=man;
3008else
3009 mansubdir=$MANTYPE;
3010fi
3011AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003012
Damien Millera22ba012000-03-02 23:09:20 +11003013# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003014MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003015AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003016 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003017 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003018 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003019 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3020 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003021 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003022 fi
3023 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003024)
3025
Damien Millera22ba012000-03-02 23:09:20 +11003026# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003027AC_ARG_WITH(shadow,
3028 [ --without-shadow Disable shadow password support],
3029 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003030 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003031 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003032 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003033 fi
3034 ]
3035)
3036
Damien Miller1f335fb2000-06-26 11:31:33 +10003037if test -z "$disable_shadow" ; then
3038 AC_MSG_CHECKING([if the systems has expire shadow information])
3039 AC_TRY_COMPILE(
3040 [
3041#include <sys/types.h>
3042#include <shadow.h>
3043 struct spwd sp;
3044 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3045 [ sp_expire_available=yes ], []
3046 )
3047
3048 if test "x$sp_expire_available" = "xyes" ; then
3049 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003050 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3051 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003052 else
3053 AC_MSG_RESULT(no)
3054 fi
3055fi
3056
Damien Millera22ba012000-03-02 23:09:20 +11003057# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003058if test ! -z "$IPADDR_IN_DISPLAY" ; then
3059 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003060 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3061 [Define if you need to use IP address
3062 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003063else
Damien Millera8e06ce2003-11-21 23:48:55 +11003064 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003065 AC_ARG_WITH(ipaddr-display,
3066 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3067 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003068 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003069 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003070 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003071 fi
3072 ]
3073 )
3074fi
Damien Miller76112de1999-12-21 11:18:08 +11003075
Darren Tuckere1a790d2003-09-16 11:52:19 +10003076# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003077AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003078 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003079 [ if test "x$enableval" = "xno"; then
3080 AC_MSG_NOTICE([/etc/default/login handling disabled])
3081 etc_default_login=no
3082 else
3083 etc_default_login=yes
3084 fi ],
3085 [ etc_default_login=yes ]
3086)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003087
Darren Tucker2f9573d2005-02-10 22:28:54 +11003088if test "x$etc_default_login" != "xno"; then
3089 AC_CHECK_FILE("/etc/default/login",
3090 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10003091 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3092 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003093 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
3094 elif test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003095 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3096 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003097 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003098fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003099
Tim Rice43a1c132002-04-17 21:19:14 -07003100dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003101if test $ac_cv_func_login_getcapbool = "yes" && \
3102 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003103 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003104fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003105
Damien Millera22ba012000-03-02 23:09:20 +11003106# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003107SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003108AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003109 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003110 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003111 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003112 AC_MSG_WARN([
3113--with-default-path=PATH has no effect on this system.
3114Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003115 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003116 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003117 AC_MSG_WARN([
3118--with-default-path=PATH will only be used if PATH is not defined in
3119$external_path_file .])
3120 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003121 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003122 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003123 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003124 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003125 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3126 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003127 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003128 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003129 AC_MSG_WARN([
3130If PATH is defined in $external_path_file, ensure the path to scp is included,
3131otherwise scp will not work.])
3132 fi
3133 AC_TRY_RUN(
3134 [
Tim Rice59ea0a02001-03-10 13:50:45 -08003135/* find out what STDPATH is */
3136#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003137#ifdef HAVE_PATHS_H
3138# include <paths.h>
3139#endif
3140#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003141# ifdef _PATH_USERPATH /* Irix */
3142# define _PATH_STDPATH _PATH_USERPATH
3143# else
3144# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3145# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003146#endif
3147#include <sys/types.h>
3148#include <sys/stat.h>
3149#include <fcntl.h>
3150#define DATA "conftest.stdpath"
3151
3152main()
3153{
3154 FILE *fd;
3155 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003156
Tim Rice59ea0a02001-03-10 13:50:45 -08003157 fd = fopen(DATA,"w");
3158 if(fd == NULL)
3159 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003160
Tim Rice59ea0a02001-03-10 13:50:45 -08003161 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3162 exit(1);
3163
3164 exit(0);
3165}
3166 ], [ user_path=`cat conftest.stdpath` ],
3167 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3168 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3169 )
3170# make sure $bindir is in USER_PATH so scp will work
3171 t_bindir=`eval echo ${bindir}`
3172 case $t_bindir in
3173 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3174 esac
3175 case $t_bindir in
3176 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3177 esac
3178 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3179 if test $? -ne 0 ; then
3180 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3181 if test $? -ne 0 ; then
3182 user_path=$user_path:$t_bindir
3183 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3184 fi
3185 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003186 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003187)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003188if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003189 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003190 AC_SUBST(user_path)
3191fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003192
Damien Millera18bbd32002-05-13 10:48:57 +10003193# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003194AC_ARG_WITH(superuser-path,
3195 [ --with-superuser-path= Specify different path for super-user],
3196 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003197 if test -n "$withval" && test "x$withval" != "xno" && \
3198 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003199 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3200 [Define if you want a different $PATH
3201 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003202 superuser_path=$withval
3203 fi
3204 ]
3205)
3206
3207
Damien Miller61e50f12000-05-08 20:49:37 +10003208AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003209IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003210AC_ARG_WITH(4in6,
3211 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3212 [
3213 if test "x$withval" != "xno" ; then
3214 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003215 AC_DEFINE(IPV4_IN_IPV6, 1,
3216 [Detect IPv4 in IPv6 mapped addresses
3217 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003218 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003219 else
3220 AC_MSG_RESULT(no)
3221 fi
3222 ],[
3223 if test "x$inet6_default_4in6" = "xyes"; then
3224 AC_MSG_RESULT([yes (default)])
3225 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003226 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003227 else
3228 AC_MSG_RESULT([no (default)])
3229 fi
3230 ]
3231)
3232
Damien Miller60396b02001-02-18 17:01:00 +11003233# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003234BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003235AC_ARG_WITH(bsd-auth,
3236 [ --with-bsd-auth Enable BSD auth support],
3237 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003238 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003239 AC_DEFINE(BSD_AUTH, 1,
3240 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003241 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003242 fi
3243 ]
3244)
3245
Damien Millera22ba012000-03-02 23:09:20 +11003246# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003247piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003248# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003249if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003250 piddir=`eval echo ${sysconfdir}`
3251 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003252 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003253 esac
3254fi
3255
Tim Rice88f2ab52002-03-17 12:17:34 -08003256AC_ARG_WITH(pid-dir,
3257 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3258 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003259 if test -n "$withval" && test "x$withval" != "xno" && \
3260 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003261 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003262 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003263 AC_MSG_WARN([** no $piddir directory on this system **])
3264 fi
3265 fi
3266 ]
3267)
3268
Tim Rice7df8d392005-09-19 09:33:39 -07003269AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003270AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003271
andre2ff7b5d2000-06-03 14:57:40 +00003272dnl allow user to disable some login recording features
3273AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003274 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003275 [
3276 if test "x$enableval" = "xno" ; then
3277 AC_DEFINE(DISABLE_LASTLOG)
3278 fi
3279 ]
andre2ff7b5d2000-06-03 14:57:40 +00003280)
3281AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003282 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003283 [
3284 if test "x$enableval" = "xno" ; then
3285 AC_DEFINE(DISABLE_UTMP)
3286 fi
3287 ]
andre2ff7b5d2000-06-03 14:57:40 +00003288)
3289AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003290 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003291 [
3292 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003293 AC_DEFINE(DISABLE_UTMPX, 1,
3294 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003295 fi
3296 ]
andre2ff7b5d2000-06-03 14:57:40 +00003297)
3298AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003299 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003300 [
3301 if test "x$enableval" = "xno" ; then
3302 AC_DEFINE(DISABLE_WTMP)
3303 fi
3304 ]
andre2ff7b5d2000-06-03 14:57:40 +00003305)
3306AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003307 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003308 [
3309 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003310 AC_DEFINE(DISABLE_WTMPX, 1,
3311 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003312 fi
3313 ]
andre2ff7b5d2000-06-03 14:57:40 +00003314)
3315AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003316 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003317 [
3318 if test "x$enableval" = "xno" ; then
3319 AC_DEFINE(DISABLE_LOGIN)
3320 fi
3321 ]
andre2ff7b5d2000-06-03 14:57:40 +00003322)
3323AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003324 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003325 [
3326 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003327 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3328 [Define if you don't want to use pututline()
3329 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003330 fi
3331 ]
andre2ff7b5d2000-06-03 14:57:40 +00003332)
3333AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003334 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003335 [
3336 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003337 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3338 [Define if you don't want to use pututxline()
3339 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003340 fi
3341 ]
andre2ff7b5d2000-06-03 14:57:40 +00003342)
3343AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003344 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003345 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003346 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003347 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003348 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003349 conf_lastlog_location=$withval
3350 fi
3351 ]
3352)
andre2ff7b5d2000-06-03 14:57:40 +00003353
3354dnl lastlog, [uw]tmpx? detection
3355dnl NOTE: set the paths in the platform section to avoid the
3356dnl need for command-line parameters
3357dnl lastlog and [uw]tmp are subject to a file search if all else fails
3358
3359dnl lastlog detection
3360dnl NOTE: the code itself will detect if lastlog is a directory
3361AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3362AC_TRY_COMPILE([
3363#include <sys/types.h>
3364#include <utmp.h>
3365#ifdef HAVE_LASTLOG_H
3366# include <lastlog.h>
3367#endif
Damien Miller2994e082000-06-04 15:51:47 +10003368#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003369# include <paths.h>
3370#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003371#ifdef HAVE_LOGIN_H
3372# include <login.h>
3373#endif
andre2ff7b5d2000-06-03 14:57:40 +00003374 ],
3375 [ char *lastlog = LASTLOG_FILE; ],
3376 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003377 [
3378 AC_MSG_RESULT(no)
3379 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3380 AC_TRY_COMPILE([
3381#include <sys/types.h>
3382#include <utmp.h>
3383#ifdef HAVE_LASTLOG_H
3384# include <lastlog.h>
3385#endif
3386#ifdef HAVE_PATHS_H
3387# include <paths.h>
3388#endif
3389 ],
3390 [ char *lastlog = _PATH_LASTLOG; ],
3391 [ AC_MSG_RESULT(yes) ],
3392 [
andree441aa32000-06-12 22:34:38 +00003393 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003394 system_lastlog_path=no
3395 ])
3396 ]
andre2ff7b5d2000-06-03 14:57:40 +00003397)
Damien Miller2994e082000-06-04 15:51:47 +10003398
andre2ff7b5d2000-06-03 14:57:40 +00003399if test -z "$conf_lastlog_location"; then
3400 if test x"$system_lastlog_path" = x"no" ; then
3401 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003402 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003403 conf_lastlog_location=$f
3404 fi
3405 done
3406 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003407 AC_MSG_WARN([** Cannot find lastlog **])
3408 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003409 fi
3410 fi
3411fi
3412
3413if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003414 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3415 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003416fi
andre2ff7b5d2000-06-03 14:57:40 +00003417
3418dnl utmp detection
3419AC_MSG_CHECKING([if your system defines UTMP_FILE])
3420AC_TRY_COMPILE([
3421#include <sys/types.h>
3422#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003423#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003424# include <paths.h>
3425#endif
3426 ],
3427 [ char *utmp = UTMP_FILE; ],
3428 [ AC_MSG_RESULT(yes) ],
3429 [ AC_MSG_RESULT(no)
3430 system_utmp_path=no ]
3431)
3432if test -z "$conf_utmp_location"; then
3433 if test x"$system_utmp_path" = x"no" ; then
3434 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3435 if test -f $f ; then
3436 conf_utmp_location=$f
3437 fi
3438 done
3439 if test -z "$conf_utmp_location"; then
3440 AC_DEFINE(DISABLE_UTMP)
3441 fi
3442 fi
3443fi
3444if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003445 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3446 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003447fi
andre2ff7b5d2000-06-03 14:57:40 +00003448
3449dnl wtmp detection
3450AC_MSG_CHECKING([if your system defines WTMP_FILE])
3451AC_TRY_COMPILE([
3452#include <sys/types.h>
3453#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003454#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003455# include <paths.h>
3456#endif
3457 ],
3458 [ char *wtmp = WTMP_FILE; ],
3459 [ AC_MSG_RESULT(yes) ],
3460 [ AC_MSG_RESULT(no)
3461 system_wtmp_path=no ]
3462)
3463if test -z "$conf_wtmp_location"; then
3464 if test x"$system_wtmp_path" = x"no" ; then
3465 for f in /usr/adm/wtmp /var/log/wtmp; do
3466 if test -f $f ; then
3467 conf_wtmp_location=$f
3468 fi
3469 done
3470 if test -z "$conf_wtmp_location"; then
3471 AC_DEFINE(DISABLE_WTMP)
3472 fi
3473 fi
3474fi
3475if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003476 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3477 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003478fi
andre2ff7b5d2000-06-03 14:57:40 +00003479
3480
3481dnl utmpx detection - I don't know any system so perverse as to require
3482dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3483dnl there, though.
3484AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3485AC_TRY_COMPILE([
3486#include <sys/types.h>
3487#include <utmp.h>
3488#ifdef HAVE_UTMPX_H
3489#include <utmpx.h>
3490#endif
Damien Miller2994e082000-06-04 15:51:47 +10003491#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003492# include <paths.h>
3493#endif
3494 ],
3495 [ char *utmpx = UTMPX_FILE; ],
3496 [ AC_MSG_RESULT(yes) ],
3497 [ AC_MSG_RESULT(no)
3498 system_utmpx_path=no ]
3499)
3500if test -z "$conf_utmpx_location"; then
3501 if test x"$system_utmpx_path" = x"no" ; then
3502 AC_DEFINE(DISABLE_UTMPX)
3503 fi
3504else
Tim Rice7df8d392005-09-19 09:33:39 -07003505 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3506 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003507fi
andre2ff7b5d2000-06-03 14:57:40 +00003508
3509dnl wtmpx detection
3510AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3511AC_TRY_COMPILE([
3512#include <sys/types.h>
3513#include <utmp.h>
3514#ifdef HAVE_UTMPX_H
3515#include <utmpx.h>
3516#endif
Damien Miller2994e082000-06-04 15:51:47 +10003517#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003518# include <paths.h>
3519#endif
3520 ],
3521 [ char *wtmpx = WTMPX_FILE; ],
3522 [ AC_MSG_RESULT(yes) ],
3523 [ AC_MSG_RESULT(no)
3524 system_wtmpx_path=no ]
3525)
3526if test -z "$conf_wtmpx_location"; then
3527 if test x"$system_wtmpx_path" = x"no" ; then
3528 AC_DEFINE(DISABLE_WTMPX)
3529 fi
3530else
Tim Rice7df8d392005-09-19 09:33:39 -07003531 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3532 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003533fi
andre2ff7b5d2000-06-03 14:57:40 +00003534
Damien Miller4018c192000-04-30 09:30:44 +10003535
Damien Miller29ea30d2000-03-17 10:54:15 +11003536if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003537 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3538 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003539fi
3540
Tim Rice4cec93f2002-02-26 08:40:48 -08003541dnl remove pam and dl because they are in $LIBPAM
3542if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003543 LIBS=`echo $LIBS | sed 's/-lpam //'`
3544fi
3545if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3546 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003547fi
3548
Darren Tucker7da23cb2005-08-03 00:20:15 +10003549dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3550dnl Add now.
3551CFLAGS="$CFLAGS $werror_flags"
3552
Damien Millerbac2d8a2000-09-05 16:13:06 +11003553AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003554AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3555 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003556AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003557
Damien Miller7b22d652000-06-18 14:07:04 +10003558# Print summary of options
3559
Damien Miller7b22d652000-06-18 14:07:04 +10003560# Someone please show me a better way :)
3561A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3562B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3563C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3564D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003565E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003566F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003567G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003568H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3569I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3570J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003571
3572echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003573echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003574echo " User binaries: $B"
3575echo " System binaries: $C"
3576echo " Configuration files: $D"
3577echo " Askpass program: $E"
3578echo " Manual pages: $F"
3579echo " PID file: $G"
3580echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003581if test "x$external_path_file" = "x/etc/login.conf" ; then
3582echo " At runtime, sshd will use the path defined in $external_path_file"
3583echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003584else
Damien Millerf58c6722002-05-13 13:15:42 +10003585echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003586 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003587echo " (If PATH is set in $external_path_file it will be used instead. If"
3588echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3589 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003590fi
Damien Millera18bbd32002-05-13 10:48:57 +10003591if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003592echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003593fi
Damien Millerf58c6722002-05-13 13:15:42 +10003594echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003595echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003596echo " KerberosV support: $KRB5_MSG"
3597echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003598echo " S/KEY support: $SKEY_MSG"
3599echo " TCP Wrappers support: $TCPW_MSG"
3600echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003601echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003602echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003603echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3604echo " BSD Auth support: $BSD_AUTH_MSG"
3605echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003606if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003607echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003608fi
3609
Damien Miller7b22d652000-06-18 14:07:04 +10003610echo ""
3611
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003612echo " Host: ${host}"
3613echo " Compiler: ${CC}"
3614echo " Compiler flags: ${CFLAGS}"
3615echo "Preprocessor flags: ${CPPFLAGS}"
3616echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003617echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003618
3619echo ""
3620
Tim Rice6f1f7582004-05-30 21:38:51 -07003621if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003622 echo "SVR4 style packages are supported with \"make package\""
3623 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003624fi
3625
Damien Miller82cf0ce2000-12-20 13:34:48 +11003626if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003627 echo "PAM is enabled. You may need to install a PAM control file "
3628 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003629 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003630 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003631 echo ""
3632fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003633
Damien Miller6c21c512002-01-22 21:57:53 +11003634if test ! -z "$RAND_HELPER_CMDHASH" ; then
3635 echo "WARNING: you are using the builtin random number collection "
3636 echo "service. Please read WARNING.RNG and request that your OS "
3637 echo "vendor includes kernel-based random number collection in "
3638 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003639 echo ""
3640fi
Damien Miller60396b02001-02-18 17:01:00 +11003641
Damien Millerb4097182004-05-23 14:09:40 +10003642if test ! -z "$NO_PEERCHECK" ; then
3643 echo "WARNING: the operating system that you are using does not "
3644 echo "appear to support either the getpeereid() API nor the "
3645 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3646 echo "enforce security checks to prevent unauthorised connections to "
3647 echo "ssh-agent. Their absence increases the risk that a malicious "
3648 echo "user can connect to your agent. "
3649 echo ""
3650fi
3651
Darren Tuckerd9f88912005-02-20 21:01:48 +11003652if test "$AUDIT_MODULE" = "bsm" ; then
3653 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3654 echo "See the Solaris section in README.platform for details."
3655fi