blob: bd0352a8a5f5317ad8c2b2ad7f12e934450106f1 [file] [log] [blame]
Darren Tucker9ac1a652005-10-09 11:40:03 +10001# $Id: configure.ac,v 1.301 2005/10/09 01:40:03 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070060 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
61 [If your header files don't define LOGIN_PROGRAM,
62 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100063else
64 # Search for login
65 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
66 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
67 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
68 fi
69fi
70
Darren Tucker23bc8d02004-02-06 16:24:31 +110071AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
72if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070073 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
74 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110075fi
76
Damien Miller166bd442000-03-16 10:48:25 +110077if test -z "$LD" ; then
78 LD=$CC
79fi
80AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080081
Damien Miller166bd442000-03-16 10:48:25 +110082AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100083
84AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
85
Damien Millera8e06ce2003-11-21 23:48:55 +110086if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100087 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Tim Rice3db1e3f2005-08-23 17:11:26 -070088 GCC_VER=`$CC --version`
89 case $GCC_VER in
90 1.*) ;;
91 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
92 2.*) ;;
93 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
94 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +100095
Darren Tucker67b37032005-06-03 17:58:31 +100096 if test -z "$have_llong_max"; then
97 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
98 unset ac_cv_have_decl_LLONG_MAX
99 saved_CFLAGS="$CFLAGS"
100 CFLAGS="$CFLAGS -std=gnu99"
101 AC_CHECK_DECL(LLONG_MAX,
102 [have_llong_max=1],
103 [CFLAGS="$saved_CFLAGS"],
104 [#include <limits.h>]
105 )
106 fi
Damien Miller166bd442000-03-16 10:48:25 +1100107fi
108
Darren Tucker431f0222005-06-07 17:53:40 +1000109if test -z "$have_llong_max"; then
110 AC_MSG_CHECKING([for max value of long long])
111 AC_RUN_IFELSE(
112 [AC_LANG_SOURCE([[
113#include <stdio.h>
114/* Why is this so damn hard? */
115#ifdef __GNUC__
116# undef __GNUC__
117#endif
118#define __USE_ISOC99
119#include <limits.h>
120#define DATA "conftest.llminmax"
121int main(void) {
122 FILE *f;
123 long long i, llmin, llmax = 0;
124
125 if((f = fopen(DATA,"w")) == NULL)
126 exit(1);
127
128#if defined(LLONG_MIN) && defined(LLONG_MAX)
129 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
130 llmin = LLONG_MIN;
131 llmax = LLONG_MAX;
132#else
133 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
134 /* This will work on one's complement and two's complement */
135 for (i = 1; i > llmax; i <<= 1, i++)
136 llmax = i;
137 llmin = llmax + 1LL; /* wrap */
138#endif
139
140 /* Sanity check */
141 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
142 || llmax - 1 > llmax) {
143 fprintf(f, "unknown unknown\n");
144 exit(2);
145 }
146
147 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
148 exit(3);
149
150 exit(0);
151}
152 ]])],
153 [
154 llong_min=`$AWK '{print $1}' conftest.llminmax`
155 llong_max=`$AWK '{print $2}' conftest.llminmax`
156 AC_MSG_RESULT($llong_max)
157 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
158 [max value of long long calculated by configure])
159 AC_MSG_CHECKING([for min value of long long])
160 AC_MSG_RESULT($llong_min)
161 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
162 [min value of long long calculated by configure])
163 ],
164 [
165 AC_MSG_RESULT(not found)
166 ],
167 [
168 AC_MSG_WARN([cross compiling: not checking])
169 ]
170 )
171fi
172
Tim Rice88368a32003-12-08 12:35:59 -0800173AC_ARG_WITH(rpath,
174 [ --without-rpath Disable auto-added -R linker paths],
175 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800176 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800177 need_dash_r=""
178 fi
179 if test "x$withval" = "xyes" ; then
180 need_dash_r=1
181 fi
182 ]
183)
184
Damien Millera22ba012000-03-02 23:09:20 +1100185# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100186case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100187*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100188 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000189 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800190 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100191 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000192 saved_LDFLAGS="$LDFLAGS"
193 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
194 if (test -z "$blibflags"); then
195 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
196 AC_TRY_LINK([], [], [blibflags=$tryflags])
197 fi
198 done
199 if (test -z "$blibflags"); then
200 AC_MSG_RESULT(not found)
201 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
202 else
203 AC_MSG_RESULT($blibflags)
204 fi
205 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000206 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700207 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
208 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700209 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000210 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700211 LIBS="$LIBS -ls"
212 ])
213 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100214 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100215 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100216 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000217 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100218 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000219 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
220 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000221 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000222 [(void)loginfailed("user","host","tty",0);],
223 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700224 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
225 [Define if your AIX loginfailed() function
226 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000227 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000228 )],
229 [],
230 [#include <usersec.h>]
231 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000232 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100233 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700234 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
235 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
236 [Define if your platform breaks doing a seteuid before a setuid])
237 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
238 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000239 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700240 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
241 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
242 [Some systems need a utmpx entry for /bin/login to work])
243 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
244 [Define to a Set Process Title type if your system is
245 supported by bsd-setproctitle.c])
Damien Miller75b1d102000-01-07 14:01:41 +1100246 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100247*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100248 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800249 LIBS="$LIBS /usr/lib/textmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700250 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
251 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
252 AC_DEFINE(DISABLE_SHADOW, 1,
253 [Define if you want to disable shadow passwords])
254 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
255 [Define if your system choked on IP TOS setting])
256 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
257 [Define if X11 doesn't support AF_UNIX sockets on that system])
258 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
259 [Define if the concept of ports only accessible to
260 superusers isn't known])
261 AC_DEFINE(DISABLE_FD_PASSING, 1,
262 [Define if your platform needs to skip post auth
263 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100264 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000265*-*-dgux*)
266 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100267 AC_DEFINE(SETEUID_BREAKS_SETUID)
268 AC_DEFINE(BROKEN_SETREUID)
269 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000270 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000271*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000272 AC_MSG_CHECKING(if we have working getaddrinfo)
273 AC_TRY_RUN([#include <mach-o/dyld.h>
274main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
275 exit(0);
276 else
277 exit(1);
278}], [AC_MSG_RESULT(working)],
279 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700280 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700281 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000282 AC_DEFINE(SETEUID_BREAKS_SETUID)
283 AC_DEFINE(BROKEN_SETREUID)
284 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700285 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
286 [Define if your resolver libs need this for getrrsetbyname])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000287 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000288*-*-hpux*)
289 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000290 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100291 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000292 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700293 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
294 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000295 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700296 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
297 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000298 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000299 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700300 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000301 AC_CHECK_LIB(xnet, t_error, ,
302 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
303
304 # next, we define all of the options specific to major releases
305 case "$host" in
306 *-*-hpux10*)
307 if test -z "$GCC"; then
308 CFLAGS="$CFLAGS -Ae"
309 fi
310 ;;
311 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700312 AC_DEFINE(PAM_SUN_CODEBASE, 1,
313 [Define if you are using Solaris-derived PAM which
314 passes pam_messages to the conversation function
315 with an extra level of indirection])
316 AC_DEFINE(DISABLE_UTMP, 1,
317 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000318 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
319 check_for_hpux_broken_getaddrinfo=1
320 check_for_conflicting_getspnam=1
321 ;;
322 esac
323
324 # lastly, we define options specific to minor releases
325 case "$host" in
326 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700327 AC_DEFINE(HAVE_SECUREWARE, 1,
328 [Define if you have SecureWare-based
329 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000330 disable_ptmx_check=yes
331 LIBS="$LIBS -lsecpw"
332 ;;
333 esac
Damien Miller1bead332000-04-30 00:47:29 +1000334 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100335*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100336 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700337 AC_DEFINE(BROKEN_INET_NTOA, 1,
338 [Define if you system's inet_ntoa is busted
339 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000340 AC_DEFINE(SETEUID_BREAKS_SETUID)
341 AC_DEFINE(BROKEN_SETREUID)
342 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700343 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
344 [Define if you shouldn't strip 'tty' from your
345 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000346 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100347 ;;
348*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100349 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700350 AC_DEFINE(WITH_IRIX_ARRAY, 1,
351 [Define if you have/want arrays
352 (cluster-wide session managment, not C arrays)])
353 AC_DEFINE(WITH_IRIX_PROJECT, 1,
354 [Define if you want IRIX project management])
355 AC_DEFINE(WITH_IRIX_AUDIT, 1,
356 [Define if you want IRIX audit trails])
357 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
358 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000359 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000360 AC_DEFINE(SETEUID_BREAKS_SETUID)
361 AC_DEFINE(BROKEN_SETREUID)
362 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700363 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000364 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000365 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100366 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100367*-*-linux*)
368 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100369 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000370 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700371 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
372 AC_DEFINE(PAM_TTY_KLUDGE, 1,
373 [Work around problematic Linux PAM modules handling of PAM_TTY])
374 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
375 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000376 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700377 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
378 [Define to whatever link() returns for "not supported"
379 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100380 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700381 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100382 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000383 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000384 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700385 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
386 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000387 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000388 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100389 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000390mips-sony-bsd|mips-sony-newsos4)
Tim Rice7df8d392005-09-19 09:33:39 -0700391 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000392 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000393 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100394*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000395 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800396 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800397 need_dash_r=1
398 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100399 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100400*-*-freebsd*)
401 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000402 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Millerfbd884a2001-02-27 08:39:07 +1100403 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000404*-*-bsdi*)
405 AC_DEFINE(SETEUID_BREAKS_SETUID)
406 AC_DEFINE(BROKEN_SETREUID)
407 AC_DEFINE(BROKEN_SETREGID)
408 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000409*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000410 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100411 conf_utmp_location=/etc/utmp
412 conf_wtmp_location=/usr/adm/wtmp
413 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700414 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000415 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000416 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700417 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000418 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000419*-*-openbsd*)
420 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000421 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Darren Tucker4a422572005-07-14 17:22:11 +1000422 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100423*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800424 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800425 need_dash_r=1
426 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100427 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000428 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700429 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
430 [Some versions of /bin/login need the TERM supplied
431 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000432 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700433 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
434 [Define if pam_chauthtok wants real uid set
435 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000436 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000437 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700438 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
439 [Define if sshd somehow reacquires a controlling TTY
440 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000441 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000442 # hardwire lastlog location (can't detect it on some versions)
443 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000444 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
445 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
446 if test "$sol2ver" -ge 8; then
447 AC_MSG_RESULT(yes)
448 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700449 AC_DEFINE(DISABLE_WTMP, 1,
450 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000451 else
452 AC_MSG_RESULT(no)
453 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100454 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000455*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000456 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000457 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100458 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000459 conf_utmp_location=/etc/utmp
460 conf_wtmp_location=/var/adm/wtmp
461 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000462 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000463 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000464*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700465 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000466 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000467 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000468 AC_DEFINE(SETEUID_BREAKS_SETUID)
469 AC_DEFINE(BROKEN_SETREUID)
470 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000471 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000472*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700473 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000474 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100475 # -lresolv needs to be at then end of LIBS or DNS lookups break
476 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100477 IPADDR_IN_DISPLAY=yes
478 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000479 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000480 AC_DEFINE(SETEUID_BREAKS_SETUID)
481 AC_DEFINE(BROKEN_SETREUID)
482 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000483 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000484 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700485 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
486 # Attention: always take care to bind libsocket and libnsl before libc,
487 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000488 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800489# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100490*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100491 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700492 AC_DEFINE(SETEUID_BREAKS_SETUID)
493 AC_DEFINE(BROKEN_SETREUID)
494 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700495 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100496 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800497# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100498*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700499 check_for_libcrypt_later=1
500 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100501 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700502 AC_DEFINE(SETEUID_BREAKS_SETUID)
503 AC_DEFINE(BROKEN_SETREUID)
504 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700505 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700506 case "$host" in
507 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
508 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700509 AC_DEFINE(BROKEN_LIBIAF, 1,
510 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700511 ;;
512 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100513 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100514*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100515 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800516# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100517*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800518 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100519 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800520# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100521*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800522 if test -z "$GCC"; then
523 CFLAGS="$CFLAGS -belf"
524 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100525 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000526 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100527 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000528 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000529 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700530 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700531 AC_DEFINE(SETEUID_BREAKS_SETUID)
532 AC_DEFINE(BROKEN_SETREUID)
533 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700534 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700535 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700536 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100537 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700538 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700539 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000540 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000541*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700542 AC_DEFINE(NO_SSH_LASTLOG, 1,
543 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100544 AC_DEFINE(SETEUID_BREAKS_SETUID)
545 AC_DEFINE(BROKEN_SETREUID)
546 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000547 AC_DEFINE(USE_PIPES)
548 AC_DEFINE(DISABLE_FD_PASSING)
549 LDFLAGS="$LDFLAGS"
550 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
551 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000552 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000553*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100554 AC_DEFINE(SETEUID_BREAKS_SETUID)
555 AC_DEFINE(BROKEN_SETREUID)
556 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000557 AC_DEFINE(WITH_ABBREV_NO_TTY)
558 AC_DEFINE(USE_PIPES)
559 AC_DEFINE(DISABLE_FD_PASSING)
560 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100561 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000562 MANTYPE=cat
563 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000564*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100565 AC_DEFINE(SETEUID_BREAKS_SETUID)
566 AC_DEFINE(BROKEN_SETREUID)
567 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000568 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700569 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700570 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000571 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
572 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
573 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700574 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000575*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000576 AC_MSG_CHECKING(for Digital Unix SIA)
577 no_osfsia=""
578 AC_ARG_WITH(osfsia,
579 [ --with-osfsia Enable Digital Unix SIA],
580 [
581 if test "x$withval" = "xno" ; then
582 AC_MSG_RESULT(disabled)
583 no_osfsia=1
584 fi
585 ],
586 )
587 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000588 if test -f /etc/sia/matrix.conf; then
589 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700590 AC_DEFINE(HAVE_OSF_SIA, 1,
591 [Define if you have Digital Unix Security
592 Integration Architecture])
593 AC_DEFINE(DISABLE_LOGIN, 1,
594 [Define if you don't want to use your
595 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000596 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000597 LIBS="$LIBS -lsecurity -ldb -lm -laud"
598 else
599 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700600 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
601 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000602 fi
603 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000604 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700605 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000606 AC_DEFINE(BROKEN_SETREUID)
607 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000608 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000609
610*-*-nto-qnx)
611 AC_DEFINE(USE_PIPES)
612 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700613 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
614 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
615 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000616 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000617
618*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700619 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
620 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
621 AC_DEFINE(NEED_SETPRGP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700622 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
623 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000624
625*-*-lynxos)
626 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700627 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000628 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
629 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100630esac
631
Damien Millere37bfc12000-06-05 09:37:43 +1000632# Allow user to specify flags
633AC_ARG_WITH(cflags,
634 [ --with-cflags Specify additional flags to pass to compiler],
635 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800636 if test -n "$withval" && test "x$withval" != "xno" && \
637 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000638 CFLAGS="$CFLAGS $withval"
639 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800640 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000641)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000642AC_ARG_WITH(cppflags,
643 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
644 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800645 if test -n "$withval" && test "x$withval" != "xno" && \
646 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000647 CPPFLAGS="$CPPFLAGS $withval"
648 fi
649 ]
650)
Damien Millere37bfc12000-06-05 09:37:43 +1000651AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000652 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000653 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800654 if test -n "$withval" && test "x$withval" != "xno" && \
655 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000656 LDFLAGS="$LDFLAGS $withval"
657 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800658 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000659)
660AC_ARG_WITH(libs,
661 [ --with-libs Specify additional libraries to link with],
662 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800663 if test -n "$withval" && test "x$withval" != "xno" && \
664 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000665 LIBS="$LIBS $withval"
666 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800667 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000668)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000669AC_ARG_WITH(Werror,
670 [ --with-Werror Build main code with -Werror],
671 [
672 if test -n "$withval" && test "x$withval" != "xno"; then
673 werror_flags="-Werror"
Damien Millere04ec6f2005-10-08 16:21:19 +1000674 if test "x${withval}" != "xyes"; then
Darren Tucker7da23cb2005-08-03 00:20:15 +1000675 werror_flags="$withval"
676 fi
677 fi
678 ]
679)
Damien Millere37bfc12000-06-05 09:37:43 +1000680
Darren Tucker6eb93042003-06-29 21:30:41 +1000681AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000682AC_RUN_IFELSE(
683 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000684#include <stdio.h>
685int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000686 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000687 [ AC_MSG_RESULT(yes) ],
688 [
689 AC_MSG_RESULT(no)
690 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000691 ],
692 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000693)
694
Darren Tucker0c9653f2005-05-28 15:58:14 +1000695dnl Checks for header files.
696AC_CHECK_HEADERS( \
697 bstring.h \
698 crypt.h \
699 dirent.h \
700 endian.h \
701 features.h \
702 floatingpoint.h \
703 getopt.h \
704 glob.h \
705 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700706 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000707 lastlog.h \
708 limits.h \
709 login.h \
710 login_cap.h \
711 maillock.h \
712 ndir.h \
713 netdb.h \
714 netgroup.h \
715 netinet/in_systm.h \
716 pam/pam_appl.h \
717 paths.h \
718 pty.h \
719 readpassphrase.h \
720 rpc/types.h \
721 security/pam_appl.h \
722 shadow.h \
723 stddef.h \
724 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000725 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000726 strings.h \
727 sys/audit.h \
728 sys/bitypes.h \
729 sys/bsdtty.h \
730 sys/cdefs.h \
731 sys/dir.h \
732 sys/mman.h \
733 sys/ndir.h \
734 sys/prctl.h \
735 sys/pstat.h \
736 sys/select.h \
737 sys/stat.h \
738 sys/stream.h \
739 sys/stropts.h \
740 sys/strtio.h \
741 sys/sysmacros.h \
742 sys/time.h \
743 sys/timers.h \
744 sys/un.h \
745 time.h \
746 tmpdir.h \
747 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000748 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000749 usersec.h \
750 util.h \
751 utime.h \
752 utmp.h \
753 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000754 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000755)
Tim Rice4cec93f2002-02-26 08:40:48 -0800756
Darren Tucker48d99d32004-08-29 17:04:50 +1000757# sys/ptms.h requires sys/stream.h to be included first on Solaris
758AC_CHECK_HEADERS(sys/ptms.h, [], [], [
759#ifdef HAVE_SYS_STREAM_H
760# include <sys/stream.h>
761#endif
762])
763
Damien Millera22ba012000-03-02 23:09:20 +1100764# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700765AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
766AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000767
Tim Rice1e1ef642003-09-11 22:19:31 -0700768dnl IRIX and Solaris 2.5.1 have dirname() in libgen
769AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
770 AC_CHECK_LIB(gen, dirname,[
771 AC_CACHE_CHECK([for broken dirname],
772 ac_cv_have_broken_dirname, [
773 save_LIBS="$LIBS"
774 LIBS="$LIBS -lgen"
775 AC_TRY_RUN(
776 [
777#include <libgen.h>
778#include <string.h>
779
780int main(int argc, char **argv) {
781 char *s, buf[32];
782
783 strncpy(buf,"/etc", 32);
784 s = dirname(buf);
785 if (!s || strncmp(s, "/", 32) != 0) {
786 exit(1);
787 } else {
788 exit(0);
789 }
790}
791 ],
792 [ ac_cv_have_broken_dirname="no" ],
793 [ ac_cv_have_broken_dirname="yes" ]
794 )
795 LIBS="$save_LIBS"
796 ])
797 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
798 LIBS="$LIBS -lgen"
799 AC_DEFINE(HAVE_DIRNAME)
800 AC_CHECK_HEADERS(libgen.h)
801 fi
802 ])
803])
804
805AC_CHECK_FUNC(getspnam, ,
806 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700807AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
808 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700809
Tim Rice13aae5e2001-10-21 17:53:58 -0700810dnl zlib is required
811AC_ARG_WITH(zlib,
812 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100813 [ if test "x$withval" = "xno" ; then
814 AC_MSG_ERROR([*** zlib is required ***])
815 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700816 if test -d "$withval/lib"; then
817 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700818 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700819 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700820 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700821 fi
822 else
823 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700824 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700825 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700826 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700827 fi
828 fi
829 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700830 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700831 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700832 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700833 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100834 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700835)
836
Tim Ricefcb62202004-01-23 18:35:16 -0800837AC_CHECK_LIB(z, deflate, ,
838 [
839 saved_CPPFLAGS="$CPPFLAGS"
840 saved_LDFLAGS="$LDFLAGS"
841 save_LIBS="$LIBS"
842 dnl Check default zlib install dir
843 if test -n "${need_dash_r}"; then
844 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
845 else
846 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
847 fi
848 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
849 LIBS="$LIBS -lz"
850 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
851 [
852 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
853 ]
854 )
855 ]
856)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100857AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100858
859AC_ARG_WITH(zlib-version-check,
860 [ --without-zlib-version-check Disable zlib version check],
861 [ if test "x$withval" = "xno" ; then
862 zlib_check_nonfatal=1
863 fi
864 ]
865)
866
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000867AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000868AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000869#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100870#include <zlib.h>
871int main()
872{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000873 int a=0, b=0, c=0, d=0, n, v;
874 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
875 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100876 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000877 v = a*1000000 + b*10000 + c*100 + d;
878 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
879
880 /* 1.1.4 is OK */
881 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100882 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000883
Darren Tucker41097ed2005-07-25 15:24:21 +1000884 /* 1.2.3 and up are OK */
885 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000886 exit(0);
887
Darren Tucker2dcd2392004-01-23 17:13:33 +1100888 exit(2);
889}
Darren Tucker623d92f2004-09-12 22:36:15 +1000890 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000891 AC_MSG_RESULT(no),
892 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100893 if test -z "$zlib_check_nonfatal" ; then
894 AC_MSG_ERROR([*** zlib too old - check config.log ***
895Your reported zlib version has known security problems. It's possible your
896vendor has fixed these problems without changing the version number. If you
897are sure this is the case, you can disable the check by running
898"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000899If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000900See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100901 else
902 AC_MSG_WARN([zlib version may have security problems])
903 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000904 ],
905 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100906)
Damien Miller6f9c3372000-10-25 10:06:04 +1100907
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000908dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100909AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000910 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
911)
Damien Millera8e06ce2003-11-21 23:48:55 +1100912AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700913 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
914 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000915)
Damien Millerab18c411999-11-11 10:40:23 +1100916
Tim Ricee589a292001-11-03 11:09:32 -0800917dnl Checks for libutil functions
918AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700919AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
920 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800921AC_CHECK_FUNCS(logout updwtmp logwtmp)
922
Ben Lindstrom8697e082001-02-24 21:41:10 +0000923AC_FUNC_STRFTIME
924
Damien Miller3c027682001-03-14 11:39:45 +1100925# Check for ALTDIRFUNC glob() extension
926AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
927AC_EGREP_CPP(FOUNDIT,
928 [
929 #include <glob.h>
930 #ifdef GLOB_ALTDIRFUNC
931 FOUNDIT
932 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100933 ],
Damien Miller3c027682001-03-14 11:39:45 +1100934 [
Tim Rice7df8d392005-09-19 09:33:39 -0700935 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
936 [Define if your system glob() function has
937 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100938 AC_MSG_RESULT(yes)
939 ],
940 [
941 AC_MSG_RESULT(no)
942 ]
943)
Damien Millerab18c411999-11-11 10:40:23 +1100944
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000945# Check for g.gl_matchc glob() extension
946AC_MSG_CHECKING(for gl_matchc field in glob_t)
947AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100948 [
949 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000950 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100951 ],
952 [
Tim Rice7df8d392005-09-19 09:33:39 -0700953 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
954 [Define if your system glob() function has
955 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100956 AC_MSG_RESULT(yes)
957 ],
958 [
959 AC_MSG_RESULT(no)
960 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000961)
962
Damien Miller18bb4732001-03-28 14:35:30 +1000963AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000964AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000965 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000966#include <sys/types.h>
967#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700968int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000969 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100970 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000971 [
972 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700973 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
974 [Define in your struct dirent expects you to
975 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000976 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800977 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000978 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
979 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000980 ]
981)
982
Damien Miller36f49652004-08-15 18:40:59 +1000983AC_MSG_CHECKING([for /proc/pid/fd directory])
984if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700985 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000986 AC_MSG_RESULT(yes)
987else
988 AC_MSG_RESULT(no)
989fi
990
Damien Millerc547bf12001-02-16 10:18:12 +1100991# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100992SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100993AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100994 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100995 [
996 if test "x$withval" != "xno" ; then
997
998 if test "x$withval" != "xyes" ; then
999 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1000 LDFLAGS="$LDFLAGS -L${withval}/lib"
1001 fi
1002
Tim Rice7df8d392005-09-19 09:33:39 -07001003 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001004 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001005 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001006
Tim Rice4cec93f2002-02-26 08:40:48 -08001007 AC_MSG_CHECKING([for s/key support])
1008 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +11001009 [
Tim Rice4cec93f2002-02-26 08:40:48 -08001010#include <stdio.h>
1011#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001012int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -08001013 ],
1014 [AC_MSG_RESULT(yes)],
1015 [
1016 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001017 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1018 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001019 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1020 AC_TRY_COMPILE(
1021 [#include <stdio.h>
1022 #include <skey.h>],
1023 [(void)skeychallenge(NULL,"name","",0);],
1024 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001025 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1026 [Define if your skeychallenge()
1027 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001028 [AC_MSG_RESULT(no)]
1029 )
Damien Millerc547bf12001-02-16 10:18:12 +11001030 fi
1031 ]
1032)
1033
1034# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001035TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001036AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001037 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001038 [
1039 if test "x$withval" != "xno" ; then
1040 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001041 saved_LDFLAGS="$LDFLAGS"
1042 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001043 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001044 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001045 if test -d "${withval}/lib"; then
1046 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001047 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001048 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001049 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001050 fi
1051 else
1052 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001053 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001054 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001055 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001056 fi
1057 fi
1058 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001059 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001060 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001061 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001062 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001063 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001064 LIBWRAP="-lwrap"
1065 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001066 AC_MSG_CHECKING(for libwrap)
1067 AC_TRY_LINK(
1068 [
Damien Miller0ac45002004-04-14 20:14:26 +10001069#include <sys/types.h>
1070#include <sys/socket.h>
1071#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001072#include <tcpd.h>
1073 int deny_severity = 0, allow_severity = 0;
1074 ],
1075 [hosts_access(0);],
1076 [
1077 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001078 AC_DEFINE(LIBWRAP, 1,
1079 [Define if you want
1080 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001081 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001082 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001083 ],
1084 [
1085 AC_MSG_ERROR([*** libwrap missing])
1086 ]
1087 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001088 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001089 fi
1090 ]
1091)
1092
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001093# Check whether user wants libedit support
1094LIBEDIT_MSG="no"
1095AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001096 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001097 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001098 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001099 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1100 if test -n "${need_dash_r}"; then
1101 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1102 else
1103 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1104 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001105 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001106 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001107 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001108 LIBEDIT="-ledit -lcurses"
1109 LIBEDIT_MSG="yes"
1110 AC_SUBST(LIBEDIT)
1111 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001112 [ AC_MSG_ERROR(libedit not found) ],
1113 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001114 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001115 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001116 AC_COMPILE_IFELSE(
1117 [AC_LANG_SOURCE([[
1118#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001119int main(void)
1120{
1121 int i = H_SETSIZE;
1122 el_init("", NULL, NULL, NULL);
1123 exit(0);
1124}
Tim Ricec1819c82005-08-15 17:48:40 -07001125 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001126 [ AC_MSG_RESULT(yes) ],
1127 [ AC_MSG_RESULT(no)
1128 AC_MSG_ERROR(libedit version is not compatible) ]
1129 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001130 fi ]
1131)
1132
Darren Tuckerd9f88912005-02-20 21:01:48 +11001133AUDIT_MODULE=none
1134AC_ARG_WITH(audit,
1135 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1136 [
1137 AC_MSG_CHECKING(for supported audit module)
1138 case "$withval" in
1139 bsm)
1140 AC_MSG_RESULT(bsm)
1141 AUDIT_MODULE=bsm
1142 dnl Checks for headers, libs and functions
1143 AC_CHECK_HEADERS(bsm/audit.h, [],
1144 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1145 AC_CHECK_LIB(bsm, getaudit, [],
1146 [AC_MSG_ERROR(BSM enabled and required library not found)])
1147 AC_CHECK_FUNCS(getaudit, [],
1148 [AC_MSG_ERROR(BSM enabled and required function not found)])
1149 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001150 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001151 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001152 ;;
1153 debug)
1154 AUDIT_MODULE=debug
1155 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001156 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001157 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001158 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001159 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001160 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001161 *)
1162 AC_MSG_ERROR([Unknown audit module $withval])
1163 ;;
1164 esac ]
1165)
1166
Damien Millerfe1f1432003-02-24 15:45:42 +11001167dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001168AC_CHECK_FUNCS( \
1169 arc4random \
1170 b64_ntop \
1171 __b64_ntop \
1172 b64_pton \
1173 __b64_pton \
1174 bcopy \
1175 bindresvport_sa \
1176 clock \
1177 closefrom \
1178 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001179 fchmod \
1180 fchown \
1181 freeaddrinfo \
1182 futimes \
1183 getaddrinfo \
1184 getcwd \
1185 getgrouplist \
1186 getnameinfo \
1187 getopt \
1188 getpeereid \
1189 _getpty \
1190 getrlimit \
1191 getttyent \
1192 glob \
1193 inet_aton \
1194 inet_ntoa \
1195 inet_ntop \
1196 innetgr \
1197 login_getcapbool \
1198 md5_crypt \
1199 memmove \
1200 mkdtemp \
1201 mmap \
1202 ngetaddrinfo \
1203 nsleep \
1204 ogetaddrinfo \
1205 openlog_r \
1206 openpty \
1207 prctl \
1208 pstat \
1209 readpassphrase \
1210 realpath \
1211 recvmsg \
1212 rresvport_af \
1213 sendmsg \
1214 setdtablesize \
1215 setegid \
1216 setenv \
1217 seteuid \
1218 setgroups \
1219 setlogin \
1220 setpcred \
1221 setproctitle \
1222 setregid \
1223 setreuid \
1224 setrlimit \
1225 setsid \
1226 setvbuf \
1227 sigaction \
1228 sigvec \
1229 snprintf \
1230 socketpair \
1231 strdup \
1232 strerror \
1233 strlcat \
1234 strlcpy \
1235 strmode \
1236 strnvis \
1237 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001238 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001239 strtoul \
1240 sysconf \
1241 tcgetpgrp \
1242 truncate \
1243 unsetenv \
1244 updwtmpx \
1245 utimes \
1246 vhangup \
1247 vsnprintf \
1248 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001249)
Tim Rice13aae5e2001-10-21 17:53:58 -07001250
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001251# IRIX has a const char return value for gai_strerror()
1252AC_CHECK_FUNCS(gai_strerror,[
1253 AC_DEFINE(HAVE_GAI_STRERROR)
1254 AC_TRY_COMPILE([
1255#include <sys/types.h>
1256#include <sys/socket.h>
1257#include <netdb.h>
1258
1259const char *gai_strerror(int);],[
1260char *str;
1261
1262str = gai_strerror(0);],[
1263 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1264 [Define if gai_strerror() returns const char *])])])
1265
Tim Rice7df8d392005-09-19 09:33:39 -07001266AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1267 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001268
Darren Tuckerf1159b52003-07-07 19:44:01 +10001269dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001270AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001271AC_CHECK_DECL(strsep,
1272 [AC_CHECK_FUNCS(strsep)],
1273 [],
1274 [
1275#ifdef HAVE_STRING_H
1276# include <string.h>
1277#endif
1278 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001279
Darren Tuckerb2427c82003-09-10 15:22:44 +10001280dnl tcsendbreak might be a macro
1281AC_CHECK_DECL(tcsendbreak,
1282 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001283 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001284 [#include <termios.h>]
1285)
1286
Darren Tucker5bb14002004-04-23 18:53:10 +10001287AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1288
Darren Tucker2a6b0292003-12-31 14:59:17 +11001289AC_CHECK_FUNCS(setresuid, [
1290 dnl Some platorms have setresuid that isn't implemented, test for this
1291 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001292 AC_RUN_IFELSE(
1293 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001294#include <stdlib.h>
1295#include <errno.h>
1296int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001297 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001298 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001299 [AC_DEFINE(BROKEN_SETRESUID, 1,
1300 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001301 AC_MSG_RESULT(not implemented)],
1302 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001303 )
1304])
Darren Tuckere937be32003-12-17 18:53:26 +11001305
Darren Tucker2a6b0292003-12-31 14:59:17 +11001306AC_CHECK_FUNCS(setresgid, [
1307 dnl Some platorms have setresgid that isn't implemented, test for this
1308 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001309 AC_RUN_IFELSE(
1310 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001311#include <stdlib.h>
1312#include <errno.h>
1313int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001314 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001315 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001316 [AC_DEFINE(BROKEN_SETRESGID, 1,
1317 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001318 AC_MSG_RESULT(not implemented)],
1319 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001320 )
1321])
Darren Tuckere937be32003-12-17 18:53:26 +11001322
Damien Millerad833b32000-08-23 10:46:23 +10001323dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001324AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001325dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001326AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001327AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001328dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001329AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001330AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001331
Damien Millera8e06ce2003-11-21 23:48:55 +11001332AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001333 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1334 [AC_CHECK_LIB(bsd, daemon,
1335 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001336)
1337
Damien Millera8e06ce2003-11-21 23:48:55 +11001338AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001339 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1340 [Define if your libraries define getpagesize()])],
1341 [AC_CHECK_LIB(ucb, getpagesize,
1342 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001343)
1344
Damien Millercb170cb2000-07-01 16:52:55 +10001345# Check for broken snprintf
1346if test "x$ac_cv_func_snprintf" = "xyes" ; then
1347 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001348 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001349 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001350#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001351int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001352 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001353 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001354 [
1355 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001356 AC_DEFINE(BROKEN_SNPRINTF, 1,
1357 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001358 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001359 ],
1360 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001361 )
1362fi
1363
Damien Millerb4097182004-05-23 14:09:40 +10001364# Check for missing getpeereid (or equiv) support
1365NO_PEERCHECK=""
1366if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1367 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1368 AC_TRY_COMPILE(
1369 [#include <sys/types.h>
1370 #include <sys/socket.h>],
1371 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001372 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001373 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001374 ],
Damien Millerb4097182004-05-23 14:09:40 +10001375 [AC_MSG_RESULT(no)
1376 NO_PEERCHECK=1]
1377 )
1378fi
1379
Damien Millere8328192003-01-07 15:18:32 +11001380dnl see whether mkstemp() requires XXXXXX
1381if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1382AC_MSG_CHECKING([for (overly) strict mkstemp])
1383AC_TRY_RUN(
1384 [
1385#include <stdlib.h>
1386main() { char template[]="conftest.mkstemp-test";
1387if (mkstemp(template) == -1)
1388 exit(1);
1389unlink(template); exit(0);
1390}
1391 ],
1392 [
1393 AC_MSG_RESULT(no)
1394 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001395 [
Damien Millere8328192003-01-07 15:18:32 +11001396 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001397 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001398 ],
1399 [
1400 AC_MSG_RESULT(yes)
1401 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001402 ]
Damien Millere8328192003-01-07 15:18:32 +11001403)
1404fi
1405
Darren Tucker70a3d552003-08-21 17:58:29 +10001406dnl make sure that openpty does not reacquire controlling terminal
1407if test ! -z "$check_for_openpty_ctty_bug"; then
1408 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1409 AC_TRY_RUN(
1410 [
1411#include <stdio.h>
1412#include <sys/fcntl.h>
1413#include <sys/types.h>
1414#include <sys/wait.h>
1415
1416int
1417main()
1418{
1419 pid_t pid;
1420 int fd, ptyfd, ttyfd, status;
1421
1422 pid = fork();
1423 if (pid < 0) { /* failed */
1424 exit(1);
1425 } else if (pid > 0) { /* parent */
1426 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001427 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001428 exit(WEXITSTATUS(status));
1429 else
1430 exit(2);
1431 } else { /* child */
1432 close(0); close(1); close(2);
1433 setsid();
1434 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1435 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1436 if (fd >= 0)
1437 exit(3); /* Acquired ctty: broken */
1438 else
1439 exit(0); /* Did not acquire ctty: OK */
1440 }
1441}
1442 ],
1443 [
1444 AC_MSG_RESULT(yes)
1445 ],
1446 [
1447 AC_MSG_RESULT(no)
1448 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1449 ]
1450 )
1451fi
1452
Tim Rice8bb561b2005-03-17 16:23:19 -08001453if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1454 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001455 AC_MSG_CHECKING(if getaddrinfo seems to work)
1456 AC_TRY_RUN(
1457 [
1458#include <stdio.h>
1459#include <sys/socket.h>
1460#include <netdb.h>
1461#include <errno.h>
1462#include <netinet/in.h>
1463
1464#define TEST_PORT "2222"
1465
1466int
1467main(void)
1468{
1469 int err, sock;
1470 struct addrinfo *gai_ai, *ai, hints;
1471 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1472
1473 memset(&hints, 0, sizeof(hints));
1474 hints.ai_family = PF_UNSPEC;
1475 hints.ai_socktype = SOCK_STREAM;
1476 hints.ai_flags = AI_PASSIVE;
1477
1478 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1479 if (err != 0) {
1480 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1481 exit(1);
1482 }
1483
1484 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1485 if (ai->ai_family != AF_INET6)
1486 continue;
1487
1488 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1489 sizeof(ntop), strport, sizeof(strport),
1490 NI_NUMERICHOST|NI_NUMERICSERV);
1491
1492 if (err != 0) {
1493 if (err == EAI_SYSTEM)
1494 perror("getnameinfo EAI_SYSTEM");
1495 else
1496 fprintf(stderr, "getnameinfo failed: %s\n",
1497 gai_strerror(err));
1498 exit(2);
1499 }
1500
1501 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1502 if (sock < 0)
1503 perror("socket");
1504 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1505 if (errno == EBADF)
1506 exit(3);
1507 }
1508 }
1509 exit(0);
1510}
1511 ],
1512 [
1513 AC_MSG_RESULT(yes)
1514 ],
1515 [
1516 AC_MSG_RESULT(no)
1517 AC_DEFINE(BROKEN_GETADDRINFO)
1518 ]
1519 )
1520fi
1521
Tim Rice8bb561b2005-03-17 16:23:19 -08001522if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1523 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001524 AC_MSG_CHECKING(if getaddrinfo seems to work)
1525 AC_TRY_RUN(
1526 [
1527#include <stdio.h>
1528#include <sys/socket.h>
1529#include <netdb.h>
1530#include <errno.h>
1531#include <netinet/in.h>
1532
1533#define TEST_PORT "2222"
1534
1535int
1536main(void)
1537{
1538 int err, sock;
1539 struct addrinfo *gai_ai, *ai, hints;
1540 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1541
1542 memset(&hints, 0, sizeof(hints));
1543 hints.ai_family = PF_UNSPEC;
1544 hints.ai_socktype = SOCK_STREAM;
1545 hints.ai_flags = AI_PASSIVE;
1546
1547 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1548 if (err != 0) {
1549 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1550 exit(1);
1551 }
1552
1553 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1554 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1555 continue;
1556
1557 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1558 sizeof(ntop), strport, sizeof(strport),
1559 NI_NUMERICHOST|NI_NUMERICSERV);
1560
1561 if (ai->ai_family == AF_INET && err != 0) {
1562 perror("getnameinfo");
1563 exit(2);
1564 }
1565 }
1566 exit(0);
1567}
1568 ],
1569 [
1570 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001571 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1572 [Define if you have a getaddrinfo that fails
1573 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001574 ],
1575 [
1576 AC_MSG_RESULT(no)
1577 AC_DEFINE(BROKEN_GETADDRINFO)
1578 ]
1579 )
1580fi
1581
Darren Tuckera56f1912004-11-02 20:30:54 +11001582if test "x$check_for_conflicting_getspnam" = "x1"; then
1583 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1584 AC_COMPILE_IFELSE(
1585 [
1586#include <shadow.h>
1587int main(void) {exit(0);}
1588 ],
1589 [
1590 AC_MSG_RESULT(no)
1591 ],
1592 [
1593 AC_MSG_RESULT(yes)
1594 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1595 [Conflicting defs for getspnam])
1596 ]
1597 )
1598fi
1599
Damien Miller606f8802000-09-16 15:39:56 +11001600AC_FUNC_GETPGRP
1601
Damien Millera64b57a2001-01-17 10:44:13 +11001602# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001603PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001604AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001605 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001606 [
Damien Millera64b57a2001-01-17 10:44:13 +11001607 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001608 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1609 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001610 AC_MSG_ERROR([PAM headers not found])
1611 fi
1612
1613 AC_CHECK_LIB(dl, dlopen, , )
1614 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1615 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001616 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001617
Damien Millera64b57a2001-01-17 10:44:13 +11001618 PAM_MSG="yes"
1619
Tim Rice7df8d392005-09-19 09:33:39 -07001620 AC_DEFINE(USE_PAM, 1,
1621 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001622 if test $ac_cv_lib_dl_dlopen = yes; then
1623 LIBPAM="-lpam -ldl"
1624 else
1625 LIBPAM="-lpam"
1626 fi
1627 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001628 fi
1629 ]
1630)
Damien Millera22ba012000-03-02 23:09:20 +11001631
Damien Millera64b57a2001-01-17 10:44:13 +11001632# Check for older PAM
1633if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001634 # Check PAM strerror arguments (old PAM)
1635 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1636 AC_TRY_COMPILE(
1637 [
Damien Miller81171112000-04-23 11:14:01 +10001638#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001639#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001640#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001641#elif defined (HAVE_PAM_PAM_APPL_H)
1642#include <pam/pam_appl.h>
1643#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001644 ],
1645 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001646 [AC_MSG_RESULT(no)],
1647 [
Tim Rice7df8d392005-09-19 09:33:39 -07001648 AC_DEFINE(HAVE_OLD_PAM, 1,
1649 [Define if you have an old version of PAM
1650 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001651 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001652 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001653 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001654 )
Damien Millera22ba012000-03-02 23:09:20 +11001655fi
1656
Tim Riceaef73712002-05-11 13:17:42 -07001657# Search for OpenSSL
1658saved_CPPFLAGS="$CPPFLAGS"
1659saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001660AC_ARG_WITH(ssl-dir,
1661 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1662 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001663 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001664 case "$withval" in
1665 # Relative paths
1666 ./*|../*) withval="`pwd`/$withval"
1667 esac
Tim Riceaef73712002-05-11 13:17:42 -07001668 if test -d "$withval/lib"; then
1669 if test -n "${need_dash_r}"; then
1670 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1671 else
1672 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1673 fi
1674 else
1675 if test -n "${need_dash_r}"; then
1676 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1677 else
1678 LDFLAGS="-L${withval} ${LDFLAGS}"
1679 fi
1680 fi
1681 if test -d "$withval/include"; then
1682 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1683 else
1684 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1685 fi
Damien Millera22ba012000-03-02 23:09:20 +11001686 fi
1687 ]
1688)
Tim Rice3d5352e2004-02-12 09:27:21 -08001689LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001690AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1691 [Define if your ssl headers are included
1692 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001693 [
Tim Riceaef73712002-05-11 13:17:42 -07001694 dnl Check default openssl install dir
1695 if test -n "${need_dash_r}"; then
1696 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001697 else
Tim Riceaef73712002-05-11 13:17:42 -07001698 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001699 fi
Tim Riceaef73712002-05-11 13:17:42 -07001700 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1701 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1702 [
1703 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1704 ]
1705 )
1706 ]
1707)
1708
Tim Riced730b782002-08-13 18:52:10 -07001709# Determine OpenSSL header version
1710AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001711AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001712 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001713#include <stdio.h>
1714#include <string.h>
1715#include <openssl/opensslv.h>
1716#define DATA "conftest.sslincver"
1717int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001718 FILE *fd;
1719 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001720
Damien Millera8e06ce2003-11-21 23:48:55 +11001721 fd = fopen(DATA,"w");
1722 if(fd == NULL)
1723 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001724
1725 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1726 exit(1);
1727
1728 exit(0);
1729}
Darren Tucker623d92f2004-09-12 22:36:15 +10001730 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001731 [
1732 ssl_header_ver=`cat conftest.sslincver`
1733 AC_MSG_RESULT($ssl_header_ver)
1734 ],
1735 [
1736 AC_MSG_RESULT(not found)
1737 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001738 ],
1739 [
1740 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001741 ]
1742)
1743
1744# Determine OpenSSL library version
1745AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001746AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001747 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001748#include <stdio.h>
1749#include <string.h>
1750#include <openssl/opensslv.h>
1751#include <openssl/crypto.h>
1752#define DATA "conftest.ssllibver"
1753int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001754 FILE *fd;
1755 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001756
Damien Millera8e06ce2003-11-21 23:48:55 +11001757 fd = fopen(DATA,"w");
1758 if(fd == NULL)
1759 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001760
1761 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1762 exit(1);
1763
1764 exit(0);
1765}
Darren Tucker623d92f2004-09-12 22:36:15 +10001766 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001767 [
1768 ssl_library_ver=`cat conftest.ssllibver`
1769 AC_MSG_RESULT($ssl_library_ver)
1770 ],
1771 [
1772 AC_MSG_RESULT(not found)
1773 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001774 ],
1775 [
1776 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001777 ]
1778)
Damien Millera22ba012000-03-02 23:09:20 +11001779
Damien Millerec932372002-01-22 22:16:03 +11001780# Sanity check OpenSSL headers
1781AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001782AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001783 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001784#include <string.h>
1785#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001786int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001787 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001788 [
1789 AC_MSG_RESULT(yes)
1790 ],
1791 [
1792 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001793 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1794Check config.log for details.
1795Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001796 ],
1797 [
1798 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001799 ]
1800)
1801
Tim Rice3d5352e2004-02-12 09:27:21 -08001802# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1803# because the system crypt() is more featureful.
1804if test "x$check_for_libcrypt_before" = "x1"; then
1805 AC_CHECK_LIB(crypt, crypt)
1806fi
1807
Damien Millera8e06ce2003-11-21 23:48:55 +11001808# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001809# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001810if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001811 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001812fi
1813
Tim Rice2291c002005-08-26 13:15:19 -07001814AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001815
1816### Configure cryptographic random number support
1817
1818# Check wheter OpenSSL seeds itself
1819AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001820AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001821 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001822#include <string.h>
1823#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001824int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001825 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001826 [
1827 OPENSSL_SEEDS_ITSELF=yes
1828 AC_MSG_RESULT(yes)
1829 ],
1830 [
1831 AC_MSG_RESULT(no)
1832 # Default to use of the rand helper if OpenSSL doesn't
1833 # seed itself
1834 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001835 ],
1836 [
1837 AC_MSG_WARN([cross compiling: assuming yes])
1838 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001839 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001840 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001841 ]
1842)
1843
1844
1845# Do we want to force the use of the rand helper?
1846AC_ARG_WITH(rand-helper,
1847 [ --with-rand-helper Use subprocess to gather strong randomness ],
1848 [
1849 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001850 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001851 # the previous test showed it to be unseeded.
1852 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1853 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1854 OPENSSL_SEEDS_ITSELF=yes
1855 USE_RAND_HELPER=""
1856 fi
1857 else
1858 USE_RAND_HELPER=yes
1859 fi
1860 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001861)
Damien Miller6c21c512002-01-22 21:57:53 +11001862
1863# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001864if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001865 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001866 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1867 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001868 RAND_MSG="OpenSSL internal ONLY"
1869 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001870elif test ! -z "$USE_RAND_HELPER" ; then
1871 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001872 RAND_MSG="ssh-rand-helper"
1873 INSTALL_SSH_RAND_HELPER="yes"
1874fi
1875AC_SUBST(INSTALL_SSH_RAND_HELPER)
1876
1877### Configuration of ssh-rand-helper
1878
1879# PRNGD TCP socket
1880AC_ARG_WITH(prngd-port,
1881 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1882 [
Damien Millere996d722002-01-23 11:20:59 +11001883 case "$withval" in
1884 no)
1885 withval=""
1886 ;;
1887 [[0-9]]*)
1888 ;;
1889 *)
1890 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1891 ;;
1892 esac
1893 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001894 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001895 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1896 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001897 fi
1898 ]
1899)
1900
1901# PRNGD Unix domain socket
1902AC_ARG_WITH(prngd-socket,
1903 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1904 [
Damien Millere996d722002-01-23 11:20:59 +11001905 case "$withval" in
1906 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001907 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001908 ;;
1909 no)
1910 withval=""
1911 ;;
1912 /*)
1913 ;;
1914 *)
1915 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1916 ;;
1917 esac
1918
1919 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001920 if test ! -z "$PRNGD_PORT" ; then
1921 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1922 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001923 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001924 AC_MSG_WARN(Entropy socket is not readable)
1925 fi
1926 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001927 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1928 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001929 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001930 ],
1931 [
1932 # Check for existing socket only if we don't have a random device already
1933 if test "$USE_RAND_HELPER" = yes ; then
1934 AC_MSG_CHECKING(for PRNGD/EGD socket)
1935 # Insert other locations here
1936 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1937 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1938 PRNGD_SOCKET="$sock"
1939 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1940 break;
1941 fi
1942 done
1943 if test ! -z "$PRNGD_SOCKET" ; then
1944 AC_MSG_RESULT($PRNGD_SOCKET)
1945 else
1946 AC_MSG_RESULT(not found)
1947 fi
1948 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001949 ]
1950)
1951
1952# Change default command timeout for hashing entropy source
1953entropy_timeout=200
1954AC_ARG_WITH(entropy-timeout,
1955 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1956 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001957 if test -n "$withval" && test "x$withval" != "xno" && \
1958 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001959 entropy_timeout=$withval
1960 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001961 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001962)
Tim Rice7df8d392005-09-19 09:33:39 -07001963AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1964 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11001965
Damien Millerd3f6ad22002-06-25 10:24:47 +10001966SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001967AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001968 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001969 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001970 if test -n "$withval" && test "x$withval" != "xno" && \
1971 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001972 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001973 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001974 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001975)
Tim Rice7df8d392005-09-19 09:33:39 -07001976AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
1977 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10001978AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001979
Tim Rice88f2ab52002-03-17 12:17:34 -08001980# We do this little dance with the search path to insure
1981# that programs that we select for use by installed programs
1982# (which may be run by the super-user) come from trusted
1983# locations before they come from the user's private area.
1984# This should help avoid accidentally configuring some
1985# random version of a program in someone's personal bin.
1986
1987OPATH=$PATH
1988PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001989test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001990test -d /sbin && PATH=$PATH:/sbin
1991test -d /usr/sbin && PATH=$PATH:/usr/sbin
1992PATH=$PATH:/etc:$OPATH
1993
Damien Millera8e06ce2003-11-21 23:48:55 +11001994# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001995OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1996OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1997OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1998OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1999OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2000OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2001OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2002OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2003OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2004OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2005OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2006OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2007OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2008OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2009OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2010OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002011# restore PATH
2012PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002013
2014# Where does ssh-rand-helper get its randomness from?
2015INSTALL_SSH_PRNG_CMDS=""
2016if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2017 if test ! -z "$PRNGD_PORT" ; then
2018 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2019 elif test ! -z "$PRNGD_SOCKET" ; then
2020 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2021 else
2022 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2023 RAND_HELPER_CMDHASH=yes
2024 INSTALL_SSH_PRNG_CMDS="yes"
2025 fi
2026fi
2027AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2028
2029
Ben Lindstromb5628642000-10-18 00:02:25 +00002030# Cheap hack to ensure NEWS-OS libraries are arranged right.
2031if test ! -z "$SONY" ; then
2032 LIBS="$LIBS -liberty";
2033fi
2034
Damien Millera22ba012000-03-02 23:09:20 +11002035# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11002036AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002037AC_CHECK_SIZEOF(short int, 2)
2038AC_CHECK_SIZEOF(int, 4)
2039AC_CHECK_SIZEOF(long int, 4)
2040AC_CHECK_SIZEOF(long long int, 8)
2041
Damien Millerfa2bb692002-04-23 23:22:25 +10002042# Sanity check long long for some platforms (AIX)
2043if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2044 ac_cv_sizeof_long_long_int=0
2045fi
2046
Damien Millera22ba012000-03-02 23:09:20 +11002047# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002048AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2049 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002050 [ #include <sys/types.h> ],
2051 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002052 [ ac_cv_have_u_int="yes" ],
2053 [ ac_cv_have_u_int="no" ]
2054 )
2055])
2056if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002057 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002058 have_u_int=1
2059fi
2060
Damien Miller61e50f12000-05-08 20:49:37 +10002061AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2062 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002063 [ #include <sys/types.h> ],
2064 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002065 [ ac_cv_have_intxx_t="yes" ],
2066 [ ac_cv_have_intxx_t="no" ]
2067 )
2068])
2069if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002070 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002071 have_intxx_t=1
2072fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002073
2074if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002075 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002076then
2077 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2078 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002079 [ #include <stdint.h> ],
2080 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002081 [
2082 AC_DEFINE(HAVE_INTXX_T)
2083 AC_MSG_RESULT(yes)
2084 ],
2085 [ AC_MSG_RESULT(no) ]
2086 )
2087fi
2088
Damien Miller578783e2000-09-23 14:12:24 +11002089AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2090 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002091 [
2092#include <sys/types.h>
2093#ifdef HAVE_STDINT_H
2094# include <stdint.h>
2095#endif
2096#include <sys/socket.h>
2097#ifdef HAVE_SYS_BITYPES_H
2098# include <sys/bitypes.h>
2099#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002100 ],
2101 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002102 [ ac_cv_have_int64_t="yes" ],
2103 [ ac_cv_have_int64_t="no" ]
2104 )
2105])
2106if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002107 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002108fi
2109
Damien Miller61e50f12000-05-08 20:49:37 +10002110AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2111 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002112 [ #include <sys/types.h> ],
2113 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002114 [ ac_cv_have_u_intxx_t="yes" ],
2115 [ ac_cv_have_u_intxx_t="no" ]
2116 )
2117])
2118if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002119 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002120 have_u_intxx_t=1
2121fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002122
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002123if test -z "$have_u_intxx_t" ; then
2124 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2125 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002126 [ #include <sys/socket.h> ],
2127 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002128 [
2129 AC_DEFINE(HAVE_U_INTXX_T)
2130 AC_MSG_RESULT(yes)
2131 ],
2132 [ AC_MSG_RESULT(no) ]
2133 )
2134fi
2135
Damien Miller578783e2000-09-23 14:12:24 +11002136AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2137 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002138 [ #include <sys/types.h> ],
2139 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002140 [ ac_cv_have_u_int64_t="yes" ],
2141 [ ac_cv_have_u_int64_t="no" ]
2142 )
2143])
2144if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002145 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002146 have_u_int64_t=1
2147fi
2148
Tim Rice4cec93f2002-02-26 08:40:48 -08002149if test -z "$have_u_int64_t" ; then
2150 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2151 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002152 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002153 [ u_int64_t a; a = 1],
2154 [
2155 AC_DEFINE(HAVE_U_INT64_T)
2156 AC_MSG_RESULT(yes)
2157 ],
2158 [ AC_MSG_RESULT(no) ]
2159 )
2160fi
2161
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002162if test -z "$have_u_intxx_t" ; then
2163 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2164 AC_TRY_COMPILE(
2165 [
2166#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002167 ],
2168 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002169 [ ac_cv_have_uintxx_t="yes" ],
2170 [ ac_cv_have_uintxx_t="no" ]
2171 )
2172 ])
2173 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002174 AC_DEFINE(HAVE_UINTXX_T, 1,
2175 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002176 fi
2177fi
2178
2179if test -z "$have_uintxx_t" ; then
2180 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2181 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002182 [ #include <stdint.h> ],
2183 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002184 [
2185 AC_DEFINE(HAVE_UINTXX_T)
2186 AC_MSG_RESULT(yes)
2187 ],
2188 [ AC_MSG_RESULT(no) ]
2189 )
2190fi
2191
Damien Milleredb82922000-06-20 13:25:52 +10002192if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002193 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002194then
2195 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2196 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002197 [
2198#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002199 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002200 [
Damien Miller70494d12000-04-03 15:57:06 +10002201 int8_t a; int16_t b; int32_t c;
2202 u_int8_t e; u_int16_t f; u_int32_t g;
2203 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002204 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002205 [
2206 AC_DEFINE(HAVE_U_INTXX_T)
2207 AC_DEFINE(HAVE_INTXX_T)
2208 AC_MSG_RESULT(yes)
2209 ],
2210 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002211 )
Damien Millerb29ea912000-01-15 14:12:03 +11002212fi
2213
Damien Miller58be7382001-09-15 21:31:54 +10002214
2215AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2216 AC_TRY_COMPILE(
2217 [
2218#include <sys/types.h>
2219 ],
2220 [ u_char foo; foo = 125; ],
2221 [ ac_cv_have_u_char="yes" ],
2222 [ ac_cv_have_u_char="no" ]
2223 )
2224])
2225if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002226 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002227fi
2228
Tim Rice13aae5e2001-10-21 17:53:58 -07002229TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002230
Tim Rice200a5c02002-02-26 22:12:34 -08002231AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002232
Damien Miller848b9932005-02-24 12:12:34 +11002233AC_CHECK_TYPES(in_addr_t,,,
2234[#include <sys/types.h>
2235#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002236
Damien Miller61e50f12000-05-08 20:49:37 +10002237AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2238 AC_TRY_COMPILE(
2239 [
2240#include <sys/types.h>
2241 ],
2242 [ size_t foo; foo = 1235; ],
2243 [ ac_cv_have_size_t="yes" ],
2244 [ ac_cv_have_size_t="no" ]
2245 )
2246])
2247if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002248 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002249fi
Damien Miller95058511999-12-29 10:36:45 +11002250
Damien Miller615f9392000-05-17 22:53:33 +10002251AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2252 AC_TRY_COMPILE(
2253 [
2254#include <sys/types.h>
2255 ],
2256 [ ssize_t foo; foo = 1235; ],
2257 [ ac_cv_have_ssize_t="yes" ],
2258 [ ac_cv_have_ssize_t="no" ]
2259 )
2260])
2261if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002262 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002263fi
2264
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002265AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2266 AC_TRY_COMPILE(
2267 [
2268#include <time.h>
2269 ],
2270 [ clock_t foo; foo = 1235; ],
2271 [ ac_cv_have_clock_t="yes" ],
2272 [ ac_cv_have_clock_t="no" ]
2273 )
2274])
2275if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002276 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002277fi
2278
Damien Millerb54b40e2000-06-23 08:23:34 +10002279AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2280 AC_TRY_COMPILE(
2281 [
2282#include <sys/types.h>
2283#include <sys/socket.h>
2284 ],
2285 [ sa_family_t foo; foo = 1235; ],
2286 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002287 [ AC_TRY_COMPILE(
2288 [
2289#include <sys/types.h>
2290#include <sys/socket.h>
2291#include <netinet/in.h>
2292 ],
2293 [ sa_family_t foo; foo = 1235; ],
2294 [ ac_cv_have_sa_family_t="yes" ],
2295
Damien Millerb54b40e2000-06-23 08:23:34 +10002296 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002297 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002298 )
2299])
2300if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002301 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2302 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002303fi
2304
Damien Miller0f91b4e2000-06-18 15:43:25 +10002305AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2306 AC_TRY_COMPILE(
2307 [
2308#include <sys/types.h>
2309 ],
2310 [ pid_t foo; foo = 1235; ],
2311 [ ac_cv_have_pid_t="yes" ],
2312 [ ac_cv_have_pid_t="no" ]
2313 )
2314])
2315if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002316 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002317fi
2318
2319AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2320 AC_TRY_COMPILE(
2321 [
2322#include <sys/types.h>
2323 ],
2324 [ mode_t foo; foo = 1235; ],
2325 [ ac_cv_have_mode_t="yes" ],
2326 [ ac_cv_have_mode_t="no" ]
2327 )
2328])
2329if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002330 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002331fi
2332
Damien Miller61e50f12000-05-08 20:49:37 +10002333
2334AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2335 AC_TRY_COMPILE(
2336 [
Damien Miller81171112000-04-23 11:14:01 +10002337#include <sys/types.h>
2338#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002339 ],
2340 [ struct sockaddr_storage s; ],
2341 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2342 [ ac_cv_have_struct_sockaddr_storage="no" ]
2343 )
2344])
2345if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002346 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2347 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002348fi
Damien Miller34132e52000-01-14 15:45:46 +11002349
Damien Miller61e50f12000-05-08 20:49:37 +10002350AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2351 AC_TRY_COMPILE(
2352 [
Damien Miller7b22d652000-06-18 14:07:04 +10002353#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002354#include <netinet/in.h>
2355 ],
2356 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2357 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2358 [ ac_cv_have_struct_sockaddr_in6="no" ]
2359 )
2360])
2361if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002362 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2363 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002364fi
Damien Miller34132e52000-01-14 15:45:46 +11002365
Damien Miller61e50f12000-05-08 20:49:37 +10002366AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2367 AC_TRY_COMPILE(
2368 [
Damien Miller7b22d652000-06-18 14:07:04 +10002369#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002370#include <netinet/in.h>
2371 ],
2372 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2373 [ ac_cv_have_struct_in6_addr="yes" ],
2374 [ ac_cv_have_struct_in6_addr="no" ]
2375 )
2376])
2377if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002378 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2379 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002380fi
Damien Miller34132e52000-01-14 15:45:46 +11002381
Damien Miller61e50f12000-05-08 20:49:37 +10002382AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2383 AC_TRY_COMPILE(
2384 [
Damien Miller81171112000-04-23 11:14:01 +10002385#include <sys/types.h>
2386#include <sys/socket.h>
2387#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002388 ],
2389 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2390 [ ac_cv_have_struct_addrinfo="yes" ],
2391 [ ac_cv_have_struct_addrinfo="no" ]
2392 )
2393])
2394if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002395 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2396 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002397fi
2398
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002399AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2400 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002401 [ #include <sys/time.h> ],
2402 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002403 [ ac_cv_have_struct_timeval="yes" ],
2404 [ ac_cv_have_struct_timeval="no" ]
2405 )
2406])
2407if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002408 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002409 have_struct_timeval=1
2410fi
2411
Tim Rice4e4dc562003-03-18 10:21:40 -08002412AC_CHECK_TYPES(struct timespec)
2413
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002414# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002415if test "x$ac_cv_have_int64_t" = "xno" && \
2416 test "x$ac_cv_sizeof_long_int" != "x8" && \
2417 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002418 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2419 echo "an alternative compiler (I.E., GCC) before continuing."
2420 echo ""
2421 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002422else
2423dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002424 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002425 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002426#include <stdio.h>
2427#include <string.h>
2428#ifdef HAVE_SNPRINTF
2429main()
2430{
2431 char buf[50];
2432 char expected_out[50];
2433 int mazsize = 50 ;
2434#if (SIZEOF_LONG_INT == 8)
2435 long int num = 0x7fffffffffffffff;
2436#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002437 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002438#endif
2439 strcpy(expected_out, "9223372036854775807");
2440 snprintf(buf, mazsize, "%lld", num);
2441 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002442 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002443 exit(0);
2444}
2445#else
2446main() { exit(0); }
2447#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002448 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002449 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002450 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002451fi
2452
Damien Miller78315eb2000-09-29 23:01:36 +11002453dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002454OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2455OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2456OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2457OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2458OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002459OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002460OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2461OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002462OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002463OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2464OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2465OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2466OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002467OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2468OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2469OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2470OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002471
2472AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002473
Damien Miller61e50f12000-05-08 20:49:37 +10002474AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2475 ac_cv_have_ss_family_in_struct_ss, [
2476 AC_TRY_COMPILE(
2477 [
Damien Miller81171112000-04-23 11:14:01 +10002478#include <sys/types.h>
2479#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002480 ],
2481 [ struct sockaddr_storage s; s.ss_family = 1; ],
2482 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2483 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2484 )
2485])
2486if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002487 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002488fi
2489
Damien Miller61e50f12000-05-08 20:49:37 +10002490AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2491 ac_cv_have___ss_family_in_struct_ss, [
2492 AC_TRY_COMPILE(
2493 [
Damien Miller81171112000-04-23 11:14:01 +10002494#include <sys/types.h>
2495#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002496 ],
2497 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2498 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2499 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2500 )
2501])
2502if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002503 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2504 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002505fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002506
Damien Millerad833b32000-08-23 10:46:23 +10002507AC_CACHE_CHECK([for pw_class field in struct passwd],
2508 ac_cv_have_pw_class_in_struct_passwd, [
2509 AC_TRY_COMPILE(
2510 [
Damien Millerad833b32000-08-23 10:46:23 +10002511#include <pwd.h>
2512 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002513 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002514 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2515 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2516 )
2517])
2518if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002519 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2520 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002521fi
2522
Kevin Steves82456952001-06-22 21:14:18 +00002523AC_CACHE_CHECK([for pw_expire field in struct passwd],
2524 ac_cv_have_pw_expire_in_struct_passwd, [
2525 AC_TRY_COMPILE(
2526 [
2527#include <pwd.h>
2528 ],
2529 [ struct passwd p; p.pw_expire = 0; ],
2530 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2531 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2532 )
2533])
2534if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002535 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2536 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002537fi
2538
2539AC_CACHE_CHECK([for pw_change field in struct passwd],
2540 ac_cv_have_pw_change_in_struct_passwd, [
2541 AC_TRY_COMPILE(
2542 [
2543#include <pwd.h>
2544 ],
2545 [ struct passwd p; p.pw_change = 0; ],
2546 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2547 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2548 )
2549])
2550if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002551 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2552 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002553fi
Damien Miller61e50f12000-05-08 20:49:37 +10002554
Tim Rice28bbb0c2002-05-27 17:37:32 -07002555dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002556AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2557 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002558 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002559 [
Tim Riceae49fe62002-04-12 10:26:21 -07002560#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002561#include <sys/socket.h>
2562#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002563int main() {
2564#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002565#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002566exit(1);
2567#endif
2568struct msghdr m;
2569m.msg_accrights = 0;
2570exit(0);
2571}
Kevin Steves939c9db2002-03-22 17:23:25 +00002572 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002573 [ ac_cv_have_accrights_in_msghdr="yes" ],
2574 [ ac_cv_have_accrights_in_msghdr="no" ]
2575 )
2576])
2577if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002578 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2579 [Define if your system uses access rights style
2580 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002581fi
2582
Kevin Stevesa44e0352002-04-07 16:18:03 +00002583AC_CACHE_CHECK([for msg_control field in struct msghdr],
2584 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002585 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002586 [
Tim Riceae49fe62002-04-12 10:26:21 -07002587#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002588#include <sys/socket.h>
2589#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002590int main() {
2591#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002592#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002593exit(1);
2594#endif
2595struct msghdr m;
2596m.msg_control = 0;
2597exit(0);
2598}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002599 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002600 [ ac_cv_have_control_in_msghdr="yes" ],
2601 [ ac_cv_have_control_in_msghdr="no" ]
2602 )
2603])
2604if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002605 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2606 [Define if your system uses ancillary data style
2607 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002608fi
2609
Damien Miller61e50f12000-05-08 20:49:37 +10002610AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002611 AC_TRY_LINK([],
2612 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002613 [ ac_cv_libc_defines___progname="yes" ],
2614 [ ac_cv_libc_defines___progname="no" ]
2615 )
2616])
2617if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002618 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002619fi
2620
Kevin Steves4846f4a2002-03-22 18:19:53 +00002621AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2622 AC_TRY_LINK([
2623#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002624],
2625 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002626 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2627 [ ac_cv_cc_implements___FUNCTION__="no" ]
2628 )
2629])
2630if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002631 AC_DEFINE(HAVE___FUNCTION__, 1,
2632 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002633fi
2634
2635AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2636 AC_TRY_LINK([
2637#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002638],
2639 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002640 [ ac_cv_cc_implements___func__="yes" ],
2641 [ ac_cv_cc_implements___func__="no" ]
2642 )
2643])
2644if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002645 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002646fi
2647
Damien Miller4f8e6692001-07-14 13:22:53 +10002648AC_CACHE_CHECK([whether getopt has optreset support],
2649 ac_cv_have_getopt_optreset, [
2650 AC_TRY_LINK(
2651 [
2652#include <getopt.h>
2653 ],
2654 [ extern int optreset; optreset = 0; ],
2655 [ ac_cv_have_getopt_optreset="yes" ],
2656 [ ac_cv_have_getopt_optreset="no" ]
2657 )
2658])
2659if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002660 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2661 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002662fi
Damien Millera22ba012000-03-02 23:09:20 +11002663
Damien Millerecbb26d2000-07-15 14:59:14 +10002664AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002665 AC_TRY_LINK([],
2666 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002667 [ ac_cv_libc_defines_sys_errlist="yes" ],
2668 [ ac_cv_libc_defines_sys_errlist="no" ]
2669 )
2670])
2671if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002672 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2673 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002674fi
2675
2676
Damien Miller11fa2cc2000-08-16 10:35:58 +10002677AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002678 AC_TRY_LINK([],
2679 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002680 [ ac_cv_libc_defines_sys_nerr="yes" ],
2681 [ ac_cv_libc_defines_sys_nerr="no" ]
2682 )
2683])
2684if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002685 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002686fi
2687
Damien Millera8e06ce2003-11-21 23:48:55 +11002688SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002689# Check whether user wants sectok support
2690AC_ARG_WITH(sectok,
2691 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002692 [
2693 if test "x$withval" != "xno" ; then
2694 if test "x$withval" != "xyes" ; then
2695 CPPFLAGS="$CPPFLAGS -I${withval}"
2696 LDFLAGS="$LDFLAGS -L${withval}"
2697 if test ! -z "$need_dash_r" ; then
2698 LDFLAGS="$LDFLAGS -R${withval}"
2699 fi
2700 if test ! -z "$blibpath" ; then
2701 blibpath="$blibpath:${withval}"
2702 fi
2703 fi
2704 AC_CHECK_HEADERS(sectok.h)
2705 if test "$ac_cv_header_sectok_h" != yes; then
2706 AC_MSG_ERROR(Can't find sectok.h)
2707 fi
2708 AC_CHECK_LIB(sectok, sectok_open)
2709 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2710 AC_MSG_ERROR(Can't find libsectok)
2711 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002712 AC_DEFINE(SMARTCARD, 1,
2713 [Define if you want smartcard support])
2714 AC_DEFINE(USE_SECTOK, 1,
2715 [Define if you want smartcard support
2716 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002717 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002718 fi
2719 ]
2720)
2721
2722# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002723OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002724AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10002725 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08002726 [
2727 if test "x$withval" != "xno" ; then
2728 if test "x$withval" != "xyes" ; then
2729 OPENSC_CONFIG=$withval/bin/opensc-config
2730 else
2731 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2732 fi
2733 if test "$OPENSC_CONFIG" != "no"; then
2734 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2735 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2736 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2737 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2738 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002739 AC_DEFINE(USE_OPENSC, 1,
2740 [Define if you want smartcard support
2741 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002742 SCARD_MSG="yes, using OpenSC"
2743 fi
2744 fi
2745 ]
2746)
Damien Miller85de5802001-09-18 14:01:11 +10002747
Darren Tucker5f88d342003-10-15 16:57:57 +10002748# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002749AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002750 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2751 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002752 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002753 # Needed by our getrrsetbyname()
2754 AC_SEARCH_LIBS(res_query, resolv)
2755 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002756 AC_MSG_CHECKING(if res_query will link)
2757 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2758 [AC_MSG_RESULT(no)
2759 saved_LIBS="$LIBS"
2760 LIBS="$LIBS -lresolv"
2761 AC_MSG_CHECKING(for res_query in -lresolv)
2762 AC_LINK_IFELSE([
2763#include <resolv.h>
2764int main()
2765{
2766 res_query (0, 0, 0, 0, 0);
2767 return 0;
2768}
2769 ],
2770 [LIBS="$LIBS -lresolv"
2771 AC_MSG_RESULT(yes)],
2772 [LIBS="$saved_LIBS"
2773 AC_MSG_RESULT(no)])
2774 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002775 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002776 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002777 [#include <sys/types.h>
2778 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002779 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07002780 [AC_DEFINE(HAVE_HEADER_AD, 1,
2781 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10002782 [#include <arpa/nameser.h>])
2783 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002784
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002785# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002786KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002787AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002788 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002789 [ if test "x$withval" != "xno" ; then
2790 if test "x$withval" = "xyes" ; then
2791 KRB5ROOT="/usr/local"
2792 else
2793 KRB5ROOT=${withval}
2794 fi
2795
Tim Rice7df8d392005-09-19 09:33:39 -07002796 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11002797 KRB5_MSG="yes"
2798
2799 AC_MSG_CHECKING(for krb5-config)
2800 if test -x $KRB5ROOT/bin/krb5-config ; then
2801 KRB5CONF=$KRB5ROOT/bin/krb5-config
2802 AC_MSG_RESULT($KRB5CONF)
2803
2804 AC_MSG_CHECKING(for gssapi support)
2805 if $KRB5CONF | grep gssapi >/dev/null ; then
2806 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002807 AC_DEFINE(GSSAPI, 1,
2808 [Define this if you want GSSAPI
2809 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11002810 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002811 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002812 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002813 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002814 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002815 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2816 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002817 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002818 AC_MSG_CHECKING(whether we are using Heimdal)
2819 AC_TRY_COMPILE([ #include <krb5.h> ],
2820 [ char *tmp = heimdal_version; ],
2821 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002822 AC_DEFINE(HEIMDAL, 1,
2823 [Define this if you are using the
2824 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002825 AC_MSG_RESULT(no)
2826 )
2827 else
2828 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002829 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002830 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002831 AC_MSG_CHECKING(whether we are using Heimdal)
2832 AC_TRY_COMPILE([ #include <krb5.h> ],
2833 [ char *tmp = heimdal_version; ],
2834 [ AC_MSG_RESULT(yes)
2835 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002836 K5LIBS="-lkrb5 -ldes"
2837 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002838 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002839 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002840 ],
2841 [ AC_MSG_RESULT(no)
2842 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2843 ]
2844 )
Damien Miller200d0a72003-06-30 19:21:36 +10002845 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002846
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002847 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2848 [ AC_DEFINE(GSSAPI)
2849 K5LIBS="-lgssapi $K5LIBS" ],
2850 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2851 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002852 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002853 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2854 $K5LIBS)
2855 ],
2856 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002857
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002858 AC_CHECK_HEADER(gssapi.h, ,
2859 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002860 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002861 AC_CHECK_HEADERS(gssapi.h, ,
2862 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002863 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002864 ]
2865 )
2866
2867 oldCPP="$CPPFLAGS"
2868 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2869 AC_CHECK_HEADER(gssapi_krb5.h, ,
2870 [ CPPFLAGS="$oldCPP" ])
2871
Damien Millera8e06ce2003-11-21 23:48:55 +11002872 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002873 if test ! -z "$need_dash_r" ; then
2874 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2875 fi
2876 if test ! -z "$blibpath" ; then
2877 blibpath="$blibpath:${KRB5ROOT}/lib"
2878 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07002879
2880 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2881 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2882 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2883
2884 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07002885 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
2886 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002887 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002888 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002889)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002890
Damien Millera22ba012000-03-02 23:09:20 +11002891# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002892
Damien Millerf58c6722002-05-13 13:15:42 +10002893PRIVSEP_PATH=/var/empty
2894AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002895 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002896 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002897 if test -n "$withval" && test "x$withval" != "xno" && \
2898 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002899 PRIVSEP_PATH=$withval
2900 fi
2901 ]
2902)
2903AC_SUBST(PRIVSEP_PATH)
2904
Damien Millera22ba012000-03-02 23:09:20 +11002905AC_ARG_WITH(xauth,
2906 [ --with-xauth=PATH Specify path to xauth program ],
2907 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002908 if test -n "$withval" && test "x$withval" != "xno" && \
2909 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002910 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002911 fi
2912 ],
2913 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002914 TestPath="$PATH"
2915 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2916 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2917 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2918 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2919 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002920 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002921 xauth_path="/usr/openwin/bin/xauth"
2922 fi
2923 ]
2924)
2925
Damien Miller7d901272003-01-13 16:55:22 +11002926STRIP_OPT=-s
2927AC_ARG_ENABLE(strip,
2928 [ --disable-strip Disable calling strip(1) on install],
2929 [
2930 if test "x$enableval" = "xno" ; then
2931 STRIP_OPT=
2932 fi
2933 ]
2934)
2935AC_SUBST(STRIP_OPT)
2936
Damien Millera19cf472000-11-29 13:28:50 +11002937if test -z "$xauth_path" ; then
2938 XAUTH_PATH="undefined"
2939 AC_SUBST(XAUTH_PATH)
2940else
Tim Rice7df8d392005-09-19 09:33:39 -07002941 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
2942 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11002943 XAUTH_PATH=$xauth_path
2944 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002945fi
Damien Millera22ba012000-03-02 23:09:20 +11002946
2947# Check for mail directory (last resort if we cannot get it from headers)
2948if test ! -z "$MAIL" ; then
2949 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07002950 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
2951 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11002952fi
2953
Darren Tucker623d92f2004-09-12 22:36:15 +10002954if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002955 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2956 disable_ptmx_check=yes
2957fi
Damien Millera22ba012000-03-02 23:09:20 +11002958if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002959 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002960 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002961 [
Tim Rice7df8d392005-09-19 09:33:39 -07002962 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
2963 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002964 have_dev_ptmx=1
2965 ]
2966 )
2967 fi
Damien Millera22ba012000-03-02 23:09:20 +11002968fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002969
Darren Tucker623d92f2004-09-12 22:36:15 +10002970if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002971 AC_CHECK_FILE("/dev/ptc",
2972 [
Tim Rice7df8d392005-09-19 09:33:39 -07002973 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
2974 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002975 have_dev_ptc=1
2976 ]
2977 )
2978else
2979 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2980fi
Damien Miller204ad072000-03-02 23:56:12 +11002981
Damien Millera22ba012000-03-02 23:09:20 +11002982# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002983AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002984 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002985 [
Damien Miller897741e2001-04-16 10:41:46 +10002986 case "$withval" in
2987 man|cat|doc)
2988 MANTYPE=$withval
2989 ;;
2990 *)
2991 AC_MSG_ERROR(invalid man type: $withval)
2992 ;;
2993 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002994 ]
2995)
Ben Lindstrombc709922001-04-18 18:04:21 +00002996if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002997 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2998 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002999 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3000 MANTYPE=doc
3001 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3002 MANTYPE=man
3003 else
3004 MANTYPE=cat
3005 fi
3006fi
Damien Miller670a4b82000-01-22 13:53:11 +11003007AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003008if test "$MANTYPE" = "doc"; then
3009 mansubdir=man;
3010else
3011 mansubdir=$MANTYPE;
3012fi
3013AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003014
Damien Millera22ba012000-03-02 23:09:20 +11003015# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003016MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003017AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003018 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003019 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003020 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003021 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3022 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003023 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003024 fi
3025 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003026)
3027
Damien Millera22ba012000-03-02 23:09:20 +11003028# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003029AC_ARG_WITH(shadow,
3030 [ --without-shadow Disable shadow password support],
3031 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003032 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003033 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003034 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003035 fi
3036 ]
3037)
3038
Damien Miller1f335fb2000-06-26 11:31:33 +10003039if test -z "$disable_shadow" ; then
3040 AC_MSG_CHECKING([if the systems has expire shadow information])
3041 AC_TRY_COMPILE(
3042 [
3043#include <sys/types.h>
3044#include <shadow.h>
3045 struct spwd sp;
3046 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3047 [ sp_expire_available=yes ], []
3048 )
3049
3050 if test "x$sp_expire_available" = "xyes" ; then
3051 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003052 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3053 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003054 else
3055 AC_MSG_RESULT(no)
3056 fi
3057fi
3058
Damien Millera22ba012000-03-02 23:09:20 +11003059# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003060if test ! -z "$IPADDR_IN_DISPLAY" ; then
3061 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003062 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3063 [Define if you need to use IP address
3064 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003065else
Damien Millera8e06ce2003-11-21 23:48:55 +11003066 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003067 AC_ARG_WITH(ipaddr-display,
3068 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3069 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003070 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003071 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003072 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003073 fi
3074 ]
3075 )
3076fi
Damien Miller76112de1999-12-21 11:18:08 +11003077
Darren Tuckere1a790d2003-09-16 11:52:19 +10003078# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003079AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003080 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003081 [ if test "x$enableval" = "xno"; then
3082 AC_MSG_NOTICE([/etc/default/login handling disabled])
3083 etc_default_login=no
3084 else
3085 etc_default_login=yes
3086 fi ],
3087 [ etc_default_login=yes ]
3088)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003089
Darren Tucker2f9573d2005-02-10 22:28:54 +11003090if test "x$etc_default_login" != "xno"; then
3091 AC_CHECK_FILE("/etc/default/login",
3092 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10003093 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3094 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003095 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
3096 elif test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003097 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3098 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003099 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003100fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003101
Tim Rice43a1c132002-04-17 21:19:14 -07003102dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003103if test $ac_cv_func_login_getcapbool = "yes" && \
3104 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003105 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003106fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003107
Damien Millera22ba012000-03-02 23:09:20 +11003108# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003109SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003110AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003111 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003112 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003113 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003114 AC_MSG_WARN([
3115--with-default-path=PATH has no effect on this system.
3116Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003117 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003118 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003119 AC_MSG_WARN([
3120--with-default-path=PATH will only be used if PATH is not defined in
3121$external_path_file .])
3122 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003123 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003124 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003125 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003126 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003127 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3128 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003129 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003130 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003131 AC_MSG_WARN([
3132If PATH is defined in $external_path_file, ensure the path to scp is included,
3133otherwise scp will not work.])
3134 fi
3135 AC_TRY_RUN(
3136 [
Tim Rice59ea0a02001-03-10 13:50:45 -08003137/* find out what STDPATH is */
3138#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003139#ifdef HAVE_PATHS_H
3140# include <paths.h>
3141#endif
3142#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003143# ifdef _PATH_USERPATH /* Irix */
3144# define _PATH_STDPATH _PATH_USERPATH
3145# else
3146# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3147# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003148#endif
3149#include <sys/types.h>
3150#include <sys/stat.h>
3151#include <fcntl.h>
3152#define DATA "conftest.stdpath"
3153
3154main()
3155{
3156 FILE *fd;
3157 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003158
Tim Rice59ea0a02001-03-10 13:50:45 -08003159 fd = fopen(DATA,"w");
3160 if(fd == NULL)
3161 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003162
Tim Rice59ea0a02001-03-10 13:50:45 -08003163 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3164 exit(1);
3165
3166 exit(0);
3167}
3168 ], [ user_path=`cat conftest.stdpath` ],
3169 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3170 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3171 )
3172# make sure $bindir is in USER_PATH so scp will work
3173 t_bindir=`eval echo ${bindir}`
3174 case $t_bindir in
3175 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3176 esac
3177 case $t_bindir in
3178 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3179 esac
3180 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3181 if test $? -ne 0 ; then
3182 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3183 if test $? -ne 0 ; then
3184 user_path=$user_path:$t_bindir
3185 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3186 fi
3187 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003188 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003189)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003190if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003191 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003192 AC_SUBST(user_path)
3193fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003194
Damien Millera18bbd32002-05-13 10:48:57 +10003195# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003196AC_ARG_WITH(superuser-path,
3197 [ --with-superuser-path= Specify different path for super-user],
3198 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003199 if test -n "$withval" && test "x$withval" != "xno" && \
3200 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003201 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3202 [Define if you want a different $PATH
3203 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003204 superuser_path=$withval
3205 fi
3206 ]
3207)
3208
3209
Damien Miller61e50f12000-05-08 20:49:37 +10003210AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003211IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003212AC_ARG_WITH(4in6,
3213 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3214 [
3215 if test "x$withval" != "xno" ; then
3216 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003217 AC_DEFINE(IPV4_IN_IPV6, 1,
3218 [Detect IPv4 in IPv6 mapped addresses
3219 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003220 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003221 else
3222 AC_MSG_RESULT(no)
3223 fi
3224 ],[
3225 if test "x$inet6_default_4in6" = "xyes"; then
3226 AC_MSG_RESULT([yes (default)])
3227 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003228 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003229 else
3230 AC_MSG_RESULT([no (default)])
3231 fi
3232 ]
3233)
3234
Damien Miller60396b02001-02-18 17:01:00 +11003235# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003236BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003237AC_ARG_WITH(bsd-auth,
3238 [ --with-bsd-auth Enable BSD auth support],
3239 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003240 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003241 AC_DEFINE(BSD_AUTH, 1,
3242 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003243 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003244 fi
3245 ]
3246)
3247
Damien Millera22ba012000-03-02 23:09:20 +11003248# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003249piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003250# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003251if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003252 piddir=`eval echo ${sysconfdir}`
3253 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003254 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003255 esac
3256fi
3257
Tim Rice88f2ab52002-03-17 12:17:34 -08003258AC_ARG_WITH(pid-dir,
3259 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3260 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003261 if test -n "$withval" && test "x$withval" != "xno" && \
3262 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003263 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003264 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003265 AC_MSG_WARN([** no $piddir directory on this system **])
3266 fi
3267 fi
3268 ]
3269)
3270
Tim Rice7df8d392005-09-19 09:33:39 -07003271AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003272AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003273
andre2ff7b5d2000-06-03 14:57:40 +00003274dnl allow user to disable some login recording features
3275AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003276 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003277 [
3278 if test "x$enableval" = "xno" ; then
3279 AC_DEFINE(DISABLE_LASTLOG)
3280 fi
3281 ]
andre2ff7b5d2000-06-03 14:57:40 +00003282)
3283AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003284 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003285 [
3286 if test "x$enableval" = "xno" ; then
3287 AC_DEFINE(DISABLE_UTMP)
3288 fi
3289 ]
andre2ff7b5d2000-06-03 14:57:40 +00003290)
3291AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003292 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003293 [
3294 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003295 AC_DEFINE(DISABLE_UTMPX, 1,
3296 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003297 fi
3298 ]
andre2ff7b5d2000-06-03 14:57:40 +00003299)
3300AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003301 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003302 [
3303 if test "x$enableval" = "xno" ; then
3304 AC_DEFINE(DISABLE_WTMP)
3305 fi
3306 ]
andre2ff7b5d2000-06-03 14:57:40 +00003307)
3308AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003309 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003310 [
3311 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003312 AC_DEFINE(DISABLE_WTMPX, 1,
3313 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003314 fi
3315 ]
andre2ff7b5d2000-06-03 14:57:40 +00003316)
3317AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003318 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003319 [
3320 if test "x$enableval" = "xno" ; then
3321 AC_DEFINE(DISABLE_LOGIN)
3322 fi
3323 ]
andre2ff7b5d2000-06-03 14:57:40 +00003324)
3325AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003326 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003327 [
3328 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003329 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3330 [Define if you don't want to use pututline()
3331 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003332 fi
3333 ]
andre2ff7b5d2000-06-03 14:57:40 +00003334)
3335AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003336 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003337 [
3338 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003339 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3340 [Define if you don't want to use pututxline()
3341 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003342 fi
3343 ]
andre2ff7b5d2000-06-03 14:57:40 +00003344)
3345AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003346 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003347 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003348 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003349 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003350 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003351 conf_lastlog_location=$withval
3352 fi
3353 ]
3354)
andre2ff7b5d2000-06-03 14:57:40 +00003355
3356dnl lastlog, [uw]tmpx? detection
3357dnl NOTE: set the paths in the platform section to avoid the
3358dnl need for command-line parameters
3359dnl lastlog and [uw]tmp are subject to a file search if all else fails
3360
3361dnl lastlog detection
3362dnl NOTE: the code itself will detect if lastlog is a directory
3363AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3364AC_TRY_COMPILE([
3365#include <sys/types.h>
3366#include <utmp.h>
3367#ifdef HAVE_LASTLOG_H
3368# include <lastlog.h>
3369#endif
Damien Miller2994e082000-06-04 15:51:47 +10003370#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003371# include <paths.h>
3372#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003373#ifdef HAVE_LOGIN_H
3374# include <login.h>
3375#endif
andre2ff7b5d2000-06-03 14:57:40 +00003376 ],
3377 [ char *lastlog = LASTLOG_FILE; ],
3378 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003379 [
3380 AC_MSG_RESULT(no)
3381 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3382 AC_TRY_COMPILE([
3383#include <sys/types.h>
3384#include <utmp.h>
3385#ifdef HAVE_LASTLOG_H
3386# include <lastlog.h>
3387#endif
3388#ifdef HAVE_PATHS_H
3389# include <paths.h>
3390#endif
3391 ],
3392 [ char *lastlog = _PATH_LASTLOG; ],
3393 [ AC_MSG_RESULT(yes) ],
3394 [
andree441aa32000-06-12 22:34:38 +00003395 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003396 system_lastlog_path=no
3397 ])
3398 ]
andre2ff7b5d2000-06-03 14:57:40 +00003399)
Damien Miller2994e082000-06-04 15:51:47 +10003400
andre2ff7b5d2000-06-03 14:57:40 +00003401if test -z "$conf_lastlog_location"; then
3402 if test x"$system_lastlog_path" = x"no" ; then
3403 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003404 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003405 conf_lastlog_location=$f
3406 fi
3407 done
3408 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003409 AC_MSG_WARN([** Cannot find lastlog **])
3410 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003411 fi
3412 fi
3413fi
3414
3415if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003416 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3417 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003418fi
andre2ff7b5d2000-06-03 14:57:40 +00003419
3420dnl utmp detection
3421AC_MSG_CHECKING([if your system defines UTMP_FILE])
3422AC_TRY_COMPILE([
3423#include <sys/types.h>
3424#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003425#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003426# include <paths.h>
3427#endif
3428 ],
3429 [ char *utmp = UTMP_FILE; ],
3430 [ AC_MSG_RESULT(yes) ],
3431 [ AC_MSG_RESULT(no)
3432 system_utmp_path=no ]
3433)
3434if test -z "$conf_utmp_location"; then
3435 if test x"$system_utmp_path" = x"no" ; then
3436 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3437 if test -f $f ; then
3438 conf_utmp_location=$f
3439 fi
3440 done
3441 if test -z "$conf_utmp_location"; then
3442 AC_DEFINE(DISABLE_UTMP)
3443 fi
3444 fi
3445fi
3446if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003447 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3448 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003449fi
andre2ff7b5d2000-06-03 14:57:40 +00003450
3451dnl wtmp detection
3452AC_MSG_CHECKING([if your system defines WTMP_FILE])
3453AC_TRY_COMPILE([
3454#include <sys/types.h>
3455#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003456#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003457# include <paths.h>
3458#endif
3459 ],
3460 [ char *wtmp = WTMP_FILE; ],
3461 [ AC_MSG_RESULT(yes) ],
3462 [ AC_MSG_RESULT(no)
3463 system_wtmp_path=no ]
3464)
3465if test -z "$conf_wtmp_location"; then
3466 if test x"$system_wtmp_path" = x"no" ; then
3467 for f in /usr/adm/wtmp /var/log/wtmp; do
3468 if test -f $f ; then
3469 conf_wtmp_location=$f
3470 fi
3471 done
3472 if test -z "$conf_wtmp_location"; then
3473 AC_DEFINE(DISABLE_WTMP)
3474 fi
3475 fi
3476fi
3477if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003478 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3479 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003480fi
andre2ff7b5d2000-06-03 14:57:40 +00003481
3482
3483dnl utmpx detection - I don't know any system so perverse as to require
3484dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3485dnl there, though.
3486AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3487AC_TRY_COMPILE([
3488#include <sys/types.h>
3489#include <utmp.h>
3490#ifdef HAVE_UTMPX_H
3491#include <utmpx.h>
3492#endif
Damien Miller2994e082000-06-04 15:51:47 +10003493#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003494# include <paths.h>
3495#endif
3496 ],
3497 [ char *utmpx = UTMPX_FILE; ],
3498 [ AC_MSG_RESULT(yes) ],
3499 [ AC_MSG_RESULT(no)
3500 system_utmpx_path=no ]
3501)
3502if test -z "$conf_utmpx_location"; then
3503 if test x"$system_utmpx_path" = x"no" ; then
3504 AC_DEFINE(DISABLE_UTMPX)
3505 fi
3506else
Tim Rice7df8d392005-09-19 09:33:39 -07003507 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3508 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003509fi
andre2ff7b5d2000-06-03 14:57:40 +00003510
3511dnl wtmpx detection
3512AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3513AC_TRY_COMPILE([
3514#include <sys/types.h>
3515#include <utmp.h>
3516#ifdef HAVE_UTMPX_H
3517#include <utmpx.h>
3518#endif
Damien Miller2994e082000-06-04 15:51:47 +10003519#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003520# include <paths.h>
3521#endif
3522 ],
3523 [ char *wtmpx = WTMPX_FILE; ],
3524 [ AC_MSG_RESULT(yes) ],
3525 [ AC_MSG_RESULT(no)
3526 system_wtmpx_path=no ]
3527)
3528if test -z "$conf_wtmpx_location"; then
3529 if test x"$system_wtmpx_path" = x"no" ; then
3530 AC_DEFINE(DISABLE_WTMPX)
3531 fi
3532else
Tim Rice7df8d392005-09-19 09:33:39 -07003533 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3534 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003535fi
andre2ff7b5d2000-06-03 14:57:40 +00003536
Damien Miller4018c192000-04-30 09:30:44 +10003537
Damien Miller29ea30d2000-03-17 10:54:15 +11003538if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003539 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3540 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003541fi
3542
Tim Rice4cec93f2002-02-26 08:40:48 -08003543dnl remove pam and dl because they are in $LIBPAM
3544if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003545 LIBS=`echo $LIBS | sed 's/-lpam //'`
3546fi
3547if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3548 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003549fi
3550
Darren Tucker7da23cb2005-08-03 00:20:15 +10003551dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3552dnl Add now.
3553CFLAGS="$CFLAGS $werror_flags"
3554
Damien Millerbac2d8a2000-09-05 16:13:06 +11003555AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003556AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3557 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003558AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003559
Damien Miller7b22d652000-06-18 14:07:04 +10003560# Print summary of options
3561
Damien Miller7b22d652000-06-18 14:07:04 +10003562# Someone please show me a better way :)
3563A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3564B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3565C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3566D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003567E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003568F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003569G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003570H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3571I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3572J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003573
3574echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003575echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003576echo " User binaries: $B"
3577echo " System binaries: $C"
3578echo " Configuration files: $D"
3579echo " Askpass program: $E"
3580echo " Manual pages: $F"
3581echo " PID file: $G"
3582echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003583if test "x$external_path_file" = "x/etc/login.conf" ; then
3584echo " At runtime, sshd will use the path defined in $external_path_file"
3585echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003586else
Damien Millerf58c6722002-05-13 13:15:42 +10003587echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003588 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003589echo " (If PATH is set in $external_path_file it will be used instead. If"
3590echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3591 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003592fi
Damien Millera18bbd32002-05-13 10:48:57 +10003593if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003594echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003595fi
Damien Millerf58c6722002-05-13 13:15:42 +10003596echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003597echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003598echo " KerberosV support: $KRB5_MSG"
3599echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003600echo " S/KEY support: $SKEY_MSG"
3601echo " TCP Wrappers support: $TCPW_MSG"
3602echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003603echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003604echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003605echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3606echo " BSD Auth support: $BSD_AUTH_MSG"
3607echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003608if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003609echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003610fi
3611
Damien Miller7b22d652000-06-18 14:07:04 +10003612echo ""
3613
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003614echo " Host: ${host}"
3615echo " Compiler: ${CC}"
3616echo " Compiler flags: ${CFLAGS}"
3617echo "Preprocessor flags: ${CPPFLAGS}"
3618echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003619echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003620
3621echo ""
3622
Tim Rice6f1f7582004-05-30 21:38:51 -07003623if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003624 echo "SVR4 style packages are supported with \"make package\""
3625 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003626fi
3627
Damien Miller82cf0ce2000-12-20 13:34:48 +11003628if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003629 echo "PAM is enabled. You may need to install a PAM control file "
3630 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003631 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003632 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003633 echo ""
3634fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003635
Damien Miller6c21c512002-01-22 21:57:53 +11003636if test ! -z "$RAND_HELPER_CMDHASH" ; then
3637 echo "WARNING: you are using the builtin random number collection "
3638 echo "service. Please read WARNING.RNG and request that your OS "
3639 echo "vendor includes kernel-based random number collection in "
3640 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003641 echo ""
3642fi
Damien Miller60396b02001-02-18 17:01:00 +11003643
Damien Millerb4097182004-05-23 14:09:40 +10003644if test ! -z "$NO_PEERCHECK" ; then
3645 echo "WARNING: the operating system that you are using does not "
3646 echo "appear to support either the getpeereid() API nor the "
3647 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3648 echo "enforce security checks to prevent unauthorised connections to "
3649 echo "ssh-agent. Their absence increases the risk that a malicious "
3650 echo "user can connect to your agent. "
3651 echo ""
3652fi
3653
Darren Tuckerd9f88912005-02-20 21:01:48 +11003654if test "$AUDIT_MODULE" = "bsm" ; then
3655 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3656 echo "See the Solaris section in README.platform for details."
3657fi