blob: 12bf6587bb80347a7d331419b5e07ce2905a0e89 [file] [log] [blame]
Darren Tucker1e6616b2005-10-08 12:07:01 +10001# $Id: configure.ac,v 1.299 2005/10/08 02:07:02 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])
421 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100422*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800423 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800424 need_dash_r=1
425 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100426 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000427 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700428 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
429 [Some versions of /bin/login need the TERM supplied
430 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000431 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700432 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
433 [Define if pam_chauthtok wants real uid set
434 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000435 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000436 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700437 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
438 [Define if sshd somehow reacquires a controlling TTY
439 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000440 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000441 # hardwire lastlog location (can't detect it on some versions)
442 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000443 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
444 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
445 if test "$sol2ver" -ge 8; then
446 AC_MSG_RESULT(yes)
447 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700448 AC_DEFINE(DISABLE_WTMP, 1,
449 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000450 else
451 AC_MSG_RESULT(no)
452 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100453 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000454*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000455 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000456 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100457 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000458 conf_utmp_location=/etc/utmp
459 conf_wtmp_location=/var/adm/wtmp
460 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000461 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000462 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000463*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700464 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000465 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000466 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000467 AC_DEFINE(SETEUID_BREAKS_SETUID)
468 AC_DEFINE(BROKEN_SETREUID)
469 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000470 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000471*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700472 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000473 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100474 # -lresolv needs to be at then end of LIBS or DNS lookups break
475 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100476 IPADDR_IN_DISPLAY=yes
477 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000478 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000479 AC_DEFINE(SETEUID_BREAKS_SETUID)
480 AC_DEFINE(BROKEN_SETREUID)
481 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000482 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000483 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700484 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
485 # Attention: always take care to bind libsocket and libnsl before libc,
486 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000487 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800488# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100489*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100490 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700491 AC_DEFINE(SETEUID_BREAKS_SETUID)
492 AC_DEFINE(BROKEN_SETREUID)
493 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700494 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100495 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800496# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100497*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700498 check_for_libcrypt_later=1
499 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100500 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700501 AC_DEFINE(SETEUID_BREAKS_SETUID)
502 AC_DEFINE(BROKEN_SETREUID)
503 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700504 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700505 case "$host" in
506 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
507 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700508 AC_DEFINE(BROKEN_LIBIAF, 1,
509 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700510 ;;
511 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100512 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100513*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100514 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800515# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100516*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800517 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100518 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800519# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100520*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800521 if test -z "$GCC"; then
522 CFLAGS="$CFLAGS -belf"
523 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100524 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000525 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100526 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000527 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000528 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700529 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700530 AC_DEFINE(SETEUID_BREAKS_SETUID)
531 AC_DEFINE(BROKEN_SETREUID)
532 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700533 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700534 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700535 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100536 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700537 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700538 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000539 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000540*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700541 AC_DEFINE(NO_SSH_LASTLOG, 1,
542 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100543 AC_DEFINE(SETEUID_BREAKS_SETUID)
544 AC_DEFINE(BROKEN_SETREUID)
545 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000546 AC_DEFINE(USE_PIPES)
547 AC_DEFINE(DISABLE_FD_PASSING)
548 LDFLAGS="$LDFLAGS"
549 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
550 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000551 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000552*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100553 AC_DEFINE(SETEUID_BREAKS_SETUID)
554 AC_DEFINE(BROKEN_SETREUID)
555 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000556 AC_DEFINE(WITH_ABBREV_NO_TTY)
557 AC_DEFINE(USE_PIPES)
558 AC_DEFINE(DISABLE_FD_PASSING)
559 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100560 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000561 MANTYPE=cat
562 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000563*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100564 AC_DEFINE(SETEUID_BREAKS_SETUID)
565 AC_DEFINE(BROKEN_SETREUID)
566 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000567 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700568 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700569 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000570 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
571 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
572 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700573 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000574*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000575 AC_MSG_CHECKING(for Digital Unix SIA)
576 no_osfsia=""
577 AC_ARG_WITH(osfsia,
578 [ --with-osfsia Enable Digital Unix SIA],
579 [
580 if test "x$withval" = "xno" ; then
581 AC_MSG_RESULT(disabled)
582 no_osfsia=1
583 fi
584 ],
585 )
586 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000587 if test -f /etc/sia/matrix.conf; then
588 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700589 AC_DEFINE(HAVE_OSF_SIA, 1,
590 [Define if you have Digital Unix Security
591 Integration Architecture])
592 AC_DEFINE(DISABLE_LOGIN, 1,
593 [Define if you don't want to use your
594 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000595 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000596 LIBS="$LIBS -lsecurity -ldb -lm -laud"
597 else
598 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700599 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
600 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000601 fi
602 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000603 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700604 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000605 AC_DEFINE(BROKEN_SETREUID)
606 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000607 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000608
609*-*-nto-qnx)
610 AC_DEFINE(USE_PIPES)
611 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700612 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
613 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
614 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000615 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000616
617*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700618 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
619 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
620 AC_DEFINE(NEED_SETPRGP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700621 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
622 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000623
624*-*-lynxos)
625 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700626 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000627 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
628 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100629esac
630
Damien Millere37bfc12000-06-05 09:37:43 +1000631# Allow user to specify flags
632AC_ARG_WITH(cflags,
633 [ --with-cflags Specify additional flags to pass to compiler],
634 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800635 if test -n "$withval" && test "x$withval" != "xno" && \
636 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000637 CFLAGS="$CFLAGS $withval"
638 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800639 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000640)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000641AC_ARG_WITH(cppflags,
642 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
643 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800644 if test -n "$withval" && test "x$withval" != "xno" && \
645 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000646 CPPFLAGS="$CPPFLAGS $withval"
647 fi
648 ]
649)
Damien Millere37bfc12000-06-05 09:37:43 +1000650AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000651 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000652 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800653 if test -n "$withval" && test "x$withval" != "xno" && \
654 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000655 LDFLAGS="$LDFLAGS $withval"
656 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800657 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000658)
659AC_ARG_WITH(libs,
660 [ --with-libs Specify additional libraries to link with],
661 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800662 if test -n "$withval" && test "x$withval" != "xno" && \
663 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000664 LIBS="$LIBS $withval"
665 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800666 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000667)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000668AC_ARG_WITH(Werror,
669 [ --with-Werror Build main code with -Werror],
670 [
671 if test -n "$withval" && test "x$withval" != "xno"; then
672 werror_flags="-Werror"
673 if "x${withval}" != "xyes"; then
674 werror_flags="$withval"
675 fi
676 fi
677 ]
678)
Damien Millere37bfc12000-06-05 09:37:43 +1000679
Darren Tucker6eb93042003-06-29 21:30:41 +1000680AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000681AC_RUN_IFELSE(
682 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000683#include <stdio.h>
684int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000685 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000686 [ AC_MSG_RESULT(yes) ],
687 [
688 AC_MSG_RESULT(no)
689 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000690 ],
691 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000692)
693
Darren Tucker0c9653f2005-05-28 15:58:14 +1000694dnl Checks for header files.
695AC_CHECK_HEADERS( \
696 bstring.h \
697 crypt.h \
698 dirent.h \
699 endian.h \
700 features.h \
701 floatingpoint.h \
702 getopt.h \
703 glob.h \
704 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700705 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000706 lastlog.h \
707 limits.h \
708 login.h \
709 login_cap.h \
710 maillock.h \
711 ndir.h \
712 netdb.h \
713 netgroup.h \
714 netinet/in_systm.h \
715 pam/pam_appl.h \
716 paths.h \
717 pty.h \
718 readpassphrase.h \
719 rpc/types.h \
720 security/pam_appl.h \
721 shadow.h \
722 stddef.h \
723 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000724 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000725 strings.h \
726 sys/audit.h \
727 sys/bitypes.h \
728 sys/bsdtty.h \
729 sys/cdefs.h \
730 sys/dir.h \
731 sys/mman.h \
732 sys/ndir.h \
733 sys/prctl.h \
734 sys/pstat.h \
735 sys/select.h \
736 sys/stat.h \
737 sys/stream.h \
738 sys/stropts.h \
739 sys/strtio.h \
740 sys/sysmacros.h \
741 sys/time.h \
742 sys/timers.h \
743 sys/un.h \
744 time.h \
745 tmpdir.h \
746 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000747 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000748 usersec.h \
749 util.h \
750 utime.h \
751 utmp.h \
752 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000753 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000754)
Tim Rice4cec93f2002-02-26 08:40:48 -0800755
Darren Tucker48d99d32004-08-29 17:04:50 +1000756# sys/ptms.h requires sys/stream.h to be included first on Solaris
757AC_CHECK_HEADERS(sys/ptms.h, [], [], [
758#ifdef HAVE_SYS_STREAM_H
759# include <sys/stream.h>
760#endif
761])
762
Damien Millera22ba012000-03-02 23:09:20 +1100763# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700764AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
765AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000766
Tim Rice1e1ef642003-09-11 22:19:31 -0700767dnl IRIX and Solaris 2.5.1 have dirname() in libgen
768AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
769 AC_CHECK_LIB(gen, dirname,[
770 AC_CACHE_CHECK([for broken dirname],
771 ac_cv_have_broken_dirname, [
772 save_LIBS="$LIBS"
773 LIBS="$LIBS -lgen"
774 AC_TRY_RUN(
775 [
776#include <libgen.h>
777#include <string.h>
778
779int main(int argc, char **argv) {
780 char *s, buf[32];
781
782 strncpy(buf,"/etc", 32);
783 s = dirname(buf);
784 if (!s || strncmp(s, "/", 32) != 0) {
785 exit(1);
786 } else {
787 exit(0);
788 }
789}
790 ],
791 [ ac_cv_have_broken_dirname="no" ],
792 [ ac_cv_have_broken_dirname="yes" ]
793 )
794 LIBS="$save_LIBS"
795 ])
796 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
797 LIBS="$LIBS -lgen"
798 AC_DEFINE(HAVE_DIRNAME)
799 AC_CHECK_HEADERS(libgen.h)
800 fi
801 ])
802])
803
804AC_CHECK_FUNC(getspnam, ,
805 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700806AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
807 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700808
Tim Rice13aae5e2001-10-21 17:53:58 -0700809dnl zlib is required
810AC_ARG_WITH(zlib,
811 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100812 [ if test "x$withval" = "xno" ; then
813 AC_MSG_ERROR([*** zlib is required ***])
814 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700815 if test -d "$withval/lib"; then
816 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700817 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700818 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700819 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700820 fi
821 else
822 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700823 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700824 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700825 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700826 fi
827 fi
828 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700829 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700830 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700831 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700832 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100833 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700834)
835
Tim Ricefcb62202004-01-23 18:35:16 -0800836AC_CHECK_LIB(z, deflate, ,
837 [
838 saved_CPPFLAGS="$CPPFLAGS"
839 saved_LDFLAGS="$LDFLAGS"
840 save_LIBS="$LIBS"
841 dnl Check default zlib install dir
842 if test -n "${need_dash_r}"; then
843 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
844 else
845 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
846 fi
847 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
848 LIBS="$LIBS -lz"
849 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
850 [
851 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
852 ]
853 )
854 ]
855)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100856AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100857
858AC_ARG_WITH(zlib-version-check,
859 [ --without-zlib-version-check Disable zlib version check],
860 [ if test "x$withval" = "xno" ; then
861 zlib_check_nonfatal=1
862 fi
863 ]
864)
865
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000866AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000867AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000868#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100869#include <zlib.h>
870int main()
871{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000872 int a=0, b=0, c=0, d=0, n, v;
873 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
874 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100875 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000876 v = a*1000000 + b*10000 + c*100 + d;
877 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
878
879 /* 1.1.4 is OK */
880 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100881 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000882
Darren Tucker41097ed2005-07-25 15:24:21 +1000883 /* 1.2.3 and up are OK */
884 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000885 exit(0);
886
Darren Tucker2dcd2392004-01-23 17:13:33 +1100887 exit(2);
888}
Darren Tucker623d92f2004-09-12 22:36:15 +1000889 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000890 AC_MSG_RESULT(no),
891 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100892 if test -z "$zlib_check_nonfatal" ; then
893 AC_MSG_ERROR([*** zlib too old - check config.log ***
894Your reported zlib version has known security problems. It's possible your
895vendor has fixed these problems without changing the version number. If you
896are sure this is the case, you can disable the check by running
897"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000898If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000899See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100900 else
901 AC_MSG_WARN([zlib version may have security problems])
902 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000903 ],
904 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100905)
Damien Miller6f9c3372000-10-25 10:06:04 +1100906
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000907dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100908AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000909 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
910)
Damien Millera8e06ce2003-11-21 23:48:55 +1100911AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700912 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
913 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000914)
Damien Millerab18c411999-11-11 10:40:23 +1100915
Tim Ricee589a292001-11-03 11:09:32 -0800916dnl Checks for libutil functions
917AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700918AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
919 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800920AC_CHECK_FUNCS(logout updwtmp logwtmp)
921
Ben Lindstrom8697e082001-02-24 21:41:10 +0000922AC_FUNC_STRFTIME
923
Damien Miller3c027682001-03-14 11:39:45 +1100924# Check for ALTDIRFUNC glob() extension
925AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
926AC_EGREP_CPP(FOUNDIT,
927 [
928 #include <glob.h>
929 #ifdef GLOB_ALTDIRFUNC
930 FOUNDIT
931 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100932 ],
Damien Miller3c027682001-03-14 11:39:45 +1100933 [
Tim Rice7df8d392005-09-19 09:33:39 -0700934 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
935 [Define if your system glob() function has
936 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100937 AC_MSG_RESULT(yes)
938 ],
939 [
940 AC_MSG_RESULT(no)
941 ]
942)
Damien Millerab18c411999-11-11 10:40:23 +1100943
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000944# Check for g.gl_matchc glob() extension
945AC_MSG_CHECKING(for gl_matchc field in glob_t)
946AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100947 [
948 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000949 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100950 ],
951 [
Tim Rice7df8d392005-09-19 09:33:39 -0700952 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
953 [Define if your system glob() function has
954 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100955 AC_MSG_RESULT(yes)
956 ],
957 [
958 AC_MSG_RESULT(no)
959 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000960)
961
Damien Miller18bb4732001-03-28 14:35:30 +1000962AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000963AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000964 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000965#include <sys/types.h>
966#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700967int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000968 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100969 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000970 [
971 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700972 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
973 [Define in your struct dirent expects you to
974 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000975 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800976 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000977 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
978 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000979 ]
980)
981
Damien Miller36f49652004-08-15 18:40:59 +1000982AC_MSG_CHECKING([for /proc/pid/fd directory])
983if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700984 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000985 AC_MSG_RESULT(yes)
986else
987 AC_MSG_RESULT(no)
988fi
989
Damien Millerc547bf12001-02-16 10:18:12 +1100990# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100991SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100992AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100993 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100994 [
995 if test "x$withval" != "xno" ; then
996
997 if test "x$withval" != "xyes" ; then
998 CPPFLAGS="$CPPFLAGS -I${withval}/include"
999 LDFLAGS="$LDFLAGS -L${withval}/lib"
1000 fi
1001
Tim Rice7df8d392005-09-19 09:33:39 -07001002 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001003 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001004 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001005
Tim Rice4cec93f2002-02-26 08:40:48 -08001006 AC_MSG_CHECKING([for s/key support])
1007 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +11001008 [
Tim Rice4cec93f2002-02-26 08:40:48 -08001009#include <stdio.h>
1010#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001011int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -08001012 ],
1013 [AC_MSG_RESULT(yes)],
1014 [
1015 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001016 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1017 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001018 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1019 AC_TRY_COMPILE(
1020 [#include <stdio.h>
1021 #include <skey.h>],
1022 [(void)skeychallenge(NULL,"name","",0);],
1023 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001024 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1025 [Define if your skeychallenge()
1026 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001027 [AC_MSG_RESULT(no)]
1028 )
Damien Millerc547bf12001-02-16 10:18:12 +11001029 fi
1030 ]
1031)
1032
1033# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001034TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001035AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001036 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001037 [
1038 if test "x$withval" != "xno" ; then
1039 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001040 saved_LDFLAGS="$LDFLAGS"
1041 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001042 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001043 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001044 if test -d "${withval}/lib"; then
1045 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001046 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001047 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001048 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001049 fi
1050 else
1051 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001052 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001053 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001054 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001055 fi
1056 fi
1057 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001058 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001059 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001060 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001061 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001062 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001063 LIBWRAP="-lwrap"
1064 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001065 AC_MSG_CHECKING(for libwrap)
1066 AC_TRY_LINK(
1067 [
Damien Miller0ac45002004-04-14 20:14:26 +10001068#include <sys/types.h>
1069#include <sys/socket.h>
1070#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001071#include <tcpd.h>
1072 int deny_severity = 0, allow_severity = 0;
1073 ],
1074 [hosts_access(0);],
1075 [
1076 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001077 AC_DEFINE(LIBWRAP, 1,
1078 [Define if you want
1079 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001080 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001081 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001082 ],
1083 [
1084 AC_MSG_ERROR([*** libwrap missing])
1085 ]
1086 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001087 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001088 fi
1089 ]
1090)
1091
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001092# Check whether user wants libedit support
1093LIBEDIT_MSG="no"
1094AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001095 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001096 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001097 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001098 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1099 if test -n "${need_dash_r}"; then
1100 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1101 else
1102 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1103 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001104 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001105 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001106 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001107 LIBEDIT="-ledit -lcurses"
1108 LIBEDIT_MSG="yes"
1109 AC_SUBST(LIBEDIT)
1110 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001111 [ AC_MSG_ERROR(libedit not found) ],
1112 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001113 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001114 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001115 AC_COMPILE_IFELSE(
1116 [AC_LANG_SOURCE([[
1117#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001118int main(void)
1119{
1120 int i = H_SETSIZE;
1121 el_init("", NULL, NULL, NULL);
1122 exit(0);
1123}
Tim Ricec1819c82005-08-15 17:48:40 -07001124 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001125 [ AC_MSG_RESULT(yes) ],
1126 [ AC_MSG_RESULT(no)
1127 AC_MSG_ERROR(libedit version is not compatible) ]
1128 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001129 fi ]
1130)
1131
Darren Tuckerd9f88912005-02-20 21:01:48 +11001132AUDIT_MODULE=none
1133AC_ARG_WITH(audit,
1134 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1135 [
1136 AC_MSG_CHECKING(for supported audit module)
1137 case "$withval" in
1138 bsm)
1139 AC_MSG_RESULT(bsm)
1140 AUDIT_MODULE=bsm
1141 dnl Checks for headers, libs and functions
1142 AC_CHECK_HEADERS(bsm/audit.h, [],
1143 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1144 AC_CHECK_LIB(bsm, getaudit, [],
1145 [AC_MSG_ERROR(BSM enabled and required library not found)])
1146 AC_CHECK_FUNCS(getaudit, [],
1147 [AC_MSG_ERROR(BSM enabled and required function not found)])
1148 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001149 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001150 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001151 ;;
1152 debug)
1153 AUDIT_MODULE=debug
1154 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001155 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001156 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001157 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001158 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001159 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001160 *)
1161 AC_MSG_ERROR([Unknown audit module $withval])
1162 ;;
1163 esac ]
1164)
1165
Damien Millerfe1f1432003-02-24 15:45:42 +11001166dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001167AC_CHECK_FUNCS( \
1168 arc4random \
1169 b64_ntop \
1170 __b64_ntop \
1171 b64_pton \
1172 __b64_pton \
1173 bcopy \
1174 bindresvport_sa \
1175 clock \
1176 closefrom \
1177 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001178 fchmod \
1179 fchown \
1180 freeaddrinfo \
1181 futimes \
1182 getaddrinfo \
1183 getcwd \
1184 getgrouplist \
1185 getnameinfo \
1186 getopt \
1187 getpeereid \
1188 _getpty \
1189 getrlimit \
1190 getttyent \
1191 glob \
1192 inet_aton \
1193 inet_ntoa \
1194 inet_ntop \
1195 innetgr \
1196 login_getcapbool \
1197 md5_crypt \
1198 memmove \
1199 mkdtemp \
1200 mmap \
1201 ngetaddrinfo \
1202 nsleep \
1203 ogetaddrinfo \
1204 openlog_r \
1205 openpty \
1206 prctl \
1207 pstat \
1208 readpassphrase \
1209 realpath \
1210 recvmsg \
1211 rresvport_af \
1212 sendmsg \
1213 setdtablesize \
1214 setegid \
1215 setenv \
1216 seteuid \
1217 setgroups \
1218 setlogin \
1219 setpcred \
1220 setproctitle \
1221 setregid \
1222 setreuid \
1223 setrlimit \
1224 setsid \
1225 setvbuf \
1226 sigaction \
1227 sigvec \
1228 snprintf \
1229 socketpair \
1230 strdup \
1231 strerror \
1232 strlcat \
1233 strlcpy \
1234 strmode \
1235 strnvis \
1236 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001237 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001238 strtoul \
1239 sysconf \
1240 tcgetpgrp \
1241 truncate \
1242 unsetenv \
1243 updwtmpx \
1244 utimes \
1245 vhangup \
1246 vsnprintf \
1247 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001248)
Tim Rice13aae5e2001-10-21 17:53:58 -07001249
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001250# IRIX has a const char return value for gai_strerror()
1251AC_CHECK_FUNCS(gai_strerror,[
1252 AC_DEFINE(HAVE_GAI_STRERROR)
1253 AC_TRY_COMPILE([
1254#include <sys/types.h>
1255#include <sys/socket.h>
1256#include <netdb.h>
1257
1258const char *gai_strerror(int);],[
1259char *str;
1260
1261str = gai_strerror(0);],[
1262 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1263 [Define if gai_strerror() returns const char *])])])
1264
Tim Rice7df8d392005-09-19 09:33:39 -07001265AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1266 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001267
Darren Tuckerf1159b52003-07-07 19:44:01 +10001268dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001269AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001270AC_CHECK_DECL(strsep,
1271 [AC_CHECK_FUNCS(strsep)],
1272 [],
1273 [
1274#ifdef HAVE_STRING_H
1275# include <string.h>
1276#endif
1277 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001278
Darren Tuckerb2427c82003-09-10 15:22:44 +10001279dnl tcsendbreak might be a macro
1280AC_CHECK_DECL(tcsendbreak,
1281 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001282 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001283 [#include <termios.h>]
1284)
1285
Darren Tucker5bb14002004-04-23 18:53:10 +10001286AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1287
Darren Tucker2a6b0292003-12-31 14:59:17 +11001288AC_CHECK_FUNCS(setresuid, [
1289 dnl Some platorms have setresuid that isn't implemented, test for this
1290 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001291 AC_RUN_IFELSE(
1292 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001293#include <stdlib.h>
1294#include <errno.h>
1295int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001296 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001297 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001298 [AC_DEFINE(BROKEN_SETRESUID, 1,
1299 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001300 AC_MSG_RESULT(not implemented)],
1301 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001302 )
1303])
Darren Tuckere937be32003-12-17 18:53:26 +11001304
Darren Tucker2a6b0292003-12-31 14:59:17 +11001305AC_CHECK_FUNCS(setresgid, [
1306 dnl Some platorms have setresgid that isn't implemented, test for this
1307 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001308 AC_RUN_IFELSE(
1309 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001310#include <stdlib.h>
1311#include <errno.h>
1312int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001313 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001314 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001315 [AC_DEFINE(BROKEN_SETRESGID, 1,
1316 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001317 AC_MSG_RESULT(not implemented)],
1318 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001319 )
1320])
Darren Tuckere937be32003-12-17 18:53:26 +11001321
Damien Millerad833b32000-08-23 10:46:23 +10001322dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001323AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001324dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001325AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001326AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001327dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001328AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001329AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001330
Damien Millera8e06ce2003-11-21 23:48:55 +11001331AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001332 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1333 [AC_CHECK_LIB(bsd, daemon,
1334 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001335)
1336
Damien Millera8e06ce2003-11-21 23:48:55 +11001337AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001338 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1339 [Define if your libraries define getpagesize()])],
1340 [AC_CHECK_LIB(ucb, getpagesize,
1341 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001342)
1343
Damien Millercb170cb2000-07-01 16:52:55 +10001344# Check for broken snprintf
1345if test "x$ac_cv_func_snprintf" = "xyes" ; then
1346 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001347 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001348 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001349#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001350int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001351 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001352 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001353 [
1354 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001355 AC_DEFINE(BROKEN_SNPRINTF, 1,
1356 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001357 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001358 ],
1359 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001360 )
1361fi
1362
Damien Millerb4097182004-05-23 14:09:40 +10001363# Check for missing getpeereid (or equiv) support
1364NO_PEERCHECK=""
1365if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1366 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1367 AC_TRY_COMPILE(
1368 [#include <sys/types.h>
1369 #include <sys/socket.h>],
1370 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001371 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001372 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001373 ],
Damien Millerb4097182004-05-23 14:09:40 +10001374 [AC_MSG_RESULT(no)
1375 NO_PEERCHECK=1]
1376 )
1377fi
1378
Damien Millere8328192003-01-07 15:18:32 +11001379dnl see whether mkstemp() requires XXXXXX
1380if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1381AC_MSG_CHECKING([for (overly) strict mkstemp])
1382AC_TRY_RUN(
1383 [
1384#include <stdlib.h>
1385main() { char template[]="conftest.mkstemp-test";
1386if (mkstemp(template) == -1)
1387 exit(1);
1388unlink(template); exit(0);
1389}
1390 ],
1391 [
1392 AC_MSG_RESULT(no)
1393 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001394 [
Damien Millere8328192003-01-07 15:18:32 +11001395 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001396 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001397 ],
1398 [
1399 AC_MSG_RESULT(yes)
1400 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001401 ]
Damien Millere8328192003-01-07 15:18:32 +11001402)
1403fi
1404
Darren Tucker70a3d552003-08-21 17:58:29 +10001405dnl make sure that openpty does not reacquire controlling terminal
1406if test ! -z "$check_for_openpty_ctty_bug"; then
1407 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1408 AC_TRY_RUN(
1409 [
1410#include <stdio.h>
1411#include <sys/fcntl.h>
1412#include <sys/types.h>
1413#include <sys/wait.h>
1414
1415int
1416main()
1417{
1418 pid_t pid;
1419 int fd, ptyfd, ttyfd, status;
1420
1421 pid = fork();
1422 if (pid < 0) { /* failed */
1423 exit(1);
1424 } else if (pid > 0) { /* parent */
1425 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001426 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001427 exit(WEXITSTATUS(status));
1428 else
1429 exit(2);
1430 } else { /* child */
1431 close(0); close(1); close(2);
1432 setsid();
1433 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1434 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1435 if (fd >= 0)
1436 exit(3); /* Acquired ctty: broken */
1437 else
1438 exit(0); /* Did not acquire ctty: OK */
1439 }
1440}
1441 ],
1442 [
1443 AC_MSG_RESULT(yes)
1444 ],
1445 [
1446 AC_MSG_RESULT(no)
1447 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1448 ]
1449 )
1450fi
1451
Tim Rice8bb561b2005-03-17 16:23:19 -08001452if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1453 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001454 AC_MSG_CHECKING(if getaddrinfo seems to work)
1455 AC_TRY_RUN(
1456 [
1457#include <stdio.h>
1458#include <sys/socket.h>
1459#include <netdb.h>
1460#include <errno.h>
1461#include <netinet/in.h>
1462
1463#define TEST_PORT "2222"
1464
1465int
1466main(void)
1467{
1468 int err, sock;
1469 struct addrinfo *gai_ai, *ai, hints;
1470 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1471
1472 memset(&hints, 0, sizeof(hints));
1473 hints.ai_family = PF_UNSPEC;
1474 hints.ai_socktype = SOCK_STREAM;
1475 hints.ai_flags = AI_PASSIVE;
1476
1477 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1478 if (err != 0) {
1479 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1480 exit(1);
1481 }
1482
1483 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1484 if (ai->ai_family != AF_INET6)
1485 continue;
1486
1487 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1488 sizeof(ntop), strport, sizeof(strport),
1489 NI_NUMERICHOST|NI_NUMERICSERV);
1490
1491 if (err != 0) {
1492 if (err == EAI_SYSTEM)
1493 perror("getnameinfo EAI_SYSTEM");
1494 else
1495 fprintf(stderr, "getnameinfo failed: %s\n",
1496 gai_strerror(err));
1497 exit(2);
1498 }
1499
1500 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1501 if (sock < 0)
1502 perror("socket");
1503 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1504 if (errno == EBADF)
1505 exit(3);
1506 }
1507 }
1508 exit(0);
1509}
1510 ],
1511 [
1512 AC_MSG_RESULT(yes)
1513 ],
1514 [
1515 AC_MSG_RESULT(no)
1516 AC_DEFINE(BROKEN_GETADDRINFO)
1517 ]
1518 )
1519fi
1520
Tim Rice8bb561b2005-03-17 16:23:19 -08001521if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1522 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001523 AC_MSG_CHECKING(if getaddrinfo seems to work)
1524 AC_TRY_RUN(
1525 [
1526#include <stdio.h>
1527#include <sys/socket.h>
1528#include <netdb.h>
1529#include <errno.h>
1530#include <netinet/in.h>
1531
1532#define TEST_PORT "2222"
1533
1534int
1535main(void)
1536{
1537 int err, sock;
1538 struct addrinfo *gai_ai, *ai, hints;
1539 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1540
1541 memset(&hints, 0, sizeof(hints));
1542 hints.ai_family = PF_UNSPEC;
1543 hints.ai_socktype = SOCK_STREAM;
1544 hints.ai_flags = AI_PASSIVE;
1545
1546 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1547 if (err != 0) {
1548 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1549 exit(1);
1550 }
1551
1552 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1553 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1554 continue;
1555
1556 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1557 sizeof(ntop), strport, sizeof(strport),
1558 NI_NUMERICHOST|NI_NUMERICSERV);
1559
1560 if (ai->ai_family == AF_INET && err != 0) {
1561 perror("getnameinfo");
1562 exit(2);
1563 }
1564 }
1565 exit(0);
1566}
1567 ],
1568 [
1569 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001570 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1571 [Define if you have a getaddrinfo that fails
1572 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001573 ],
1574 [
1575 AC_MSG_RESULT(no)
1576 AC_DEFINE(BROKEN_GETADDRINFO)
1577 ]
1578 )
1579fi
1580
Darren Tuckera56f1912004-11-02 20:30:54 +11001581if test "x$check_for_conflicting_getspnam" = "x1"; then
1582 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1583 AC_COMPILE_IFELSE(
1584 [
1585#include <shadow.h>
1586int main(void) {exit(0);}
1587 ],
1588 [
1589 AC_MSG_RESULT(no)
1590 ],
1591 [
1592 AC_MSG_RESULT(yes)
1593 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1594 [Conflicting defs for getspnam])
1595 ]
1596 )
1597fi
1598
Damien Miller606f8802000-09-16 15:39:56 +11001599AC_FUNC_GETPGRP
1600
Damien Millera64b57a2001-01-17 10:44:13 +11001601# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001602PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001603AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001604 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001605 [
Damien Millera64b57a2001-01-17 10:44:13 +11001606 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001607 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1608 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001609 AC_MSG_ERROR([PAM headers not found])
1610 fi
1611
1612 AC_CHECK_LIB(dl, dlopen, , )
1613 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1614 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001615 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001616
Damien Millera64b57a2001-01-17 10:44:13 +11001617 PAM_MSG="yes"
1618
Tim Rice7df8d392005-09-19 09:33:39 -07001619 AC_DEFINE(USE_PAM, 1,
1620 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001621 if test $ac_cv_lib_dl_dlopen = yes; then
1622 LIBPAM="-lpam -ldl"
1623 else
1624 LIBPAM="-lpam"
1625 fi
1626 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001627 fi
1628 ]
1629)
Damien Millera22ba012000-03-02 23:09:20 +11001630
Damien Millera64b57a2001-01-17 10:44:13 +11001631# Check for older PAM
1632if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001633 # Check PAM strerror arguments (old PAM)
1634 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1635 AC_TRY_COMPILE(
1636 [
Damien Miller81171112000-04-23 11:14:01 +10001637#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001638#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001639#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001640#elif defined (HAVE_PAM_PAM_APPL_H)
1641#include <pam/pam_appl.h>
1642#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001643 ],
1644 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001645 [AC_MSG_RESULT(no)],
1646 [
Tim Rice7df8d392005-09-19 09:33:39 -07001647 AC_DEFINE(HAVE_OLD_PAM, 1,
1648 [Define if you have an old version of PAM
1649 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001650 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001651 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001652 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001653 )
Damien Millera22ba012000-03-02 23:09:20 +11001654fi
1655
Tim Riceaef73712002-05-11 13:17:42 -07001656# Search for OpenSSL
1657saved_CPPFLAGS="$CPPFLAGS"
1658saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001659AC_ARG_WITH(ssl-dir,
1660 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1661 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001662 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001663 case "$withval" in
1664 # Relative paths
1665 ./*|../*) withval="`pwd`/$withval"
1666 esac
Tim Riceaef73712002-05-11 13:17:42 -07001667 if test -d "$withval/lib"; then
1668 if test -n "${need_dash_r}"; then
1669 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1670 else
1671 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1672 fi
1673 else
1674 if test -n "${need_dash_r}"; then
1675 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1676 else
1677 LDFLAGS="-L${withval} ${LDFLAGS}"
1678 fi
1679 fi
1680 if test -d "$withval/include"; then
1681 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1682 else
1683 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1684 fi
Damien Millera22ba012000-03-02 23:09:20 +11001685 fi
1686 ]
1687)
Tim Rice3d5352e2004-02-12 09:27:21 -08001688LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001689AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1690 [Define if your ssl headers are included
1691 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001692 [
Tim Riceaef73712002-05-11 13:17:42 -07001693 dnl Check default openssl install dir
1694 if test -n "${need_dash_r}"; then
1695 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001696 else
Tim Riceaef73712002-05-11 13:17:42 -07001697 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001698 fi
Tim Riceaef73712002-05-11 13:17:42 -07001699 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1700 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1701 [
1702 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1703 ]
1704 )
1705 ]
1706)
1707
Tim Riced730b782002-08-13 18:52:10 -07001708# Determine OpenSSL header version
1709AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001710AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001711 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001712#include <stdio.h>
1713#include <string.h>
1714#include <openssl/opensslv.h>
1715#define DATA "conftest.sslincver"
1716int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001717 FILE *fd;
1718 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001719
Damien Millera8e06ce2003-11-21 23:48:55 +11001720 fd = fopen(DATA,"w");
1721 if(fd == NULL)
1722 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001723
1724 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1725 exit(1);
1726
1727 exit(0);
1728}
Darren Tucker623d92f2004-09-12 22:36:15 +10001729 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001730 [
1731 ssl_header_ver=`cat conftest.sslincver`
1732 AC_MSG_RESULT($ssl_header_ver)
1733 ],
1734 [
1735 AC_MSG_RESULT(not found)
1736 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001737 ],
1738 [
1739 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001740 ]
1741)
1742
1743# Determine OpenSSL library version
1744AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001745AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001746 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001747#include <stdio.h>
1748#include <string.h>
1749#include <openssl/opensslv.h>
1750#include <openssl/crypto.h>
1751#define DATA "conftest.ssllibver"
1752int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001753 FILE *fd;
1754 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001755
Damien Millera8e06ce2003-11-21 23:48:55 +11001756 fd = fopen(DATA,"w");
1757 if(fd == NULL)
1758 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001759
1760 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1761 exit(1);
1762
1763 exit(0);
1764}
Darren Tucker623d92f2004-09-12 22:36:15 +10001765 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001766 [
1767 ssl_library_ver=`cat conftest.ssllibver`
1768 AC_MSG_RESULT($ssl_library_ver)
1769 ],
1770 [
1771 AC_MSG_RESULT(not found)
1772 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001773 ],
1774 [
1775 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001776 ]
1777)
Damien Millera22ba012000-03-02 23:09:20 +11001778
Damien Millerec932372002-01-22 22:16:03 +11001779# Sanity check OpenSSL headers
1780AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001781AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001782 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001783#include <string.h>
1784#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001785int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001786 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001787 [
1788 AC_MSG_RESULT(yes)
1789 ],
1790 [
1791 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001792 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1793Check config.log for details.
1794Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001795 ],
1796 [
1797 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001798 ]
1799)
1800
Tim Rice3d5352e2004-02-12 09:27:21 -08001801# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1802# because the system crypt() is more featureful.
1803if test "x$check_for_libcrypt_before" = "x1"; then
1804 AC_CHECK_LIB(crypt, crypt)
1805fi
1806
Damien Millera8e06ce2003-11-21 23:48:55 +11001807# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001808# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001809if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001810 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001811fi
1812
Tim Rice2291c002005-08-26 13:15:19 -07001813AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001814
1815### Configure cryptographic random number support
1816
1817# Check wheter OpenSSL seeds itself
1818AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001819AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001820 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001821#include <string.h>
1822#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001823int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001824 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001825 [
1826 OPENSSL_SEEDS_ITSELF=yes
1827 AC_MSG_RESULT(yes)
1828 ],
1829 [
1830 AC_MSG_RESULT(no)
1831 # Default to use of the rand helper if OpenSSL doesn't
1832 # seed itself
1833 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001834 ],
1835 [
1836 AC_MSG_WARN([cross compiling: assuming yes])
1837 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001838 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001839 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001840 ]
1841)
1842
1843
1844# Do we want to force the use of the rand helper?
1845AC_ARG_WITH(rand-helper,
1846 [ --with-rand-helper Use subprocess to gather strong randomness ],
1847 [
1848 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001849 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001850 # the previous test showed it to be unseeded.
1851 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1852 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1853 OPENSSL_SEEDS_ITSELF=yes
1854 USE_RAND_HELPER=""
1855 fi
1856 else
1857 USE_RAND_HELPER=yes
1858 fi
1859 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001860)
Damien Miller6c21c512002-01-22 21:57:53 +11001861
1862# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001863if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001864 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001865 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1866 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001867 RAND_MSG="OpenSSL internal ONLY"
1868 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001869elif test ! -z "$USE_RAND_HELPER" ; then
1870 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001871 RAND_MSG="ssh-rand-helper"
1872 INSTALL_SSH_RAND_HELPER="yes"
1873fi
1874AC_SUBST(INSTALL_SSH_RAND_HELPER)
1875
1876### Configuration of ssh-rand-helper
1877
1878# PRNGD TCP socket
1879AC_ARG_WITH(prngd-port,
1880 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1881 [
Damien Millere996d722002-01-23 11:20:59 +11001882 case "$withval" in
1883 no)
1884 withval=""
1885 ;;
1886 [[0-9]]*)
1887 ;;
1888 *)
1889 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1890 ;;
1891 esac
1892 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001893 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001894 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1895 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001896 fi
1897 ]
1898)
1899
1900# PRNGD Unix domain socket
1901AC_ARG_WITH(prngd-socket,
1902 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1903 [
Damien Millere996d722002-01-23 11:20:59 +11001904 case "$withval" in
1905 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001906 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001907 ;;
1908 no)
1909 withval=""
1910 ;;
1911 /*)
1912 ;;
1913 *)
1914 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1915 ;;
1916 esac
1917
1918 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001919 if test ! -z "$PRNGD_PORT" ; then
1920 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1921 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001922 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001923 AC_MSG_WARN(Entropy socket is not readable)
1924 fi
1925 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001926 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1927 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001928 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001929 ],
1930 [
1931 # Check for existing socket only if we don't have a random device already
1932 if test "$USE_RAND_HELPER" = yes ; then
1933 AC_MSG_CHECKING(for PRNGD/EGD socket)
1934 # Insert other locations here
1935 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1936 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1937 PRNGD_SOCKET="$sock"
1938 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1939 break;
1940 fi
1941 done
1942 if test ! -z "$PRNGD_SOCKET" ; then
1943 AC_MSG_RESULT($PRNGD_SOCKET)
1944 else
1945 AC_MSG_RESULT(not found)
1946 fi
1947 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001948 ]
1949)
1950
1951# Change default command timeout for hashing entropy source
1952entropy_timeout=200
1953AC_ARG_WITH(entropy-timeout,
1954 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1955 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001956 if test -n "$withval" && test "x$withval" != "xno" && \
1957 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001958 entropy_timeout=$withval
1959 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001960 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001961)
Tim Rice7df8d392005-09-19 09:33:39 -07001962AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1963 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11001964
Damien Millerd3f6ad22002-06-25 10:24:47 +10001965SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001966AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001967 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001968 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001969 if test -n "$withval" && test "x$withval" != "xno" && \
1970 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001971 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001972 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001973 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001974)
Tim Rice7df8d392005-09-19 09:33:39 -07001975AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
1976 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10001977AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001978
Tim Rice88f2ab52002-03-17 12:17:34 -08001979# We do this little dance with the search path to insure
1980# that programs that we select for use by installed programs
1981# (which may be run by the super-user) come from trusted
1982# locations before they come from the user's private area.
1983# This should help avoid accidentally configuring some
1984# random version of a program in someone's personal bin.
1985
1986OPATH=$PATH
1987PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001988test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001989test -d /sbin && PATH=$PATH:/sbin
1990test -d /usr/sbin && PATH=$PATH:/usr/sbin
1991PATH=$PATH:/etc:$OPATH
1992
Damien Millera8e06ce2003-11-21 23:48:55 +11001993# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001994OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1995OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1996OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1997OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1998OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1999OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2000OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2001OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2002OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2003OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2004OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2005OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2006OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2007OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2008OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2009OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002010# restore PATH
2011PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002012
2013# Where does ssh-rand-helper get its randomness from?
2014INSTALL_SSH_PRNG_CMDS=""
2015if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2016 if test ! -z "$PRNGD_PORT" ; then
2017 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2018 elif test ! -z "$PRNGD_SOCKET" ; then
2019 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2020 else
2021 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2022 RAND_HELPER_CMDHASH=yes
2023 INSTALL_SSH_PRNG_CMDS="yes"
2024 fi
2025fi
2026AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2027
2028
Ben Lindstromb5628642000-10-18 00:02:25 +00002029# Cheap hack to ensure NEWS-OS libraries are arranged right.
2030if test ! -z "$SONY" ; then
2031 LIBS="$LIBS -liberty";
2032fi
2033
Damien Millera22ba012000-03-02 23:09:20 +11002034# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11002035AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002036AC_CHECK_SIZEOF(short int, 2)
2037AC_CHECK_SIZEOF(int, 4)
2038AC_CHECK_SIZEOF(long int, 4)
2039AC_CHECK_SIZEOF(long long int, 8)
2040
Damien Millerfa2bb692002-04-23 23:22:25 +10002041# Sanity check long long for some platforms (AIX)
2042if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2043 ac_cv_sizeof_long_long_int=0
2044fi
2045
Damien Millera22ba012000-03-02 23:09:20 +11002046# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002047AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2048 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002049 [ #include <sys/types.h> ],
2050 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002051 [ ac_cv_have_u_int="yes" ],
2052 [ ac_cv_have_u_int="no" ]
2053 )
2054])
2055if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002056 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002057 have_u_int=1
2058fi
2059
Damien Miller61e50f12000-05-08 20:49:37 +10002060AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2061 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002062 [ #include <sys/types.h> ],
2063 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002064 [ ac_cv_have_intxx_t="yes" ],
2065 [ ac_cv_have_intxx_t="no" ]
2066 )
2067])
2068if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002069 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002070 have_intxx_t=1
2071fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002072
2073if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002074 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002075then
2076 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2077 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002078 [ #include <stdint.h> ],
2079 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002080 [
2081 AC_DEFINE(HAVE_INTXX_T)
2082 AC_MSG_RESULT(yes)
2083 ],
2084 [ AC_MSG_RESULT(no) ]
2085 )
2086fi
2087
Damien Miller578783e2000-09-23 14:12:24 +11002088AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2089 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002090 [
2091#include <sys/types.h>
2092#ifdef HAVE_STDINT_H
2093# include <stdint.h>
2094#endif
2095#include <sys/socket.h>
2096#ifdef HAVE_SYS_BITYPES_H
2097# include <sys/bitypes.h>
2098#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002099 ],
2100 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002101 [ ac_cv_have_int64_t="yes" ],
2102 [ ac_cv_have_int64_t="no" ]
2103 )
2104])
2105if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002106 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002107fi
2108
Damien Miller61e50f12000-05-08 20:49:37 +10002109AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2110 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002111 [ #include <sys/types.h> ],
2112 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002113 [ ac_cv_have_u_intxx_t="yes" ],
2114 [ ac_cv_have_u_intxx_t="no" ]
2115 )
2116])
2117if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002118 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002119 have_u_intxx_t=1
2120fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002121
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002122if test -z "$have_u_intxx_t" ; then
2123 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2124 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002125 [ #include <sys/socket.h> ],
2126 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002127 [
2128 AC_DEFINE(HAVE_U_INTXX_T)
2129 AC_MSG_RESULT(yes)
2130 ],
2131 [ AC_MSG_RESULT(no) ]
2132 )
2133fi
2134
Damien Miller578783e2000-09-23 14:12:24 +11002135AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2136 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002137 [ #include <sys/types.h> ],
2138 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002139 [ ac_cv_have_u_int64_t="yes" ],
2140 [ ac_cv_have_u_int64_t="no" ]
2141 )
2142])
2143if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002144 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002145 have_u_int64_t=1
2146fi
2147
Tim Rice4cec93f2002-02-26 08:40:48 -08002148if test -z "$have_u_int64_t" ; then
2149 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2150 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002151 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002152 [ u_int64_t a; a = 1],
2153 [
2154 AC_DEFINE(HAVE_U_INT64_T)
2155 AC_MSG_RESULT(yes)
2156 ],
2157 [ AC_MSG_RESULT(no) ]
2158 )
2159fi
2160
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002161if test -z "$have_u_intxx_t" ; then
2162 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2163 AC_TRY_COMPILE(
2164 [
2165#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002166 ],
2167 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002168 [ ac_cv_have_uintxx_t="yes" ],
2169 [ ac_cv_have_uintxx_t="no" ]
2170 )
2171 ])
2172 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002173 AC_DEFINE(HAVE_UINTXX_T, 1,
2174 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002175 fi
2176fi
2177
2178if test -z "$have_uintxx_t" ; then
2179 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2180 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002181 [ #include <stdint.h> ],
2182 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002183 [
2184 AC_DEFINE(HAVE_UINTXX_T)
2185 AC_MSG_RESULT(yes)
2186 ],
2187 [ AC_MSG_RESULT(no) ]
2188 )
2189fi
2190
Damien Milleredb82922000-06-20 13:25:52 +10002191if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002192 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002193then
2194 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2195 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002196 [
2197#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002198 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002199 [
Damien Miller70494d12000-04-03 15:57:06 +10002200 int8_t a; int16_t b; int32_t c;
2201 u_int8_t e; u_int16_t f; u_int32_t g;
2202 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002203 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002204 [
2205 AC_DEFINE(HAVE_U_INTXX_T)
2206 AC_DEFINE(HAVE_INTXX_T)
2207 AC_MSG_RESULT(yes)
2208 ],
2209 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002210 )
Damien Millerb29ea912000-01-15 14:12:03 +11002211fi
2212
Damien Miller58be7382001-09-15 21:31:54 +10002213
2214AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2215 AC_TRY_COMPILE(
2216 [
2217#include <sys/types.h>
2218 ],
2219 [ u_char foo; foo = 125; ],
2220 [ ac_cv_have_u_char="yes" ],
2221 [ ac_cv_have_u_char="no" ]
2222 )
2223])
2224if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002225 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002226fi
2227
Tim Rice13aae5e2001-10-21 17:53:58 -07002228TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002229
Tim Rice200a5c02002-02-26 22:12:34 -08002230AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002231
Damien Miller848b9932005-02-24 12:12:34 +11002232AC_CHECK_TYPES(in_addr_t,,,
2233[#include <sys/types.h>
2234#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002235
Damien Miller61e50f12000-05-08 20:49:37 +10002236AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2237 AC_TRY_COMPILE(
2238 [
2239#include <sys/types.h>
2240 ],
2241 [ size_t foo; foo = 1235; ],
2242 [ ac_cv_have_size_t="yes" ],
2243 [ ac_cv_have_size_t="no" ]
2244 )
2245])
2246if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002247 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002248fi
Damien Miller95058511999-12-29 10:36:45 +11002249
Damien Miller615f9392000-05-17 22:53:33 +10002250AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2251 AC_TRY_COMPILE(
2252 [
2253#include <sys/types.h>
2254 ],
2255 [ ssize_t foo; foo = 1235; ],
2256 [ ac_cv_have_ssize_t="yes" ],
2257 [ ac_cv_have_ssize_t="no" ]
2258 )
2259])
2260if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002261 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002262fi
2263
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002264AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2265 AC_TRY_COMPILE(
2266 [
2267#include <time.h>
2268 ],
2269 [ clock_t foo; foo = 1235; ],
2270 [ ac_cv_have_clock_t="yes" ],
2271 [ ac_cv_have_clock_t="no" ]
2272 )
2273])
2274if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002275 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002276fi
2277
Damien Millerb54b40e2000-06-23 08:23:34 +10002278AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2279 AC_TRY_COMPILE(
2280 [
2281#include <sys/types.h>
2282#include <sys/socket.h>
2283 ],
2284 [ sa_family_t foo; foo = 1235; ],
2285 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002286 [ AC_TRY_COMPILE(
2287 [
2288#include <sys/types.h>
2289#include <sys/socket.h>
2290#include <netinet/in.h>
2291 ],
2292 [ sa_family_t foo; foo = 1235; ],
2293 [ ac_cv_have_sa_family_t="yes" ],
2294
Damien Millerb54b40e2000-06-23 08:23:34 +10002295 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002296 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002297 )
2298])
2299if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002300 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2301 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002302fi
2303
Damien Miller0f91b4e2000-06-18 15:43:25 +10002304AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2305 AC_TRY_COMPILE(
2306 [
2307#include <sys/types.h>
2308 ],
2309 [ pid_t foo; foo = 1235; ],
2310 [ ac_cv_have_pid_t="yes" ],
2311 [ ac_cv_have_pid_t="no" ]
2312 )
2313])
2314if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002315 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002316fi
2317
2318AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2319 AC_TRY_COMPILE(
2320 [
2321#include <sys/types.h>
2322 ],
2323 [ mode_t foo; foo = 1235; ],
2324 [ ac_cv_have_mode_t="yes" ],
2325 [ ac_cv_have_mode_t="no" ]
2326 )
2327])
2328if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002329 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002330fi
2331
Damien Miller61e50f12000-05-08 20:49:37 +10002332
2333AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2334 AC_TRY_COMPILE(
2335 [
Damien Miller81171112000-04-23 11:14:01 +10002336#include <sys/types.h>
2337#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002338 ],
2339 [ struct sockaddr_storage s; ],
2340 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2341 [ ac_cv_have_struct_sockaddr_storage="no" ]
2342 )
2343])
2344if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002345 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2346 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002347fi
Damien Miller34132e52000-01-14 15:45:46 +11002348
Damien Miller61e50f12000-05-08 20:49:37 +10002349AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2350 AC_TRY_COMPILE(
2351 [
Damien Miller7b22d652000-06-18 14:07:04 +10002352#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002353#include <netinet/in.h>
2354 ],
2355 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2356 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2357 [ ac_cv_have_struct_sockaddr_in6="no" ]
2358 )
2359])
2360if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002361 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2362 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002363fi
Damien Miller34132e52000-01-14 15:45:46 +11002364
Damien Miller61e50f12000-05-08 20:49:37 +10002365AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2366 AC_TRY_COMPILE(
2367 [
Damien Miller7b22d652000-06-18 14:07:04 +10002368#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002369#include <netinet/in.h>
2370 ],
2371 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2372 [ ac_cv_have_struct_in6_addr="yes" ],
2373 [ ac_cv_have_struct_in6_addr="no" ]
2374 )
2375])
2376if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002377 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2378 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002379fi
Damien Miller34132e52000-01-14 15:45:46 +11002380
Damien Miller61e50f12000-05-08 20:49:37 +10002381AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2382 AC_TRY_COMPILE(
2383 [
Damien Miller81171112000-04-23 11:14:01 +10002384#include <sys/types.h>
2385#include <sys/socket.h>
2386#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002387 ],
2388 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2389 [ ac_cv_have_struct_addrinfo="yes" ],
2390 [ ac_cv_have_struct_addrinfo="no" ]
2391 )
2392])
2393if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002394 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2395 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002396fi
2397
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002398AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2399 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002400 [ #include <sys/time.h> ],
2401 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002402 [ ac_cv_have_struct_timeval="yes" ],
2403 [ ac_cv_have_struct_timeval="no" ]
2404 )
2405])
2406if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002407 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002408 have_struct_timeval=1
2409fi
2410
Tim Rice4e4dc562003-03-18 10:21:40 -08002411AC_CHECK_TYPES(struct timespec)
2412
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002413# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002414if test "x$ac_cv_have_int64_t" = "xno" && \
2415 test "x$ac_cv_sizeof_long_int" != "x8" && \
2416 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002417 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2418 echo "an alternative compiler (I.E., GCC) before continuing."
2419 echo ""
2420 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002421else
2422dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002423 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002424 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002425#include <stdio.h>
2426#include <string.h>
2427#ifdef HAVE_SNPRINTF
2428main()
2429{
2430 char buf[50];
2431 char expected_out[50];
2432 int mazsize = 50 ;
2433#if (SIZEOF_LONG_INT == 8)
2434 long int num = 0x7fffffffffffffff;
2435#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002436 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002437#endif
2438 strcpy(expected_out, "9223372036854775807");
2439 snprintf(buf, mazsize, "%lld", num);
2440 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002441 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002442 exit(0);
2443}
2444#else
2445main() { exit(0); }
2446#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002447 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002448 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002449 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002450fi
2451
Damien Miller78315eb2000-09-29 23:01:36 +11002452dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002453OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2454OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2455OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2456OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2457OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002458OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002459OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2460OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002461OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002462OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2463OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2464OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2465OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002466OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2467OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2468OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2469OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002470
2471AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002472
Damien Miller61e50f12000-05-08 20:49:37 +10002473AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2474 ac_cv_have_ss_family_in_struct_ss, [
2475 AC_TRY_COMPILE(
2476 [
Damien Miller81171112000-04-23 11:14:01 +10002477#include <sys/types.h>
2478#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002479 ],
2480 [ struct sockaddr_storage s; s.ss_family = 1; ],
2481 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2482 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2483 )
2484])
2485if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002486 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002487fi
2488
Damien Miller61e50f12000-05-08 20:49:37 +10002489AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2490 ac_cv_have___ss_family_in_struct_ss, [
2491 AC_TRY_COMPILE(
2492 [
Damien Miller81171112000-04-23 11:14:01 +10002493#include <sys/types.h>
2494#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002495 ],
2496 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2497 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2498 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2499 )
2500])
2501if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002502 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2503 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002504fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002505
Damien Millerad833b32000-08-23 10:46:23 +10002506AC_CACHE_CHECK([for pw_class field in struct passwd],
2507 ac_cv_have_pw_class_in_struct_passwd, [
2508 AC_TRY_COMPILE(
2509 [
Damien Millerad833b32000-08-23 10:46:23 +10002510#include <pwd.h>
2511 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002512 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002513 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2514 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2515 )
2516])
2517if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002518 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2519 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002520fi
2521
Kevin Steves82456952001-06-22 21:14:18 +00002522AC_CACHE_CHECK([for pw_expire field in struct passwd],
2523 ac_cv_have_pw_expire_in_struct_passwd, [
2524 AC_TRY_COMPILE(
2525 [
2526#include <pwd.h>
2527 ],
2528 [ struct passwd p; p.pw_expire = 0; ],
2529 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2530 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2531 )
2532])
2533if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002534 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2535 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002536fi
2537
2538AC_CACHE_CHECK([for pw_change field in struct passwd],
2539 ac_cv_have_pw_change_in_struct_passwd, [
2540 AC_TRY_COMPILE(
2541 [
2542#include <pwd.h>
2543 ],
2544 [ struct passwd p; p.pw_change = 0; ],
2545 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2546 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2547 )
2548])
2549if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002550 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2551 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002552fi
Damien Miller61e50f12000-05-08 20:49:37 +10002553
Tim Rice28bbb0c2002-05-27 17:37:32 -07002554dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002555AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2556 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002557 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002558 [
Tim Riceae49fe62002-04-12 10:26:21 -07002559#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002560#include <sys/socket.h>
2561#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002562int main() {
2563#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002564#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002565exit(1);
2566#endif
2567struct msghdr m;
2568m.msg_accrights = 0;
2569exit(0);
2570}
Kevin Steves939c9db2002-03-22 17:23:25 +00002571 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002572 [ ac_cv_have_accrights_in_msghdr="yes" ],
2573 [ ac_cv_have_accrights_in_msghdr="no" ]
2574 )
2575])
2576if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002577 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2578 [Define if your system uses access rights style
2579 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002580fi
2581
Kevin Stevesa44e0352002-04-07 16:18:03 +00002582AC_CACHE_CHECK([for msg_control field in struct msghdr],
2583 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002584 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002585 [
Tim Riceae49fe62002-04-12 10:26:21 -07002586#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002587#include <sys/socket.h>
2588#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002589int main() {
2590#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002591#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002592exit(1);
2593#endif
2594struct msghdr m;
2595m.msg_control = 0;
2596exit(0);
2597}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002598 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002599 [ ac_cv_have_control_in_msghdr="yes" ],
2600 [ ac_cv_have_control_in_msghdr="no" ]
2601 )
2602])
2603if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002604 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2605 [Define if your system uses ancillary data style
2606 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002607fi
2608
Damien Miller61e50f12000-05-08 20:49:37 +10002609AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002610 AC_TRY_LINK([],
2611 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002612 [ ac_cv_libc_defines___progname="yes" ],
2613 [ ac_cv_libc_defines___progname="no" ]
2614 )
2615])
2616if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002617 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002618fi
2619
Kevin Steves4846f4a2002-03-22 18:19:53 +00002620AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2621 AC_TRY_LINK([
2622#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002623],
2624 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002625 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2626 [ ac_cv_cc_implements___FUNCTION__="no" ]
2627 )
2628])
2629if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002630 AC_DEFINE(HAVE___FUNCTION__, 1,
2631 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002632fi
2633
2634AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2635 AC_TRY_LINK([
2636#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002637],
2638 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002639 [ ac_cv_cc_implements___func__="yes" ],
2640 [ ac_cv_cc_implements___func__="no" ]
2641 )
2642])
2643if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002644 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002645fi
2646
Damien Miller4f8e6692001-07-14 13:22:53 +10002647AC_CACHE_CHECK([whether getopt has optreset support],
2648 ac_cv_have_getopt_optreset, [
2649 AC_TRY_LINK(
2650 [
2651#include <getopt.h>
2652 ],
2653 [ extern int optreset; optreset = 0; ],
2654 [ ac_cv_have_getopt_optreset="yes" ],
2655 [ ac_cv_have_getopt_optreset="no" ]
2656 )
2657])
2658if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002659 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2660 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002661fi
Damien Millera22ba012000-03-02 23:09:20 +11002662
Damien Millerecbb26d2000-07-15 14:59:14 +10002663AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002664 AC_TRY_LINK([],
2665 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002666 [ ac_cv_libc_defines_sys_errlist="yes" ],
2667 [ ac_cv_libc_defines_sys_errlist="no" ]
2668 )
2669])
2670if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002671 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2672 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002673fi
2674
2675
Damien Miller11fa2cc2000-08-16 10:35:58 +10002676AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002677 AC_TRY_LINK([],
2678 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002679 [ ac_cv_libc_defines_sys_nerr="yes" ],
2680 [ ac_cv_libc_defines_sys_nerr="no" ]
2681 )
2682])
2683if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002684 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002685fi
2686
Damien Millera8e06ce2003-11-21 23:48:55 +11002687SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002688# Check whether user wants sectok support
2689AC_ARG_WITH(sectok,
2690 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002691 [
2692 if test "x$withval" != "xno" ; then
2693 if test "x$withval" != "xyes" ; then
2694 CPPFLAGS="$CPPFLAGS -I${withval}"
2695 LDFLAGS="$LDFLAGS -L${withval}"
2696 if test ! -z "$need_dash_r" ; then
2697 LDFLAGS="$LDFLAGS -R${withval}"
2698 fi
2699 if test ! -z "$blibpath" ; then
2700 blibpath="$blibpath:${withval}"
2701 fi
2702 fi
2703 AC_CHECK_HEADERS(sectok.h)
2704 if test "$ac_cv_header_sectok_h" != yes; then
2705 AC_MSG_ERROR(Can't find sectok.h)
2706 fi
2707 AC_CHECK_LIB(sectok, sectok_open)
2708 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2709 AC_MSG_ERROR(Can't find libsectok)
2710 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002711 AC_DEFINE(SMARTCARD, 1,
2712 [Define if you want smartcard support])
2713 AC_DEFINE(USE_SECTOK, 1,
2714 [Define if you want smartcard support
2715 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002716 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002717 fi
2718 ]
2719)
2720
2721# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002722OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002723AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10002724 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08002725 [
2726 if test "x$withval" != "xno" ; then
2727 if test "x$withval" != "xyes" ; then
2728 OPENSC_CONFIG=$withval/bin/opensc-config
2729 else
2730 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2731 fi
2732 if test "$OPENSC_CONFIG" != "no"; then
2733 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2734 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2735 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2736 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2737 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002738 AC_DEFINE(USE_OPENSC, 1,
2739 [Define if you want smartcard support
2740 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002741 SCARD_MSG="yes, using OpenSC"
2742 fi
2743 fi
2744 ]
2745)
Damien Miller85de5802001-09-18 14:01:11 +10002746
Darren Tucker5f88d342003-10-15 16:57:57 +10002747# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002748AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002749 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2750 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002751 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002752 # Needed by our getrrsetbyname()
2753 AC_SEARCH_LIBS(res_query, resolv)
2754 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002755 AC_MSG_CHECKING(if res_query will link)
2756 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2757 [AC_MSG_RESULT(no)
2758 saved_LIBS="$LIBS"
2759 LIBS="$LIBS -lresolv"
2760 AC_MSG_CHECKING(for res_query in -lresolv)
2761 AC_LINK_IFELSE([
2762#include <resolv.h>
2763int main()
2764{
2765 res_query (0, 0, 0, 0, 0);
2766 return 0;
2767}
2768 ],
2769 [LIBS="$LIBS -lresolv"
2770 AC_MSG_RESULT(yes)],
2771 [LIBS="$saved_LIBS"
2772 AC_MSG_RESULT(no)])
2773 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002774 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002775 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002776 [#include <sys/types.h>
2777 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002778 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07002779 [AC_DEFINE(HAVE_HEADER_AD, 1,
2780 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10002781 [#include <arpa/nameser.h>])
2782 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002783
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002784# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002785KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002786AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002787 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002788 [ if test "x$withval" != "xno" ; then
2789 if test "x$withval" = "xyes" ; then
2790 KRB5ROOT="/usr/local"
2791 else
2792 KRB5ROOT=${withval}
2793 fi
2794
Tim Rice7df8d392005-09-19 09:33:39 -07002795 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11002796 KRB5_MSG="yes"
2797
2798 AC_MSG_CHECKING(for krb5-config)
2799 if test -x $KRB5ROOT/bin/krb5-config ; then
2800 KRB5CONF=$KRB5ROOT/bin/krb5-config
2801 AC_MSG_RESULT($KRB5CONF)
2802
2803 AC_MSG_CHECKING(for gssapi support)
2804 if $KRB5CONF | grep gssapi >/dev/null ; then
2805 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002806 AC_DEFINE(GSSAPI, 1,
2807 [Define this if you want GSSAPI
2808 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11002809 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002810 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002811 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002812 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002813 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002814 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2815 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002816 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002817 AC_MSG_CHECKING(whether we are using Heimdal)
2818 AC_TRY_COMPILE([ #include <krb5.h> ],
2819 [ char *tmp = heimdal_version; ],
2820 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002821 AC_DEFINE(HEIMDAL, 1,
2822 [Define this if you are using the
2823 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002824 AC_MSG_RESULT(no)
2825 )
2826 else
2827 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002828 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002829 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002830 AC_MSG_CHECKING(whether we are using Heimdal)
2831 AC_TRY_COMPILE([ #include <krb5.h> ],
2832 [ char *tmp = heimdal_version; ],
2833 [ AC_MSG_RESULT(yes)
2834 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002835 K5LIBS="-lkrb5 -ldes"
2836 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002837 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002838 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002839 ],
2840 [ AC_MSG_RESULT(no)
2841 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2842 ]
2843 )
Damien Miller200d0a72003-06-30 19:21:36 +10002844 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002845
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002846 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2847 [ AC_DEFINE(GSSAPI)
2848 K5LIBS="-lgssapi $K5LIBS" ],
2849 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2850 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002851 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002852 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2853 $K5LIBS)
2854 ],
2855 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002856
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002857 AC_CHECK_HEADER(gssapi.h, ,
2858 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002859 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002860 AC_CHECK_HEADERS(gssapi.h, ,
2861 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002862 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002863 ]
2864 )
2865
2866 oldCPP="$CPPFLAGS"
2867 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2868 AC_CHECK_HEADER(gssapi_krb5.h, ,
2869 [ CPPFLAGS="$oldCPP" ])
2870
Damien Millera8e06ce2003-11-21 23:48:55 +11002871 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002872 if test ! -z "$need_dash_r" ; then
2873 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2874 fi
2875 if test ! -z "$blibpath" ; then
2876 blibpath="$blibpath:${KRB5ROOT}/lib"
2877 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07002878
2879 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2880 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2881 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2882
2883 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07002884 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
2885 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002886 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002887 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002888)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002889
Damien Millera22ba012000-03-02 23:09:20 +11002890# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002891
Damien Millerf58c6722002-05-13 13:15:42 +10002892PRIVSEP_PATH=/var/empty
2893AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002894 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002895 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002896 if test -n "$withval" && test "x$withval" != "xno" && \
2897 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002898 PRIVSEP_PATH=$withval
2899 fi
2900 ]
2901)
2902AC_SUBST(PRIVSEP_PATH)
2903
Damien Millera22ba012000-03-02 23:09:20 +11002904AC_ARG_WITH(xauth,
2905 [ --with-xauth=PATH Specify path to xauth program ],
2906 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002907 if test -n "$withval" && test "x$withval" != "xno" && \
2908 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002909 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002910 fi
2911 ],
2912 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002913 TestPath="$PATH"
2914 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2915 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2916 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2917 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2918 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002919 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002920 xauth_path="/usr/openwin/bin/xauth"
2921 fi
2922 ]
2923)
2924
Damien Miller7d901272003-01-13 16:55:22 +11002925STRIP_OPT=-s
2926AC_ARG_ENABLE(strip,
2927 [ --disable-strip Disable calling strip(1) on install],
2928 [
2929 if test "x$enableval" = "xno" ; then
2930 STRIP_OPT=
2931 fi
2932 ]
2933)
2934AC_SUBST(STRIP_OPT)
2935
Damien Millera19cf472000-11-29 13:28:50 +11002936if test -z "$xauth_path" ; then
2937 XAUTH_PATH="undefined"
2938 AC_SUBST(XAUTH_PATH)
2939else
Tim Rice7df8d392005-09-19 09:33:39 -07002940 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
2941 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11002942 XAUTH_PATH=$xauth_path
2943 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002944fi
Damien Millera22ba012000-03-02 23:09:20 +11002945
2946# Check for mail directory (last resort if we cannot get it from headers)
2947if test ! -z "$MAIL" ; then
2948 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07002949 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
2950 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11002951fi
2952
Darren Tucker623d92f2004-09-12 22:36:15 +10002953if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002954 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2955 disable_ptmx_check=yes
2956fi
Damien Millera22ba012000-03-02 23:09:20 +11002957if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002958 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002959 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002960 [
Tim Rice7df8d392005-09-19 09:33:39 -07002961 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
2962 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002963 have_dev_ptmx=1
2964 ]
2965 )
2966 fi
Damien Millera22ba012000-03-02 23:09:20 +11002967fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002968
Darren Tucker623d92f2004-09-12 22:36:15 +10002969if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002970 AC_CHECK_FILE("/dev/ptc",
2971 [
Tim Rice7df8d392005-09-19 09:33:39 -07002972 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
2973 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002974 have_dev_ptc=1
2975 ]
2976 )
2977else
2978 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2979fi
Damien Miller204ad072000-03-02 23:56:12 +11002980
Damien Millera22ba012000-03-02 23:09:20 +11002981# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002982AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002983 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002984 [
Damien Miller897741e2001-04-16 10:41:46 +10002985 case "$withval" in
2986 man|cat|doc)
2987 MANTYPE=$withval
2988 ;;
2989 *)
2990 AC_MSG_ERROR(invalid man type: $withval)
2991 ;;
2992 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002993 ]
2994)
Ben Lindstrombc709922001-04-18 18:04:21 +00002995if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002996 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2997 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002998 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2999 MANTYPE=doc
3000 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3001 MANTYPE=man
3002 else
3003 MANTYPE=cat
3004 fi
3005fi
Damien Miller670a4b82000-01-22 13:53:11 +11003006AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003007if test "$MANTYPE" = "doc"; then
3008 mansubdir=man;
3009else
3010 mansubdir=$MANTYPE;
3011fi
3012AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003013
Damien Millera22ba012000-03-02 23:09:20 +11003014# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003015MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003016AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003017 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003018 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003019 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003020 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3021 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003022 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003023 fi
3024 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003025)
3026
Damien Millera22ba012000-03-02 23:09:20 +11003027# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003028AC_ARG_WITH(shadow,
3029 [ --without-shadow Disable shadow password support],
3030 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003031 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003032 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003033 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003034 fi
3035 ]
3036)
3037
Damien Miller1f335fb2000-06-26 11:31:33 +10003038if test -z "$disable_shadow" ; then
3039 AC_MSG_CHECKING([if the systems has expire shadow information])
3040 AC_TRY_COMPILE(
3041 [
3042#include <sys/types.h>
3043#include <shadow.h>
3044 struct spwd sp;
3045 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3046 [ sp_expire_available=yes ], []
3047 )
3048
3049 if test "x$sp_expire_available" = "xyes" ; then
3050 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003051 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3052 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003053 else
3054 AC_MSG_RESULT(no)
3055 fi
3056fi
3057
Damien Millera22ba012000-03-02 23:09:20 +11003058# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003059if test ! -z "$IPADDR_IN_DISPLAY" ; then
3060 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003061 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3062 [Define if you need to use IP address
3063 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003064else
Damien Millera8e06ce2003-11-21 23:48:55 +11003065 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003066 AC_ARG_WITH(ipaddr-display,
3067 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3068 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003069 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003070 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003071 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003072 fi
3073 ]
3074 )
3075fi
Damien Miller76112de1999-12-21 11:18:08 +11003076
Darren Tuckere1a790d2003-09-16 11:52:19 +10003077# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003078AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003079 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003080 [ if test "x$enableval" = "xno"; then
3081 AC_MSG_NOTICE([/etc/default/login handling disabled])
3082 etc_default_login=no
3083 else
3084 etc_default_login=yes
3085 fi ],
3086 [ etc_default_login=yes ]
3087)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003088
Darren Tucker2f9573d2005-02-10 22:28:54 +11003089if test "x$etc_default_login" != "xno"; then
3090 AC_CHECK_FILE("/etc/default/login",
3091 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10003092 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3093 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003094 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
3095 elif test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003096 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3097 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003098 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003099fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003100
Tim Rice43a1c132002-04-17 21:19:14 -07003101dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003102if test $ac_cv_func_login_getcapbool = "yes" && \
3103 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003104 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003105fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003106
Damien Millera22ba012000-03-02 23:09:20 +11003107# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003108SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003109AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003110 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003111 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003112 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003113 AC_MSG_WARN([
3114--with-default-path=PATH has no effect on this system.
3115Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003116 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003117 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003118 AC_MSG_WARN([
3119--with-default-path=PATH will only be used if PATH is not defined in
3120$external_path_file .])
3121 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003122 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003123 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003124 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003125 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003126 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3127 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003128 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003129 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003130 AC_MSG_WARN([
3131If PATH is defined in $external_path_file, ensure the path to scp is included,
3132otherwise scp will not work.])
3133 fi
3134 AC_TRY_RUN(
3135 [
Tim Rice59ea0a02001-03-10 13:50:45 -08003136/* find out what STDPATH is */
3137#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003138#ifdef HAVE_PATHS_H
3139# include <paths.h>
3140#endif
3141#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003142# ifdef _PATH_USERPATH /* Irix */
3143# define _PATH_STDPATH _PATH_USERPATH
3144# else
3145# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3146# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003147#endif
3148#include <sys/types.h>
3149#include <sys/stat.h>
3150#include <fcntl.h>
3151#define DATA "conftest.stdpath"
3152
3153main()
3154{
3155 FILE *fd;
3156 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003157
Tim Rice59ea0a02001-03-10 13:50:45 -08003158 fd = fopen(DATA,"w");
3159 if(fd == NULL)
3160 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003161
Tim Rice59ea0a02001-03-10 13:50:45 -08003162 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3163 exit(1);
3164
3165 exit(0);
3166}
3167 ], [ user_path=`cat conftest.stdpath` ],
3168 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3169 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3170 )
3171# make sure $bindir is in USER_PATH so scp will work
3172 t_bindir=`eval echo ${bindir}`
3173 case $t_bindir in
3174 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3175 esac
3176 case $t_bindir in
3177 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3178 esac
3179 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3180 if test $? -ne 0 ; then
3181 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3182 if test $? -ne 0 ; then
3183 user_path=$user_path:$t_bindir
3184 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3185 fi
3186 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003187 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003188)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003189if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003190 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003191 AC_SUBST(user_path)
3192fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003193
Damien Millera18bbd32002-05-13 10:48:57 +10003194# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003195AC_ARG_WITH(superuser-path,
3196 [ --with-superuser-path= Specify different path for super-user],
3197 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003198 if test -n "$withval" && test "x$withval" != "xno" && \
3199 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003200 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3201 [Define if you want a different $PATH
3202 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003203 superuser_path=$withval
3204 fi
3205 ]
3206)
3207
3208
Damien Miller61e50f12000-05-08 20:49:37 +10003209AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003210IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003211AC_ARG_WITH(4in6,
3212 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3213 [
3214 if test "x$withval" != "xno" ; then
3215 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003216 AC_DEFINE(IPV4_IN_IPV6, 1,
3217 [Detect IPv4 in IPv6 mapped addresses
3218 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003219 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003220 else
3221 AC_MSG_RESULT(no)
3222 fi
3223 ],[
3224 if test "x$inet6_default_4in6" = "xyes"; then
3225 AC_MSG_RESULT([yes (default)])
3226 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003227 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003228 else
3229 AC_MSG_RESULT([no (default)])
3230 fi
3231 ]
3232)
3233
Damien Miller60396b02001-02-18 17:01:00 +11003234# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003235BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003236AC_ARG_WITH(bsd-auth,
3237 [ --with-bsd-auth Enable BSD auth support],
3238 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003239 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003240 AC_DEFINE(BSD_AUTH, 1,
3241 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003242 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003243 fi
3244 ]
3245)
3246
Damien Millera22ba012000-03-02 23:09:20 +11003247# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003248piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003249# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003250if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003251 piddir=`eval echo ${sysconfdir}`
3252 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003253 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003254 esac
3255fi
3256
Tim Rice88f2ab52002-03-17 12:17:34 -08003257AC_ARG_WITH(pid-dir,
3258 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3259 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003260 if test -n "$withval" && test "x$withval" != "xno" && \
3261 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003262 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003263 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003264 AC_MSG_WARN([** no $piddir directory on this system **])
3265 fi
3266 fi
3267 ]
3268)
3269
Tim Rice7df8d392005-09-19 09:33:39 -07003270AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003271AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003272
andre2ff7b5d2000-06-03 14:57:40 +00003273dnl allow user to disable some login recording features
3274AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003275 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003276 [
3277 if test "x$enableval" = "xno" ; then
3278 AC_DEFINE(DISABLE_LASTLOG)
3279 fi
3280 ]
andre2ff7b5d2000-06-03 14:57:40 +00003281)
3282AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003283 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003284 [
3285 if test "x$enableval" = "xno" ; then
3286 AC_DEFINE(DISABLE_UTMP)
3287 fi
3288 ]
andre2ff7b5d2000-06-03 14:57:40 +00003289)
3290AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003291 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003292 [
3293 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003294 AC_DEFINE(DISABLE_UTMPX, 1,
3295 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003296 fi
3297 ]
andre2ff7b5d2000-06-03 14:57:40 +00003298)
3299AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003300 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003301 [
3302 if test "x$enableval" = "xno" ; then
3303 AC_DEFINE(DISABLE_WTMP)
3304 fi
3305 ]
andre2ff7b5d2000-06-03 14:57:40 +00003306)
3307AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003308 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003309 [
3310 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003311 AC_DEFINE(DISABLE_WTMPX, 1,
3312 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003313 fi
3314 ]
andre2ff7b5d2000-06-03 14:57:40 +00003315)
3316AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003317 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003318 [
3319 if test "x$enableval" = "xno" ; then
3320 AC_DEFINE(DISABLE_LOGIN)
3321 fi
3322 ]
andre2ff7b5d2000-06-03 14:57:40 +00003323)
3324AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003325 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003326 [
3327 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003328 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3329 [Define if you don't want to use pututline()
3330 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003331 fi
3332 ]
andre2ff7b5d2000-06-03 14:57:40 +00003333)
3334AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003335 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003336 [
3337 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003338 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3339 [Define if you don't want to use pututxline()
3340 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003341 fi
3342 ]
andre2ff7b5d2000-06-03 14:57:40 +00003343)
3344AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003345 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003346 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003347 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003348 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003349 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003350 conf_lastlog_location=$withval
3351 fi
3352 ]
3353)
andre2ff7b5d2000-06-03 14:57:40 +00003354
3355dnl lastlog, [uw]tmpx? detection
3356dnl NOTE: set the paths in the platform section to avoid the
3357dnl need for command-line parameters
3358dnl lastlog and [uw]tmp are subject to a file search if all else fails
3359
3360dnl lastlog detection
3361dnl NOTE: the code itself will detect if lastlog is a directory
3362AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3363AC_TRY_COMPILE([
3364#include <sys/types.h>
3365#include <utmp.h>
3366#ifdef HAVE_LASTLOG_H
3367# include <lastlog.h>
3368#endif
Damien Miller2994e082000-06-04 15:51:47 +10003369#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003370# include <paths.h>
3371#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003372#ifdef HAVE_LOGIN_H
3373# include <login.h>
3374#endif
andre2ff7b5d2000-06-03 14:57:40 +00003375 ],
3376 [ char *lastlog = LASTLOG_FILE; ],
3377 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003378 [
3379 AC_MSG_RESULT(no)
3380 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3381 AC_TRY_COMPILE([
3382#include <sys/types.h>
3383#include <utmp.h>
3384#ifdef HAVE_LASTLOG_H
3385# include <lastlog.h>
3386#endif
3387#ifdef HAVE_PATHS_H
3388# include <paths.h>
3389#endif
3390 ],
3391 [ char *lastlog = _PATH_LASTLOG; ],
3392 [ AC_MSG_RESULT(yes) ],
3393 [
andree441aa32000-06-12 22:34:38 +00003394 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003395 system_lastlog_path=no
3396 ])
3397 ]
andre2ff7b5d2000-06-03 14:57:40 +00003398)
Damien Miller2994e082000-06-04 15:51:47 +10003399
andre2ff7b5d2000-06-03 14:57:40 +00003400if test -z "$conf_lastlog_location"; then
3401 if test x"$system_lastlog_path" = x"no" ; then
3402 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003403 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003404 conf_lastlog_location=$f
3405 fi
3406 done
3407 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003408 AC_MSG_WARN([** Cannot find lastlog **])
3409 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003410 fi
3411 fi
3412fi
3413
3414if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003415 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3416 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003417fi
andre2ff7b5d2000-06-03 14:57:40 +00003418
3419dnl utmp detection
3420AC_MSG_CHECKING([if your system defines UTMP_FILE])
3421AC_TRY_COMPILE([
3422#include <sys/types.h>
3423#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003424#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003425# include <paths.h>
3426#endif
3427 ],
3428 [ char *utmp = UTMP_FILE; ],
3429 [ AC_MSG_RESULT(yes) ],
3430 [ AC_MSG_RESULT(no)
3431 system_utmp_path=no ]
3432)
3433if test -z "$conf_utmp_location"; then
3434 if test x"$system_utmp_path" = x"no" ; then
3435 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3436 if test -f $f ; then
3437 conf_utmp_location=$f
3438 fi
3439 done
3440 if test -z "$conf_utmp_location"; then
3441 AC_DEFINE(DISABLE_UTMP)
3442 fi
3443 fi
3444fi
3445if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003446 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3447 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003448fi
andre2ff7b5d2000-06-03 14:57:40 +00003449
3450dnl wtmp detection
3451AC_MSG_CHECKING([if your system defines WTMP_FILE])
3452AC_TRY_COMPILE([
3453#include <sys/types.h>
3454#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003455#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003456# include <paths.h>
3457#endif
3458 ],
3459 [ char *wtmp = WTMP_FILE; ],
3460 [ AC_MSG_RESULT(yes) ],
3461 [ AC_MSG_RESULT(no)
3462 system_wtmp_path=no ]
3463)
3464if test -z "$conf_wtmp_location"; then
3465 if test x"$system_wtmp_path" = x"no" ; then
3466 for f in /usr/adm/wtmp /var/log/wtmp; do
3467 if test -f $f ; then
3468 conf_wtmp_location=$f
3469 fi
3470 done
3471 if test -z "$conf_wtmp_location"; then
3472 AC_DEFINE(DISABLE_WTMP)
3473 fi
3474 fi
3475fi
3476if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003477 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3478 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003479fi
andre2ff7b5d2000-06-03 14:57:40 +00003480
3481
3482dnl utmpx detection - I don't know any system so perverse as to require
3483dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3484dnl there, though.
3485AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3486AC_TRY_COMPILE([
3487#include <sys/types.h>
3488#include <utmp.h>
3489#ifdef HAVE_UTMPX_H
3490#include <utmpx.h>
3491#endif
Damien Miller2994e082000-06-04 15:51:47 +10003492#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003493# include <paths.h>
3494#endif
3495 ],
3496 [ char *utmpx = UTMPX_FILE; ],
3497 [ AC_MSG_RESULT(yes) ],
3498 [ AC_MSG_RESULT(no)
3499 system_utmpx_path=no ]
3500)
3501if test -z "$conf_utmpx_location"; then
3502 if test x"$system_utmpx_path" = x"no" ; then
3503 AC_DEFINE(DISABLE_UTMPX)
3504 fi
3505else
Tim Rice7df8d392005-09-19 09:33:39 -07003506 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3507 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003508fi
andre2ff7b5d2000-06-03 14:57:40 +00003509
3510dnl wtmpx detection
3511AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3512AC_TRY_COMPILE([
3513#include <sys/types.h>
3514#include <utmp.h>
3515#ifdef HAVE_UTMPX_H
3516#include <utmpx.h>
3517#endif
Damien Miller2994e082000-06-04 15:51:47 +10003518#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003519# include <paths.h>
3520#endif
3521 ],
3522 [ char *wtmpx = WTMPX_FILE; ],
3523 [ AC_MSG_RESULT(yes) ],
3524 [ AC_MSG_RESULT(no)
3525 system_wtmpx_path=no ]
3526)
3527if test -z "$conf_wtmpx_location"; then
3528 if test x"$system_wtmpx_path" = x"no" ; then
3529 AC_DEFINE(DISABLE_WTMPX)
3530 fi
3531else
Tim Rice7df8d392005-09-19 09:33:39 -07003532 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3533 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003534fi
andre2ff7b5d2000-06-03 14:57:40 +00003535
Damien Miller4018c192000-04-30 09:30:44 +10003536
Damien Miller29ea30d2000-03-17 10:54:15 +11003537if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003538 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3539 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003540fi
3541
Tim Rice4cec93f2002-02-26 08:40:48 -08003542dnl remove pam and dl because they are in $LIBPAM
3543if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003544 LIBS=`echo $LIBS | sed 's/-lpam //'`
3545fi
3546if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3547 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003548fi
3549
Darren Tucker7da23cb2005-08-03 00:20:15 +10003550dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3551dnl Add now.
3552CFLAGS="$CFLAGS $werror_flags"
3553
Damien Millerbac2d8a2000-09-05 16:13:06 +11003554AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003555AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3556 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003557AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003558
Damien Miller7b22d652000-06-18 14:07:04 +10003559# Print summary of options
3560
Damien Miller7b22d652000-06-18 14:07:04 +10003561# Someone please show me a better way :)
3562A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3563B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3564C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3565D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003566E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003567F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003568G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003569H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3570I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3571J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003572
3573echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003574echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003575echo " User binaries: $B"
3576echo " System binaries: $C"
3577echo " Configuration files: $D"
3578echo " Askpass program: $E"
3579echo " Manual pages: $F"
3580echo " PID file: $G"
3581echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003582if test "x$external_path_file" = "x/etc/login.conf" ; then
3583echo " At runtime, sshd will use the path defined in $external_path_file"
3584echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003585else
Damien Millerf58c6722002-05-13 13:15:42 +10003586echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003587 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003588echo " (If PATH is set in $external_path_file it will be used instead. If"
3589echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3590 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003591fi
Damien Millera18bbd32002-05-13 10:48:57 +10003592if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003593echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003594fi
Damien Millerf58c6722002-05-13 13:15:42 +10003595echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003596echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003597echo " KerberosV support: $KRB5_MSG"
3598echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003599echo " S/KEY support: $SKEY_MSG"
3600echo " TCP Wrappers support: $TCPW_MSG"
3601echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003602echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003603echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003604echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3605echo " BSD Auth support: $BSD_AUTH_MSG"
3606echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003607if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003608echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003609fi
3610
Damien Miller7b22d652000-06-18 14:07:04 +10003611echo ""
3612
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003613echo " Host: ${host}"
3614echo " Compiler: ${CC}"
3615echo " Compiler flags: ${CFLAGS}"
3616echo "Preprocessor flags: ${CPPFLAGS}"
3617echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003618echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003619
3620echo ""
3621
Tim Rice6f1f7582004-05-30 21:38:51 -07003622if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003623 echo "SVR4 style packages are supported with \"make package\""
3624 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003625fi
3626
Damien Miller82cf0ce2000-12-20 13:34:48 +11003627if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003628 echo "PAM is enabled. You may need to install a PAM control file "
3629 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003630 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003631 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003632 echo ""
3633fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003634
Damien Miller6c21c512002-01-22 21:57:53 +11003635if test ! -z "$RAND_HELPER_CMDHASH" ; then
3636 echo "WARNING: you are using the builtin random number collection "
3637 echo "service. Please read WARNING.RNG and request that your OS "
3638 echo "vendor includes kernel-based random number collection in "
3639 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003640 echo ""
3641fi
Damien Miller60396b02001-02-18 17:01:00 +11003642
Damien Millerb4097182004-05-23 14:09:40 +10003643if test ! -z "$NO_PEERCHECK" ; then
3644 echo "WARNING: the operating system that you are using does not "
3645 echo "appear to support either the getpeereid() API nor the "
3646 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3647 echo "enforce security checks to prevent unauthorised connections to "
3648 echo "ssh-agent. Their absence increases the risk that a malicious "
3649 echo "user can connect to your agent. "
3650 echo ""
3651fi
3652
Darren Tuckerd9f88912005-02-20 21:01:48 +11003653if test "$AUDIT_MODULE" = "bsm" ; then
3654 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3655 echo "See the Solaris section in README.platform for details."
3656fi