blob: ff1f87abd01cda43c1049b46e4887378bbfb4dc2 [file] [log] [blame]
Darren Tuckerc373a562005-09-22 20:15:08 +10001# $Id: configure.ac,v 1.295 2005/09/22 10:15:08 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070060 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
61 [If your header files don't define LOGIN_PROGRAM,
62 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100063else
64 # Search for login
65 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
66 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
67 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
68 fi
69fi
70
Darren Tucker23bc8d02004-02-06 16:24:31 +110071AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
72if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070073 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
74 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110075fi
76
Damien Miller166bd442000-03-16 10:48:25 +110077if test -z "$LD" ; then
78 LD=$CC
79fi
80AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080081
Damien Miller166bd442000-03-16 10:48:25 +110082AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100083
84AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
85
Damien Millera8e06ce2003-11-21 23:48:55 +110086if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100087 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Tim Rice3db1e3f2005-08-23 17:11:26 -070088 GCC_VER=`$CC --version`
89 case $GCC_VER in
90 1.*) ;;
91 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
92 2.*) ;;
93 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
94 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +100095
Darren Tucker67b37032005-06-03 17:58:31 +100096 if test -z "$have_llong_max"; then
97 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
98 unset ac_cv_have_decl_LLONG_MAX
99 saved_CFLAGS="$CFLAGS"
100 CFLAGS="$CFLAGS -std=gnu99"
101 AC_CHECK_DECL(LLONG_MAX,
102 [have_llong_max=1],
103 [CFLAGS="$saved_CFLAGS"],
104 [#include <limits.h>]
105 )
106 fi
Damien Miller166bd442000-03-16 10:48:25 +1100107fi
108
Darren Tucker431f0222005-06-07 17:53:40 +1000109if test -z "$have_llong_max"; then
110 AC_MSG_CHECKING([for max value of long long])
111 AC_RUN_IFELSE(
112 [AC_LANG_SOURCE([[
113#include <stdio.h>
114/* Why is this so damn hard? */
115#ifdef __GNUC__
116# undef __GNUC__
117#endif
118#define __USE_ISOC99
119#include <limits.h>
120#define DATA "conftest.llminmax"
121int main(void) {
122 FILE *f;
123 long long i, llmin, llmax = 0;
124
125 if((f = fopen(DATA,"w")) == NULL)
126 exit(1);
127
128#if defined(LLONG_MIN) && defined(LLONG_MAX)
129 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
130 llmin = LLONG_MIN;
131 llmax = LLONG_MAX;
132#else
133 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
134 /* This will work on one's complement and two's complement */
135 for (i = 1; i > llmax; i <<= 1, i++)
136 llmax = i;
137 llmin = llmax + 1LL; /* wrap */
138#endif
139
140 /* Sanity check */
141 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
142 || llmax - 1 > llmax) {
143 fprintf(f, "unknown unknown\n");
144 exit(2);
145 }
146
147 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
148 exit(3);
149
150 exit(0);
151}
152 ]])],
153 [
154 llong_min=`$AWK '{print $1}' conftest.llminmax`
155 llong_max=`$AWK '{print $2}' conftest.llminmax`
156 AC_MSG_RESULT($llong_max)
157 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
158 [max value of long long calculated by configure])
159 AC_MSG_CHECKING([for min value of long long])
160 AC_MSG_RESULT($llong_min)
161 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
162 [min value of long long calculated by configure])
163 ],
164 [
165 AC_MSG_RESULT(not found)
166 ],
167 [
168 AC_MSG_WARN([cross compiling: not checking])
169 ]
170 )
171fi
172
Tim Rice88368a32003-12-08 12:35:59 -0800173AC_ARG_WITH(rpath,
174 [ --without-rpath Disable auto-added -R linker paths],
175 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800176 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800177 need_dash_r=""
178 fi
179 if test "x$withval" = "xyes" ; then
180 need_dash_r=1
181 fi
182 ]
183)
184
Damien Millera22ba012000-03-02 23:09:20 +1100185# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100186case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100187*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100188 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000189 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800190 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100191 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000192 saved_LDFLAGS="$LDFLAGS"
193 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
194 if (test -z "$blibflags"); then
195 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
196 AC_TRY_LINK([], [], [blibflags=$tryflags])
197 fi
198 done
199 if (test -z "$blibflags"); then
200 AC_MSG_RESULT(not found)
201 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
202 else
203 AC_MSG_RESULT($blibflags)
204 fi
205 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000206 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700207 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
208 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700209 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000210 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700211 LIBS="$LIBS -ls"
212 ])
213 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100214 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100215 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100216 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000217 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100218 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000219 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
220 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000221 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000222 [(void)loginfailed("user","host","tty",0);],
223 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700224 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
225 [Define if your AIX loginfailed() function
226 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000227 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000228 )],
229 [],
230 [#include <usersec.h>]
231 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000232 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100233 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700234 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
235 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
236 [Define if your platform breaks doing a seteuid before a setuid])
237 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
238 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000239 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700240 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
241 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
242 [Some systems need a utmpx entry for /bin/login to work])
243 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
244 [Define to a Set Process Title type if your system is
245 supported by bsd-setproctitle.c])
Damien Miller75b1d102000-01-07 14:01:41 +1100246 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100247*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100248 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800249 LIBS="$LIBS /usr/lib/textmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700250 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
251 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
252 AC_DEFINE(DISABLE_SHADOW, 1,
253 [Define if you want to disable shadow passwords])
254 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
255 [Define if your system choked on IP TOS setting])
256 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
257 [Define if X11 doesn't support AF_UNIX sockets on that system])
258 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
259 [Define if the concept of ports only accessible to
260 superusers isn't known])
261 AC_DEFINE(DISABLE_FD_PASSING, 1,
262 [Define if your platform needs to skip post auth
263 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100264 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000265*-*-dgux*)
266 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100267 AC_DEFINE(SETEUID_BREAKS_SETUID)
268 AC_DEFINE(BROKEN_SETREUID)
269 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000270 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000271*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000272 AC_MSG_CHECKING(if we have working getaddrinfo)
273 AC_TRY_RUN([#include <mach-o/dyld.h>
274main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
275 exit(0);
276 else
277 exit(1);
278}], [AC_MSG_RESULT(working)],
279 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700280 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700281 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000282 AC_DEFINE(SETEUID_BREAKS_SETUID)
283 AC_DEFINE(BROKEN_SETREUID)
284 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700285 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
286 [Define if your resolver libs need this for getrrsetbyname])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000287 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000288*-*-hpux*)
289 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000290 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100291 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000292 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700293 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
294 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000295 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700296 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
297 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000298 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700299 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000300 AC_CHECK_LIB(xnet, t_error, ,
301 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
302
303 # next, we define all of the options specific to major releases
304 case "$host" in
305 *-*-hpux10*)
306 if test -z "$GCC"; then
307 CFLAGS="$CFLAGS -Ae"
308 fi
309 ;;
310 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700311 AC_DEFINE(PAM_SUN_CODEBASE, 1,
312 [Define if you are using Solaris-derived PAM which
313 passes pam_messages to the conversation function
314 with an extra level of indirection])
315 AC_DEFINE(DISABLE_UTMP, 1,
316 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000317 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
318 check_for_hpux_broken_getaddrinfo=1
319 check_for_conflicting_getspnam=1
320 ;;
321 esac
322
323 # lastly, we define options specific to minor releases
324 case "$host" in
325 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700326 AC_DEFINE(HAVE_SECUREWARE, 1,
327 [Define if you have SecureWare-based
328 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000329 disable_ptmx_check=yes
330 LIBS="$LIBS -lsecpw"
331 ;;
332 esac
Damien Miller1bead332000-04-30 00:47:29 +1000333 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100334*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100335 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700336 AC_DEFINE(BROKEN_INET_NTOA, 1,
337 [Define if you system's inet_ntoa is busted
338 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000339 AC_DEFINE(SETEUID_BREAKS_SETUID)
340 AC_DEFINE(BROKEN_SETREUID)
341 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700342 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
343 [Define if you shouldn't strip 'tty' from your
344 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000345 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100346 ;;
347*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100348 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700349 AC_DEFINE(WITH_IRIX_ARRAY, 1,
350 [Define if you have/want arrays
351 (cluster-wide session managment, not C arrays)])
352 AC_DEFINE(WITH_IRIX_PROJECT, 1,
353 [Define if you want IRIX project management])
354 AC_DEFINE(WITH_IRIX_AUDIT, 1,
355 [Define if you want IRIX audit trails])
356 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
357 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000358 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000359 AC_DEFINE(SETEUID_BREAKS_SETUID)
360 AC_DEFINE(BROKEN_SETREUID)
361 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700362 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000363 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000364 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100365 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100366*-*-linux*)
367 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100368 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000369 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700370 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
371 AC_DEFINE(PAM_TTY_KLUDGE, 1,
372 [Work around problematic Linux PAM modules handling of PAM_TTY])
373 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
374 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000375 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700376 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
377 [Define to whatever link() returns for "not supported"
378 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100379 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700380 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100381 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000382 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000383 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700384 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
385 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000386 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000387 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100388 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000389mips-sony-bsd|mips-sony-newsos4)
Tim Rice7df8d392005-09-19 09:33:39 -0700390 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000391 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000392 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100393*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000394 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800395 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800396 need_dash_r=1
397 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100398 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100399*-*-freebsd*)
400 check_for_libcrypt_later=1
401 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000402*-*-bsdi*)
403 AC_DEFINE(SETEUID_BREAKS_SETUID)
404 AC_DEFINE(BROKEN_SETREUID)
405 AC_DEFINE(BROKEN_SETREGID)
406 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000407*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000408 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100409 conf_utmp_location=/etc/utmp
410 conf_wtmp_location=/usr/adm/wtmp
411 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700412 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000413 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000414 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700415 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000416 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000417*-*-openbsd*)
418 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
419 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100420*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800421 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800422 need_dash_r=1
423 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100424 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000425 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700426 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
427 [Some versions of /bin/login need the TERM supplied
428 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000429 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700430 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
431 [Define if pam_chauthtok wants real uid set
432 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000433 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000434 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700435 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
436 [Define if sshd somehow reacquires a controlling TTY
437 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000438 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000439 # hardwire lastlog location (can't detect it on some versions)
440 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000441 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
442 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
443 if test "$sol2ver" -ge 8; then
444 AC_MSG_RESULT(yes)
445 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700446 AC_DEFINE(DISABLE_WTMP, 1,
447 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000448 else
449 AC_MSG_RESULT(no)
450 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100451 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000452*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000453 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000454 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100455 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000456 conf_utmp_location=/etc/utmp
457 conf_wtmp_location=/var/adm/wtmp
458 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000459 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000460 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000461*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700462 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000463 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000464 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000465 AC_DEFINE(SETEUID_BREAKS_SETUID)
466 AC_DEFINE(BROKEN_SETREUID)
467 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000468 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000469*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700470 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000471 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100472 # -lresolv needs to be at then end of LIBS or DNS lookups break
473 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100474 IPADDR_IN_DISPLAY=yes
475 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000476 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000477 AC_DEFINE(SETEUID_BREAKS_SETUID)
478 AC_DEFINE(BROKEN_SETREUID)
479 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000480 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000481 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700482 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
483 # Attention: always take care to bind libsocket and libnsl before libc,
484 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000485 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800486# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100487*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100488 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700489 AC_DEFINE(SETEUID_BREAKS_SETUID)
490 AC_DEFINE(BROKEN_SETREUID)
491 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700492 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100493 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800494# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100495*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700496 check_for_libcrypt_later=1
497 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100498 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700499 AC_DEFINE(SETEUID_BREAKS_SETUID)
500 AC_DEFINE(BROKEN_SETREUID)
501 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700502 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700503 case "$host" in
504 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
505 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700506 AC_DEFINE(BROKEN_LIBIAF, 1,
507 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700508 ;;
509 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100510 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100511*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100512 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800513# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100514*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800515 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100516 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800517# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100518*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800519 if test -z "$GCC"; then
520 CFLAGS="$CFLAGS -belf"
521 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100522 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000523 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100524 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000525 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000526 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700527 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700528 AC_DEFINE(SETEUID_BREAKS_SETUID)
529 AC_DEFINE(BROKEN_SETREUID)
530 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700531 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700532 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700533 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100534 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700535 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700536 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000537 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000538*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700539 AC_DEFINE(NO_SSH_LASTLOG, 1,
540 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100541 AC_DEFINE(SETEUID_BREAKS_SETUID)
542 AC_DEFINE(BROKEN_SETREUID)
543 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000544 AC_DEFINE(USE_PIPES)
545 AC_DEFINE(DISABLE_FD_PASSING)
546 LDFLAGS="$LDFLAGS"
547 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
548 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000549 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000550*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100551 AC_DEFINE(SETEUID_BREAKS_SETUID)
552 AC_DEFINE(BROKEN_SETREUID)
553 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000554 AC_DEFINE(WITH_ABBREV_NO_TTY)
555 AC_DEFINE(USE_PIPES)
556 AC_DEFINE(DISABLE_FD_PASSING)
557 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100558 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000559 MANTYPE=cat
560 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000561*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100562 AC_DEFINE(SETEUID_BREAKS_SETUID)
563 AC_DEFINE(BROKEN_SETREUID)
564 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000565 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700566 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700567 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000568 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
569 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
570 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700571 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000572*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000573 AC_MSG_CHECKING(for Digital Unix SIA)
574 no_osfsia=""
575 AC_ARG_WITH(osfsia,
576 [ --with-osfsia Enable Digital Unix SIA],
577 [
578 if test "x$withval" = "xno" ; then
579 AC_MSG_RESULT(disabled)
580 no_osfsia=1
581 fi
582 ],
583 )
584 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000585 if test -f /etc/sia/matrix.conf; then
586 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700587 AC_DEFINE(HAVE_OSF_SIA, 1,
588 [Define if you have Digital Unix Security
589 Integration Architecture])
590 AC_DEFINE(DISABLE_LOGIN, 1,
591 [Define if you don't want to use your
592 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000593 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000594 LIBS="$LIBS -lsecurity -ldb -lm -laud"
595 else
596 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700597 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
598 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000599 fi
600 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000601 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700602 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000603 AC_DEFINE(BROKEN_SETREUID)
604 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000605 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000606
607*-*-nto-qnx)
608 AC_DEFINE(USE_PIPES)
609 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700610 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
611 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
612 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000613 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000614
615*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700616 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
617 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
618 AC_DEFINE(NEED_SETPRGP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700619 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
620 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000621
622*-*-lynxos)
623 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700624 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000625 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
626 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100627esac
628
Damien Millere37bfc12000-06-05 09:37:43 +1000629# Allow user to specify flags
630AC_ARG_WITH(cflags,
631 [ --with-cflags Specify additional flags to pass to compiler],
632 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800633 if test -n "$withval" && test "x$withval" != "xno" && \
634 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000635 CFLAGS="$CFLAGS $withval"
636 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800637 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000638)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000639AC_ARG_WITH(cppflags,
640 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
641 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800642 if test -n "$withval" && test "x$withval" != "xno" && \
643 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000644 CPPFLAGS="$CPPFLAGS $withval"
645 fi
646 ]
647)
Damien Millere37bfc12000-06-05 09:37:43 +1000648AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000649 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000650 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800651 if test -n "$withval" && test "x$withval" != "xno" && \
652 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000653 LDFLAGS="$LDFLAGS $withval"
654 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800655 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000656)
657AC_ARG_WITH(libs,
658 [ --with-libs Specify additional libraries to link with],
659 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800660 if test -n "$withval" && test "x$withval" != "xno" && \
661 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000662 LIBS="$LIBS $withval"
663 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800664 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000665)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000666AC_ARG_WITH(Werror,
667 [ --with-Werror Build main code with -Werror],
668 [
669 if test -n "$withval" && test "x$withval" != "xno"; then
670 werror_flags="-Werror"
671 if "x${withval}" != "xyes"; then
672 werror_flags="$withval"
673 fi
674 fi
675 ]
676)
Damien Millere37bfc12000-06-05 09:37:43 +1000677
Darren Tucker6eb93042003-06-29 21:30:41 +1000678AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000679AC_RUN_IFELSE(
680 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000681#include <stdio.h>
682int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000683 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000684 [ AC_MSG_RESULT(yes) ],
685 [
686 AC_MSG_RESULT(no)
687 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000688 ],
689 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000690)
691
Darren Tucker0c9653f2005-05-28 15:58:14 +1000692dnl Checks for header files.
693AC_CHECK_HEADERS( \
694 bstring.h \
695 crypt.h \
696 dirent.h \
697 endian.h \
698 features.h \
699 floatingpoint.h \
700 getopt.h \
701 glob.h \
702 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700703 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000704 lastlog.h \
705 limits.h \
706 login.h \
707 login_cap.h \
708 maillock.h \
709 ndir.h \
710 netdb.h \
711 netgroup.h \
712 netinet/in_systm.h \
713 pam/pam_appl.h \
714 paths.h \
715 pty.h \
716 readpassphrase.h \
717 rpc/types.h \
718 security/pam_appl.h \
719 shadow.h \
720 stddef.h \
721 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000722 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000723 strings.h \
724 sys/audit.h \
725 sys/bitypes.h \
726 sys/bsdtty.h \
727 sys/cdefs.h \
728 sys/dir.h \
729 sys/mman.h \
730 sys/ndir.h \
731 sys/prctl.h \
732 sys/pstat.h \
733 sys/select.h \
734 sys/stat.h \
735 sys/stream.h \
736 sys/stropts.h \
737 sys/strtio.h \
738 sys/sysmacros.h \
739 sys/time.h \
740 sys/timers.h \
741 sys/un.h \
742 time.h \
743 tmpdir.h \
744 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000745 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000746 usersec.h \
747 util.h \
748 utime.h \
749 utmp.h \
750 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000751 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000752)
Tim Rice4cec93f2002-02-26 08:40:48 -0800753
Darren Tucker48d99d32004-08-29 17:04:50 +1000754# sys/ptms.h requires sys/stream.h to be included first on Solaris
755AC_CHECK_HEADERS(sys/ptms.h, [], [], [
756#ifdef HAVE_SYS_STREAM_H
757# include <sys/stream.h>
758#endif
759])
760
Damien Millera22ba012000-03-02 23:09:20 +1100761# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700762AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
763AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000764
Tim Rice1e1ef642003-09-11 22:19:31 -0700765dnl IRIX and Solaris 2.5.1 have dirname() in libgen
766AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
767 AC_CHECK_LIB(gen, dirname,[
768 AC_CACHE_CHECK([for broken dirname],
769 ac_cv_have_broken_dirname, [
770 save_LIBS="$LIBS"
771 LIBS="$LIBS -lgen"
772 AC_TRY_RUN(
773 [
774#include <libgen.h>
775#include <string.h>
776
777int main(int argc, char **argv) {
778 char *s, buf[32];
779
780 strncpy(buf,"/etc", 32);
781 s = dirname(buf);
782 if (!s || strncmp(s, "/", 32) != 0) {
783 exit(1);
784 } else {
785 exit(0);
786 }
787}
788 ],
789 [ ac_cv_have_broken_dirname="no" ],
790 [ ac_cv_have_broken_dirname="yes" ]
791 )
792 LIBS="$save_LIBS"
793 ])
794 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
795 LIBS="$LIBS -lgen"
796 AC_DEFINE(HAVE_DIRNAME)
797 AC_CHECK_HEADERS(libgen.h)
798 fi
799 ])
800])
801
802AC_CHECK_FUNC(getspnam, ,
803 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700804AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
805 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700806
Tim Rice13aae5e2001-10-21 17:53:58 -0700807dnl zlib is required
808AC_ARG_WITH(zlib,
809 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100810 [ if test "x$withval" = "xno" ; then
811 AC_MSG_ERROR([*** zlib is required ***])
812 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700813 if test -d "$withval/lib"; then
814 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700815 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700816 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700817 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700818 fi
819 else
820 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700821 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700822 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700823 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700824 fi
825 fi
826 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700827 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700828 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700829 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700830 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100831 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700832)
833
Tim Ricefcb62202004-01-23 18:35:16 -0800834AC_CHECK_LIB(z, deflate, ,
835 [
836 saved_CPPFLAGS="$CPPFLAGS"
837 saved_LDFLAGS="$LDFLAGS"
838 save_LIBS="$LIBS"
839 dnl Check default zlib install dir
840 if test -n "${need_dash_r}"; then
841 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
842 else
843 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
844 fi
845 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
846 LIBS="$LIBS -lz"
847 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
848 [
849 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
850 ]
851 )
852 ]
853)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100854AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100855
856AC_ARG_WITH(zlib-version-check,
857 [ --without-zlib-version-check Disable zlib version check],
858 [ if test "x$withval" = "xno" ; then
859 zlib_check_nonfatal=1
860 fi
861 ]
862)
863
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000864AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000865AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000866#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100867#include <zlib.h>
868int main()
869{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000870 int a=0, b=0, c=0, d=0, n, v;
871 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
872 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100873 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000874 v = a*1000000 + b*10000 + c*100 + d;
875 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
876
877 /* 1.1.4 is OK */
878 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100879 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000880
Darren Tucker41097ed2005-07-25 15:24:21 +1000881 /* 1.2.3 and up are OK */
882 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000883 exit(0);
884
Darren Tucker2dcd2392004-01-23 17:13:33 +1100885 exit(2);
886}
Darren Tucker623d92f2004-09-12 22:36:15 +1000887 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000888 AC_MSG_RESULT(no),
889 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100890 if test -z "$zlib_check_nonfatal" ; then
891 AC_MSG_ERROR([*** zlib too old - check config.log ***
892Your reported zlib version has known security problems. It's possible your
893vendor has fixed these problems without changing the version number. If you
894are sure this is the case, you can disable the check by running
895"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000896If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000897See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100898 else
899 AC_MSG_WARN([zlib version may have security problems])
900 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000901 ],
902 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100903)
Damien Miller6f9c3372000-10-25 10:06:04 +1100904
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000905dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100906AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000907 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
908)
Damien Millera8e06ce2003-11-21 23:48:55 +1100909AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700910 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
911 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000912)
Damien Millerab18c411999-11-11 10:40:23 +1100913
Tim Ricee589a292001-11-03 11:09:32 -0800914dnl Checks for libutil functions
915AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700916AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
917 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800918AC_CHECK_FUNCS(logout updwtmp logwtmp)
919
Ben Lindstrom8697e082001-02-24 21:41:10 +0000920AC_FUNC_STRFTIME
921
Damien Miller3c027682001-03-14 11:39:45 +1100922# Check for ALTDIRFUNC glob() extension
923AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
924AC_EGREP_CPP(FOUNDIT,
925 [
926 #include <glob.h>
927 #ifdef GLOB_ALTDIRFUNC
928 FOUNDIT
929 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100930 ],
Damien Miller3c027682001-03-14 11:39:45 +1100931 [
Tim Rice7df8d392005-09-19 09:33:39 -0700932 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
933 [Define if your system glob() function has
934 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100935 AC_MSG_RESULT(yes)
936 ],
937 [
938 AC_MSG_RESULT(no)
939 ]
940)
Damien Millerab18c411999-11-11 10:40:23 +1100941
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000942# Check for g.gl_matchc glob() extension
943AC_MSG_CHECKING(for gl_matchc field in glob_t)
944AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100945 [
946 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000947 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100948 ],
949 [
Tim Rice7df8d392005-09-19 09:33:39 -0700950 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
951 [Define if your system glob() function has
952 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100953 AC_MSG_RESULT(yes)
954 ],
955 [
956 AC_MSG_RESULT(no)
957 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000958)
959
Damien Miller18bb4732001-03-28 14:35:30 +1000960AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000961AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000962 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000963#include <sys/types.h>
964#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700965int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000966 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100967 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000968 [
969 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700970 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
971 [Define in your struct dirent expects you to
972 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000973 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800974 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000975 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
976 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000977 ]
978)
979
Damien Miller36f49652004-08-15 18:40:59 +1000980AC_MSG_CHECKING([for /proc/pid/fd directory])
981if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700982 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000983 AC_MSG_RESULT(yes)
984else
985 AC_MSG_RESULT(no)
986fi
987
Damien Millerc547bf12001-02-16 10:18:12 +1100988# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100989SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100990AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100991 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100992 [
993 if test "x$withval" != "xno" ; then
994
995 if test "x$withval" != "xyes" ; then
996 CPPFLAGS="$CPPFLAGS -I${withval}/include"
997 LDFLAGS="$LDFLAGS -L${withval}/lib"
998 fi
999
Tim Rice7df8d392005-09-19 09:33:39 -07001000 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001001 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001002 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001003
Tim Rice4cec93f2002-02-26 08:40:48 -08001004 AC_MSG_CHECKING([for s/key support])
1005 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +11001006 [
Tim Rice4cec93f2002-02-26 08:40:48 -08001007#include <stdio.h>
1008#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001009int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -08001010 ],
1011 [AC_MSG_RESULT(yes)],
1012 [
1013 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001014 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1015 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001016 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1017 AC_TRY_COMPILE(
1018 [#include <stdio.h>
1019 #include <skey.h>],
1020 [(void)skeychallenge(NULL,"name","",0);],
1021 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001022 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1023 [Define if your skeychallenge()
1024 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001025 [AC_MSG_RESULT(no)]
1026 )
Damien Millerc547bf12001-02-16 10:18:12 +11001027 fi
1028 ]
1029)
1030
1031# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001032TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001033AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001034 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001035 [
1036 if test "x$withval" != "xno" ; then
1037 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001038 saved_LDFLAGS="$LDFLAGS"
1039 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001040 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001041 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001042 if test -d "${withval}/lib"; then
1043 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001044 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001045 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001046 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001047 fi
1048 else
1049 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001050 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001051 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001052 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001053 fi
1054 fi
1055 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001056 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001057 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001058 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001059 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001060 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001061 LIBWRAP="-lwrap"
1062 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001063 AC_MSG_CHECKING(for libwrap)
1064 AC_TRY_LINK(
1065 [
Damien Miller0ac45002004-04-14 20:14:26 +10001066#include <sys/types.h>
1067#include <sys/socket.h>
1068#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001069#include <tcpd.h>
1070 int deny_severity = 0, allow_severity = 0;
1071 ],
1072 [hosts_access(0);],
1073 [
1074 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001075 AC_DEFINE(LIBWRAP, 1,
1076 [Define if you want
1077 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001078 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001079 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001080 ],
1081 [
1082 AC_MSG_ERROR([*** libwrap missing])
1083 ]
1084 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001085 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001086 fi
1087 ]
1088)
1089
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001090# Check whether user wants libedit support
1091LIBEDIT_MSG="no"
1092AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001093 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001094 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001095 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001096 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1097 if test -n "${need_dash_r}"; then
1098 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1099 else
1100 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1101 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001102 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001103 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001104 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001105 LIBEDIT="-ledit -lcurses"
1106 LIBEDIT_MSG="yes"
1107 AC_SUBST(LIBEDIT)
1108 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001109 [ AC_MSG_ERROR(libedit not found) ],
1110 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001111 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001112 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001113 AC_COMPILE_IFELSE(
1114 [AC_LANG_SOURCE([[
1115#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001116int main(void)
1117{
1118 int i = H_SETSIZE;
1119 el_init("", NULL, NULL, NULL);
1120 exit(0);
1121}
Tim Ricec1819c82005-08-15 17:48:40 -07001122 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001123 [ AC_MSG_RESULT(yes) ],
1124 [ AC_MSG_RESULT(no)
1125 AC_MSG_ERROR(libedit version is not compatible) ]
1126 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001127 fi ]
1128)
1129
Darren Tuckerd9f88912005-02-20 21:01:48 +11001130AUDIT_MODULE=none
1131AC_ARG_WITH(audit,
1132 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1133 [
1134 AC_MSG_CHECKING(for supported audit module)
1135 case "$withval" in
1136 bsm)
1137 AC_MSG_RESULT(bsm)
1138 AUDIT_MODULE=bsm
1139 dnl Checks for headers, libs and functions
1140 AC_CHECK_HEADERS(bsm/audit.h, [],
1141 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1142 AC_CHECK_LIB(bsm, getaudit, [],
1143 [AC_MSG_ERROR(BSM enabled and required library not found)])
1144 AC_CHECK_FUNCS(getaudit, [],
1145 [AC_MSG_ERROR(BSM enabled and required function not found)])
1146 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001147 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001148 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001149 ;;
1150 debug)
1151 AUDIT_MODULE=debug
1152 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001153 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001154 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001155 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001156 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001157 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001158 *)
1159 AC_MSG_ERROR([Unknown audit module $withval])
1160 ;;
1161 esac ]
1162)
1163
Damien Millerfe1f1432003-02-24 15:45:42 +11001164dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001165AC_CHECK_FUNCS( \
1166 arc4random \
1167 b64_ntop \
1168 __b64_ntop \
1169 b64_pton \
1170 __b64_pton \
1171 bcopy \
1172 bindresvport_sa \
1173 clock \
1174 closefrom \
1175 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001176 fchmod \
1177 fchown \
1178 freeaddrinfo \
1179 futimes \
1180 getaddrinfo \
1181 getcwd \
1182 getgrouplist \
1183 getnameinfo \
1184 getopt \
1185 getpeereid \
1186 _getpty \
1187 getrlimit \
1188 getttyent \
1189 glob \
1190 inet_aton \
1191 inet_ntoa \
1192 inet_ntop \
1193 innetgr \
1194 login_getcapbool \
1195 md5_crypt \
1196 memmove \
1197 mkdtemp \
1198 mmap \
1199 ngetaddrinfo \
1200 nsleep \
1201 ogetaddrinfo \
1202 openlog_r \
1203 openpty \
1204 prctl \
1205 pstat \
1206 readpassphrase \
1207 realpath \
1208 recvmsg \
1209 rresvport_af \
1210 sendmsg \
1211 setdtablesize \
1212 setegid \
1213 setenv \
1214 seteuid \
1215 setgroups \
1216 setlogin \
1217 setpcred \
1218 setproctitle \
1219 setregid \
1220 setreuid \
1221 setrlimit \
1222 setsid \
1223 setvbuf \
1224 sigaction \
1225 sigvec \
1226 snprintf \
1227 socketpair \
1228 strdup \
1229 strerror \
1230 strlcat \
1231 strlcpy \
1232 strmode \
1233 strnvis \
1234 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001235 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001236 strtoul \
1237 sysconf \
1238 tcgetpgrp \
1239 truncate \
1240 unsetenv \
1241 updwtmpx \
1242 utimes \
1243 vhangup \
1244 vsnprintf \
1245 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001246)
Tim Rice13aae5e2001-10-21 17:53:58 -07001247
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001248# IRIX has a const char return value for gai_strerror()
1249AC_CHECK_FUNCS(gai_strerror,[
1250 AC_DEFINE(HAVE_GAI_STRERROR)
1251 AC_TRY_COMPILE([
1252#include <sys/types.h>
1253#include <sys/socket.h>
1254#include <netdb.h>
1255
1256const char *gai_strerror(int);],[
1257char *str;
1258
1259str = gai_strerror(0);],[
1260 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1261 [Define if gai_strerror() returns const char *])])])
1262
Tim Rice7df8d392005-09-19 09:33:39 -07001263AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1264 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001265
Darren Tuckerf1159b52003-07-07 19:44:01 +10001266dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001267AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001268AC_CHECK_DECL(strsep,
1269 [AC_CHECK_FUNCS(strsep)],
1270 [],
1271 [
1272#ifdef HAVE_STRING_H
1273# include <string.h>
1274#endif
1275 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001276
Darren Tuckerb2427c82003-09-10 15:22:44 +10001277dnl tcsendbreak might be a macro
1278AC_CHECK_DECL(tcsendbreak,
1279 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001280 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001281 [#include <termios.h>]
1282)
1283
Darren Tucker5bb14002004-04-23 18:53:10 +10001284AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1285
Darren Tucker2a6b0292003-12-31 14:59:17 +11001286AC_CHECK_FUNCS(setresuid, [
1287 dnl Some platorms have setresuid that isn't implemented, test for this
1288 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001289 AC_RUN_IFELSE(
1290 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001291#include <stdlib.h>
1292#include <errno.h>
1293int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001294 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001295 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001296 [AC_DEFINE(BROKEN_SETRESUID, 1,
1297 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001298 AC_MSG_RESULT(not implemented)],
1299 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001300 )
1301])
Darren Tuckere937be32003-12-17 18:53:26 +11001302
Darren Tucker2a6b0292003-12-31 14:59:17 +11001303AC_CHECK_FUNCS(setresgid, [
1304 dnl Some platorms have setresgid that isn't implemented, test for this
1305 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001306 AC_RUN_IFELSE(
1307 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001308#include <stdlib.h>
1309#include <errno.h>
1310int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001311 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001312 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001313 [AC_DEFINE(BROKEN_SETRESGID, 1,
1314 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001315 AC_MSG_RESULT(not implemented)],
1316 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001317 )
1318])
Darren Tuckere937be32003-12-17 18:53:26 +11001319
Damien Millerad833b32000-08-23 10:46:23 +10001320dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001321AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001322dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001323AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001324AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001325dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001326AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001327AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001328
Damien Millera8e06ce2003-11-21 23:48:55 +11001329AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001330 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1331 [AC_CHECK_LIB(bsd, daemon,
1332 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001333)
1334
Damien Millera8e06ce2003-11-21 23:48:55 +11001335AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001336 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1337 [Define if your libraries define getpagesize()])],
1338 [AC_CHECK_LIB(ucb, getpagesize,
1339 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001340)
1341
Damien Millercb170cb2000-07-01 16:52:55 +10001342# Check for broken snprintf
1343if test "x$ac_cv_func_snprintf" = "xyes" ; then
1344 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001345 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001346 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001347#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001348int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001349 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001350 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001351 [
1352 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001353 AC_DEFINE(BROKEN_SNPRINTF, 1,
1354 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001355 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001356 ],
1357 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001358 )
1359fi
1360
Damien Millerb4097182004-05-23 14:09:40 +10001361# Check for missing getpeereid (or equiv) support
1362NO_PEERCHECK=""
1363if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1364 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1365 AC_TRY_COMPILE(
1366 [#include <sys/types.h>
1367 #include <sys/socket.h>],
1368 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001369 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001370 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001371 ],
Damien Millerb4097182004-05-23 14:09:40 +10001372 [AC_MSG_RESULT(no)
1373 NO_PEERCHECK=1]
1374 )
1375fi
1376
Damien Millere8328192003-01-07 15:18:32 +11001377dnl see whether mkstemp() requires XXXXXX
1378if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1379AC_MSG_CHECKING([for (overly) strict mkstemp])
1380AC_TRY_RUN(
1381 [
1382#include <stdlib.h>
1383main() { char template[]="conftest.mkstemp-test";
1384if (mkstemp(template) == -1)
1385 exit(1);
1386unlink(template); exit(0);
1387}
1388 ],
1389 [
1390 AC_MSG_RESULT(no)
1391 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001392 [
Damien Millere8328192003-01-07 15:18:32 +11001393 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001394 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001395 ],
1396 [
1397 AC_MSG_RESULT(yes)
1398 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001399 ]
Damien Millere8328192003-01-07 15:18:32 +11001400)
1401fi
1402
Darren Tucker70a3d552003-08-21 17:58:29 +10001403dnl make sure that openpty does not reacquire controlling terminal
1404if test ! -z "$check_for_openpty_ctty_bug"; then
1405 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1406 AC_TRY_RUN(
1407 [
1408#include <stdio.h>
1409#include <sys/fcntl.h>
1410#include <sys/types.h>
1411#include <sys/wait.h>
1412
1413int
1414main()
1415{
1416 pid_t pid;
1417 int fd, ptyfd, ttyfd, status;
1418
1419 pid = fork();
1420 if (pid < 0) { /* failed */
1421 exit(1);
1422 } else if (pid > 0) { /* parent */
1423 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001424 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001425 exit(WEXITSTATUS(status));
1426 else
1427 exit(2);
1428 } else { /* child */
1429 close(0); close(1); close(2);
1430 setsid();
1431 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1432 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1433 if (fd >= 0)
1434 exit(3); /* Acquired ctty: broken */
1435 else
1436 exit(0); /* Did not acquire ctty: OK */
1437 }
1438}
1439 ],
1440 [
1441 AC_MSG_RESULT(yes)
1442 ],
1443 [
1444 AC_MSG_RESULT(no)
1445 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1446 ]
1447 )
1448fi
1449
Tim Rice8bb561b2005-03-17 16:23:19 -08001450if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1451 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001452 AC_MSG_CHECKING(if getaddrinfo seems to work)
1453 AC_TRY_RUN(
1454 [
1455#include <stdio.h>
1456#include <sys/socket.h>
1457#include <netdb.h>
1458#include <errno.h>
1459#include <netinet/in.h>
1460
1461#define TEST_PORT "2222"
1462
1463int
1464main(void)
1465{
1466 int err, sock;
1467 struct addrinfo *gai_ai, *ai, hints;
1468 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1469
1470 memset(&hints, 0, sizeof(hints));
1471 hints.ai_family = PF_UNSPEC;
1472 hints.ai_socktype = SOCK_STREAM;
1473 hints.ai_flags = AI_PASSIVE;
1474
1475 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1476 if (err != 0) {
1477 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1478 exit(1);
1479 }
1480
1481 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1482 if (ai->ai_family != AF_INET6)
1483 continue;
1484
1485 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1486 sizeof(ntop), strport, sizeof(strport),
1487 NI_NUMERICHOST|NI_NUMERICSERV);
1488
1489 if (err != 0) {
1490 if (err == EAI_SYSTEM)
1491 perror("getnameinfo EAI_SYSTEM");
1492 else
1493 fprintf(stderr, "getnameinfo failed: %s\n",
1494 gai_strerror(err));
1495 exit(2);
1496 }
1497
1498 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1499 if (sock < 0)
1500 perror("socket");
1501 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1502 if (errno == EBADF)
1503 exit(3);
1504 }
1505 }
1506 exit(0);
1507}
1508 ],
1509 [
1510 AC_MSG_RESULT(yes)
1511 ],
1512 [
1513 AC_MSG_RESULT(no)
1514 AC_DEFINE(BROKEN_GETADDRINFO)
1515 ]
1516 )
1517fi
1518
Tim Rice8bb561b2005-03-17 16:23:19 -08001519if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1520 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001521 AC_MSG_CHECKING(if getaddrinfo seems to work)
1522 AC_TRY_RUN(
1523 [
1524#include <stdio.h>
1525#include <sys/socket.h>
1526#include <netdb.h>
1527#include <errno.h>
1528#include <netinet/in.h>
1529
1530#define TEST_PORT "2222"
1531
1532int
1533main(void)
1534{
1535 int err, sock;
1536 struct addrinfo *gai_ai, *ai, hints;
1537 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1538
1539 memset(&hints, 0, sizeof(hints));
1540 hints.ai_family = PF_UNSPEC;
1541 hints.ai_socktype = SOCK_STREAM;
1542 hints.ai_flags = AI_PASSIVE;
1543
1544 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1545 if (err != 0) {
1546 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1547 exit(1);
1548 }
1549
1550 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1551 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1552 continue;
1553
1554 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1555 sizeof(ntop), strport, sizeof(strport),
1556 NI_NUMERICHOST|NI_NUMERICSERV);
1557
1558 if (ai->ai_family == AF_INET && err != 0) {
1559 perror("getnameinfo");
1560 exit(2);
1561 }
1562 }
1563 exit(0);
1564}
1565 ],
1566 [
1567 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001568 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1569 [Define if you have a getaddrinfo that fails
1570 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001571 ],
1572 [
1573 AC_MSG_RESULT(no)
1574 AC_DEFINE(BROKEN_GETADDRINFO)
1575 ]
1576 )
1577fi
1578
Darren Tuckera56f1912004-11-02 20:30:54 +11001579if test "x$check_for_conflicting_getspnam" = "x1"; then
1580 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1581 AC_COMPILE_IFELSE(
1582 [
1583#include <shadow.h>
1584int main(void) {exit(0);}
1585 ],
1586 [
1587 AC_MSG_RESULT(no)
1588 ],
1589 [
1590 AC_MSG_RESULT(yes)
1591 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1592 [Conflicting defs for getspnam])
1593 ]
1594 )
1595fi
1596
Damien Miller606f8802000-09-16 15:39:56 +11001597AC_FUNC_GETPGRP
1598
Damien Millera64b57a2001-01-17 10:44:13 +11001599# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001600PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001601AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001602 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001603 [
Damien Millera64b57a2001-01-17 10:44:13 +11001604 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001605 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1606 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001607 AC_MSG_ERROR([PAM headers not found])
1608 fi
1609
1610 AC_CHECK_LIB(dl, dlopen, , )
1611 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1612 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001613 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001614
Damien Millera64b57a2001-01-17 10:44:13 +11001615 PAM_MSG="yes"
1616
Tim Rice7df8d392005-09-19 09:33:39 -07001617 AC_DEFINE(USE_PAM, 1,
1618 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001619 if test $ac_cv_lib_dl_dlopen = yes; then
1620 LIBPAM="-lpam -ldl"
1621 else
1622 LIBPAM="-lpam"
1623 fi
1624 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001625 fi
1626 ]
1627)
Damien Millera22ba012000-03-02 23:09:20 +11001628
Damien Millera64b57a2001-01-17 10:44:13 +11001629# Check for older PAM
1630if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001631 # Check PAM strerror arguments (old PAM)
1632 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1633 AC_TRY_COMPILE(
1634 [
Damien Miller81171112000-04-23 11:14:01 +10001635#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001636#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001637#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001638#elif defined (HAVE_PAM_PAM_APPL_H)
1639#include <pam/pam_appl.h>
1640#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001641 ],
1642 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001643 [AC_MSG_RESULT(no)],
1644 [
Tim Rice7df8d392005-09-19 09:33:39 -07001645 AC_DEFINE(HAVE_OLD_PAM, 1,
1646 [Define if you have an old version of PAM
1647 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001648 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001649 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001650 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001651 )
Damien Millera22ba012000-03-02 23:09:20 +11001652fi
1653
Tim Riceaef73712002-05-11 13:17:42 -07001654# Search for OpenSSL
1655saved_CPPFLAGS="$CPPFLAGS"
1656saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001657AC_ARG_WITH(ssl-dir,
1658 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1659 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001660 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001661 case "$withval" in
1662 # Relative paths
1663 ./*|../*) withval="`pwd`/$withval"
1664 esac
Tim Riceaef73712002-05-11 13:17:42 -07001665 if test -d "$withval/lib"; then
1666 if test -n "${need_dash_r}"; then
1667 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1668 else
1669 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1670 fi
1671 else
1672 if test -n "${need_dash_r}"; then
1673 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1674 else
1675 LDFLAGS="-L${withval} ${LDFLAGS}"
1676 fi
1677 fi
1678 if test -d "$withval/include"; then
1679 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1680 else
1681 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1682 fi
Damien Millera22ba012000-03-02 23:09:20 +11001683 fi
1684 ]
1685)
Tim Rice3d5352e2004-02-12 09:27:21 -08001686LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001687AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1688 [Define if your ssl headers are included
1689 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001690 [
Tim Riceaef73712002-05-11 13:17:42 -07001691 dnl Check default openssl install dir
1692 if test -n "${need_dash_r}"; then
1693 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001694 else
Tim Riceaef73712002-05-11 13:17:42 -07001695 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001696 fi
Tim Riceaef73712002-05-11 13:17:42 -07001697 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1698 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1699 [
1700 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1701 ]
1702 )
1703 ]
1704)
1705
Tim Riced730b782002-08-13 18:52:10 -07001706# Determine OpenSSL header version
1707AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001708AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001709 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001710#include <stdio.h>
1711#include <string.h>
1712#include <openssl/opensslv.h>
1713#define DATA "conftest.sslincver"
1714int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001715 FILE *fd;
1716 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001717
Damien Millera8e06ce2003-11-21 23:48:55 +11001718 fd = fopen(DATA,"w");
1719 if(fd == NULL)
1720 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001721
1722 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1723 exit(1);
1724
1725 exit(0);
1726}
Darren Tucker623d92f2004-09-12 22:36:15 +10001727 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001728 [
1729 ssl_header_ver=`cat conftest.sslincver`
1730 AC_MSG_RESULT($ssl_header_ver)
1731 ],
1732 [
1733 AC_MSG_RESULT(not found)
1734 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001735 ],
1736 [
1737 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001738 ]
1739)
1740
1741# Determine OpenSSL library version
1742AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001743AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001744 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001745#include <stdio.h>
1746#include <string.h>
1747#include <openssl/opensslv.h>
1748#include <openssl/crypto.h>
1749#define DATA "conftest.ssllibver"
1750int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001751 FILE *fd;
1752 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001753
Damien Millera8e06ce2003-11-21 23:48:55 +11001754 fd = fopen(DATA,"w");
1755 if(fd == NULL)
1756 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001757
1758 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1759 exit(1);
1760
1761 exit(0);
1762}
Darren Tucker623d92f2004-09-12 22:36:15 +10001763 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001764 [
1765 ssl_library_ver=`cat conftest.ssllibver`
1766 AC_MSG_RESULT($ssl_library_ver)
1767 ],
1768 [
1769 AC_MSG_RESULT(not found)
1770 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001771 ],
1772 [
1773 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001774 ]
1775)
Damien Millera22ba012000-03-02 23:09:20 +11001776
Damien Millerec932372002-01-22 22:16:03 +11001777# Sanity check OpenSSL headers
1778AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001779AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001780 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001781#include <string.h>
1782#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001783int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001784 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001785 [
1786 AC_MSG_RESULT(yes)
1787 ],
1788 [
1789 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001790 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1791Check config.log for details.
1792Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001793 ],
1794 [
1795 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001796 ]
1797)
1798
Tim Rice3d5352e2004-02-12 09:27:21 -08001799# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1800# because the system crypt() is more featureful.
1801if test "x$check_for_libcrypt_before" = "x1"; then
1802 AC_CHECK_LIB(crypt, crypt)
1803fi
1804
Damien Millera8e06ce2003-11-21 23:48:55 +11001805# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001806# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001807if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001808 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001809fi
1810
Tim Rice2291c002005-08-26 13:15:19 -07001811AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001812
1813### Configure cryptographic random number support
1814
1815# Check wheter OpenSSL seeds itself
1816AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001817AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001818 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001819#include <string.h>
1820#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001821int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001822 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001823 [
1824 OPENSSL_SEEDS_ITSELF=yes
1825 AC_MSG_RESULT(yes)
1826 ],
1827 [
1828 AC_MSG_RESULT(no)
1829 # Default to use of the rand helper if OpenSSL doesn't
1830 # seed itself
1831 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001832 ],
1833 [
1834 AC_MSG_WARN([cross compiling: assuming yes])
1835 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001836 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001837 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001838 ]
1839)
1840
1841
1842# Do we want to force the use of the rand helper?
1843AC_ARG_WITH(rand-helper,
1844 [ --with-rand-helper Use subprocess to gather strong randomness ],
1845 [
1846 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001847 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001848 # the previous test showed it to be unseeded.
1849 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1850 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1851 OPENSSL_SEEDS_ITSELF=yes
1852 USE_RAND_HELPER=""
1853 fi
1854 else
1855 USE_RAND_HELPER=yes
1856 fi
1857 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001858)
Damien Miller6c21c512002-01-22 21:57:53 +11001859
1860# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001861if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001862 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001863 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1864 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001865 RAND_MSG="OpenSSL internal ONLY"
1866 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001867elif test ! -z "$USE_RAND_HELPER" ; then
1868 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001869 RAND_MSG="ssh-rand-helper"
1870 INSTALL_SSH_RAND_HELPER="yes"
1871fi
1872AC_SUBST(INSTALL_SSH_RAND_HELPER)
1873
1874### Configuration of ssh-rand-helper
1875
1876# PRNGD TCP socket
1877AC_ARG_WITH(prngd-port,
1878 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1879 [
Damien Millere996d722002-01-23 11:20:59 +11001880 case "$withval" in
1881 no)
1882 withval=""
1883 ;;
1884 [[0-9]]*)
1885 ;;
1886 *)
1887 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1888 ;;
1889 esac
1890 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001891 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001892 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1893 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001894 fi
1895 ]
1896)
1897
1898# PRNGD Unix domain socket
1899AC_ARG_WITH(prngd-socket,
1900 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1901 [
Damien Millere996d722002-01-23 11:20:59 +11001902 case "$withval" in
1903 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001904 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001905 ;;
1906 no)
1907 withval=""
1908 ;;
1909 /*)
1910 ;;
1911 *)
1912 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1913 ;;
1914 esac
1915
1916 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001917 if test ! -z "$PRNGD_PORT" ; then
1918 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1919 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001920 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001921 AC_MSG_WARN(Entropy socket is not readable)
1922 fi
1923 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001924 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1925 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001926 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001927 ],
1928 [
1929 # Check for existing socket only if we don't have a random device already
1930 if test "$USE_RAND_HELPER" = yes ; then
1931 AC_MSG_CHECKING(for PRNGD/EGD socket)
1932 # Insert other locations here
1933 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1934 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1935 PRNGD_SOCKET="$sock"
1936 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1937 break;
1938 fi
1939 done
1940 if test ! -z "$PRNGD_SOCKET" ; then
1941 AC_MSG_RESULT($PRNGD_SOCKET)
1942 else
1943 AC_MSG_RESULT(not found)
1944 fi
1945 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001946 ]
1947)
1948
1949# Change default command timeout for hashing entropy source
1950entropy_timeout=200
1951AC_ARG_WITH(entropy-timeout,
1952 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1953 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001954 if test -n "$withval" && test "x$withval" != "xno" && \
1955 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001956 entropy_timeout=$withval
1957 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001958 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001959)
Tim Rice7df8d392005-09-19 09:33:39 -07001960AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1961 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11001962
Damien Millerd3f6ad22002-06-25 10:24:47 +10001963SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001964AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001965 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001966 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001967 if test -n "$withval" && test "x$withval" != "xno" && \
1968 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001969 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001970 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001971 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001972)
Tim Rice7df8d392005-09-19 09:33:39 -07001973AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
1974 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10001975AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001976
Tim Rice88f2ab52002-03-17 12:17:34 -08001977# We do this little dance with the search path to insure
1978# that programs that we select for use by installed programs
1979# (which may be run by the super-user) come from trusted
1980# locations before they come from the user's private area.
1981# This should help avoid accidentally configuring some
1982# random version of a program in someone's personal bin.
1983
1984OPATH=$PATH
1985PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001986test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001987test -d /sbin && PATH=$PATH:/sbin
1988test -d /usr/sbin && PATH=$PATH:/usr/sbin
1989PATH=$PATH:/etc:$OPATH
1990
Damien Millera8e06ce2003-11-21 23:48:55 +11001991# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001992OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1993OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1994OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1995OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1996OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1997OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1998OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1999OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2000OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2001OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2002OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2003OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2004OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2005OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2006OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2007OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002008# restore PATH
2009PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002010
2011# Where does ssh-rand-helper get its randomness from?
2012INSTALL_SSH_PRNG_CMDS=""
2013if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2014 if test ! -z "$PRNGD_PORT" ; then
2015 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2016 elif test ! -z "$PRNGD_SOCKET" ; then
2017 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2018 else
2019 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2020 RAND_HELPER_CMDHASH=yes
2021 INSTALL_SSH_PRNG_CMDS="yes"
2022 fi
2023fi
2024AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2025
2026
Ben Lindstromb5628642000-10-18 00:02:25 +00002027# Cheap hack to ensure NEWS-OS libraries are arranged right.
2028if test ! -z "$SONY" ; then
2029 LIBS="$LIBS -liberty";
2030fi
2031
Damien Millera22ba012000-03-02 23:09:20 +11002032# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11002033AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002034AC_CHECK_SIZEOF(short int, 2)
2035AC_CHECK_SIZEOF(int, 4)
2036AC_CHECK_SIZEOF(long int, 4)
2037AC_CHECK_SIZEOF(long long int, 8)
2038
Damien Millerfa2bb692002-04-23 23:22:25 +10002039# Sanity check long long for some platforms (AIX)
2040if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2041 ac_cv_sizeof_long_long_int=0
2042fi
2043
Damien Millera22ba012000-03-02 23:09:20 +11002044# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002045AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2046 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002047 [ #include <sys/types.h> ],
2048 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002049 [ ac_cv_have_u_int="yes" ],
2050 [ ac_cv_have_u_int="no" ]
2051 )
2052])
2053if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002054 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002055 have_u_int=1
2056fi
2057
Damien Miller61e50f12000-05-08 20:49:37 +10002058AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2059 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002060 [ #include <sys/types.h> ],
2061 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002062 [ ac_cv_have_intxx_t="yes" ],
2063 [ ac_cv_have_intxx_t="no" ]
2064 )
2065])
2066if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002067 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002068 have_intxx_t=1
2069fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002070
2071if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002072 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002073then
2074 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2075 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002076 [ #include <stdint.h> ],
2077 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002078 [
2079 AC_DEFINE(HAVE_INTXX_T)
2080 AC_MSG_RESULT(yes)
2081 ],
2082 [ AC_MSG_RESULT(no) ]
2083 )
2084fi
2085
Damien Miller578783e2000-09-23 14:12:24 +11002086AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2087 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002088 [
2089#include <sys/types.h>
2090#ifdef HAVE_STDINT_H
2091# include <stdint.h>
2092#endif
2093#include <sys/socket.h>
2094#ifdef HAVE_SYS_BITYPES_H
2095# include <sys/bitypes.h>
2096#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002097 ],
2098 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002099 [ ac_cv_have_int64_t="yes" ],
2100 [ ac_cv_have_int64_t="no" ]
2101 )
2102])
2103if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002104 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002105fi
2106
Damien Miller61e50f12000-05-08 20:49:37 +10002107AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2108 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002109 [ #include <sys/types.h> ],
2110 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002111 [ ac_cv_have_u_intxx_t="yes" ],
2112 [ ac_cv_have_u_intxx_t="no" ]
2113 )
2114])
2115if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002116 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002117 have_u_intxx_t=1
2118fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002119
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002120if test -z "$have_u_intxx_t" ; then
2121 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2122 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002123 [ #include <sys/socket.h> ],
2124 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002125 [
2126 AC_DEFINE(HAVE_U_INTXX_T)
2127 AC_MSG_RESULT(yes)
2128 ],
2129 [ AC_MSG_RESULT(no) ]
2130 )
2131fi
2132
Damien Miller578783e2000-09-23 14:12:24 +11002133AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2134 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002135 [ #include <sys/types.h> ],
2136 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002137 [ ac_cv_have_u_int64_t="yes" ],
2138 [ ac_cv_have_u_int64_t="no" ]
2139 )
2140])
2141if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002142 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002143 have_u_int64_t=1
2144fi
2145
Tim Rice4cec93f2002-02-26 08:40:48 -08002146if test -z "$have_u_int64_t" ; then
2147 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2148 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002149 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002150 [ u_int64_t a; a = 1],
2151 [
2152 AC_DEFINE(HAVE_U_INT64_T)
2153 AC_MSG_RESULT(yes)
2154 ],
2155 [ AC_MSG_RESULT(no) ]
2156 )
2157fi
2158
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002159if test -z "$have_u_intxx_t" ; then
2160 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2161 AC_TRY_COMPILE(
2162 [
2163#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002164 ],
2165 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002166 [ ac_cv_have_uintxx_t="yes" ],
2167 [ ac_cv_have_uintxx_t="no" ]
2168 )
2169 ])
2170 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002171 AC_DEFINE(HAVE_UINTXX_T, 1,
2172 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002173 fi
2174fi
2175
2176if test -z "$have_uintxx_t" ; then
2177 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2178 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002179 [ #include <stdint.h> ],
2180 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002181 [
2182 AC_DEFINE(HAVE_UINTXX_T)
2183 AC_MSG_RESULT(yes)
2184 ],
2185 [ AC_MSG_RESULT(no) ]
2186 )
2187fi
2188
Damien Milleredb82922000-06-20 13:25:52 +10002189if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002190 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002191then
2192 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2193 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002194 [
2195#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002196 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002197 [
Damien Miller70494d12000-04-03 15:57:06 +10002198 int8_t a; int16_t b; int32_t c;
2199 u_int8_t e; u_int16_t f; u_int32_t g;
2200 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002201 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002202 [
2203 AC_DEFINE(HAVE_U_INTXX_T)
2204 AC_DEFINE(HAVE_INTXX_T)
2205 AC_MSG_RESULT(yes)
2206 ],
2207 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002208 )
Damien Millerb29ea912000-01-15 14:12:03 +11002209fi
2210
Damien Miller58be7382001-09-15 21:31:54 +10002211
2212AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2213 AC_TRY_COMPILE(
2214 [
2215#include <sys/types.h>
2216 ],
2217 [ u_char foo; foo = 125; ],
2218 [ ac_cv_have_u_char="yes" ],
2219 [ ac_cv_have_u_char="no" ]
2220 )
2221])
2222if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002223 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002224fi
2225
Tim Rice13aae5e2001-10-21 17:53:58 -07002226TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002227
Tim Rice200a5c02002-02-26 22:12:34 -08002228AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002229
Damien Miller848b9932005-02-24 12:12:34 +11002230AC_CHECK_TYPES(in_addr_t,,,
2231[#include <sys/types.h>
2232#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002233
Damien Miller61e50f12000-05-08 20:49:37 +10002234AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2235 AC_TRY_COMPILE(
2236 [
2237#include <sys/types.h>
2238 ],
2239 [ size_t foo; foo = 1235; ],
2240 [ ac_cv_have_size_t="yes" ],
2241 [ ac_cv_have_size_t="no" ]
2242 )
2243])
2244if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002245 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002246fi
Damien Miller95058511999-12-29 10:36:45 +11002247
Damien Miller615f9392000-05-17 22:53:33 +10002248AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2249 AC_TRY_COMPILE(
2250 [
2251#include <sys/types.h>
2252 ],
2253 [ ssize_t foo; foo = 1235; ],
2254 [ ac_cv_have_ssize_t="yes" ],
2255 [ ac_cv_have_ssize_t="no" ]
2256 )
2257])
2258if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002259 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002260fi
2261
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002262AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2263 AC_TRY_COMPILE(
2264 [
2265#include <time.h>
2266 ],
2267 [ clock_t foo; foo = 1235; ],
2268 [ ac_cv_have_clock_t="yes" ],
2269 [ ac_cv_have_clock_t="no" ]
2270 )
2271])
2272if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002273 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002274fi
2275
Damien Millerb54b40e2000-06-23 08:23:34 +10002276AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2277 AC_TRY_COMPILE(
2278 [
2279#include <sys/types.h>
2280#include <sys/socket.h>
2281 ],
2282 [ sa_family_t foo; foo = 1235; ],
2283 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002284 [ AC_TRY_COMPILE(
2285 [
2286#include <sys/types.h>
2287#include <sys/socket.h>
2288#include <netinet/in.h>
2289 ],
2290 [ sa_family_t foo; foo = 1235; ],
2291 [ ac_cv_have_sa_family_t="yes" ],
2292
Damien Millerb54b40e2000-06-23 08:23:34 +10002293 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002294 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002295 )
2296])
2297if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002298 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2299 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002300fi
2301
Damien Miller0f91b4e2000-06-18 15:43:25 +10002302AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2303 AC_TRY_COMPILE(
2304 [
2305#include <sys/types.h>
2306 ],
2307 [ pid_t foo; foo = 1235; ],
2308 [ ac_cv_have_pid_t="yes" ],
2309 [ ac_cv_have_pid_t="no" ]
2310 )
2311])
2312if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002313 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002314fi
2315
2316AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2317 AC_TRY_COMPILE(
2318 [
2319#include <sys/types.h>
2320 ],
2321 [ mode_t foo; foo = 1235; ],
2322 [ ac_cv_have_mode_t="yes" ],
2323 [ ac_cv_have_mode_t="no" ]
2324 )
2325])
2326if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002327 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002328fi
2329
Damien Miller61e50f12000-05-08 20:49:37 +10002330
2331AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2332 AC_TRY_COMPILE(
2333 [
Damien Miller81171112000-04-23 11:14:01 +10002334#include <sys/types.h>
2335#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002336 ],
2337 [ struct sockaddr_storage s; ],
2338 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2339 [ ac_cv_have_struct_sockaddr_storage="no" ]
2340 )
2341])
2342if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002343 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2344 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002345fi
Damien Miller34132e52000-01-14 15:45:46 +11002346
Damien Miller61e50f12000-05-08 20:49:37 +10002347AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2348 AC_TRY_COMPILE(
2349 [
Damien Miller7b22d652000-06-18 14:07:04 +10002350#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002351#include <netinet/in.h>
2352 ],
2353 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2354 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2355 [ ac_cv_have_struct_sockaddr_in6="no" ]
2356 )
2357])
2358if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002359 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2360 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002361fi
Damien Miller34132e52000-01-14 15:45:46 +11002362
Damien Miller61e50f12000-05-08 20:49:37 +10002363AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2364 AC_TRY_COMPILE(
2365 [
Damien Miller7b22d652000-06-18 14:07:04 +10002366#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002367#include <netinet/in.h>
2368 ],
2369 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2370 [ ac_cv_have_struct_in6_addr="yes" ],
2371 [ ac_cv_have_struct_in6_addr="no" ]
2372 )
2373])
2374if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002375 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2376 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002377fi
Damien Miller34132e52000-01-14 15:45:46 +11002378
Damien Miller61e50f12000-05-08 20:49:37 +10002379AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2380 AC_TRY_COMPILE(
2381 [
Damien Miller81171112000-04-23 11:14:01 +10002382#include <sys/types.h>
2383#include <sys/socket.h>
2384#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002385 ],
2386 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2387 [ ac_cv_have_struct_addrinfo="yes" ],
2388 [ ac_cv_have_struct_addrinfo="no" ]
2389 )
2390])
2391if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002392 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2393 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002394fi
2395
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002396AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2397 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002398 [ #include <sys/time.h> ],
2399 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002400 [ ac_cv_have_struct_timeval="yes" ],
2401 [ ac_cv_have_struct_timeval="no" ]
2402 )
2403])
2404if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002405 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002406 have_struct_timeval=1
2407fi
2408
Tim Rice4e4dc562003-03-18 10:21:40 -08002409AC_CHECK_TYPES(struct timespec)
2410
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002411# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002412if test "x$ac_cv_have_int64_t" = "xno" && \
2413 test "x$ac_cv_sizeof_long_int" != "x8" && \
2414 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002415 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2416 echo "an alternative compiler (I.E., GCC) before continuing."
2417 echo ""
2418 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002419else
2420dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002421 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002422 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002423#include <stdio.h>
2424#include <string.h>
2425#ifdef HAVE_SNPRINTF
2426main()
2427{
2428 char buf[50];
2429 char expected_out[50];
2430 int mazsize = 50 ;
2431#if (SIZEOF_LONG_INT == 8)
2432 long int num = 0x7fffffffffffffff;
2433#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002434 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002435#endif
2436 strcpy(expected_out, "9223372036854775807");
2437 snprintf(buf, mazsize, "%lld", num);
2438 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002439 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002440 exit(0);
2441}
2442#else
2443main() { exit(0); }
2444#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002445 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002446 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002447 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002448fi
2449
Damien Miller78315eb2000-09-29 23:01:36 +11002450dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002451OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2452OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2453OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2454OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2455OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002456OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002457OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2458OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002459OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002460OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2461OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2462OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2463OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002464OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2465OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2466OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2467OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002468
2469AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002470
Damien Miller61e50f12000-05-08 20:49:37 +10002471AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2472 ac_cv_have_ss_family_in_struct_ss, [
2473 AC_TRY_COMPILE(
2474 [
Damien Miller81171112000-04-23 11:14:01 +10002475#include <sys/types.h>
2476#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002477 ],
2478 [ struct sockaddr_storage s; s.ss_family = 1; ],
2479 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2480 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2481 )
2482])
2483if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002484 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002485fi
2486
Damien Miller61e50f12000-05-08 20:49:37 +10002487AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2488 ac_cv_have___ss_family_in_struct_ss, [
2489 AC_TRY_COMPILE(
2490 [
Damien Miller81171112000-04-23 11:14:01 +10002491#include <sys/types.h>
2492#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002493 ],
2494 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2495 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2496 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2497 )
2498])
2499if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002500 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2501 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002502fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002503
Damien Millerad833b32000-08-23 10:46:23 +10002504AC_CACHE_CHECK([for pw_class field in struct passwd],
2505 ac_cv_have_pw_class_in_struct_passwd, [
2506 AC_TRY_COMPILE(
2507 [
Damien Millerad833b32000-08-23 10:46:23 +10002508#include <pwd.h>
2509 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002510 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002511 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2512 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2513 )
2514])
2515if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002516 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2517 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002518fi
2519
Kevin Steves82456952001-06-22 21:14:18 +00002520AC_CACHE_CHECK([for pw_expire field in struct passwd],
2521 ac_cv_have_pw_expire_in_struct_passwd, [
2522 AC_TRY_COMPILE(
2523 [
2524#include <pwd.h>
2525 ],
2526 [ struct passwd p; p.pw_expire = 0; ],
2527 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2528 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2529 )
2530])
2531if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002532 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2533 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002534fi
2535
2536AC_CACHE_CHECK([for pw_change field in struct passwd],
2537 ac_cv_have_pw_change_in_struct_passwd, [
2538 AC_TRY_COMPILE(
2539 [
2540#include <pwd.h>
2541 ],
2542 [ struct passwd p; p.pw_change = 0; ],
2543 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2544 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2545 )
2546])
2547if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002548 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2549 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002550fi
Damien Miller61e50f12000-05-08 20:49:37 +10002551
Tim Rice28bbb0c2002-05-27 17:37:32 -07002552dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002553AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2554 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002555 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002556 [
Tim Riceae49fe62002-04-12 10:26:21 -07002557#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002558#include <sys/socket.h>
2559#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002560int main() {
2561#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002562#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002563exit(1);
2564#endif
2565struct msghdr m;
2566m.msg_accrights = 0;
2567exit(0);
2568}
Kevin Steves939c9db2002-03-22 17:23:25 +00002569 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002570 [ ac_cv_have_accrights_in_msghdr="yes" ],
2571 [ ac_cv_have_accrights_in_msghdr="no" ]
2572 )
2573])
2574if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002575 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2576 [Define if your system uses access rights style
2577 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002578fi
2579
Kevin Stevesa44e0352002-04-07 16:18:03 +00002580AC_CACHE_CHECK([for msg_control field in struct msghdr],
2581 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002582 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002583 [
Tim Riceae49fe62002-04-12 10:26:21 -07002584#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002585#include <sys/socket.h>
2586#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002587int main() {
2588#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002589#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002590exit(1);
2591#endif
2592struct msghdr m;
2593m.msg_control = 0;
2594exit(0);
2595}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002596 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002597 [ ac_cv_have_control_in_msghdr="yes" ],
2598 [ ac_cv_have_control_in_msghdr="no" ]
2599 )
2600])
2601if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002602 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2603 [Define if your system uses ancillary data style
2604 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002605fi
2606
Damien Miller61e50f12000-05-08 20:49:37 +10002607AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002608 AC_TRY_LINK([],
2609 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002610 [ ac_cv_libc_defines___progname="yes" ],
2611 [ ac_cv_libc_defines___progname="no" ]
2612 )
2613])
2614if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002615 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002616fi
2617
Kevin Steves4846f4a2002-03-22 18:19:53 +00002618AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2619 AC_TRY_LINK([
2620#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002621],
2622 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002623 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2624 [ ac_cv_cc_implements___FUNCTION__="no" ]
2625 )
2626])
2627if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002628 AC_DEFINE(HAVE___FUNCTION__, 1,
2629 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002630fi
2631
2632AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2633 AC_TRY_LINK([
2634#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002635],
2636 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002637 [ ac_cv_cc_implements___func__="yes" ],
2638 [ ac_cv_cc_implements___func__="no" ]
2639 )
2640])
2641if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002642 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002643fi
2644
Damien Miller4f8e6692001-07-14 13:22:53 +10002645AC_CACHE_CHECK([whether getopt has optreset support],
2646 ac_cv_have_getopt_optreset, [
2647 AC_TRY_LINK(
2648 [
2649#include <getopt.h>
2650 ],
2651 [ extern int optreset; optreset = 0; ],
2652 [ ac_cv_have_getopt_optreset="yes" ],
2653 [ ac_cv_have_getopt_optreset="no" ]
2654 )
2655])
2656if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002657 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2658 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002659fi
Damien Millera22ba012000-03-02 23:09:20 +11002660
Damien Millerecbb26d2000-07-15 14:59:14 +10002661AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002662 AC_TRY_LINK([],
2663 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002664 [ ac_cv_libc_defines_sys_errlist="yes" ],
2665 [ ac_cv_libc_defines_sys_errlist="no" ]
2666 )
2667])
2668if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002669 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2670 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002671fi
2672
2673
Damien Miller11fa2cc2000-08-16 10:35:58 +10002674AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002675 AC_TRY_LINK([],
2676 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002677 [ ac_cv_libc_defines_sys_nerr="yes" ],
2678 [ ac_cv_libc_defines_sys_nerr="no" ]
2679 )
2680])
2681if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002682 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002683fi
2684
Damien Millera8e06ce2003-11-21 23:48:55 +11002685SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002686# Check whether user wants sectok support
2687AC_ARG_WITH(sectok,
2688 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002689 [
2690 if test "x$withval" != "xno" ; then
2691 if test "x$withval" != "xyes" ; then
2692 CPPFLAGS="$CPPFLAGS -I${withval}"
2693 LDFLAGS="$LDFLAGS -L${withval}"
2694 if test ! -z "$need_dash_r" ; then
2695 LDFLAGS="$LDFLAGS -R${withval}"
2696 fi
2697 if test ! -z "$blibpath" ; then
2698 blibpath="$blibpath:${withval}"
2699 fi
2700 fi
2701 AC_CHECK_HEADERS(sectok.h)
2702 if test "$ac_cv_header_sectok_h" != yes; then
2703 AC_MSG_ERROR(Can't find sectok.h)
2704 fi
2705 AC_CHECK_LIB(sectok, sectok_open)
2706 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2707 AC_MSG_ERROR(Can't find libsectok)
2708 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002709 AC_DEFINE(SMARTCARD, 1,
2710 [Define if you want smartcard support])
2711 AC_DEFINE(USE_SECTOK, 1,
2712 [Define if you want smartcard support
2713 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002714 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002715 fi
2716 ]
2717)
2718
2719# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002720OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002721AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002722 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2723 [
2724 if test "x$withval" != "xno" ; then
2725 if test "x$withval" != "xyes" ; then
2726 OPENSC_CONFIG=$withval/bin/opensc-config
2727 else
2728 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2729 fi
2730 if test "$OPENSC_CONFIG" != "no"; then
2731 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2732 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2733 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2734 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2735 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002736 AC_DEFINE(USE_OPENSC, 1,
2737 [Define if you want smartcard support
2738 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002739 SCARD_MSG="yes, using OpenSC"
2740 fi
2741 fi
2742 ]
2743)
Damien Miller85de5802001-09-18 14:01:11 +10002744
Darren Tucker5f88d342003-10-15 16:57:57 +10002745# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002746AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002747 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2748 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002749 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002750 # Needed by our getrrsetbyname()
2751 AC_SEARCH_LIBS(res_query, resolv)
2752 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002753 AC_MSG_CHECKING(if res_query will link)
2754 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2755 [AC_MSG_RESULT(no)
2756 saved_LIBS="$LIBS"
2757 LIBS="$LIBS -lresolv"
2758 AC_MSG_CHECKING(for res_query in -lresolv)
2759 AC_LINK_IFELSE([
2760#include <resolv.h>
2761int main()
2762{
2763 res_query (0, 0, 0, 0, 0);
2764 return 0;
2765}
2766 ],
2767 [LIBS="$LIBS -lresolv"
2768 AC_MSG_RESULT(yes)],
2769 [LIBS="$saved_LIBS"
2770 AC_MSG_RESULT(no)])
2771 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002772 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002773 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002774 [#include <sys/types.h>
2775 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002776 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07002777 [AC_DEFINE(HAVE_HEADER_AD, 1,
2778 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10002779 [#include <arpa/nameser.h>])
2780 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002781
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002782# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002783KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002784AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002785 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002786 [ if test "x$withval" != "xno" ; then
2787 if test "x$withval" = "xyes" ; then
2788 KRB5ROOT="/usr/local"
2789 else
2790 KRB5ROOT=${withval}
2791 fi
2792
Tim Rice7df8d392005-09-19 09:33:39 -07002793 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11002794 KRB5_MSG="yes"
2795
2796 AC_MSG_CHECKING(for krb5-config)
2797 if test -x $KRB5ROOT/bin/krb5-config ; then
2798 KRB5CONF=$KRB5ROOT/bin/krb5-config
2799 AC_MSG_RESULT($KRB5CONF)
2800
2801 AC_MSG_CHECKING(for gssapi support)
2802 if $KRB5CONF | grep gssapi >/dev/null ; then
2803 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002804 AC_DEFINE(GSSAPI, 1,
2805 [Define this if you want GSSAPI
2806 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11002807 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002808 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002809 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002810 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002811 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002812 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2813 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002814 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002815 AC_MSG_CHECKING(whether we are using Heimdal)
2816 AC_TRY_COMPILE([ #include <krb5.h> ],
2817 [ char *tmp = heimdal_version; ],
2818 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002819 AC_DEFINE(HEIMDAL, 1,
2820 [Define this if you are using the
2821 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002822 AC_MSG_RESULT(no)
2823 )
2824 else
2825 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002826 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002827 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002828 AC_MSG_CHECKING(whether we are using Heimdal)
2829 AC_TRY_COMPILE([ #include <krb5.h> ],
2830 [ char *tmp = heimdal_version; ],
2831 [ AC_MSG_RESULT(yes)
2832 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002833 K5LIBS="-lkrb5 -ldes"
2834 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002835 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002836 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002837 ],
2838 [ AC_MSG_RESULT(no)
2839 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2840 ]
2841 )
Damien Miller200d0a72003-06-30 19:21:36 +10002842 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002843
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002844 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2845 [ AC_DEFINE(GSSAPI)
2846 K5LIBS="-lgssapi $K5LIBS" ],
2847 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2848 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002849 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002850 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2851 $K5LIBS)
2852 ],
2853 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002854
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002855 AC_CHECK_HEADER(gssapi.h, ,
2856 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002857 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002858 AC_CHECK_HEADERS(gssapi.h, ,
2859 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002860 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002861 ]
2862 )
2863
2864 oldCPP="$CPPFLAGS"
2865 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2866 AC_CHECK_HEADER(gssapi_krb5.h, ,
2867 [ CPPFLAGS="$oldCPP" ])
2868
Damien Millera8e06ce2003-11-21 23:48:55 +11002869 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002870 if test ! -z "$need_dash_r" ; then
2871 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2872 fi
2873 if test ! -z "$blibpath" ; then
2874 blibpath="$blibpath:${KRB5ROOT}/lib"
2875 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07002876
2877 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2878 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2879 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2880
2881 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07002882 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
2883 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002884 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002885 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002886)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002887
Damien Millera22ba012000-03-02 23:09:20 +11002888# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002889
Damien Millerf58c6722002-05-13 13:15:42 +10002890PRIVSEP_PATH=/var/empty
2891AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002892 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002893 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002894 if test -n "$withval" && test "x$withval" != "xno" && \
2895 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002896 PRIVSEP_PATH=$withval
2897 fi
2898 ]
2899)
2900AC_SUBST(PRIVSEP_PATH)
2901
Damien Millera22ba012000-03-02 23:09:20 +11002902AC_ARG_WITH(xauth,
2903 [ --with-xauth=PATH Specify path to xauth program ],
2904 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002905 if test -n "$withval" && test "x$withval" != "xno" && \
2906 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002907 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002908 fi
2909 ],
2910 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002911 TestPath="$PATH"
2912 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2913 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2914 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2915 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2916 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002917 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002918 xauth_path="/usr/openwin/bin/xauth"
2919 fi
2920 ]
2921)
2922
Damien Miller7d901272003-01-13 16:55:22 +11002923STRIP_OPT=-s
2924AC_ARG_ENABLE(strip,
2925 [ --disable-strip Disable calling strip(1) on install],
2926 [
2927 if test "x$enableval" = "xno" ; then
2928 STRIP_OPT=
2929 fi
2930 ]
2931)
2932AC_SUBST(STRIP_OPT)
2933
Damien Millera19cf472000-11-29 13:28:50 +11002934if test -z "$xauth_path" ; then
2935 XAUTH_PATH="undefined"
2936 AC_SUBST(XAUTH_PATH)
2937else
Tim Rice7df8d392005-09-19 09:33:39 -07002938 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
2939 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11002940 XAUTH_PATH=$xauth_path
2941 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002942fi
Damien Millera22ba012000-03-02 23:09:20 +11002943
2944# Check for mail directory (last resort if we cannot get it from headers)
2945if test ! -z "$MAIL" ; then
2946 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07002947 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
2948 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11002949fi
2950
Darren Tucker623d92f2004-09-12 22:36:15 +10002951if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002952 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2953 disable_ptmx_check=yes
2954fi
Damien Millera22ba012000-03-02 23:09:20 +11002955if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002956 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002957 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002958 [
Tim Rice7df8d392005-09-19 09:33:39 -07002959 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
2960 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002961 have_dev_ptmx=1
2962 ]
2963 )
2964 fi
Damien Millera22ba012000-03-02 23:09:20 +11002965fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002966
Darren Tucker623d92f2004-09-12 22:36:15 +10002967if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002968 AC_CHECK_FILE("/dev/ptc",
2969 [
Tim Rice7df8d392005-09-19 09:33:39 -07002970 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
2971 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002972 have_dev_ptc=1
2973 ]
2974 )
2975else
2976 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2977fi
Damien Miller204ad072000-03-02 23:56:12 +11002978
Damien Millera22ba012000-03-02 23:09:20 +11002979# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002980AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002981 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002982 [
Damien Miller897741e2001-04-16 10:41:46 +10002983 case "$withval" in
2984 man|cat|doc)
2985 MANTYPE=$withval
2986 ;;
2987 *)
2988 AC_MSG_ERROR(invalid man type: $withval)
2989 ;;
2990 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002991 ]
2992)
Ben Lindstrombc709922001-04-18 18:04:21 +00002993if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002994 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2995 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002996 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2997 MANTYPE=doc
2998 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2999 MANTYPE=man
3000 else
3001 MANTYPE=cat
3002 fi
3003fi
Damien Miller670a4b82000-01-22 13:53:11 +11003004AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003005if test "$MANTYPE" = "doc"; then
3006 mansubdir=man;
3007else
3008 mansubdir=$MANTYPE;
3009fi
3010AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003011
Damien Millera22ba012000-03-02 23:09:20 +11003012# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003013MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003014AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003015 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003016 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003017 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003018 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3019 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003020 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003021 fi
3022 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003023)
3024
Damien Millera22ba012000-03-02 23:09:20 +11003025# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003026AC_ARG_WITH(shadow,
3027 [ --without-shadow Disable shadow password support],
3028 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003029 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003030 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003031 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003032 fi
3033 ]
3034)
3035
Damien Miller1f335fb2000-06-26 11:31:33 +10003036if test -z "$disable_shadow" ; then
3037 AC_MSG_CHECKING([if the systems has expire shadow information])
3038 AC_TRY_COMPILE(
3039 [
3040#include <sys/types.h>
3041#include <shadow.h>
3042 struct spwd sp;
3043 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3044 [ sp_expire_available=yes ], []
3045 )
3046
3047 if test "x$sp_expire_available" = "xyes" ; then
3048 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003049 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3050 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003051 else
3052 AC_MSG_RESULT(no)
3053 fi
3054fi
3055
Damien Millera22ba012000-03-02 23:09:20 +11003056# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003057if test ! -z "$IPADDR_IN_DISPLAY" ; then
3058 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003059 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3060 [Define if you need to use IP address
3061 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003062else
Damien Millera8e06ce2003-11-21 23:48:55 +11003063 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003064 AC_ARG_WITH(ipaddr-display,
3065 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3066 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003067 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003068 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003069 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003070 fi
3071 ]
3072 )
3073fi
Damien Miller76112de1999-12-21 11:18:08 +11003074
Darren Tuckere1a790d2003-09-16 11:52:19 +10003075# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003076AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003077 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003078 [ if test "x$enableval" = "xno"; then
3079 AC_MSG_NOTICE([/etc/default/login handling disabled])
3080 etc_default_login=no
3081 else
3082 etc_default_login=yes
3083 fi ],
3084 [ etc_default_login=yes ]
3085)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003086
Darren Tucker2f9573d2005-02-10 22:28:54 +11003087if test "x$etc_default_login" != "xno"; then
3088 AC_CHECK_FILE("/etc/default/login",
3089 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10003090 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3091 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003092 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
3093 elif test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003094 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3095 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003096 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003097fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003098
Tim Rice43a1c132002-04-17 21:19:14 -07003099dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003100if test $ac_cv_func_login_getcapbool = "yes" && \
3101 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003102 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003103fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003104
Damien Millera22ba012000-03-02 23:09:20 +11003105# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003106SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003107AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003108 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003109 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003110 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003111 AC_MSG_WARN([
3112--with-default-path=PATH has no effect on this system.
3113Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003114 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003115 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003116 AC_MSG_WARN([
3117--with-default-path=PATH will only be used if PATH is not defined in
3118$external_path_file .])
3119 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003120 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003121 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003122 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003123 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003124 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3125 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003126 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003127 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003128 AC_MSG_WARN([
3129If PATH is defined in $external_path_file, ensure the path to scp is included,
3130otherwise scp will not work.])
3131 fi
3132 AC_TRY_RUN(
3133 [
Tim Rice59ea0a02001-03-10 13:50:45 -08003134/* find out what STDPATH is */
3135#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003136#ifdef HAVE_PATHS_H
3137# include <paths.h>
3138#endif
3139#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003140# ifdef _PATH_USERPATH /* Irix */
3141# define _PATH_STDPATH _PATH_USERPATH
3142# else
3143# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3144# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003145#endif
3146#include <sys/types.h>
3147#include <sys/stat.h>
3148#include <fcntl.h>
3149#define DATA "conftest.stdpath"
3150
3151main()
3152{
3153 FILE *fd;
3154 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003155
Tim Rice59ea0a02001-03-10 13:50:45 -08003156 fd = fopen(DATA,"w");
3157 if(fd == NULL)
3158 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003159
Tim Rice59ea0a02001-03-10 13:50:45 -08003160 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3161 exit(1);
3162
3163 exit(0);
3164}
3165 ], [ user_path=`cat conftest.stdpath` ],
3166 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3167 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3168 )
3169# make sure $bindir is in USER_PATH so scp will work
3170 t_bindir=`eval echo ${bindir}`
3171 case $t_bindir in
3172 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3173 esac
3174 case $t_bindir in
3175 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3176 esac
3177 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3178 if test $? -ne 0 ; then
3179 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3180 if test $? -ne 0 ; then
3181 user_path=$user_path:$t_bindir
3182 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3183 fi
3184 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003185 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003186)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003187if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003188 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003189 AC_SUBST(user_path)
3190fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003191
Damien Millera18bbd32002-05-13 10:48:57 +10003192# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003193AC_ARG_WITH(superuser-path,
3194 [ --with-superuser-path= Specify different path for super-user],
3195 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003196 if test -n "$withval" && test "x$withval" != "xno" && \
3197 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003198 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3199 [Define if you want a different $PATH
3200 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003201 superuser_path=$withval
3202 fi
3203 ]
3204)
3205
3206
Damien Miller61e50f12000-05-08 20:49:37 +10003207AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003208IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003209AC_ARG_WITH(4in6,
3210 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3211 [
3212 if test "x$withval" != "xno" ; then
3213 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003214 AC_DEFINE(IPV4_IN_IPV6, 1,
3215 [Detect IPv4 in IPv6 mapped addresses
3216 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003217 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003218 else
3219 AC_MSG_RESULT(no)
3220 fi
3221 ],[
3222 if test "x$inet6_default_4in6" = "xyes"; then
3223 AC_MSG_RESULT([yes (default)])
3224 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003225 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003226 else
3227 AC_MSG_RESULT([no (default)])
3228 fi
3229 ]
3230)
3231
Damien Miller60396b02001-02-18 17:01:00 +11003232# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003233BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003234AC_ARG_WITH(bsd-auth,
3235 [ --with-bsd-auth Enable BSD auth support],
3236 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003237 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003238 AC_DEFINE(BSD_AUTH, 1,
3239 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003240 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003241 fi
3242 ]
3243)
3244
Damien Millera22ba012000-03-02 23:09:20 +11003245# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003246piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003247# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003248if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003249 piddir=`eval echo ${sysconfdir}`
3250 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003251 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003252 esac
3253fi
3254
Tim Rice88f2ab52002-03-17 12:17:34 -08003255AC_ARG_WITH(pid-dir,
3256 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3257 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003258 if test -n "$withval" && test "x$withval" != "xno" && \
3259 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003260 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003261 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003262 AC_MSG_WARN([** no $piddir directory on this system **])
3263 fi
3264 fi
3265 ]
3266)
3267
Tim Rice7df8d392005-09-19 09:33:39 -07003268AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003269AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003270
andre2ff7b5d2000-06-03 14:57:40 +00003271dnl allow user to disable some login recording features
3272AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003273 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003274 [
3275 if test "x$enableval" = "xno" ; then
3276 AC_DEFINE(DISABLE_LASTLOG)
3277 fi
3278 ]
andre2ff7b5d2000-06-03 14:57:40 +00003279)
3280AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003281 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003282 [
3283 if test "x$enableval" = "xno" ; then
3284 AC_DEFINE(DISABLE_UTMP)
3285 fi
3286 ]
andre2ff7b5d2000-06-03 14:57:40 +00003287)
3288AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003289 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003290 [
3291 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003292 AC_DEFINE(DISABLE_UTMPX, 1,
3293 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003294 fi
3295 ]
andre2ff7b5d2000-06-03 14:57:40 +00003296)
3297AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003298 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003299 [
3300 if test "x$enableval" = "xno" ; then
3301 AC_DEFINE(DISABLE_WTMP)
3302 fi
3303 ]
andre2ff7b5d2000-06-03 14:57:40 +00003304)
3305AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003306 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003307 [
3308 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003309 AC_DEFINE(DISABLE_WTMPX, 1,
3310 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003311 fi
3312 ]
andre2ff7b5d2000-06-03 14:57:40 +00003313)
3314AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003315 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003316 [
3317 if test "x$enableval" = "xno" ; then
3318 AC_DEFINE(DISABLE_LOGIN)
3319 fi
3320 ]
andre2ff7b5d2000-06-03 14:57:40 +00003321)
3322AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003323 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003324 [
3325 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003326 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3327 [Define if you don't want to use pututline()
3328 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003329 fi
3330 ]
andre2ff7b5d2000-06-03 14:57:40 +00003331)
3332AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003333 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003334 [
3335 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003336 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3337 [Define if you don't want to use pututxline()
3338 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003339 fi
3340 ]
andre2ff7b5d2000-06-03 14:57:40 +00003341)
3342AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003343 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003344 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003345 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003346 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003347 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003348 conf_lastlog_location=$withval
3349 fi
3350 ]
3351)
andre2ff7b5d2000-06-03 14:57:40 +00003352
3353dnl lastlog, [uw]tmpx? detection
3354dnl NOTE: set the paths in the platform section to avoid the
3355dnl need for command-line parameters
3356dnl lastlog and [uw]tmp are subject to a file search if all else fails
3357
3358dnl lastlog detection
3359dnl NOTE: the code itself will detect if lastlog is a directory
3360AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3361AC_TRY_COMPILE([
3362#include <sys/types.h>
3363#include <utmp.h>
3364#ifdef HAVE_LASTLOG_H
3365# include <lastlog.h>
3366#endif
Damien Miller2994e082000-06-04 15:51:47 +10003367#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003368# include <paths.h>
3369#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003370#ifdef HAVE_LOGIN_H
3371# include <login.h>
3372#endif
andre2ff7b5d2000-06-03 14:57:40 +00003373 ],
3374 [ char *lastlog = LASTLOG_FILE; ],
3375 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003376 [
3377 AC_MSG_RESULT(no)
3378 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3379 AC_TRY_COMPILE([
3380#include <sys/types.h>
3381#include <utmp.h>
3382#ifdef HAVE_LASTLOG_H
3383# include <lastlog.h>
3384#endif
3385#ifdef HAVE_PATHS_H
3386# include <paths.h>
3387#endif
3388 ],
3389 [ char *lastlog = _PATH_LASTLOG; ],
3390 [ AC_MSG_RESULT(yes) ],
3391 [
andree441aa32000-06-12 22:34:38 +00003392 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003393 system_lastlog_path=no
3394 ])
3395 ]
andre2ff7b5d2000-06-03 14:57:40 +00003396)
Damien Miller2994e082000-06-04 15:51:47 +10003397
andre2ff7b5d2000-06-03 14:57:40 +00003398if test -z "$conf_lastlog_location"; then
3399 if test x"$system_lastlog_path" = x"no" ; then
3400 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003401 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003402 conf_lastlog_location=$f
3403 fi
3404 done
3405 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003406 AC_MSG_WARN([** Cannot find lastlog **])
3407 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003408 fi
3409 fi
3410fi
3411
3412if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003413 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3414 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003415fi
andre2ff7b5d2000-06-03 14:57:40 +00003416
3417dnl utmp detection
3418AC_MSG_CHECKING([if your system defines UTMP_FILE])
3419AC_TRY_COMPILE([
3420#include <sys/types.h>
3421#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003422#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003423# include <paths.h>
3424#endif
3425 ],
3426 [ char *utmp = UTMP_FILE; ],
3427 [ AC_MSG_RESULT(yes) ],
3428 [ AC_MSG_RESULT(no)
3429 system_utmp_path=no ]
3430)
3431if test -z "$conf_utmp_location"; then
3432 if test x"$system_utmp_path" = x"no" ; then
3433 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3434 if test -f $f ; then
3435 conf_utmp_location=$f
3436 fi
3437 done
3438 if test -z "$conf_utmp_location"; then
3439 AC_DEFINE(DISABLE_UTMP)
3440 fi
3441 fi
3442fi
3443if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003444 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3445 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003446fi
andre2ff7b5d2000-06-03 14:57:40 +00003447
3448dnl wtmp detection
3449AC_MSG_CHECKING([if your system defines WTMP_FILE])
3450AC_TRY_COMPILE([
3451#include <sys/types.h>
3452#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003453#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003454# include <paths.h>
3455#endif
3456 ],
3457 [ char *wtmp = WTMP_FILE; ],
3458 [ AC_MSG_RESULT(yes) ],
3459 [ AC_MSG_RESULT(no)
3460 system_wtmp_path=no ]
3461)
3462if test -z "$conf_wtmp_location"; then
3463 if test x"$system_wtmp_path" = x"no" ; then
3464 for f in /usr/adm/wtmp /var/log/wtmp; do
3465 if test -f $f ; then
3466 conf_wtmp_location=$f
3467 fi
3468 done
3469 if test -z "$conf_wtmp_location"; then
3470 AC_DEFINE(DISABLE_WTMP)
3471 fi
3472 fi
3473fi
3474if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003475 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3476 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003477fi
andre2ff7b5d2000-06-03 14:57:40 +00003478
3479
3480dnl utmpx detection - I don't know any system so perverse as to require
3481dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3482dnl there, though.
3483AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3484AC_TRY_COMPILE([
3485#include <sys/types.h>
3486#include <utmp.h>
3487#ifdef HAVE_UTMPX_H
3488#include <utmpx.h>
3489#endif
Damien Miller2994e082000-06-04 15:51:47 +10003490#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003491# include <paths.h>
3492#endif
3493 ],
3494 [ char *utmpx = UTMPX_FILE; ],
3495 [ AC_MSG_RESULT(yes) ],
3496 [ AC_MSG_RESULT(no)
3497 system_utmpx_path=no ]
3498)
3499if test -z "$conf_utmpx_location"; then
3500 if test x"$system_utmpx_path" = x"no" ; then
3501 AC_DEFINE(DISABLE_UTMPX)
3502 fi
3503else
Tim Rice7df8d392005-09-19 09:33:39 -07003504 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3505 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003506fi
andre2ff7b5d2000-06-03 14:57:40 +00003507
3508dnl wtmpx detection
3509AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3510AC_TRY_COMPILE([
3511#include <sys/types.h>
3512#include <utmp.h>
3513#ifdef HAVE_UTMPX_H
3514#include <utmpx.h>
3515#endif
Damien Miller2994e082000-06-04 15:51:47 +10003516#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003517# include <paths.h>
3518#endif
3519 ],
3520 [ char *wtmpx = WTMPX_FILE; ],
3521 [ AC_MSG_RESULT(yes) ],
3522 [ AC_MSG_RESULT(no)
3523 system_wtmpx_path=no ]
3524)
3525if test -z "$conf_wtmpx_location"; then
3526 if test x"$system_wtmpx_path" = x"no" ; then
3527 AC_DEFINE(DISABLE_WTMPX)
3528 fi
3529else
Tim Rice7df8d392005-09-19 09:33:39 -07003530 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3531 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003532fi
andre2ff7b5d2000-06-03 14:57:40 +00003533
Damien Miller4018c192000-04-30 09:30:44 +10003534
Damien Miller29ea30d2000-03-17 10:54:15 +11003535if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003536 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3537 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003538fi
3539
Tim Rice4cec93f2002-02-26 08:40:48 -08003540dnl remove pam and dl because they are in $LIBPAM
3541if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003542 LIBS=`echo $LIBS | sed 's/-lpam //'`
3543fi
3544if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3545 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003546fi
3547
Darren Tucker7da23cb2005-08-03 00:20:15 +10003548dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3549dnl Add now.
3550CFLAGS="$CFLAGS $werror_flags"
3551
Damien Millerbac2d8a2000-09-05 16:13:06 +11003552AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003553AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3554 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003555AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003556
Damien Miller7b22d652000-06-18 14:07:04 +10003557# Print summary of options
3558
Damien Miller7b22d652000-06-18 14:07:04 +10003559# Someone please show me a better way :)
3560A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3561B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3562C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3563D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003564E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003565F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003566G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003567H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3568I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3569J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003570
3571echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003572echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003573echo " User binaries: $B"
3574echo " System binaries: $C"
3575echo " Configuration files: $D"
3576echo " Askpass program: $E"
3577echo " Manual pages: $F"
3578echo " PID file: $G"
3579echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003580if test "x$external_path_file" = "x/etc/login.conf" ; then
3581echo " At runtime, sshd will use the path defined in $external_path_file"
3582echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003583else
Damien Millerf58c6722002-05-13 13:15:42 +10003584echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003585 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003586echo " (If PATH is set in $external_path_file it will be used instead. If"
3587echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3588 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003589fi
Damien Millera18bbd32002-05-13 10:48:57 +10003590if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003591echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003592fi
Damien Millerf58c6722002-05-13 13:15:42 +10003593echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003594echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003595echo " KerberosV support: $KRB5_MSG"
3596echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003597echo " S/KEY support: $SKEY_MSG"
3598echo " TCP Wrappers support: $TCPW_MSG"
3599echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003600echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003601echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003602echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3603echo " BSD Auth support: $BSD_AUTH_MSG"
3604echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003605if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003606echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003607fi
3608
Damien Miller7b22d652000-06-18 14:07:04 +10003609echo ""
3610
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003611echo " Host: ${host}"
3612echo " Compiler: ${CC}"
3613echo " Compiler flags: ${CFLAGS}"
3614echo "Preprocessor flags: ${CPPFLAGS}"
3615echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003616echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003617
3618echo ""
3619
Tim Rice6f1f7582004-05-30 21:38:51 -07003620if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003621 echo "SVR4 style packages are supported with \"make package\""
3622 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003623fi
3624
Damien Miller82cf0ce2000-12-20 13:34:48 +11003625if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003626 echo "PAM is enabled. You may need to install a PAM control file "
3627 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003628 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003629 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003630 echo ""
3631fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003632
Damien Miller6c21c512002-01-22 21:57:53 +11003633if test ! -z "$RAND_HELPER_CMDHASH" ; then
3634 echo "WARNING: you are using the builtin random number collection "
3635 echo "service. Please read WARNING.RNG and request that your OS "
3636 echo "vendor includes kernel-based random number collection in "
3637 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003638 echo ""
3639fi
Damien Miller60396b02001-02-18 17:01:00 +11003640
Damien Millerb4097182004-05-23 14:09:40 +10003641if test ! -z "$NO_PEERCHECK" ; then
3642 echo "WARNING: the operating system that you are using does not "
3643 echo "appear to support either the getpeereid() API nor the "
3644 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3645 echo "enforce security checks to prevent unauthorised connections to "
3646 echo "ssh-agent. Their absence increases the risk that a malicious "
3647 echo "user can connect to your agent. "
3648 echo ""
3649fi
3650
Darren Tuckerd9f88912005-02-20 21:01:48 +11003651if test "$AUDIT_MODULE" = "bsm" ; then
3652 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3653 echo "See the Solaris section in README.platform for details."
3654fi