blob: d0569df6080aa4410bd57f4a2d4180d49ac95ed9 [file] [log] [blame]
Darren Tucker314d89e2005-10-17 23:29:23 +10001# $Id: configure.ac,v 1.302 2005/10/17 13:29:23 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)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000299 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700300 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000301 AC_CHECK_LIB(xnet, t_error, ,
302 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
303
304 # next, we define all of the options specific to major releases
305 case "$host" in
306 *-*-hpux10*)
307 if test -z "$GCC"; then
308 CFLAGS="$CFLAGS -Ae"
309 fi
310 ;;
311 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700312 AC_DEFINE(PAM_SUN_CODEBASE, 1,
313 [Define if you are using Solaris-derived PAM which
314 passes pam_messages to the conversation function
315 with an extra level of indirection])
316 AC_DEFINE(DISABLE_UTMP, 1,
317 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000318 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
319 check_for_hpux_broken_getaddrinfo=1
320 check_for_conflicting_getspnam=1
321 ;;
322 esac
323
324 # lastly, we define options specific to minor releases
325 case "$host" in
326 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700327 AC_DEFINE(HAVE_SECUREWARE, 1,
328 [Define if you have SecureWare-based
329 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000330 disable_ptmx_check=yes
331 LIBS="$LIBS -lsecpw"
332 ;;
333 esac
Damien Miller1bead332000-04-30 00:47:29 +1000334 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100335*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100336 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700337 AC_DEFINE(BROKEN_INET_NTOA, 1,
338 [Define if you system's inet_ntoa is busted
339 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000340 AC_DEFINE(SETEUID_BREAKS_SETUID)
341 AC_DEFINE(BROKEN_SETREUID)
342 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700343 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
344 [Define if you shouldn't strip 'tty' from your
345 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000346 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100347 ;;
348*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100349 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700350 AC_DEFINE(WITH_IRIX_ARRAY, 1,
351 [Define if you have/want arrays
352 (cluster-wide session managment, not C arrays)])
353 AC_DEFINE(WITH_IRIX_PROJECT, 1,
354 [Define if you want IRIX project management])
355 AC_DEFINE(WITH_IRIX_AUDIT, 1,
356 [Define if you want IRIX audit trails])
357 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
358 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000359 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000360 AC_DEFINE(SETEUID_BREAKS_SETUID)
361 AC_DEFINE(BROKEN_SETREUID)
362 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700363 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000364 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000365 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100366 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100367*-*-linux*)
368 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100369 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000370 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700371 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
372 AC_DEFINE(PAM_TTY_KLUDGE, 1,
373 [Work around problematic Linux PAM modules handling of PAM_TTY])
374 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
375 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000376 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700377 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
378 [Define to whatever link() returns for "not supported"
379 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100380 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700381 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100382 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000383 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000384 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700385 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
386 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000387 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000388 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100389 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000390mips-sony-bsd|mips-sony-newsos4)
Tim Rice7df8d392005-09-19 09:33:39 -0700391 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000392 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000393 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100394*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000395 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800396 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800397 need_dash_r=1
398 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100399 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100400*-*-freebsd*)
401 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000402 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Millerfbd884a2001-02-27 08:39:07 +1100403 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000404*-*-bsdi*)
405 AC_DEFINE(SETEUID_BREAKS_SETUID)
406 AC_DEFINE(BROKEN_SETREUID)
407 AC_DEFINE(BROKEN_SETREGID)
408 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000409*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000410 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100411 conf_utmp_location=/etc/utmp
412 conf_wtmp_location=/usr/adm/wtmp
413 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700414 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000415 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000416 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700417 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000418 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000419*-*-openbsd*)
420 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000421 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Darren Tucker4a422572005-07-14 17:22:11 +1000422 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100423*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800424 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800425 need_dash_r=1
426 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100427 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000428 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700429 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
430 [Some versions of /bin/login need the TERM supplied
431 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000432 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700433 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
434 [Define if pam_chauthtok wants real uid set
435 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000436 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000437 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700438 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
439 [Define if sshd somehow reacquires a controlling TTY
440 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000441 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000442 # hardwire lastlog location (can't detect it on some versions)
443 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000444 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
445 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
446 if test "$sol2ver" -ge 8; then
447 AC_MSG_RESULT(yes)
448 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700449 AC_DEFINE(DISABLE_WTMP, 1,
450 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000451 else
452 AC_MSG_RESULT(no)
453 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100454 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000455*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000456 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000457 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100458 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000459 conf_utmp_location=/etc/utmp
460 conf_wtmp_location=/var/adm/wtmp
461 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000462 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000463 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000464*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700465 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000466 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000467 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000468 AC_DEFINE(SETEUID_BREAKS_SETUID)
469 AC_DEFINE(BROKEN_SETREUID)
470 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000471 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000472*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700473 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000474 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100475 # -lresolv needs to be at then end of LIBS or DNS lookups break
476 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100477 IPADDR_IN_DISPLAY=yes
478 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000479 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000480 AC_DEFINE(SETEUID_BREAKS_SETUID)
481 AC_DEFINE(BROKEN_SETREUID)
482 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000483 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000484 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700485 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
486 # Attention: always take care to bind libsocket and libnsl before libc,
487 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000488 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800489# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100490*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100491 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700492 AC_DEFINE(SETEUID_BREAKS_SETUID)
493 AC_DEFINE(BROKEN_SETREUID)
494 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700495 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100496 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800497# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100498*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700499 check_for_libcrypt_later=1
500 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100501 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700502 AC_DEFINE(SETEUID_BREAKS_SETUID)
503 AC_DEFINE(BROKEN_SETREUID)
504 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700505 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700506 case "$host" in
507 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
508 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700509 AC_DEFINE(BROKEN_LIBIAF, 1,
510 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700511 ;;
512 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100513 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100514*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100515 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800516# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100517*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800518 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100519 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800520# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100521*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800522 if test -z "$GCC"; then
523 CFLAGS="$CFLAGS -belf"
524 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100525 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000526 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100527 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000528 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000529 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700530 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700531 AC_DEFINE(SETEUID_BREAKS_SETUID)
532 AC_DEFINE(BROKEN_SETREUID)
533 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700534 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700535 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700536 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100537 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700538 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700539 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000540 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000541*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700542 AC_DEFINE(NO_SSH_LASTLOG, 1,
543 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100544 AC_DEFINE(SETEUID_BREAKS_SETUID)
545 AC_DEFINE(BROKEN_SETREUID)
546 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000547 AC_DEFINE(USE_PIPES)
548 AC_DEFINE(DISABLE_FD_PASSING)
549 LDFLAGS="$LDFLAGS"
550 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
551 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000552 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000553*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100554 AC_DEFINE(SETEUID_BREAKS_SETUID)
555 AC_DEFINE(BROKEN_SETREUID)
556 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000557 AC_DEFINE(WITH_ABBREV_NO_TTY)
558 AC_DEFINE(USE_PIPES)
559 AC_DEFINE(DISABLE_FD_PASSING)
560 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100561 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000562 MANTYPE=cat
563 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000564*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100565 AC_DEFINE(SETEUID_BREAKS_SETUID)
566 AC_DEFINE(BROKEN_SETREUID)
567 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000568 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700569 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700570 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000571 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
572 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
573 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700574 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000575*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000576 AC_MSG_CHECKING(for Digital Unix SIA)
577 no_osfsia=""
578 AC_ARG_WITH(osfsia,
579 [ --with-osfsia Enable Digital Unix SIA],
580 [
581 if test "x$withval" = "xno" ; then
582 AC_MSG_RESULT(disabled)
583 no_osfsia=1
584 fi
585 ],
586 )
587 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000588 if test -f /etc/sia/matrix.conf; then
589 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700590 AC_DEFINE(HAVE_OSF_SIA, 1,
591 [Define if you have Digital Unix Security
592 Integration Architecture])
593 AC_DEFINE(DISABLE_LOGIN, 1,
594 [Define if you don't want to use your
595 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000596 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000597 LIBS="$LIBS -lsecurity -ldb -lm -laud"
598 else
599 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700600 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
601 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000602 fi
603 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000604 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700605 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000606 AC_DEFINE(BROKEN_SETREUID)
607 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000608 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000609
610*-*-nto-qnx)
611 AC_DEFINE(USE_PIPES)
612 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700613 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
614 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
615 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000616 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000617
618*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700619 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
620 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
621 AC_DEFINE(NEED_SETPRGP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700622 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
623 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000624
625*-*-lynxos)
626 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700627 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000628 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
629 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100630esac
631
Damien Millere37bfc12000-06-05 09:37:43 +1000632# Allow user to specify flags
633AC_ARG_WITH(cflags,
634 [ --with-cflags Specify additional flags to pass to compiler],
635 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800636 if test -n "$withval" && test "x$withval" != "xno" && \
637 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000638 CFLAGS="$CFLAGS $withval"
639 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800640 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000641)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000642AC_ARG_WITH(cppflags,
643 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
644 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800645 if test -n "$withval" && test "x$withval" != "xno" && \
646 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000647 CPPFLAGS="$CPPFLAGS $withval"
648 fi
649 ]
650)
Damien Millere37bfc12000-06-05 09:37:43 +1000651AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000652 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000653 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800654 if test -n "$withval" && test "x$withval" != "xno" && \
655 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000656 LDFLAGS="$LDFLAGS $withval"
657 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800658 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000659)
660AC_ARG_WITH(libs,
661 [ --with-libs Specify additional libraries to link with],
662 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800663 if test -n "$withval" && test "x$withval" != "xno" && \
664 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000665 LIBS="$LIBS $withval"
666 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800667 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000668)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000669AC_ARG_WITH(Werror,
670 [ --with-Werror Build main code with -Werror],
671 [
672 if test -n "$withval" && test "x$withval" != "xno"; then
673 werror_flags="-Werror"
Damien Millere04ec6f2005-10-08 16:21:19 +1000674 if test "x${withval}" != "xyes"; then
Darren Tucker7da23cb2005-08-03 00:20:15 +1000675 werror_flags="$withval"
676 fi
677 fi
678 ]
679)
Damien Millere37bfc12000-06-05 09:37:43 +1000680
Darren Tucker6eb93042003-06-29 21:30:41 +1000681AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000682AC_RUN_IFELSE(
683 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000684#include <stdio.h>
685int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000686 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000687 [ AC_MSG_RESULT(yes) ],
688 [
689 AC_MSG_RESULT(no)
690 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000691 ],
692 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000693)
694
Darren Tucker0c9653f2005-05-28 15:58:14 +1000695dnl Checks for header files.
696AC_CHECK_HEADERS( \
697 bstring.h \
698 crypt.h \
699 dirent.h \
700 endian.h \
701 features.h \
702 floatingpoint.h \
703 getopt.h \
704 glob.h \
705 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700706 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000707 lastlog.h \
708 limits.h \
709 login.h \
710 login_cap.h \
711 maillock.h \
712 ndir.h \
713 netdb.h \
714 netgroup.h \
715 netinet/in_systm.h \
716 pam/pam_appl.h \
717 paths.h \
718 pty.h \
719 readpassphrase.h \
720 rpc/types.h \
721 security/pam_appl.h \
722 shadow.h \
723 stddef.h \
724 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000725 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000726 strings.h \
727 sys/audit.h \
728 sys/bitypes.h \
729 sys/bsdtty.h \
730 sys/cdefs.h \
731 sys/dir.h \
732 sys/mman.h \
733 sys/ndir.h \
734 sys/prctl.h \
735 sys/pstat.h \
736 sys/select.h \
737 sys/stat.h \
738 sys/stream.h \
739 sys/stropts.h \
740 sys/strtio.h \
741 sys/sysmacros.h \
742 sys/time.h \
743 sys/timers.h \
744 sys/un.h \
745 time.h \
746 tmpdir.h \
747 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000748 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000749 usersec.h \
750 util.h \
751 utime.h \
752 utmp.h \
753 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000754 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000755)
Tim Rice4cec93f2002-02-26 08:40:48 -0800756
Darren Tucker48d99d32004-08-29 17:04:50 +1000757# sys/ptms.h requires sys/stream.h to be included first on Solaris
758AC_CHECK_HEADERS(sys/ptms.h, [], [], [
759#ifdef HAVE_SYS_STREAM_H
760# include <sys/stream.h>
761#endif
762])
763
Damien Millera22ba012000-03-02 23:09:20 +1100764# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700765AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
766AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000767
Tim Rice1e1ef642003-09-11 22:19:31 -0700768dnl IRIX and Solaris 2.5.1 have dirname() in libgen
769AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
770 AC_CHECK_LIB(gen, dirname,[
771 AC_CACHE_CHECK([for broken dirname],
772 ac_cv_have_broken_dirname, [
773 save_LIBS="$LIBS"
774 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000775 AC_RUN_IFELSE(
776 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700777#include <libgen.h>
778#include <string.h>
779
780int main(int argc, char **argv) {
781 char *s, buf[32];
782
783 strncpy(buf,"/etc", 32);
784 s = dirname(buf);
785 if (!s || strncmp(s, "/", 32) != 0) {
786 exit(1);
787 } else {
788 exit(0);
789 }
790}
Darren Tucker314d89e2005-10-17 23:29:23 +1000791 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700792 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000793 [ ac_cv_have_broken_dirname="yes" ],
794 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700795 )
796 LIBS="$save_LIBS"
797 ])
798 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
799 LIBS="$LIBS -lgen"
800 AC_DEFINE(HAVE_DIRNAME)
801 AC_CHECK_HEADERS(libgen.h)
802 fi
803 ])
804])
805
806AC_CHECK_FUNC(getspnam, ,
807 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700808AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
809 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700810
Tim Rice13aae5e2001-10-21 17:53:58 -0700811dnl zlib is required
812AC_ARG_WITH(zlib,
813 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100814 [ if test "x$withval" = "xno" ; then
815 AC_MSG_ERROR([*** zlib is required ***])
816 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700817 if test -d "$withval/lib"; then
818 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700819 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700820 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700821 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700822 fi
823 else
824 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700825 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700826 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700827 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700828 fi
829 fi
830 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700831 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700832 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700833 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700834 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100835 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700836)
837
Tim Ricefcb62202004-01-23 18:35:16 -0800838AC_CHECK_LIB(z, deflate, ,
839 [
840 saved_CPPFLAGS="$CPPFLAGS"
841 saved_LDFLAGS="$LDFLAGS"
842 save_LIBS="$LIBS"
843 dnl Check default zlib install dir
844 if test -n "${need_dash_r}"; then
845 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
846 else
847 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
848 fi
849 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
850 LIBS="$LIBS -lz"
851 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
852 [
853 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
854 ]
855 )
856 ]
857)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100858AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100859
860AC_ARG_WITH(zlib-version-check,
861 [ --without-zlib-version-check Disable zlib version check],
862 [ if test "x$withval" = "xno" ; then
863 zlib_check_nonfatal=1
864 fi
865 ]
866)
867
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000868AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000869AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000870#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100871#include <zlib.h>
872int main()
873{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000874 int a=0, b=0, c=0, d=0, n, v;
875 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
876 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100877 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000878 v = a*1000000 + b*10000 + c*100 + d;
879 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
880
881 /* 1.1.4 is OK */
882 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100883 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000884
Darren Tucker41097ed2005-07-25 15:24:21 +1000885 /* 1.2.3 and up are OK */
886 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000887 exit(0);
888
Darren Tucker2dcd2392004-01-23 17:13:33 +1100889 exit(2);
890}
Darren Tucker623d92f2004-09-12 22:36:15 +1000891 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000892 AC_MSG_RESULT(no),
893 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100894 if test -z "$zlib_check_nonfatal" ; then
895 AC_MSG_ERROR([*** zlib too old - check config.log ***
896Your reported zlib version has known security problems. It's possible your
897vendor has fixed these problems without changing the version number. If you
898are sure this is the case, you can disable the check by running
899"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000900If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000901See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100902 else
903 AC_MSG_WARN([zlib version may have security problems])
904 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000905 ],
906 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100907)
Damien Miller6f9c3372000-10-25 10:06:04 +1100908
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000909dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100910AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000911 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
912)
Damien Millera8e06ce2003-11-21 23:48:55 +1100913AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700914 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
915 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000916)
Damien Millerab18c411999-11-11 10:40:23 +1100917
Tim Ricee589a292001-11-03 11:09:32 -0800918dnl Checks for libutil functions
919AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700920AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
921 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800922AC_CHECK_FUNCS(logout updwtmp logwtmp)
923
Ben Lindstrom8697e082001-02-24 21:41:10 +0000924AC_FUNC_STRFTIME
925
Damien Miller3c027682001-03-14 11:39:45 +1100926# Check for ALTDIRFUNC glob() extension
927AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
928AC_EGREP_CPP(FOUNDIT,
929 [
930 #include <glob.h>
931 #ifdef GLOB_ALTDIRFUNC
932 FOUNDIT
933 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100934 ],
Damien Miller3c027682001-03-14 11:39:45 +1100935 [
Tim Rice7df8d392005-09-19 09:33:39 -0700936 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
937 [Define if your system glob() function has
938 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100939 AC_MSG_RESULT(yes)
940 ],
941 [
942 AC_MSG_RESULT(no)
943 ]
944)
Damien Millerab18c411999-11-11 10:40:23 +1100945
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000946# Check for g.gl_matchc glob() extension
947AC_MSG_CHECKING(for gl_matchc field in glob_t)
948AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100949 [
950 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000951 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100952 ],
953 [
Tim Rice7df8d392005-09-19 09:33:39 -0700954 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
955 [Define if your system glob() function has
956 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100957 AC_MSG_RESULT(yes)
958 ],
959 [
960 AC_MSG_RESULT(no)
961 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000962)
963
Damien Miller18bb4732001-03-28 14:35:30 +1000964AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000965AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000966 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000967#include <sys/types.h>
968#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700969int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000970 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100971 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000972 [
973 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700974 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
975 [Define in your struct dirent expects you to
976 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000977 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800978 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000979 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
980 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000981 ]
982)
983
Damien Miller36f49652004-08-15 18:40:59 +1000984AC_MSG_CHECKING([for /proc/pid/fd directory])
985if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700986 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000987 AC_MSG_RESULT(yes)
988else
989 AC_MSG_RESULT(no)
990fi
991
Damien Millerc547bf12001-02-16 10:18:12 +1100992# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100993SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100994AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100995 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100996 [
997 if test "x$withval" != "xno" ; then
998
999 if test "x$withval" != "xyes" ; then
1000 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1001 LDFLAGS="$LDFLAGS -L${withval}/lib"
1002 fi
1003
Tim Rice7df8d392005-09-19 09:33:39 -07001004 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001005 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001006 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001007
Tim Rice4cec93f2002-02-26 08:40:48 -08001008 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001009 AC_LINK_IFELSE(
1010 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001011#include <stdio.h>
1012#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001013int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +10001014 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001015 [AC_MSG_RESULT(yes)],
1016 [
1017 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001018 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1019 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001020 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1021 AC_TRY_COMPILE(
1022 [#include <stdio.h>
1023 #include <skey.h>],
1024 [(void)skeychallenge(NULL,"name","",0);],
1025 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001026 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1027 [Define if your skeychallenge()
1028 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001029 [AC_MSG_RESULT(no)]
1030 )
Damien Millerc547bf12001-02-16 10:18:12 +11001031 fi
1032 ]
1033)
1034
1035# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001036TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001037AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001038 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001039 [
1040 if test "x$withval" != "xno" ; then
1041 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001042 saved_LDFLAGS="$LDFLAGS"
1043 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001044 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001045 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001046 if test -d "${withval}/lib"; then
1047 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001048 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001049 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001050 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001051 fi
1052 else
1053 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001054 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001055 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001056 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001057 fi
1058 fi
1059 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001060 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001061 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001062 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001063 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001064 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001065 LIBWRAP="-lwrap"
1066 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001067 AC_MSG_CHECKING(for libwrap)
1068 AC_TRY_LINK(
1069 [
Damien Miller0ac45002004-04-14 20:14:26 +10001070#include <sys/types.h>
1071#include <sys/socket.h>
1072#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001073#include <tcpd.h>
1074 int deny_severity = 0, allow_severity = 0;
1075 ],
1076 [hosts_access(0);],
1077 [
1078 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001079 AC_DEFINE(LIBWRAP, 1,
1080 [Define if you want
1081 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001082 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001083 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001084 ],
1085 [
1086 AC_MSG_ERROR([*** libwrap missing])
1087 ]
1088 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001089 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001090 fi
1091 ]
1092)
1093
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001094# Check whether user wants libedit support
1095LIBEDIT_MSG="no"
1096AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001097 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001098 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001099 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001100 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1101 if test -n "${need_dash_r}"; then
1102 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1103 else
1104 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1105 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001106 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001107 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001108 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001109 LIBEDIT="-ledit -lcurses"
1110 LIBEDIT_MSG="yes"
1111 AC_SUBST(LIBEDIT)
1112 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001113 [ AC_MSG_ERROR(libedit not found) ],
1114 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001115 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001116 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001117 AC_COMPILE_IFELSE(
1118 [AC_LANG_SOURCE([[
1119#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001120int main(void)
1121{
1122 int i = H_SETSIZE;
1123 el_init("", NULL, NULL, NULL);
1124 exit(0);
1125}
Tim Ricec1819c82005-08-15 17:48:40 -07001126 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001127 [ AC_MSG_RESULT(yes) ],
1128 [ AC_MSG_RESULT(no)
1129 AC_MSG_ERROR(libedit version is not compatible) ]
1130 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001131 fi ]
1132)
1133
Darren Tuckerd9f88912005-02-20 21:01:48 +11001134AUDIT_MODULE=none
1135AC_ARG_WITH(audit,
1136 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1137 [
1138 AC_MSG_CHECKING(for supported audit module)
1139 case "$withval" in
1140 bsm)
1141 AC_MSG_RESULT(bsm)
1142 AUDIT_MODULE=bsm
1143 dnl Checks for headers, libs and functions
1144 AC_CHECK_HEADERS(bsm/audit.h, [],
1145 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1146 AC_CHECK_LIB(bsm, getaudit, [],
1147 [AC_MSG_ERROR(BSM enabled and required library not found)])
1148 AC_CHECK_FUNCS(getaudit, [],
1149 [AC_MSG_ERROR(BSM enabled and required function not found)])
1150 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001151 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001152 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001153 ;;
1154 debug)
1155 AUDIT_MODULE=debug
1156 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001157 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001158 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001159 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001160 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001161 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001162 *)
1163 AC_MSG_ERROR([Unknown audit module $withval])
1164 ;;
1165 esac ]
1166)
1167
Damien Millerfe1f1432003-02-24 15:45:42 +11001168dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001169AC_CHECK_FUNCS( \
1170 arc4random \
1171 b64_ntop \
1172 __b64_ntop \
1173 b64_pton \
1174 __b64_pton \
1175 bcopy \
1176 bindresvport_sa \
1177 clock \
1178 closefrom \
1179 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001180 fchmod \
1181 fchown \
1182 freeaddrinfo \
1183 futimes \
1184 getaddrinfo \
1185 getcwd \
1186 getgrouplist \
1187 getnameinfo \
1188 getopt \
1189 getpeereid \
1190 _getpty \
1191 getrlimit \
1192 getttyent \
1193 glob \
1194 inet_aton \
1195 inet_ntoa \
1196 inet_ntop \
1197 innetgr \
1198 login_getcapbool \
1199 md5_crypt \
1200 memmove \
1201 mkdtemp \
1202 mmap \
1203 ngetaddrinfo \
1204 nsleep \
1205 ogetaddrinfo \
1206 openlog_r \
1207 openpty \
1208 prctl \
1209 pstat \
1210 readpassphrase \
1211 realpath \
1212 recvmsg \
1213 rresvport_af \
1214 sendmsg \
1215 setdtablesize \
1216 setegid \
1217 setenv \
1218 seteuid \
1219 setgroups \
1220 setlogin \
1221 setpcred \
1222 setproctitle \
1223 setregid \
1224 setreuid \
1225 setrlimit \
1226 setsid \
1227 setvbuf \
1228 sigaction \
1229 sigvec \
1230 snprintf \
1231 socketpair \
1232 strdup \
1233 strerror \
1234 strlcat \
1235 strlcpy \
1236 strmode \
1237 strnvis \
1238 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001239 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001240 strtoul \
1241 sysconf \
1242 tcgetpgrp \
1243 truncate \
1244 unsetenv \
1245 updwtmpx \
1246 utimes \
1247 vhangup \
1248 vsnprintf \
1249 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001250)
Tim Rice13aae5e2001-10-21 17:53:58 -07001251
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001252# IRIX has a const char return value for gai_strerror()
1253AC_CHECK_FUNCS(gai_strerror,[
1254 AC_DEFINE(HAVE_GAI_STRERROR)
1255 AC_TRY_COMPILE([
1256#include <sys/types.h>
1257#include <sys/socket.h>
1258#include <netdb.h>
1259
1260const char *gai_strerror(int);],[
1261char *str;
1262
1263str = gai_strerror(0);],[
1264 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1265 [Define if gai_strerror() returns const char *])])])
1266
Tim Rice7df8d392005-09-19 09:33:39 -07001267AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1268 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001269
Darren Tuckerf1159b52003-07-07 19:44:01 +10001270dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001271AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001272AC_CHECK_DECL(strsep,
1273 [AC_CHECK_FUNCS(strsep)],
1274 [],
1275 [
1276#ifdef HAVE_STRING_H
1277# include <string.h>
1278#endif
1279 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001280
Darren Tuckerb2427c82003-09-10 15:22:44 +10001281dnl tcsendbreak might be a macro
1282AC_CHECK_DECL(tcsendbreak,
1283 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001284 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001285 [#include <termios.h>]
1286)
1287
Darren Tucker5bb14002004-04-23 18:53:10 +10001288AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1289
Darren Tucker2a6b0292003-12-31 14:59:17 +11001290AC_CHECK_FUNCS(setresuid, [
1291 dnl Some platorms have setresuid that isn't implemented, test for this
1292 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001293 AC_RUN_IFELSE(
1294 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001295#include <stdlib.h>
1296#include <errno.h>
1297int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001298 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001299 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001300 [AC_DEFINE(BROKEN_SETRESUID, 1,
1301 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001302 AC_MSG_RESULT(not implemented)],
1303 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001304 )
1305])
Darren Tuckere937be32003-12-17 18:53:26 +11001306
Darren Tucker2a6b0292003-12-31 14:59:17 +11001307AC_CHECK_FUNCS(setresgid, [
1308 dnl Some platorms have setresgid that isn't implemented, test for this
1309 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001310 AC_RUN_IFELSE(
1311 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001312#include <stdlib.h>
1313#include <errno.h>
1314int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001315 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001316 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001317 [AC_DEFINE(BROKEN_SETRESGID, 1,
1318 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001319 AC_MSG_RESULT(not implemented)],
1320 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001321 )
1322])
Darren Tuckere937be32003-12-17 18:53:26 +11001323
Damien Millerad833b32000-08-23 10:46:23 +10001324dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001325AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001326dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001327AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001328AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001329dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001330AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001331AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001332
Damien Millera8e06ce2003-11-21 23:48:55 +11001333AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001334 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1335 [AC_CHECK_LIB(bsd, daemon,
1336 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001337)
1338
Damien Millera8e06ce2003-11-21 23:48:55 +11001339AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001340 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1341 [Define if your libraries define getpagesize()])],
1342 [AC_CHECK_LIB(ucb, getpagesize,
1343 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001344)
1345
Damien Millercb170cb2000-07-01 16:52:55 +10001346# Check for broken snprintf
1347if test "x$ac_cv_func_snprintf" = "xyes" ; then
1348 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001349 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001350 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001351#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001352int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001353 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001354 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001355 [
1356 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001357 AC_DEFINE(BROKEN_SNPRINTF, 1,
1358 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001359 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001360 ],
1361 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001362 )
1363fi
1364
Damien Millerb4097182004-05-23 14:09:40 +10001365# Check for missing getpeereid (or equiv) support
1366NO_PEERCHECK=""
1367if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1368 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1369 AC_TRY_COMPILE(
1370 [#include <sys/types.h>
1371 #include <sys/socket.h>],
1372 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001373 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001374 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001375 ],
Damien Millerb4097182004-05-23 14:09:40 +10001376 [AC_MSG_RESULT(no)
1377 NO_PEERCHECK=1]
1378 )
1379fi
1380
Damien Millere8328192003-01-07 15:18:32 +11001381dnl see whether mkstemp() requires XXXXXX
1382if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1383AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001384AC_RUN_IFELSE(
1385 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001386#include <stdlib.h>
1387main() { char template[]="conftest.mkstemp-test";
1388if (mkstemp(template) == -1)
1389 exit(1);
1390unlink(template); exit(0);
1391}
Darren Tucker314d89e2005-10-17 23:29:23 +10001392 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001393 [
1394 AC_MSG_RESULT(no)
1395 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001396 [
Damien Millere8328192003-01-07 15:18:32 +11001397 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001398 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001399 ],
1400 [
1401 AC_MSG_RESULT(yes)
1402 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001403 ]
Damien Millere8328192003-01-07 15:18:32 +11001404)
1405fi
1406
Darren Tucker70a3d552003-08-21 17:58:29 +10001407dnl make sure that openpty does not reacquire controlling terminal
1408if test ! -z "$check_for_openpty_ctty_bug"; then
1409 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001410 AC_RUN_IFELSE(
1411 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001412#include <stdio.h>
1413#include <sys/fcntl.h>
1414#include <sys/types.h>
1415#include <sys/wait.h>
1416
1417int
1418main()
1419{
1420 pid_t pid;
1421 int fd, ptyfd, ttyfd, status;
1422
1423 pid = fork();
1424 if (pid < 0) { /* failed */
1425 exit(1);
1426 } else if (pid > 0) { /* parent */
1427 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001428 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001429 exit(WEXITSTATUS(status));
1430 else
1431 exit(2);
1432 } else { /* child */
1433 close(0); close(1); close(2);
1434 setsid();
1435 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1436 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1437 if (fd >= 0)
1438 exit(3); /* Acquired ctty: broken */
1439 else
1440 exit(0); /* Did not acquire ctty: OK */
1441 }
1442}
Darren Tucker314d89e2005-10-17 23:29:23 +10001443 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001444 [
1445 AC_MSG_RESULT(yes)
1446 ],
1447 [
1448 AC_MSG_RESULT(no)
1449 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001450 ],
1451 [
1452 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001453 ]
1454 )
1455fi
1456
Tim Rice8bb561b2005-03-17 16:23:19 -08001457if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1458 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001459 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001460 AC_RUN_IFELSE(
1461 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001462#include <stdio.h>
1463#include <sys/socket.h>
1464#include <netdb.h>
1465#include <errno.h>
1466#include <netinet/in.h>
1467
1468#define TEST_PORT "2222"
1469
1470int
1471main(void)
1472{
1473 int err, sock;
1474 struct addrinfo *gai_ai, *ai, hints;
1475 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1476
1477 memset(&hints, 0, sizeof(hints));
1478 hints.ai_family = PF_UNSPEC;
1479 hints.ai_socktype = SOCK_STREAM;
1480 hints.ai_flags = AI_PASSIVE;
1481
1482 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1483 if (err != 0) {
1484 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1485 exit(1);
1486 }
1487
1488 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1489 if (ai->ai_family != AF_INET6)
1490 continue;
1491
1492 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1493 sizeof(ntop), strport, sizeof(strport),
1494 NI_NUMERICHOST|NI_NUMERICSERV);
1495
1496 if (err != 0) {
1497 if (err == EAI_SYSTEM)
1498 perror("getnameinfo EAI_SYSTEM");
1499 else
1500 fprintf(stderr, "getnameinfo failed: %s\n",
1501 gai_strerror(err));
1502 exit(2);
1503 }
1504
1505 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1506 if (sock < 0)
1507 perror("socket");
1508 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1509 if (errno == EBADF)
1510 exit(3);
1511 }
1512 }
1513 exit(0);
1514}
Darren Tucker314d89e2005-10-17 23:29:23 +10001515 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001516 [
1517 AC_MSG_RESULT(yes)
1518 ],
1519 [
1520 AC_MSG_RESULT(no)
1521 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001522 ],
1523 [
1524 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001525 ]
1526 )
1527fi
1528
Tim Rice8bb561b2005-03-17 16:23:19 -08001529if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1530 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001531 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001532 AC_RUN_IFELSE(
1533 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001534#include <stdio.h>
1535#include <sys/socket.h>
1536#include <netdb.h>
1537#include <errno.h>
1538#include <netinet/in.h>
1539
1540#define TEST_PORT "2222"
1541
1542int
1543main(void)
1544{
1545 int err, sock;
1546 struct addrinfo *gai_ai, *ai, hints;
1547 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1548
1549 memset(&hints, 0, sizeof(hints));
1550 hints.ai_family = PF_UNSPEC;
1551 hints.ai_socktype = SOCK_STREAM;
1552 hints.ai_flags = AI_PASSIVE;
1553
1554 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1555 if (err != 0) {
1556 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1557 exit(1);
1558 }
1559
1560 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1561 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1562 continue;
1563
1564 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1565 sizeof(ntop), strport, sizeof(strport),
1566 NI_NUMERICHOST|NI_NUMERICSERV);
1567
1568 if (ai->ai_family == AF_INET && err != 0) {
1569 perror("getnameinfo");
1570 exit(2);
1571 }
1572 }
1573 exit(0);
1574}
Darren Tucker314d89e2005-10-17 23:29:23 +10001575 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001576 [
1577 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001578 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1579 [Define if you have a getaddrinfo that fails
1580 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001581 ],
1582 [
1583 AC_MSG_RESULT(no)
1584 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001585 ],
1586 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001587 ]
1588 )
1589fi
1590
Darren Tuckera56f1912004-11-02 20:30:54 +11001591if test "x$check_for_conflicting_getspnam" = "x1"; then
1592 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1593 AC_COMPILE_IFELSE(
1594 [
1595#include <shadow.h>
1596int main(void) {exit(0);}
1597 ],
1598 [
1599 AC_MSG_RESULT(no)
1600 ],
1601 [
1602 AC_MSG_RESULT(yes)
1603 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1604 [Conflicting defs for getspnam])
1605 ]
1606 )
1607fi
1608
Damien Miller606f8802000-09-16 15:39:56 +11001609AC_FUNC_GETPGRP
1610
Damien Millera64b57a2001-01-17 10:44:13 +11001611# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001612PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001613AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001614 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001615 [
Damien Millera64b57a2001-01-17 10:44:13 +11001616 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001617 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1618 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001619 AC_MSG_ERROR([PAM headers not found])
1620 fi
1621
1622 AC_CHECK_LIB(dl, dlopen, , )
1623 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1624 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001625 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001626
Damien Millera64b57a2001-01-17 10:44:13 +11001627 PAM_MSG="yes"
1628
Tim Rice7df8d392005-09-19 09:33:39 -07001629 AC_DEFINE(USE_PAM, 1,
1630 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001631 if test $ac_cv_lib_dl_dlopen = yes; then
1632 LIBPAM="-lpam -ldl"
1633 else
1634 LIBPAM="-lpam"
1635 fi
1636 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001637 fi
1638 ]
1639)
Damien Millera22ba012000-03-02 23:09:20 +11001640
Damien Millera64b57a2001-01-17 10:44:13 +11001641# Check for older PAM
1642if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001643 # Check PAM strerror arguments (old PAM)
1644 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1645 AC_TRY_COMPILE(
1646 [
Damien Miller81171112000-04-23 11:14:01 +10001647#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001648#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001649#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001650#elif defined (HAVE_PAM_PAM_APPL_H)
1651#include <pam/pam_appl.h>
1652#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001653 ],
1654 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001655 [AC_MSG_RESULT(no)],
1656 [
Tim Rice7df8d392005-09-19 09:33:39 -07001657 AC_DEFINE(HAVE_OLD_PAM, 1,
1658 [Define if you have an old version of PAM
1659 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001660 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001661 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001662 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001663 )
Damien Millera22ba012000-03-02 23:09:20 +11001664fi
1665
Tim Riceaef73712002-05-11 13:17:42 -07001666# Search for OpenSSL
1667saved_CPPFLAGS="$CPPFLAGS"
1668saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001669AC_ARG_WITH(ssl-dir,
1670 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1671 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001672 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001673 case "$withval" in
1674 # Relative paths
1675 ./*|../*) withval="`pwd`/$withval"
1676 esac
Tim Riceaef73712002-05-11 13:17:42 -07001677 if test -d "$withval/lib"; then
1678 if test -n "${need_dash_r}"; then
1679 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1680 else
1681 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1682 fi
1683 else
1684 if test -n "${need_dash_r}"; then
1685 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1686 else
1687 LDFLAGS="-L${withval} ${LDFLAGS}"
1688 fi
1689 fi
1690 if test -d "$withval/include"; then
1691 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1692 else
1693 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1694 fi
Damien Millera22ba012000-03-02 23:09:20 +11001695 fi
1696 ]
1697)
Tim Rice3d5352e2004-02-12 09:27:21 -08001698LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001699AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1700 [Define if your ssl headers are included
1701 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001702 [
Tim Riceaef73712002-05-11 13:17:42 -07001703 dnl Check default openssl install dir
1704 if test -n "${need_dash_r}"; then
1705 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001706 else
Tim Riceaef73712002-05-11 13:17:42 -07001707 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001708 fi
Tim Riceaef73712002-05-11 13:17:42 -07001709 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1710 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1711 [
1712 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1713 ]
1714 )
1715 ]
1716)
1717
Tim Riced730b782002-08-13 18:52:10 -07001718# Determine OpenSSL header version
1719AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001720AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001721 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001722#include <stdio.h>
1723#include <string.h>
1724#include <openssl/opensslv.h>
1725#define DATA "conftest.sslincver"
1726int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001727 FILE *fd;
1728 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001729
Damien Millera8e06ce2003-11-21 23:48:55 +11001730 fd = fopen(DATA,"w");
1731 if(fd == NULL)
1732 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001733
1734 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1735 exit(1);
1736
1737 exit(0);
1738}
Darren Tucker623d92f2004-09-12 22:36:15 +10001739 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001740 [
1741 ssl_header_ver=`cat conftest.sslincver`
1742 AC_MSG_RESULT($ssl_header_ver)
1743 ],
1744 [
1745 AC_MSG_RESULT(not found)
1746 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001747 ],
1748 [
1749 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001750 ]
1751)
1752
1753# Determine OpenSSL library version
1754AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001755AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001756 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001757#include <stdio.h>
1758#include <string.h>
1759#include <openssl/opensslv.h>
1760#include <openssl/crypto.h>
1761#define DATA "conftest.ssllibver"
1762int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001763 FILE *fd;
1764 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001765
Damien Millera8e06ce2003-11-21 23:48:55 +11001766 fd = fopen(DATA,"w");
1767 if(fd == NULL)
1768 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001769
1770 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1771 exit(1);
1772
1773 exit(0);
1774}
Darren Tucker623d92f2004-09-12 22:36:15 +10001775 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001776 [
1777 ssl_library_ver=`cat conftest.ssllibver`
1778 AC_MSG_RESULT($ssl_library_ver)
1779 ],
1780 [
1781 AC_MSG_RESULT(not found)
1782 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001783 ],
1784 [
1785 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001786 ]
1787)
Damien Millera22ba012000-03-02 23:09:20 +11001788
Damien Millerec932372002-01-22 22:16:03 +11001789# Sanity check OpenSSL headers
1790AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001791AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001792 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001793#include <string.h>
1794#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001795int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001796 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001797 [
1798 AC_MSG_RESULT(yes)
1799 ],
1800 [
1801 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001802 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1803Check config.log for details.
1804Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001805 ],
1806 [
1807 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001808 ]
1809)
1810
Tim Rice3d5352e2004-02-12 09:27:21 -08001811# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1812# because the system crypt() is more featureful.
1813if test "x$check_for_libcrypt_before" = "x1"; then
1814 AC_CHECK_LIB(crypt, crypt)
1815fi
1816
Damien Millera8e06ce2003-11-21 23:48:55 +11001817# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001818# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001819if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001820 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001821fi
1822
Tim Rice2291c002005-08-26 13:15:19 -07001823AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001824
1825### Configure cryptographic random number support
1826
1827# Check wheter OpenSSL seeds itself
1828AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001829AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001830 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001831#include <string.h>
1832#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001833int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001834 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001835 [
1836 OPENSSL_SEEDS_ITSELF=yes
1837 AC_MSG_RESULT(yes)
1838 ],
1839 [
1840 AC_MSG_RESULT(no)
1841 # Default to use of the rand helper if OpenSSL doesn't
1842 # seed itself
1843 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001844 ],
1845 [
1846 AC_MSG_WARN([cross compiling: assuming yes])
1847 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001848 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001849 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001850 ]
1851)
1852
1853
1854# Do we want to force the use of the rand helper?
1855AC_ARG_WITH(rand-helper,
1856 [ --with-rand-helper Use subprocess to gather strong randomness ],
1857 [
1858 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001859 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001860 # the previous test showed it to be unseeded.
1861 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1862 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1863 OPENSSL_SEEDS_ITSELF=yes
1864 USE_RAND_HELPER=""
1865 fi
1866 else
1867 USE_RAND_HELPER=yes
1868 fi
1869 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001870)
Damien Miller6c21c512002-01-22 21:57:53 +11001871
1872# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001873if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001874 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001875 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1876 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001877 RAND_MSG="OpenSSL internal ONLY"
1878 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001879elif test ! -z "$USE_RAND_HELPER" ; then
1880 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001881 RAND_MSG="ssh-rand-helper"
1882 INSTALL_SSH_RAND_HELPER="yes"
1883fi
1884AC_SUBST(INSTALL_SSH_RAND_HELPER)
1885
1886### Configuration of ssh-rand-helper
1887
1888# PRNGD TCP socket
1889AC_ARG_WITH(prngd-port,
1890 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1891 [
Damien Millere996d722002-01-23 11:20:59 +11001892 case "$withval" in
1893 no)
1894 withval=""
1895 ;;
1896 [[0-9]]*)
1897 ;;
1898 *)
1899 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1900 ;;
1901 esac
1902 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001903 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001904 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1905 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001906 fi
1907 ]
1908)
1909
1910# PRNGD Unix domain socket
1911AC_ARG_WITH(prngd-socket,
1912 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1913 [
Damien Millere996d722002-01-23 11:20:59 +11001914 case "$withval" in
1915 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001916 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001917 ;;
1918 no)
1919 withval=""
1920 ;;
1921 /*)
1922 ;;
1923 *)
1924 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1925 ;;
1926 esac
1927
1928 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001929 if test ! -z "$PRNGD_PORT" ; then
1930 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1931 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001932 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001933 AC_MSG_WARN(Entropy socket is not readable)
1934 fi
1935 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001936 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1937 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001938 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001939 ],
1940 [
1941 # Check for existing socket only if we don't have a random device already
1942 if test "$USE_RAND_HELPER" = yes ; then
1943 AC_MSG_CHECKING(for PRNGD/EGD socket)
1944 # Insert other locations here
1945 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1946 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1947 PRNGD_SOCKET="$sock"
1948 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1949 break;
1950 fi
1951 done
1952 if test ! -z "$PRNGD_SOCKET" ; then
1953 AC_MSG_RESULT($PRNGD_SOCKET)
1954 else
1955 AC_MSG_RESULT(not found)
1956 fi
1957 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001958 ]
1959)
1960
1961# Change default command timeout for hashing entropy source
1962entropy_timeout=200
1963AC_ARG_WITH(entropy-timeout,
1964 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1965 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001966 if test -n "$withval" && test "x$withval" != "xno" && \
1967 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001968 entropy_timeout=$withval
1969 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001970 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001971)
Tim Rice7df8d392005-09-19 09:33:39 -07001972AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1973 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11001974
Damien Millerd3f6ad22002-06-25 10:24:47 +10001975SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001976AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001977 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001978 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001979 if test -n "$withval" && test "x$withval" != "xno" && \
1980 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001981 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001982 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001983 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001984)
Tim Rice7df8d392005-09-19 09:33:39 -07001985AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
1986 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10001987AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001988
Tim Rice88f2ab52002-03-17 12:17:34 -08001989# We do this little dance with the search path to insure
1990# that programs that we select for use by installed programs
1991# (which may be run by the super-user) come from trusted
1992# locations before they come from the user's private area.
1993# This should help avoid accidentally configuring some
1994# random version of a program in someone's personal bin.
1995
1996OPATH=$PATH
1997PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001998test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001999test -d /sbin && PATH=$PATH:/sbin
2000test -d /usr/sbin && PATH=$PATH:/usr/sbin
2001PATH=$PATH:/etc:$OPATH
2002
Damien Millera8e06ce2003-11-21 23:48:55 +11002003# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002004OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2005OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2006OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2007OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2008OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2009OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2010OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2011OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2012OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2013OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2014OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2015OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2016OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2017OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2018OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2019OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002020# restore PATH
2021PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002022
2023# Where does ssh-rand-helper get its randomness from?
2024INSTALL_SSH_PRNG_CMDS=""
2025if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2026 if test ! -z "$PRNGD_PORT" ; then
2027 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2028 elif test ! -z "$PRNGD_SOCKET" ; then
2029 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2030 else
2031 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2032 RAND_HELPER_CMDHASH=yes
2033 INSTALL_SSH_PRNG_CMDS="yes"
2034 fi
2035fi
2036AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2037
2038
Ben Lindstromb5628642000-10-18 00:02:25 +00002039# Cheap hack to ensure NEWS-OS libraries are arranged right.
2040if test ! -z "$SONY" ; then
2041 LIBS="$LIBS -liberty";
2042fi
2043
Damien Millera22ba012000-03-02 23:09:20 +11002044# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11002045AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002046AC_CHECK_SIZEOF(short int, 2)
2047AC_CHECK_SIZEOF(int, 4)
2048AC_CHECK_SIZEOF(long int, 4)
2049AC_CHECK_SIZEOF(long long int, 8)
2050
Damien Millerfa2bb692002-04-23 23:22:25 +10002051# Sanity check long long for some platforms (AIX)
2052if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2053 ac_cv_sizeof_long_long_int=0
2054fi
2055
Damien Millera22ba012000-03-02 23:09:20 +11002056# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002057AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2058 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002059 [ #include <sys/types.h> ],
2060 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002061 [ ac_cv_have_u_int="yes" ],
2062 [ ac_cv_have_u_int="no" ]
2063 )
2064])
2065if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002066 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002067 have_u_int=1
2068fi
2069
Damien Miller61e50f12000-05-08 20:49:37 +10002070AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2071 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002072 [ #include <sys/types.h> ],
2073 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002074 [ ac_cv_have_intxx_t="yes" ],
2075 [ ac_cv_have_intxx_t="no" ]
2076 )
2077])
2078if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002079 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002080 have_intxx_t=1
2081fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002082
2083if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002084 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002085then
2086 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2087 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002088 [ #include <stdint.h> ],
2089 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002090 [
2091 AC_DEFINE(HAVE_INTXX_T)
2092 AC_MSG_RESULT(yes)
2093 ],
2094 [ AC_MSG_RESULT(no) ]
2095 )
2096fi
2097
Damien Miller578783e2000-09-23 14:12:24 +11002098AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2099 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002100 [
2101#include <sys/types.h>
2102#ifdef HAVE_STDINT_H
2103# include <stdint.h>
2104#endif
2105#include <sys/socket.h>
2106#ifdef HAVE_SYS_BITYPES_H
2107# include <sys/bitypes.h>
2108#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002109 ],
2110 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002111 [ ac_cv_have_int64_t="yes" ],
2112 [ ac_cv_have_int64_t="no" ]
2113 )
2114])
2115if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002116 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002117fi
2118
Damien Miller61e50f12000-05-08 20:49:37 +10002119AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2120 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002121 [ #include <sys/types.h> ],
2122 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002123 [ ac_cv_have_u_intxx_t="yes" ],
2124 [ ac_cv_have_u_intxx_t="no" ]
2125 )
2126])
2127if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002128 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002129 have_u_intxx_t=1
2130fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002131
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002132if test -z "$have_u_intxx_t" ; then
2133 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2134 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002135 [ #include <sys/socket.h> ],
2136 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002137 [
2138 AC_DEFINE(HAVE_U_INTXX_T)
2139 AC_MSG_RESULT(yes)
2140 ],
2141 [ AC_MSG_RESULT(no) ]
2142 )
2143fi
2144
Damien Miller578783e2000-09-23 14:12:24 +11002145AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2146 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002147 [ #include <sys/types.h> ],
2148 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002149 [ ac_cv_have_u_int64_t="yes" ],
2150 [ ac_cv_have_u_int64_t="no" ]
2151 )
2152])
2153if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002154 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002155 have_u_int64_t=1
2156fi
2157
Tim Rice4cec93f2002-02-26 08:40:48 -08002158if test -z "$have_u_int64_t" ; then
2159 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2160 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002161 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002162 [ u_int64_t a; a = 1],
2163 [
2164 AC_DEFINE(HAVE_U_INT64_T)
2165 AC_MSG_RESULT(yes)
2166 ],
2167 [ AC_MSG_RESULT(no) ]
2168 )
2169fi
2170
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002171if test -z "$have_u_intxx_t" ; then
2172 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2173 AC_TRY_COMPILE(
2174 [
2175#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002176 ],
2177 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002178 [ ac_cv_have_uintxx_t="yes" ],
2179 [ ac_cv_have_uintxx_t="no" ]
2180 )
2181 ])
2182 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002183 AC_DEFINE(HAVE_UINTXX_T, 1,
2184 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002185 fi
2186fi
2187
2188if test -z "$have_uintxx_t" ; then
2189 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2190 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002191 [ #include <stdint.h> ],
2192 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002193 [
2194 AC_DEFINE(HAVE_UINTXX_T)
2195 AC_MSG_RESULT(yes)
2196 ],
2197 [ AC_MSG_RESULT(no) ]
2198 )
2199fi
2200
Damien Milleredb82922000-06-20 13:25:52 +10002201if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002202 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002203then
2204 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2205 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002206 [
2207#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002208 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002209 [
Damien Miller70494d12000-04-03 15:57:06 +10002210 int8_t a; int16_t b; int32_t c;
2211 u_int8_t e; u_int16_t f; u_int32_t g;
2212 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002213 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002214 [
2215 AC_DEFINE(HAVE_U_INTXX_T)
2216 AC_DEFINE(HAVE_INTXX_T)
2217 AC_MSG_RESULT(yes)
2218 ],
2219 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002220 )
Damien Millerb29ea912000-01-15 14:12:03 +11002221fi
2222
Damien Miller58be7382001-09-15 21:31:54 +10002223
2224AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2225 AC_TRY_COMPILE(
2226 [
2227#include <sys/types.h>
2228 ],
2229 [ u_char foo; foo = 125; ],
2230 [ ac_cv_have_u_char="yes" ],
2231 [ ac_cv_have_u_char="no" ]
2232 )
2233])
2234if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002235 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002236fi
2237
Tim Rice13aae5e2001-10-21 17:53:58 -07002238TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002239
Tim Rice200a5c02002-02-26 22:12:34 -08002240AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002241
Damien Miller848b9932005-02-24 12:12:34 +11002242AC_CHECK_TYPES(in_addr_t,,,
2243[#include <sys/types.h>
2244#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002245
Damien Miller61e50f12000-05-08 20:49:37 +10002246AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2247 AC_TRY_COMPILE(
2248 [
2249#include <sys/types.h>
2250 ],
2251 [ size_t foo; foo = 1235; ],
2252 [ ac_cv_have_size_t="yes" ],
2253 [ ac_cv_have_size_t="no" ]
2254 )
2255])
2256if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002257 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002258fi
Damien Miller95058511999-12-29 10:36:45 +11002259
Damien Miller615f9392000-05-17 22:53:33 +10002260AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2261 AC_TRY_COMPILE(
2262 [
2263#include <sys/types.h>
2264 ],
2265 [ ssize_t foo; foo = 1235; ],
2266 [ ac_cv_have_ssize_t="yes" ],
2267 [ ac_cv_have_ssize_t="no" ]
2268 )
2269])
2270if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002271 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002272fi
2273
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002274AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2275 AC_TRY_COMPILE(
2276 [
2277#include <time.h>
2278 ],
2279 [ clock_t foo; foo = 1235; ],
2280 [ ac_cv_have_clock_t="yes" ],
2281 [ ac_cv_have_clock_t="no" ]
2282 )
2283])
2284if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002285 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002286fi
2287
Damien Millerb54b40e2000-06-23 08:23:34 +10002288AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2289 AC_TRY_COMPILE(
2290 [
2291#include <sys/types.h>
2292#include <sys/socket.h>
2293 ],
2294 [ sa_family_t foo; foo = 1235; ],
2295 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002296 [ AC_TRY_COMPILE(
2297 [
2298#include <sys/types.h>
2299#include <sys/socket.h>
2300#include <netinet/in.h>
2301 ],
2302 [ sa_family_t foo; foo = 1235; ],
2303 [ ac_cv_have_sa_family_t="yes" ],
2304
Damien Millerb54b40e2000-06-23 08:23:34 +10002305 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002306 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002307 )
2308])
2309if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002310 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2311 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002312fi
2313
Damien Miller0f91b4e2000-06-18 15:43:25 +10002314AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2315 AC_TRY_COMPILE(
2316 [
2317#include <sys/types.h>
2318 ],
2319 [ pid_t foo; foo = 1235; ],
2320 [ ac_cv_have_pid_t="yes" ],
2321 [ ac_cv_have_pid_t="no" ]
2322 )
2323])
2324if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002325 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002326fi
2327
2328AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2329 AC_TRY_COMPILE(
2330 [
2331#include <sys/types.h>
2332 ],
2333 [ mode_t foo; foo = 1235; ],
2334 [ ac_cv_have_mode_t="yes" ],
2335 [ ac_cv_have_mode_t="no" ]
2336 )
2337])
2338if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002339 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002340fi
2341
Damien Miller61e50f12000-05-08 20:49:37 +10002342
2343AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2344 AC_TRY_COMPILE(
2345 [
Damien Miller81171112000-04-23 11:14:01 +10002346#include <sys/types.h>
2347#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002348 ],
2349 [ struct sockaddr_storage s; ],
2350 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2351 [ ac_cv_have_struct_sockaddr_storage="no" ]
2352 )
2353])
2354if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002355 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2356 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002357fi
Damien Miller34132e52000-01-14 15:45:46 +11002358
Damien Miller61e50f12000-05-08 20:49:37 +10002359AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2360 AC_TRY_COMPILE(
2361 [
Damien Miller7b22d652000-06-18 14:07:04 +10002362#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002363#include <netinet/in.h>
2364 ],
2365 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2366 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2367 [ ac_cv_have_struct_sockaddr_in6="no" ]
2368 )
2369])
2370if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002371 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2372 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002373fi
Damien Miller34132e52000-01-14 15:45:46 +11002374
Damien Miller61e50f12000-05-08 20:49:37 +10002375AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2376 AC_TRY_COMPILE(
2377 [
Damien Miller7b22d652000-06-18 14:07:04 +10002378#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002379#include <netinet/in.h>
2380 ],
2381 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2382 [ ac_cv_have_struct_in6_addr="yes" ],
2383 [ ac_cv_have_struct_in6_addr="no" ]
2384 )
2385])
2386if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002387 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2388 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002389fi
Damien Miller34132e52000-01-14 15:45:46 +11002390
Damien Miller61e50f12000-05-08 20:49:37 +10002391AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2392 AC_TRY_COMPILE(
2393 [
Damien Miller81171112000-04-23 11:14:01 +10002394#include <sys/types.h>
2395#include <sys/socket.h>
2396#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002397 ],
2398 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2399 [ ac_cv_have_struct_addrinfo="yes" ],
2400 [ ac_cv_have_struct_addrinfo="no" ]
2401 )
2402])
2403if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002404 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2405 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002406fi
2407
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002408AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2409 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002410 [ #include <sys/time.h> ],
2411 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002412 [ ac_cv_have_struct_timeval="yes" ],
2413 [ ac_cv_have_struct_timeval="no" ]
2414 )
2415])
2416if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002417 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002418 have_struct_timeval=1
2419fi
2420
Tim Rice4e4dc562003-03-18 10:21:40 -08002421AC_CHECK_TYPES(struct timespec)
2422
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002423# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002424if test "x$ac_cv_have_int64_t" = "xno" && \
2425 test "x$ac_cv_sizeof_long_int" != "x8" && \
2426 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002427 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2428 echo "an alternative compiler (I.E., GCC) before continuing."
2429 echo ""
2430 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002431else
2432dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002433 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002434 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002435#include <stdio.h>
2436#include <string.h>
2437#ifdef HAVE_SNPRINTF
2438main()
2439{
2440 char buf[50];
2441 char expected_out[50];
2442 int mazsize = 50 ;
2443#if (SIZEOF_LONG_INT == 8)
2444 long int num = 0x7fffffffffffffff;
2445#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002446 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002447#endif
2448 strcpy(expected_out, "9223372036854775807");
2449 snprintf(buf, mazsize, "%lld", num);
2450 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002451 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002452 exit(0);
2453}
2454#else
2455main() { exit(0); }
2456#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002457 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002458 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002459 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002460fi
2461
Damien Miller78315eb2000-09-29 23:01:36 +11002462dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002463OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2464OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2465OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2466OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2467OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002468OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002469OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2470OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002471OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002472OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2473OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2474OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2475OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002476OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2477OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2478OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2479OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002480
2481AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002482
Damien Miller61e50f12000-05-08 20:49:37 +10002483AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2484 ac_cv_have_ss_family_in_struct_ss, [
2485 AC_TRY_COMPILE(
2486 [
Damien Miller81171112000-04-23 11:14:01 +10002487#include <sys/types.h>
2488#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002489 ],
2490 [ struct sockaddr_storage s; s.ss_family = 1; ],
2491 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2492 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2493 )
2494])
2495if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002496 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002497fi
2498
Damien Miller61e50f12000-05-08 20:49:37 +10002499AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2500 ac_cv_have___ss_family_in_struct_ss, [
2501 AC_TRY_COMPILE(
2502 [
Damien Miller81171112000-04-23 11:14:01 +10002503#include <sys/types.h>
2504#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002505 ],
2506 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2507 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2508 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2509 )
2510])
2511if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002512 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2513 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002514fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002515
Damien Millerad833b32000-08-23 10:46:23 +10002516AC_CACHE_CHECK([for pw_class field in struct passwd],
2517 ac_cv_have_pw_class_in_struct_passwd, [
2518 AC_TRY_COMPILE(
2519 [
Damien Millerad833b32000-08-23 10:46:23 +10002520#include <pwd.h>
2521 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002522 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002523 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2524 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2525 )
2526])
2527if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002528 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2529 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002530fi
2531
Kevin Steves82456952001-06-22 21:14:18 +00002532AC_CACHE_CHECK([for pw_expire field in struct passwd],
2533 ac_cv_have_pw_expire_in_struct_passwd, [
2534 AC_TRY_COMPILE(
2535 [
2536#include <pwd.h>
2537 ],
2538 [ struct passwd p; p.pw_expire = 0; ],
2539 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2540 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2541 )
2542])
2543if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002544 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2545 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002546fi
2547
2548AC_CACHE_CHECK([for pw_change field in struct passwd],
2549 ac_cv_have_pw_change_in_struct_passwd, [
2550 AC_TRY_COMPILE(
2551 [
2552#include <pwd.h>
2553 ],
2554 [ struct passwd p; p.pw_change = 0; ],
2555 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2556 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2557 )
2558])
2559if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002560 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2561 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002562fi
Damien Miller61e50f12000-05-08 20:49:37 +10002563
Tim Rice28bbb0c2002-05-27 17:37:32 -07002564dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002565AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2566 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002567 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002568 [
Tim Riceae49fe62002-04-12 10:26:21 -07002569#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002570#include <sys/socket.h>
2571#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002572int main() {
2573#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002574#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002575exit(1);
2576#endif
2577struct msghdr m;
2578m.msg_accrights = 0;
2579exit(0);
2580}
Kevin Steves939c9db2002-03-22 17:23:25 +00002581 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002582 [ ac_cv_have_accrights_in_msghdr="yes" ],
2583 [ ac_cv_have_accrights_in_msghdr="no" ]
2584 )
2585])
2586if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002587 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2588 [Define if your system uses access rights style
2589 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002590fi
2591
Kevin Stevesa44e0352002-04-07 16:18:03 +00002592AC_CACHE_CHECK([for msg_control field in struct msghdr],
2593 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002594 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002595 [
Tim Riceae49fe62002-04-12 10:26:21 -07002596#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002597#include <sys/socket.h>
2598#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002599int main() {
2600#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002601#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002602exit(1);
2603#endif
2604struct msghdr m;
2605m.msg_control = 0;
2606exit(0);
2607}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002608 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002609 [ ac_cv_have_control_in_msghdr="yes" ],
2610 [ ac_cv_have_control_in_msghdr="no" ]
2611 )
2612])
2613if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002614 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2615 [Define if your system uses ancillary data style
2616 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002617fi
2618
Damien Miller61e50f12000-05-08 20:49:37 +10002619AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002620 AC_TRY_LINK([],
2621 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002622 [ ac_cv_libc_defines___progname="yes" ],
2623 [ ac_cv_libc_defines___progname="no" ]
2624 )
2625])
2626if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002627 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002628fi
2629
Kevin Steves4846f4a2002-03-22 18:19:53 +00002630AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2631 AC_TRY_LINK([
2632#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002633],
2634 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002635 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2636 [ ac_cv_cc_implements___FUNCTION__="no" ]
2637 )
2638])
2639if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002640 AC_DEFINE(HAVE___FUNCTION__, 1,
2641 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002642fi
2643
2644AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2645 AC_TRY_LINK([
2646#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002647],
2648 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002649 [ ac_cv_cc_implements___func__="yes" ],
2650 [ ac_cv_cc_implements___func__="no" ]
2651 )
2652])
2653if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002654 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002655fi
2656
Damien Miller4f8e6692001-07-14 13:22:53 +10002657AC_CACHE_CHECK([whether getopt has optreset support],
2658 ac_cv_have_getopt_optreset, [
2659 AC_TRY_LINK(
2660 [
2661#include <getopt.h>
2662 ],
2663 [ extern int optreset; optreset = 0; ],
2664 [ ac_cv_have_getopt_optreset="yes" ],
2665 [ ac_cv_have_getopt_optreset="no" ]
2666 )
2667])
2668if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002669 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2670 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002671fi
Damien Millera22ba012000-03-02 23:09:20 +11002672
Damien Millerecbb26d2000-07-15 14:59:14 +10002673AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002674 AC_TRY_LINK([],
2675 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002676 [ ac_cv_libc_defines_sys_errlist="yes" ],
2677 [ ac_cv_libc_defines_sys_errlist="no" ]
2678 )
2679])
2680if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002681 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2682 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002683fi
2684
2685
Damien Miller11fa2cc2000-08-16 10:35:58 +10002686AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002687 AC_TRY_LINK([],
2688 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002689 [ ac_cv_libc_defines_sys_nerr="yes" ],
2690 [ ac_cv_libc_defines_sys_nerr="no" ]
2691 )
2692])
2693if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002694 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002695fi
2696
Damien Millera8e06ce2003-11-21 23:48:55 +11002697SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002698# Check whether user wants sectok support
2699AC_ARG_WITH(sectok,
2700 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002701 [
2702 if test "x$withval" != "xno" ; then
2703 if test "x$withval" != "xyes" ; then
2704 CPPFLAGS="$CPPFLAGS -I${withval}"
2705 LDFLAGS="$LDFLAGS -L${withval}"
2706 if test ! -z "$need_dash_r" ; then
2707 LDFLAGS="$LDFLAGS -R${withval}"
2708 fi
2709 if test ! -z "$blibpath" ; then
2710 blibpath="$blibpath:${withval}"
2711 fi
2712 fi
2713 AC_CHECK_HEADERS(sectok.h)
2714 if test "$ac_cv_header_sectok_h" != yes; then
2715 AC_MSG_ERROR(Can't find sectok.h)
2716 fi
2717 AC_CHECK_LIB(sectok, sectok_open)
2718 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2719 AC_MSG_ERROR(Can't find libsectok)
2720 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002721 AC_DEFINE(SMARTCARD, 1,
2722 [Define if you want smartcard support])
2723 AC_DEFINE(USE_SECTOK, 1,
2724 [Define if you want smartcard support
2725 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002726 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002727 fi
2728 ]
2729)
2730
2731# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002732OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002733AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10002734 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08002735 [
2736 if test "x$withval" != "xno" ; then
2737 if test "x$withval" != "xyes" ; then
2738 OPENSC_CONFIG=$withval/bin/opensc-config
2739 else
2740 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2741 fi
2742 if test "$OPENSC_CONFIG" != "no"; then
2743 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2744 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2745 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2746 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2747 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002748 AC_DEFINE(USE_OPENSC, 1,
2749 [Define if you want smartcard support
2750 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002751 SCARD_MSG="yes, using OpenSC"
2752 fi
2753 fi
2754 ]
2755)
Damien Miller85de5802001-09-18 14:01:11 +10002756
Darren Tucker5f88d342003-10-15 16:57:57 +10002757# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002758AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002759 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2760 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002761 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002762 # Needed by our getrrsetbyname()
2763 AC_SEARCH_LIBS(res_query, resolv)
2764 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002765 AC_MSG_CHECKING(if res_query will link)
2766 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2767 [AC_MSG_RESULT(no)
2768 saved_LIBS="$LIBS"
2769 LIBS="$LIBS -lresolv"
2770 AC_MSG_CHECKING(for res_query in -lresolv)
2771 AC_LINK_IFELSE([
2772#include <resolv.h>
2773int main()
2774{
2775 res_query (0, 0, 0, 0, 0);
2776 return 0;
2777}
2778 ],
2779 [LIBS="$LIBS -lresolv"
2780 AC_MSG_RESULT(yes)],
2781 [LIBS="$saved_LIBS"
2782 AC_MSG_RESULT(no)])
2783 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002784 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002785 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002786 [#include <sys/types.h>
2787 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002788 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07002789 [AC_DEFINE(HAVE_HEADER_AD, 1,
2790 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10002791 [#include <arpa/nameser.h>])
2792 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002793
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002794# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002795KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002796AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002797 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002798 [ if test "x$withval" != "xno" ; then
2799 if test "x$withval" = "xyes" ; then
2800 KRB5ROOT="/usr/local"
2801 else
2802 KRB5ROOT=${withval}
2803 fi
2804
Tim Rice7df8d392005-09-19 09:33:39 -07002805 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11002806 KRB5_MSG="yes"
2807
2808 AC_MSG_CHECKING(for krb5-config)
2809 if test -x $KRB5ROOT/bin/krb5-config ; then
2810 KRB5CONF=$KRB5ROOT/bin/krb5-config
2811 AC_MSG_RESULT($KRB5CONF)
2812
2813 AC_MSG_CHECKING(for gssapi support)
2814 if $KRB5CONF | grep gssapi >/dev/null ; then
2815 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002816 AC_DEFINE(GSSAPI, 1,
2817 [Define this if you want GSSAPI
2818 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11002819 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002820 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002821 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002822 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002823 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002824 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2825 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002826 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002827 AC_MSG_CHECKING(whether we are using Heimdal)
2828 AC_TRY_COMPILE([ #include <krb5.h> ],
2829 [ char *tmp = heimdal_version; ],
2830 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002831 AC_DEFINE(HEIMDAL, 1,
2832 [Define this if you are using the
2833 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002834 AC_MSG_RESULT(no)
2835 )
2836 else
2837 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002838 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002839 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002840 AC_MSG_CHECKING(whether we are using Heimdal)
2841 AC_TRY_COMPILE([ #include <krb5.h> ],
2842 [ char *tmp = heimdal_version; ],
2843 [ AC_MSG_RESULT(yes)
2844 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002845 K5LIBS="-lkrb5 -ldes"
2846 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002847 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002848 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002849 ],
2850 [ AC_MSG_RESULT(no)
2851 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2852 ]
2853 )
Damien Miller200d0a72003-06-30 19:21:36 +10002854 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002855
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002856 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2857 [ AC_DEFINE(GSSAPI)
2858 K5LIBS="-lgssapi $K5LIBS" ],
2859 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2860 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002861 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002862 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2863 $K5LIBS)
2864 ],
2865 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002866
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002867 AC_CHECK_HEADER(gssapi.h, ,
2868 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002869 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002870 AC_CHECK_HEADERS(gssapi.h, ,
2871 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002872 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002873 ]
2874 )
2875
2876 oldCPP="$CPPFLAGS"
2877 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2878 AC_CHECK_HEADER(gssapi_krb5.h, ,
2879 [ CPPFLAGS="$oldCPP" ])
2880
Damien Millera8e06ce2003-11-21 23:48:55 +11002881 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002882 if test ! -z "$need_dash_r" ; then
2883 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2884 fi
2885 if test ! -z "$blibpath" ; then
2886 blibpath="$blibpath:${KRB5ROOT}/lib"
2887 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07002888
2889 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2890 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2891 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2892
2893 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07002894 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
2895 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002896 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002897 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002898)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002899
Damien Millera22ba012000-03-02 23:09:20 +11002900# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002901
Damien Millerf58c6722002-05-13 13:15:42 +10002902PRIVSEP_PATH=/var/empty
2903AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002904 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002905 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002906 if test -n "$withval" && test "x$withval" != "xno" && \
2907 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002908 PRIVSEP_PATH=$withval
2909 fi
2910 ]
2911)
2912AC_SUBST(PRIVSEP_PATH)
2913
Damien Millera22ba012000-03-02 23:09:20 +11002914AC_ARG_WITH(xauth,
2915 [ --with-xauth=PATH Specify path to xauth program ],
2916 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002917 if test -n "$withval" && test "x$withval" != "xno" && \
2918 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002919 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002920 fi
2921 ],
2922 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002923 TestPath="$PATH"
2924 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2925 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2926 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2927 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2928 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002929 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002930 xauth_path="/usr/openwin/bin/xauth"
2931 fi
2932 ]
2933)
2934
Damien Miller7d901272003-01-13 16:55:22 +11002935STRIP_OPT=-s
2936AC_ARG_ENABLE(strip,
2937 [ --disable-strip Disable calling strip(1) on install],
2938 [
2939 if test "x$enableval" = "xno" ; then
2940 STRIP_OPT=
2941 fi
2942 ]
2943)
2944AC_SUBST(STRIP_OPT)
2945
Damien Millera19cf472000-11-29 13:28:50 +11002946if test -z "$xauth_path" ; then
2947 XAUTH_PATH="undefined"
2948 AC_SUBST(XAUTH_PATH)
2949else
Tim Rice7df8d392005-09-19 09:33:39 -07002950 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
2951 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11002952 XAUTH_PATH=$xauth_path
2953 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002954fi
Damien Millera22ba012000-03-02 23:09:20 +11002955
2956# Check for mail directory (last resort if we cannot get it from headers)
2957if test ! -z "$MAIL" ; then
2958 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07002959 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
2960 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11002961fi
2962
Darren Tucker623d92f2004-09-12 22:36:15 +10002963if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002964 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2965 disable_ptmx_check=yes
2966fi
Damien Millera22ba012000-03-02 23:09:20 +11002967if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002968 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002969 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002970 [
Tim Rice7df8d392005-09-19 09:33:39 -07002971 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
2972 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002973 have_dev_ptmx=1
2974 ]
2975 )
2976 fi
Damien Millera22ba012000-03-02 23:09:20 +11002977fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002978
Darren Tucker623d92f2004-09-12 22:36:15 +10002979if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002980 AC_CHECK_FILE("/dev/ptc",
2981 [
Tim Rice7df8d392005-09-19 09:33:39 -07002982 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
2983 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002984 have_dev_ptc=1
2985 ]
2986 )
2987else
2988 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2989fi
Damien Miller204ad072000-03-02 23:56:12 +11002990
Damien Millera22ba012000-03-02 23:09:20 +11002991# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002992AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002993 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002994 [
Damien Miller897741e2001-04-16 10:41:46 +10002995 case "$withval" in
2996 man|cat|doc)
2997 MANTYPE=$withval
2998 ;;
2999 *)
3000 AC_MSG_ERROR(invalid man type: $withval)
3001 ;;
3002 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003003 ]
3004)
Ben Lindstrombc709922001-04-18 18:04:21 +00003005if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003006 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3007 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003008 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3009 MANTYPE=doc
3010 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3011 MANTYPE=man
3012 else
3013 MANTYPE=cat
3014 fi
3015fi
Damien Miller670a4b82000-01-22 13:53:11 +11003016AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003017if test "$MANTYPE" = "doc"; then
3018 mansubdir=man;
3019else
3020 mansubdir=$MANTYPE;
3021fi
3022AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003023
Damien Millera22ba012000-03-02 23:09:20 +11003024# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003025MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003026AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003027 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003028 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003029 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003030 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3031 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003032 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003033 fi
3034 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003035)
3036
Damien Millera22ba012000-03-02 23:09:20 +11003037# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003038AC_ARG_WITH(shadow,
3039 [ --without-shadow Disable shadow password support],
3040 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003041 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003042 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003043 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003044 fi
3045 ]
3046)
3047
Damien Miller1f335fb2000-06-26 11:31:33 +10003048if test -z "$disable_shadow" ; then
3049 AC_MSG_CHECKING([if the systems has expire shadow information])
3050 AC_TRY_COMPILE(
3051 [
3052#include <sys/types.h>
3053#include <shadow.h>
3054 struct spwd sp;
3055 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3056 [ sp_expire_available=yes ], []
3057 )
3058
3059 if test "x$sp_expire_available" = "xyes" ; then
3060 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003061 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3062 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003063 else
3064 AC_MSG_RESULT(no)
3065 fi
3066fi
3067
Damien Millera22ba012000-03-02 23:09:20 +11003068# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003069if test ! -z "$IPADDR_IN_DISPLAY" ; then
3070 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003071 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3072 [Define if you need to use IP address
3073 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003074else
Damien Millera8e06ce2003-11-21 23:48:55 +11003075 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003076 AC_ARG_WITH(ipaddr-display,
3077 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3078 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003079 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003080 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003081 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003082 fi
3083 ]
3084 )
3085fi
Damien Miller76112de1999-12-21 11:18:08 +11003086
Darren Tuckere1a790d2003-09-16 11:52:19 +10003087# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003088AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003089 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003090 [ if test "x$enableval" = "xno"; then
3091 AC_MSG_NOTICE([/etc/default/login handling disabled])
3092 etc_default_login=no
3093 else
3094 etc_default_login=yes
3095 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003096 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3097 then
3098 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3099 etc_default_login=no
3100 else
3101 etc_default_login=yes
3102 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003103)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003104
Darren Tucker2f9573d2005-02-10 22:28:54 +11003105if test "x$etc_default_login" != "xno"; then
3106 AC_CHECK_FILE("/etc/default/login",
3107 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003108 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003109 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3110 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003111 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003112fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003113
Tim Rice43a1c132002-04-17 21:19:14 -07003114dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003115if test $ac_cv_func_login_getcapbool = "yes" && \
3116 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003117 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003118fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003119
Damien Millera22ba012000-03-02 23:09:20 +11003120# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003121SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003122AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003123 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003124 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003125 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003126 AC_MSG_WARN([
3127--with-default-path=PATH has no effect on this system.
3128Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003129 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003130 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003131 AC_MSG_WARN([
3132--with-default-path=PATH will only be used if PATH is not defined in
3133$external_path_file .])
3134 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003135 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003136 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003137 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003138 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003139 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3140 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003141 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003142 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003143 AC_MSG_WARN([
3144If PATH is defined in $external_path_file, ensure the path to scp is included,
3145otherwise scp will not work.])
3146 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003147 AC_RUN_IFELSE(
3148 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003149/* find out what STDPATH is */
3150#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003151#ifdef HAVE_PATHS_H
3152# include <paths.h>
3153#endif
3154#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003155# ifdef _PATH_USERPATH /* Irix */
3156# define _PATH_STDPATH _PATH_USERPATH
3157# else
3158# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3159# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003160#endif
3161#include <sys/types.h>
3162#include <sys/stat.h>
3163#include <fcntl.h>
3164#define DATA "conftest.stdpath"
3165
3166main()
3167{
3168 FILE *fd;
3169 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003170
Tim Rice59ea0a02001-03-10 13:50:45 -08003171 fd = fopen(DATA,"w");
3172 if(fd == NULL)
3173 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003174
Tim Rice59ea0a02001-03-10 13:50:45 -08003175 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3176 exit(1);
3177
3178 exit(0);
3179}
Darren Tucker314d89e2005-10-17 23:29:23 +10003180 ]])],
3181 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003182 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3183 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3184 )
3185# make sure $bindir is in USER_PATH so scp will work
3186 t_bindir=`eval echo ${bindir}`
3187 case $t_bindir in
3188 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3189 esac
3190 case $t_bindir in
3191 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3192 esac
3193 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3194 if test $? -ne 0 ; then
3195 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3196 if test $? -ne 0 ; then
3197 user_path=$user_path:$t_bindir
3198 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3199 fi
3200 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003201 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003202)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003203if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003204 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003205 AC_SUBST(user_path)
3206fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003207
Damien Millera18bbd32002-05-13 10:48:57 +10003208# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003209AC_ARG_WITH(superuser-path,
3210 [ --with-superuser-path= Specify different path for super-user],
3211 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003212 if test -n "$withval" && test "x$withval" != "xno" && \
3213 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003214 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3215 [Define if you want a different $PATH
3216 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003217 superuser_path=$withval
3218 fi
3219 ]
3220)
3221
3222
Damien Miller61e50f12000-05-08 20:49:37 +10003223AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003224IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003225AC_ARG_WITH(4in6,
3226 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3227 [
3228 if test "x$withval" != "xno" ; then
3229 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003230 AC_DEFINE(IPV4_IN_IPV6, 1,
3231 [Detect IPv4 in IPv6 mapped addresses
3232 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003233 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003234 else
3235 AC_MSG_RESULT(no)
3236 fi
3237 ],[
3238 if test "x$inet6_default_4in6" = "xyes"; then
3239 AC_MSG_RESULT([yes (default)])
3240 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003241 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003242 else
3243 AC_MSG_RESULT([no (default)])
3244 fi
3245 ]
3246)
3247
Damien Miller60396b02001-02-18 17:01:00 +11003248# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003249BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003250AC_ARG_WITH(bsd-auth,
3251 [ --with-bsd-auth Enable BSD auth support],
3252 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003253 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003254 AC_DEFINE(BSD_AUTH, 1,
3255 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003256 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003257 fi
3258 ]
3259)
3260
Damien Millera22ba012000-03-02 23:09:20 +11003261# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003262piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003263# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003264if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003265 piddir=`eval echo ${sysconfdir}`
3266 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003267 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003268 esac
3269fi
3270
Tim Rice88f2ab52002-03-17 12:17:34 -08003271AC_ARG_WITH(pid-dir,
3272 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3273 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003274 if test -n "$withval" && test "x$withval" != "xno" && \
3275 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003276 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003277 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003278 AC_MSG_WARN([** no $piddir directory on this system **])
3279 fi
3280 fi
3281 ]
3282)
3283
Tim Rice7df8d392005-09-19 09:33:39 -07003284AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003285AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003286
andre2ff7b5d2000-06-03 14:57:40 +00003287dnl allow user to disable some login recording features
3288AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003289 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003290 [
3291 if test "x$enableval" = "xno" ; then
3292 AC_DEFINE(DISABLE_LASTLOG)
3293 fi
3294 ]
andre2ff7b5d2000-06-03 14:57:40 +00003295)
3296AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003297 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003298 [
3299 if test "x$enableval" = "xno" ; then
3300 AC_DEFINE(DISABLE_UTMP)
3301 fi
3302 ]
andre2ff7b5d2000-06-03 14:57:40 +00003303)
3304AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003305 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003306 [
3307 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003308 AC_DEFINE(DISABLE_UTMPX, 1,
3309 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003310 fi
3311 ]
andre2ff7b5d2000-06-03 14:57:40 +00003312)
3313AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003314 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003315 [
3316 if test "x$enableval" = "xno" ; then
3317 AC_DEFINE(DISABLE_WTMP)
3318 fi
3319 ]
andre2ff7b5d2000-06-03 14:57:40 +00003320)
3321AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003322 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003323 [
3324 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003325 AC_DEFINE(DISABLE_WTMPX, 1,
3326 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003327 fi
3328 ]
andre2ff7b5d2000-06-03 14:57:40 +00003329)
3330AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003331 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003332 [
3333 if test "x$enableval" = "xno" ; then
3334 AC_DEFINE(DISABLE_LOGIN)
3335 fi
3336 ]
andre2ff7b5d2000-06-03 14:57:40 +00003337)
3338AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003339 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003340 [
3341 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003342 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3343 [Define if you don't want to use pututline()
3344 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003345 fi
3346 ]
andre2ff7b5d2000-06-03 14:57:40 +00003347)
3348AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003349 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003350 [
3351 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003352 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3353 [Define if you don't want to use pututxline()
3354 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003355 fi
3356 ]
andre2ff7b5d2000-06-03 14:57:40 +00003357)
3358AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003359 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003360 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003361 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003362 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003363 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003364 conf_lastlog_location=$withval
3365 fi
3366 ]
3367)
andre2ff7b5d2000-06-03 14:57:40 +00003368
3369dnl lastlog, [uw]tmpx? detection
3370dnl NOTE: set the paths in the platform section to avoid the
3371dnl need for command-line parameters
3372dnl lastlog and [uw]tmp are subject to a file search if all else fails
3373
3374dnl lastlog detection
3375dnl NOTE: the code itself will detect if lastlog is a directory
3376AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3377AC_TRY_COMPILE([
3378#include <sys/types.h>
3379#include <utmp.h>
3380#ifdef HAVE_LASTLOG_H
3381# include <lastlog.h>
3382#endif
Damien Miller2994e082000-06-04 15:51:47 +10003383#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003384# include <paths.h>
3385#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003386#ifdef HAVE_LOGIN_H
3387# include <login.h>
3388#endif
andre2ff7b5d2000-06-03 14:57:40 +00003389 ],
3390 [ char *lastlog = LASTLOG_FILE; ],
3391 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003392 [
3393 AC_MSG_RESULT(no)
3394 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3395 AC_TRY_COMPILE([
3396#include <sys/types.h>
3397#include <utmp.h>
3398#ifdef HAVE_LASTLOG_H
3399# include <lastlog.h>
3400#endif
3401#ifdef HAVE_PATHS_H
3402# include <paths.h>
3403#endif
3404 ],
3405 [ char *lastlog = _PATH_LASTLOG; ],
3406 [ AC_MSG_RESULT(yes) ],
3407 [
andree441aa32000-06-12 22:34:38 +00003408 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003409 system_lastlog_path=no
3410 ])
3411 ]
andre2ff7b5d2000-06-03 14:57:40 +00003412)
Damien Miller2994e082000-06-04 15:51:47 +10003413
andre2ff7b5d2000-06-03 14:57:40 +00003414if test -z "$conf_lastlog_location"; then
3415 if test x"$system_lastlog_path" = x"no" ; then
3416 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003417 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003418 conf_lastlog_location=$f
3419 fi
3420 done
3421 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003422 AC_MSG_WARN([** Cannot find lastlog **])
3423 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003424 fi
3425 fi
3426fi
3427
3428if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003429 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3430 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003431fi
andre2ff7b5d2000-06-03 14:57:40 +00003432
3433dnl utmp detection
3434AC_MSG_CHECKING([if your system defines UTMP_FILE])
3435AC_TRY_COMPILE([
3436#include <sys/types.h>
3437#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003438#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003439# include <paths.h>
3440#endif
3441 ],
3442 [ char *utmp = UTMP_FILE; ],
3443 [ AC_MSG_RESULT(yes) ],
3444 [ AC_MSG_RESULT(no)
3445 system_utmp_path=no ]
3446)
3447if test -z "$conf_utmp_location"; then
3448 if test x"$system_utmp_path" = x"no" ; then
3449 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3450 if test -f $f ; then
3451 conf_utmp_location=$f
3452 fi
3453 done
3454 if test -z "$conf_utmp_location"; then
3455 AC_DEFINE(DISABLE_UTMP)
3456 fi
3457 fi
3458fi
3459if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003460 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3461 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003462fi
andre2ff7b5d2000-06-03 14:57:40 +00003463
3464dnl wtmp detection
3465AC_MSG_CHECKING([if your system defines WTMP_FILE])
3466AC_TRY_COMPILE([
3467#include <sys/types.h>
3468#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003469#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003470# include <paths.h>
3471#endif
3472 ],
3473 [ char *wtmp = WTMP_FILE; ],
3474 [ AC_MSG_RESULT(yes) ],
3475 [ AC_MSG_RESULT(no)
3476 system_wtmp_path=no ]
3477)
3478if test -z "$conf_wtmp_location"; then
3479 if test x"$system_wtmp_path" = x"no" ; then
3480 for f in /usr/adm/wtmp /var/log/wtmp; do
3481 if test -f $f ; then
3482 conf_wtmp_location=$f
3483 fi
3484 done
3485 if test -z "$conf_wtmp_location"; then
3486 AC_DEFINE(DISABLE_WTMP)
3487 fi
3488 fi
3489fi
3490if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003491 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3492 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003493fi
andre2ff7b5d2000-06-03 14:57:40 +00003494
3495
3496dnl utmpx detection - I don't know any system so perverse as to require
3497dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3498dnl there, though.
3499AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3500AC_TRY_COMPILE([
3501#include <sys/types.h>
3502#include <utmp.h>
3503#ifdef HAVE_UTMPX_H
3504#include <utmpx.h>
3505#endif
Damien Miller2994e082000-06-04 15:51:47 +10003506#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003507# include <paths.h>
3508#endif
3509 ],
3510 [ char *utmpx = UTMPX_FILE; ],
3511 [ AC_MSG_RESULT(yes) ],
3512 [ AC_MSG_RESULT(no)
3513 system_utmpx_path=no ]
3514)
3515if test -z "$conf_utmpx_location"; then
3516 if test x"$system_utmpx_path" = x"no" ; then
3517 AC_DEFINE(DISABLE_UTMPX)
3518 fi
3519else
Tim Rice7df8d392005-09-19 09:33:39 -07003520 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3521 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003522fi
andre2ff7b5d2000-06-03 14:57:40 +00003523
3524dnl wtmpx detection
3525AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3526AC_TRY_COMPILE([
3527#include <sys/types.h>
3528#include <utmp.h>
3529#ifdef HAVE_UTMPX_H
3530#include <utmpx.h>
3531#endif
Damien Miller2994e082000-06-04 15:51:47 +10003532#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003533# include <paths.h>
3534#endif
3535 ],
3536 [ char *wtmpx = WTMPX_FILE; ],
3537 [ AC_MSG_RESULT(yes) ],
3538 [ AC_MSG_RESULT(no)
3539 system_wtmpx_path=no ]
3540)
3541if test -z "$conf_wtmpx_location"; then
3542 if test x"$system_wtmpx_path" = x"no" ; then
3543 AC_DEFINE(DISABLE_WTMPX)
3544 fi
3545else
Tim Rice7df8d392005-09-19 09:33:39 -07003546 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3547 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003548fi
andre2ff7b5d2000-06-03 14:57:40 +00003549
Damien Miller4018c192000-04-30 09:30:44 +10003550
Damien Miller29ea30d2000-03-17 10:54:15 +11003551if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003552 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3553 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003554fi
3555
Tim Rice4cec93f2002-02-26 08:40:48 -08003556dnl remove pam and dl because they are in $LIBPAM
3557if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003558 LIBS=`echo $LIBS | sed 's/-lpam //'`
3559fi
3560if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3561 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003562fi
3563
Darren Tucker7da23cb2005-08-03 00:20:15 +10003564dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3565dnl Add now.
3566CFLAGS="$CFLAGS $werror_flags"
3567
Damien Millerbac2d8a2000-09-05 16:13:06 +11003568AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003569AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3570 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003571AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003572
Damien Miller7b22d652000-06-18 14:07:04 +10003573# Print summary of options
3574
Damien Miller7b22d652000-06-18 14:07:04 +10003575# Someone please show me a better way :)
3576A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3577B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3578C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3579D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003580E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003581F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003582G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003583H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3584I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3585J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003586
3587echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003588echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003589echo " User binaries: $B"
3590echo " System binaries: $C"
3591echo " Configuration files: $D"
3592echo " Askpass program: $E"
3593echo " Manual pages: $F"
3594echo " PID file: $G"
3595echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003596if test "x$external_path_file" = "x/etc/login.conf" ; then
3597echo " At runtime, sshd will use the path defined in $external_path_file"
3598echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003599else
Damien Millerf58c6722002-05-13 13:15:42 +10003600echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003601 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003602echo " (If PATH is set in $external_path_file it will be used instead. If"
3603echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3604 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003605fi
Damien Millera18bbd32002-05-13 10:48:57 +10003606if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003607echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003608fi
Damien Millerf58c6722002-05-13 13:15:42 +10003609echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003610echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003611echo " KerberosV support: $KRB5_MSG"
3612echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003613echo " S/KEY support: $SKEY_MSG"
3614echo " TCP Wrappers support: $TCPW_MSG"
3615echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003616echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003617echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003618echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3619echo " BSD Auth support: $BSD_AUTH_MSG"
3620echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003621if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003622echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003623fi
3624
Damien Miller7b22d652000-06-18 14:07:04 +10003625echo ""
3626
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003627echo " Host: ${host}"
3628echo " Compiler: ${CC}"
3629echo " Compiler flags: ${CFLAGS}"
3630echo "Preprocessor flags: ${CPPFLAGS}"
3631echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003632echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003633
3634echo ""
3635
Tim Rice6f1f7582004-05-30 21:38:51 -07003636if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003637 echo "SVR4 style packages are supported with \"make package\""
3638 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003639fi
3640
Damien Miller82cf0ce2000-12-20 13:34:48 +11003641if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003642 echo "PAM is enabled. You may need to install a PAM control file "
3643 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003644 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003645 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003646 echo ""
3647fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003648
Damien Miller6c21c512002-01-22 21:57:53 +11003649if test ! -z "$RAND_HELPER_CMDHASH" ; then
3650 echo "WARNING: you are using the builtin random number collection "
3651 echo "service. Please read WARNING.RNG and request that your OS "
3652 echo "vendor includes kernel-based random number collection in "
3653 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003654 echo ""
3655fi
Damien Miller60396b02001-02-18 17:01:00 +11003656
Damien Millerb4097182004-05-23 14:09:40 +10003657if test ! -z "$NO_PEERCHECK" ; then
3658 echo "WARNING: the operating system that you are using does not "
3659 echo "appear to support either the getpeereid() API nor the "
3660 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3661 echo "enforce security checks to prevent unauthorised connections to "
3662 echo "ssh-agent. Their absence increases the risk that a malicious "
3663 echo "user can connect to your agent. "
3664 echo ""
3665fi
3666
Darren Tuckerd9f88912005-02-20 21:01:48 +11003667if test "$AUDIT_MODULE" = "bsm" ; then
3668 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3669 echo "See the Solaris section in README.platform for details."
3670fi