blob: 689724133b655eae35669805774d129b5b2fa13d [file] [log] [blame]
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001# $Id: configure.ac,v 1.382 2007/06/25 12:15:12 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)
Darren Tuckerfebf0f52007-06-25 22:15:12 +100018AC_REVISION($Revision: 1.382 $)
Tim Rice13aae5e2001-10-21 17:53:58 -070019AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100020
21AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110022AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110023AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110024AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100025
Damien Millera22ba012000-03-02 23:09:20 +110026# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100027AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110028AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100029AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110030AC_PROG_INSTALL
Tim Ricefd80ddc2006-02-02 19:11:56 -080031AC_PROG_EGREP
Ben Lindstrom582d3982001-02-06 22:54:30 +000032AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070033AC_PATH_PROG(CAT, cat)
34AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070035AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080036AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110037AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100038AC_PATH_PROG(ENT, ent)
39AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110040AC_PATH_PROG(TEST_MINUS_S_SH, bash)
41AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
42AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070043AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070044AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110045
Tim Rice6f1f7582004-05-30 21:38:51 -070046dnl for buildpkg.sh
47AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
50 [/usr/sbin${PATH_SEPARATOR}/etc])
51AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
Darren Tuckerfbea7642006-01-30 00:22:39 +110052if test -x /sbin/sh; then
53 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
54else
55 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
56fi
Tim Rice6f1f7582004-05-30 21:38:51 -070057
Damien Millere8bb4502001-09-25 16:39:35 +100058# System features
59AC_SYS_LARGEFILE
60
Damien Miller3f62aba2000-11-29 11:56:35 +110061if test -z "$AR" ; then
62 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
63fi
64
Damien Millerad833b32000-08-23 10:46:23 +100065# Use LOGIN_PROGRAM from environment if possible
66if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070067 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
68 [If your header files don't define LOGIN_PROGRAM,
69 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100070else
71 # Search for login
72 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
73 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
74 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
75 fi
76fi
77
Darren Tucker23bc8d02004-02-06 16:24:31 +110078AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
79if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070080 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
81 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110082fi
83
Damien Miller166bd442000-03-16 10:48:25 +110084if test -z "$LD" ; then
85 LD=$CC
86fi
87AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080088
Damien Miller166bd442000-03-16 10:48:25 +110089AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100090
91AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
92
Damien Millera8e06ce2003-11-21 23:48:55 +110093if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100094 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Darren Tucker3f9545e2005-11-12 15:20:52 +110095 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -070096 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +100097 1.*) no_attrib_nonnull=1 ;;
98 2.8* | 2.9*)
99 CFLAGS="$CFLAGS -Wsign-compare"
100 no_attrib_nonnull=1
101 ;;
102 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerb0288092005-11-10 14:46:48 +1100103 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100104 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
105 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700106 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +1000107
Darren Tucker67b37032005-06-03 17:58:31 +1000108 if test -z "$have_llong_max"; then
109 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
110 unset ac_cv_have_decl_LLONG_MAX
111 saved_CFLAGS="$CFLAGS"
112 CFLAGS="$CFLAGS -std=gnu99"
113 AC_CHECK_DECL(LLONG_MAX,
114 [have_llong_max=1],
115 [CFLAGS="$saved_CFLAGS"],
116 [#include <limits.h>]
117 )
118 fi
Damien Miller166bd442000-03-16 10:48:25 +1100119fi
120
Darren Tucker391de5c2007-04-29 14:49:21 +1000121if test "x$no_attrib_nonnull" != "x1" ; then
122 AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
123fi
124
Tim Rice88368a32003-12-08 12:35:59 -0800125AC_ARG_WITH(rpath,
126 [ --without-rpath Disable auto-added -R linker paths],
127 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800128 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800129 need_dash_r=""
130 fi
131 if test "x$withval" = "xyes" ; then
132 need_dash_r=1
133 fi
134 ]
135)
136
Tim Rice1cfab232006-10-03 09:34:35 -0700137# Allow user to specify flags
138AC_ARG_WITH(cflags,
139 [ --with-cflags Specify additional flags to pass to compiler],
140 [
141 if test -n "$withval" && test "x$withval" != "xno" && \
142 test "x${withval}" != "xyes"; then
143 CFLAGS="$CFLAGS $withval"
144 fi
145 ]
146)
147AC_ARG_WITH(cppflags,
148 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
149 [
150 if test -n "$withval" && test "x$withval" != "xno" && \
151 test "x${withval}" != "xyes"; then
152 CPPFLAGS="$CPPFLAGS $withval"
153 fi
154 ]
155)
156AC_ARG_WITH(ldflags,
157 [ --with-ldflags Specify additional flags to pass to linker],
158 [
159 if test -n "$withval" && test "x$withval" != "xno" && \
160 test "x${withval}" != "xyes"; then
161 LDFLAGS="$LDFLAGS $withval"
162 fi
163 ]
164)
165AC_ARG_WITH(libs,
166 [ --with-libs Specify additional libraries to link with],
167 [
168 if test -n "$withval" && test "x$withval" != "xno" && \
169 test "x${withval}" != "xyes"; then
170 LIBS="$LIBS $withval"
171 fi
172 ]
173)
174AC_ARG_WITH(Werror,
175 [ --with-Werror Build main code with -Werror],
176 [
177 if test -n "$withval" && test "x$withval" != "xno"; then
178 werror_flags="-Werror"
179 if test "x${withval}" != "xyes"; then
180 werror_flags="$withval"
181 fi
182 fi
183 ]
184)
185
186AC_CHECK_HEADERS( \
187 bstring.h \
188 crypt.h \
189 crypto/sha2.h \
190 dirent.h \
191 endian.h \
192 features.h \
193 fcntl.h \
194 floatingpoint.h \
195 getopt.h \
196 glob.h \
197 ia.h \
198 iaf.h \
199 limits.h \
200 login.h \
201 maillock.h \
202 ndir.h \
203 net/if_tun.h \
204 netdb.h \
205 netgroup.h \
206 pam/pam_appl.h \
207 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000208 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700209 pty.h \
210 readpassphrase.h \
211 rpc/types.h \
212 security/pam_appl.h \
213 sha2.h \
214 shadow.h \
215 stddef.h \
216 stdint.h \
217 string.h \
218 strings.h \
219 sys/audit.h \
220 sys/bitypes.h \
221 sys/bsdtty.h \
222 sys/cdefs.h \
223 sys/dir.h \
224 sys/mman.h \
225 sys/ndir.h \
226 sys/prctl.h \
227 sys/pstat.h \
228 sys/select.h \
229 sys/stat.h \
230 sys/stream.h \
231 sys/stropts.h \
232 sys/strtio.h \
233 sys/sysmacros.h \
234 sys/time.h \
235 sys/timers.h \
236 sys/un.h \
237 time.h \
238 tmpdir.h \
239 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700240 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700241 unistd.h \
242 usersec.h \
243 util.h \
244 utime.h \
245 utmp.h \
246 utmpx.h \
247 vis.h \
248)
249
250# lastlog.h requires sys/time.h to be included first on Solaris
251AC_CHECK_HEADERS(lastlog.h, [], [], [
252#ifdef HAVE_SYS_TIME_H
253# include <sys/time.h>
254#endif
255])
256
257# sys/ptms.h requires sys/stream.h to be included first on Solaris
258AC_CHECK_HEADERS(sys/ptms.h, [], [], [
259#ifdef HAVE_SYS_STREAM_H
260# include <sys/stream.h>
261#endif
262])
263
264# login_cap.h requires sys/types.h on NetBSD
265AC_CHECK_HEADERS(login_cap.h, [], [], [
266#include <sys/types.h>
267])
268
Damien Miller1b06dc32006-08-31 03:24:41 +1000269# Messages for features tested for in target-specific section
270SIA_MSG="no"
271SPC_MSG="no"
272
Damien Millera22ba012000-03-02 23:09:20 +1100273# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100274case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100275*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000276 # Some versions of VAC won't allow macro redefinitions at
277 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
278 # particularly with older versions of vac or xlc.
279 # It also throws errors about null macro argments, but these are
280 # not fatal.
281 AC_MSG_CHECKING(if compiler allows macro redefinitions)
282 AC_COMPILE_IFELSE(
283 [AC_LANG_SOURCE([[
284#define testmacro foo
285#define testmacro bar
286int main(void) { exit(0); }
287 ]])],
288 [ AC_MSG_RESULT(yes) ],
289 [ AC_MSG_RESULT(no)
290 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
291 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
292 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
293 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
294 ]
295 )
296
Damien Millera8e06ce2003-11-21 23:48:55 +1100297 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000298 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800299 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100300 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000301 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000302 if test "$GCC" = "yes"; then
303 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
304 else
305 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
306 fi
307 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000308 if (test -z "$blibflags"); then
309 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
310 AC_TRY_LINK([], [], [blibflags=$tryflags])
311 fi
312 done
313 if (test -z "$blibflags"); then
314 AC_MSG_RESULT(not found)
315 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
316 else
317 AC_MSG_RESULT($blibflags)
318 fi
319 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000320 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700321 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
322 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700323 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000324 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700325 LIBS="$LIBS -ls"
326 ])
327 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100328 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100329 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100330 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000331 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100332 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000333 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
334 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000335 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000336 [(void)loginfailed("user","host","tty",0);],
337 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700338 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
339 [Define if your AIX loginfailed() function
340 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000341 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000342 )],
343 [],
344 [#include <usersec.h>]
345 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000346 AC_CHECK_FUNCS(setauthdb)
Darren Tucker3083bc22006-08-17 19:35:49 +1000347 AC_CHECK_DECL(F_CLOSEM,
Darren Tuckerd018b2e2006-08-18 18:51:20 +1000348 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000349 [],
350 [ #include <limits.h>
351 #include <fcntl.h> ]
352 )
Darren Tucker691d5232005-02-15 21:45:57 +1100353 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700354 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
355 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
356 [Define if your platform breaks doing a seteuid before a setuid])
357 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
358 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000359 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700360 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
361 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
362 [Some systems need a utmpx entry for /bin/login to work])
363 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
364 [Define to a Set Process Title type if your system is
365 supported by bsd-setproctitle.c])
Darren Tucker91d25a02005-11-26 22:24:09 +1100366 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
367 [AIX 5.2 and 5.3 (and presumably newer) require this])
Darren Tucker9afe1152006-06-23 21:24:12 +1000368 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100369 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100370*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100371 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100372 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700373 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
374 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
375 AC_DEFINE(DISABLE_SHADOW, 1,
376 [Define if you want to disable shadow passwords])
377 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
378 [Define if your system choked on IP TOS setting])
379 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
380 [Define if X11 doesn't support AF_UNIX sockets on that system])
381 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
382 [Define if the concept of ports only accessible to
383 superusers isn't known])
384 AC_DEFINE(DISABLE_FD_PASSING, 1,
385 [Define if your platform needs to skip post auth
386 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100387 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000388*-*-dgux*)
389 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100390 AC_DEFINE(SETEUID_BREAKS_SETUID)
391 AC_DEFINE(BROKEN_SETREUID)
392 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000393 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000394*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000395 AC_MSG_CHECKING(if we have working getaddrinfo)
396 AC_TRY_RUN([#include <mach-o/dyld.h>
397main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
398 exit(0);
399 else
400 exit(1);
401}], [AC_MSG_RESULT(working)],
402 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700403 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700404 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000405 AC_DEFINE(SETEUID_BREAKS_SETUID)
406 AC_DEFINE(BROKEN_SETREUID)
407 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700408 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
409 [Define if your resolver libs need this for getrrsetbyname])
Darren Tucker3eb48342006-06-23 21:05:12 +1000410 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
411 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
412 [Use tunnel device compatibility to OpenBSD])
413 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
414 [Prepend the address family to IP tunnel traffic])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000415 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000416*-*-dragonfly*)
417 SSHDLIBS="$SSHDLIBS -lcrypt"
418 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000419*-*-hpux*)
420 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000421 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100422 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000423 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700424 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
425 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000426 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700427 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
428 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000429 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000430 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700431 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000432 AC_CHECK_LIB(xnet, t_error, ,
433 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
434
435 # next, we define all of the options specific to major releases
436 case "$host" in
437 *-*-hpux10*)
438 if test -z "$GCC"; then
439 CFLAGS="$CFLAGS -Ae"
440 fi
441 ;;
442 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700443 AC_DEFINE(PAM_SUN_CODEBASE, 1,
444 [Define if you are using Solaris-derived PAM which
445 passes pam_messages to the conversation function
446 with an extra level of indirection])
447 AC_DEFINE(DISABLE_UTMP, 1,
448 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000449 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
450 check_for_hpux_broken_getaddrinfo=1
451 check_for_conflicting_getspnam=1
452 ;;
453 esac
454
455 # lastly, we define options specific to minor releases
456 case "$host" in
457 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700458 AC_DEFINE(HAVE_SECUREWARE, 1,
459 [Define if you have SecureWare-based
460 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000461 disable_ptmx_check=yes
462 LIBS="$LIBS -lsecpw"
463 ;;
464 esac
Damien Miller1bead332000-04-30 00:47:29 +1000465 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100466*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100467 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700468 AC_DEFINE(BROKEN_INET_NTOA, 1,
469 [Define if you system's inet_ntoa is busted
470 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000471 AC_DEFINE(SETEUID_BREAKS_SETUID)
472 AC_DEFINE(BROKEN_SETREUID)
473 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700474 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
475 [Define if you shouldn't strip 'tty' from your
476 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000477 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100478 ;;
479*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100480 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700481 AC_DEFINE(WITH_IRIX_ARRAY, 1,
482 [Define if you have/want arrays
483 (cluster-wide session managment, not C arrays)])
484 AC_DEFINE(WITH_IRIX_PROJECT, 1,
485 [Define if you want IRIX project management])
486 AC_DEFINE(WITH_IRIX_AUDIT, 1,
487 [Define if you want IRIX audit trails])
488 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
489 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000490 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000491 AC_DEFINE(SETEUID_BREAKS_SETUID)
492 AC_DEFINE(BROKEN_SETREUID)
493 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700494 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000495 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000496 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100497 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100498*-*-linux*)
499 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100500 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000501 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700502 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
503 AC_DEFINE(PAM_TTY_KLUDGE, 1,
504 [Work around problematic Linux PAM modules handling of PAM_TTY])
505 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
506 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000507 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700508 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
509 [Define to whatever link() returns for "not supported"
510 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100511 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700512 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100513 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000514 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000515 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700516 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
517 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000518 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000519 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100520 # tun(4) forwarding compat code
Damien Millerc4bcc912005-12-31 17:05:58 +1100521 AC_CHECK_HEADERS(linux/if_tun.h)
Damien Millerbd4e4102006-01-01 21:03:30 +1100522 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Damien Miller89e03ba2005-12-31 16:42:03 +1100523 AC_DEFINE(SSH_TUN_LINUX, 1,
524 [Open tunnel devices the Linux tun/tap way])
525 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
526 [Use tunnel device compatibility to OpenBSD])
527 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
528 [Prepend the address family to IP tunnel traffic])
529 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100530 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000531mips-sony-bsd|mips-sony-newsos4)
Darren Tucker988b3fd2006-02-08 22:11:27 +1100532 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000533 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000534 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100535*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000536 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800537 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800538 need_dash_r=1
539 fi
Damien Miller2dcddbf2006-01-01 19:47:05 +1100540 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
541 AC_CHECK_HEADER([net/if_tap.h], ,
542 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
543 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
544 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100545 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100546*-*-freebsd*)
547 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000548 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100549 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
550 AC_CHECK_HEADER([net/if_tap.h], ,
551 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
Damien Millerfbd884a2001-02-27 08:39:07 +1100552 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000553*-*-bsdi*)
554 AC_DEFINE(SETEUID_BREAKS_SETUID)
555 AC_DEFINE(BROKEN_SETREUID)
556 AC_DEFINE(BROKEN_SETREGID)
557 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000558*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000559 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100560 conf_utmp_location=/etc/utmp
561 conf_wtmp_location=/usr/adm/wtmp
562 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700563 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000564 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000565 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700566 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000567 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000568*-*-openbsd*)
569 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000570 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100571 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
Damien Millerbb598142006-08-19 08:38:23 +1000572 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
573 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000574 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100575*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800576 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800577 need_dash_r=1
578 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100579 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000580 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700581 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
582 [Some versions of /bin/login need the TERM supplied
583 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000584 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700585 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
586 [Define if pam_chauthtok wants real uid set
587 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000588 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000589 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700590 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
591 [Define if sshd somehow reacquires a controlling TTY
592 after setsid()])
Darren Tucker0249f932006-06-24 12:10:07 +1000593 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
594 in case the name is longer than 8 chars])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000595 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000596 # hardwire lastlog location (can't detect it on some versions)
597 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000598 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
599 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
600 if test "$sol2ver" -ge 8; then
601 AC_MSG_RESULT(yes)
602 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700603 AC_DEFINE(DISABLE_WTMP, 1,
604 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000605 else
606 AC_MSG_RESULT(no)
607 fi
Damien Miller1b06dc32006-08-31 03:24:41 +1000608 AC_ARG_WITH(solaris-contracts,
609 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
610 [
611 AC_CHECK_LIB(contract, ct_tmpl_activate,
612 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
613 [Define if you have Solaris process contracts])
614 SSHDLIBS="$SSHDLIBS -lcontract"
615 AC_SUBST(SSHDLIBS)
616 SPC_MSG="yes" ], )
617 ],
618 )
Damien Miller75b1d102000-01-07 14:01:41 +1100619 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000620*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000621 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000622 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100623 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000624 conf_utmp_location=/etc/utmp
625 conf_wtmp_location=/var/adm/wtmp
626 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000627 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000628 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000629*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700630 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000631 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000632 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000633 AC_DEFINE(SETEUID_BREAKS_SETUID)
634 AC_DEFINE(BROKEN_SETREUID)
635 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000636 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000637*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700638 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000639 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100640 # -lresolv needs to be at the end of LIBS or DNS lookups break
641 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100642 IPADDR_IN_DISPLAY=yes
643 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000644 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000645 AC_DEFINE(SETEUID_BREAKS_SETUID)
646 AC_DEFINE(BROKEN_SETREUID)
647 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000648 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000649 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700650 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
651 # Attention: always take care to bind libsocket and libnsl before libc,
652 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000653 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800654# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100655*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100656 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700657 AC_DEFINE(SETEUID_BREAKS_SETUID)
658 AC_DEFINE(BROKEN_SETREUID)
659 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700660 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800661 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100662 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800663# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100664*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700665 check_for_libcrypt_later=1
666 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100667 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700668 AC_DEFINE(SETEUID_BREAKS_SETUID)
669 AC_DEFINE(BROKEN_SETREUID)
670 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700671 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700672 case "$host" in
673 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
674 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700675 AC_DEFINE(BROKEN_LIBIAF, 1,
676 [ia_uinfo routines not supported by OS yet])
Tim Riceb8f00192006-09-06 18:11:29 -0700677 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice4dbacff2005-06-01 20:09:28 -0700678 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800679 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
680 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700681 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100682 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100683*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100684 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800685# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100686*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800687 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100688 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800689# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100690*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800691 if test -z "$GCC"; then
692 CFLAGS="$CFLAGS -belf"
693 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100694 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000695 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100696 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000697 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000698 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700699 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700700 AC_DEFINE(SETEUID_BREAKS_SETUID)
701 AC_DEFINE(BROKEN_SETREUID)
702 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700703 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700704 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700705 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100706 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700707 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700708 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000709 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000710*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700711 AC_DEFINE(NO_SSH_LASTLOG, 1,
712 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100713 AC_DEFINE(SETEUID_BREAKS_SETUID)
714 AC_DEFINE(BROKEN_SETREUID)
715 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000716 AC_DEFINE(USE_PIPES)
717 AC_DEFINE(DISABLE_FD_PASSING)
718 LDFLAGS="$LDFLAGS"
719 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
720 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000721 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000722*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100723 AC_DEFINE(SETEUID_BREAKS_SETUID)
724 AC_DEFINE(BROKEN_SETREUID)
725 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000726 AC_DEFINE(WITH_ABBREV_NO_TTY)
727 AC_DEFINE(USE_PIPES)
728 AC_DEFINE(DISABLE_FD_PASSING)
729 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100730 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000731 MANTYPE=cat
732 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000733*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100734 AC_DEFINE(SETEUID_BREAKS_SETUID)
735 AC_DEFINE(BROKEN_SETREUID)
736 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000737 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700738 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700739 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000740 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
741 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
742 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700743 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000744*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000745 AC_MSG_CHECKING(for Digital Unix SIA)
746 no_osfsia=""
747 AC_ARG_WITH(osfsia,
748 [ --with-osfsia Enable Digital Unix SIA],
749 [
750 if test "x$withval" = "xno" ; then
751 AC_MSG_RESULT(disabled)
752 no_osfsia=1
753 fi
754 ],
755 )
756 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000757 if test -f /etc/sia/matrix.conf; then
758 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700759 AC_DEFINE(HAVE_OSF_SIA, 1,
760 [Define if you have Digital Unix Security
761 Integration Architecture])
762 AC_DEFINE(DISABLE_LOGIN, 1,
763 [Define if you don't want to use your
764 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000765 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000766 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000767 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000768 else
769 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700770 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
771 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000772 fi
773 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000774 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700775 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000776 AC_DEFINE(BROKEN_SETREUID)
777 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000778 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000779
Tim Rice70335a62006-02-04 17:42:58 -0800780*-*-nto-qnx*)
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000781 AC_DEFINE(USE_PIPES)
782 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700783 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
784 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
785 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Tim Rice70335a62006-02-04 17:42:58 -0800786 AC_DEFINE(DISABLE_LASTLOG)
Darren Tucker54b75fe2006-02-26 12:31:48 +1100787 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Tim Rice2f993462006-02-11 18:37:48 -0800788 enable_etc_default_login=no # has incompatible /etc/default/login
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000789 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000790
791*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700792 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
793 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
Darren Tucker988b3fd2006-02-08 22:11:27 +1100794 AC_DEFINE(NEED_SETPGRP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700795 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
796 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000797
798*-*-lynxos)
799 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700800 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000801 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
802 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100803esac
804
Darren Tucker6eb93042003-06-29 21:30:41 +1000805AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000806AC_RUN_IFELSE(
807 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000808#include <stdio.h>
809int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000810 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000811 [ AC_MSG_RESULT(yes) ],
812 [
813 AC_MSG_RESULT(no)
814 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000815 ],
816 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000817)
818
Darren Tucker0c9653f2005-05-28 15:58:14 +1000819dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100820# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700821AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
822AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000823
Tim Rice1e1ef642003-09-11 22:19:31 -0700824dnl IRIX and Solaris 2.5.1 have dirname() in libgen
825AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
826 AC_CHECK_LIB(gen, dirname,[
827 AC_CACHE_CHECK([for broken dirname],
828 ac_cv_have_broken_dirname, [
829 save_LIBS="$LIBS"
830 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000831 AC_RUN_IFELSE(
832 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700833#include <libgen.h>
834#include <string.h>
835
836int main(int argc, char **argv) {
837 char *s, buf[32];
838
839 strncpy(buf,"/etc", 32);
840 s = dirname(buf);
841 if (!s || strncmp(s, "/", 32) != 0) {
842 exit(1);
843 } else {
844 exit(0);
845 }
846}
Darren Tucker314d89e2005-10-17 23:29:23 +1000847 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700848 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000849 [ ac_cv_have_broken_dirname="yes" ],
850 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700851 )
852 LIBS="$save_LIBS"
853 ])
854 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
855 LIBS="$LIBS -lgen"
856 AC_DEFINE(HAVE_DIRNAME)
857 AC_CHECK_HEADERS(libgen.h)
858 fi
859 ])
860])
861
862AC_CHECK_FUNC(getspnam, ,
863 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700864AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
865 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700866
Tim Rice13aae5e2001-10-21 17:53:58 -0700867dnl zlib is required
868AC_ARG_WITH(zlib,
869 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100870 [ if test "x$withval" = "xno" ; then
871 AC_MSG_ERROR([*** zlib is required ***])
872 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700873 if test -d "$withval/lib"; then
874 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700875 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700876 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700877 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700878 fi
879 else
880 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700881 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700882 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700883 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700884 fi
885 fi
886 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700887 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700888 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700889 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700890 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100891 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700892)
893
Tim Ricefcb62202004-01-23 18:35:16 -0800894AC_CHECK_LIB(z, deflate, ,
895 [
896 saved_CPPFLAGS="$CPPFLAGS"
897 saved_LDFLAGS="$LDFLAGS"
898 save_LIBS="$LIBS"
899 dnl Check default zlib install dir
900 if test -n "${need_dash_r}"; then
901 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
902 else
903 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
904 fi
905 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
906 LIBS="$LIBS -lz"
907 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
908 [
909 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
910 ]
911 )
912 ]
913)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100914AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100915
916AC_ARG_WITH(zlib-version-check,
917 [ --without-zlib-version-check Disable zlib version check],
918 [ if test "x$withval" = "xno" ; then
919 zlib_check_nonfatal=1
920 fi
921 ]
922)
923
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000924AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000925AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000926#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100927#include <zlib.h>
928int main()
929{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000930 int a=0, b=0, c=0, d=0, n, v;
931 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
932 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100933 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000934 v = a*1000000 + b*10000 + c*100 + d;
935 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
936
937 /* 1.1.4 is OK */
938 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100939 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000940
Darren Tucker41097ed2005-07-25 15:24:21 +1000941 /* 1.2.3 and up are OK */
942 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000943 exit(0);
944
Darren Tucker2dcd2392004-01-23 17:13:33 +1100945 exit(2);
946}
Darren Tucker623d92f2004-09-12 22:36:15 +1000947 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000948 AC_MSG_RESULT(no),
949 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100950 if test -z "$zlib_check_nonfatal" ; then
951 AC_MSG_ERROR([*** zlib too old - check config.log ***
952Your reported zlib version has known security problems. It's possible your
953vendor has fixed these problems without changing the version number. If you
954are sure this is the case, you can disable the check by running
955"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000956If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000957See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100958 else
959 AC_MSG_WARN([zlib version may have security problems])
960 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000961 ],
962 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100963)
Damien Miller6f9c3372000-10-25 10:06:04 +1100964
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000965dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100966AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000967 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
968)
Darren Tucker5bfe1682005-11-12 18:42:36 +1100969AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700970 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
971 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000972)
Damien Millerab18c411999-11-11 10:40:23 +1100973
Tim Ricee589a292001-11-03 11:09:32 -0800974dnl Checks for libutil functions
975AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700976AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
977 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800978AC_CHECK_FUNCS(logout updwtmp logwtmp)
979
Ben Lindstrom8697e082001-02-24 21:41:10 +0000980AC_FUNC_STRFTIME
981
Damien Miller3c027682001-03-14 11:39:45 +1100982# Check for ALTDIRFUNC glob() extension
983AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
984AC_EGREP_CPP(FOUNDIT,
985 [
986 #include <glob.h>
987 #ifdef GLOB_ALTDIRFUNC
988 FOUNDIT
989 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100990 ],
Damien Miller3c027682001-03-14 11:39:45 +1100991 [
Tim Rice7df8d392005-09-19 09:33:39 -0700992 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
993 [Define if your system glob() function has
994 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100995 AC_MSG_RESULT(yes)
996 ],
997 [
998 AC_MSG_RESULT(no)
999 ]
1000)
Damien Millerab18c411999-11-11 10:40:23 +11001001
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001002# Check for g.gl_matchc glob() extension
1003AC_MSG_CHECKING(for gl_matchc field in glob_t)
Darren Tucker486d95e2006-03-15 21:31:39 +11001004AC_TRY_COMPILE(
Damien Milleraf87af12006-03-15 13:02:28 +11001005 [ #include <glob.h> ],
1006 [glob_t g; g.gl_matchc = 1;],
Damien Millera8e06ce2003-11-21 23:48:55 +11001007 [
Tim Rice7df8d392005-09-19 09:33:39 -07001008 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1009 [Define if your system glob() function has
1010 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +11001011 AC_MSG_RESULT(yes)
1012 ],
1013 [
1014 AC_MSG_RESULT(no)
1015 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001016)
1017
Darren Tucker096faec2006-09-01 20:29:10 +10001018AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1019
Damien Miller18bb4732001-03-28 14:35:30 +10001020AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001021AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001022 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +10001023#include <sys/types.h>
1024#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001025int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +10001026 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001027 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +10001028 [
1029 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001030 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +11001031 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001032 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001033 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001034 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001035 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1036 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +10001037 ]
1038)
1039
Damien Miller36f49652004-08-15 18:40:59 +10001040AC_MSG_CHECKING([for /proc/pid/fd directory])
1041if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07001042 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +10001043 AC_MSG_RESULT(yes)
1044else
1045 AC_MSG_RESULT(no)
1046fi
1047
Damien Millerc547bf12001-02-16 10:18:12 +11001048# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001049SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001050AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001051 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001052 [
1053 if test "x$withval" != "xno" ; then
1054
1055 if test "x$withval" != "xyes" ; then
1056 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1057 LDFLAGS="$LDFLAGS -L${withval}/lib"
1058 fi
1059
Tim Rice7df8d392005-09-19 09:33:39 -07001060 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001061 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001062 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001063
Tim Rice4cec93f2002-02-26 08:40:48 -08001064 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001065 AC_LINK_IFELSE(
1066 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001067#include <stdio.h>
1068#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001069int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +10001070 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001071 [AC_MSG_RESULT(yes)],
1072 [
1073 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001074 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1075 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001076 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1077 AC_TRY_COMPILE(
1078 [#include <stdio.h>
1079 #include <skey.h>],
1080 [(void)skeychallenge(NULL,"name","",0);],
1081 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001082 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1083 [Define if your skeychallenge()
1084 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001085 [AC_MSG_RESULT(no)]
1086 )
Damien Millerc547bf12001-02-16 10:18:12 +11001087 fi
1088 ]
1089)
1090
1091# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001092TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001093AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001094 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001095 [
1096 if test "x$withval" != "xno" ; then
1097 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001098 saved_LDFLAGS="$LDFLAGS"
1099 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001100 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001101 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001102 if test -d "${withval}/lib"; then
1103 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001104 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001105 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001106 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001107 fi
1108 else
1109 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001110 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001111 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001112 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001113 fi
1114 fi
1115 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001116 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001117 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001118 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001119 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001120 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001121 LIBS="-lwrap $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001122 AC_MSG_CHECKING(for libwrap)
1123 AC_TRY_LINK(
1124 [
Damien Miller0ac45002004-04-14 20:14:26 +10001125#include <sys/types.h>
1126#include <sys/socket.h>
1127#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001128#include <tcpd.h>
1129 int deny_severity = 0, allow_severity = 0;
1130 ],
1131 [hosts_access(0);],
1132 [
1133 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001134 AC_DEFINE(LIBWRAP, 1,
1135 [Define if you want
1136 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001137 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001138 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001139 ],
1140 [
1141 AC_MSG_ERROR([*** libwrap missing])
1142 ]
1143 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001144 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001145 fi
1146 ]
1147)
1148
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001149# Check whether user wants libedit support
1150LIBEDIT_MSG="no"
1151AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001152 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001153 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001154 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001155 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1156 if test -n "${need_dash_r}"; then
1157 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1158 else
1159 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1160 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001161 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001162 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001163 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001164 LIBEDIT="-ledit -lcurses"
1165 LIBEDIT_MSG="yes"
1166 AC_SUBST(LIBEDIT)
1167 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001168 [ AC_MSG_ERROR(libedit not found) ],
1169 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001170 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001171 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001172 AC_COMPILE_IFELSE(
1173 [AC_LANG_SOURCE([[
1174#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001175int main(void)
1176{
1177 int i = H_SETSIZE;
1178 el_init("", NULL, NULL, NULL);
1179 exit(0);
1180}
Tim Ricec1819c82005-08-15 17:48:40 -07001181 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001182 [ AC_MSG_RESULT(yes) ],
1183 [ AC_MSG_RESULT(no)
1184 AC_MSG_ERROR(libedit version is not compatible) ]
1185 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001186 fi ]
1187)
1188
Darren Tuckerd9f88912005-02-20 21:01:48 +11001189AUDIT_MODULE=none
1190AC_ARG_WITH(audit,
1191 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1192 [
1193 AC_MSG_CHECKING(for supported audit module)
1194 case "$withval" in
1195 bsm)
1196 AC_MSG_RESULT(bsm)
1197 AUDIT_MODULE=bsm
1198 dnl Checks for headers, libs and functions
1199 AC_CHECK_HEADERS(bsm/audit.h, [],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001200 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1201 [
1202#ifdef HAVE_TIME_H
1203# include <time.h>
1204#endif
1205 ]
1206)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001207 AC_CHECK_LIB(bsm, getaudit, [],
1208 [AC_MSG_ERROR(BSM enabled and required library not found)])
1209 AC_CHECK_FUNCS(getaudit, [],
1210 [AC_MSG_ERROR(BSM enabled and required function not found)])
1211 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001212 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001213 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001214 ;;
1215 debug)
1216 AUDIT_MODULE=debug
1217 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001218 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001219 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001220 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001221 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001222 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001223 *)
1224 AC_MSG_ERROR([Unknown audit module $withval])
1225 ;;
1226 esac ]
1227)
1228
Damien Millerfe1f1432003-02-24 15:45:42 +11001229dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001230AC_CHECK_FUNCS( \
1231 arc4random \
Damien Miller57f39152005-11-24 19:58:19 +11001232 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001233 b64_ntop \
1234 __b64_ntop \
1235 b64_pton \
1236 __b64_pton \
1237 bcopy \
1238 bindresvport_sa \
1239 clock \
1240 closefrom \
1241 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001242 fchmod \
1243 fchown \
1244 freeaddrinfo \
1245 futimes \
1246 getaddrinfo \
1247 getcwd \
1248 getgrouplist \
1249 getnameinfo \
1250 getopt \
1251 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001252 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001253 _getpty \
1254 getrlimit \
1255 getttyent \
1256 glob \
1257 inet_aton \
1258 inet_ntoa \
1259 inet_ntop \
1260 innetgr \
1261 login_getcapbool \
1262 md5_crypt \
1263 memmove \
1264 mkdtemp \
1265 mmap \
1266 ngetaddrinfo \
1267 nsleep \
1268 ogetaddrinfo \
1269 openlog_r \
1270 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001271 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001272 prctl \
1273 pstat \
1274 readpassphrase \
1275 realpath \
1276 recvmsg \
1277 rresvport_af \
1278 sendmsg \
1279 setdtablesize \
1280 setegid \
1281 setenv \
1282 seteuid \
1283 setgroups \
1284 setlogin \
1285 setpcred \
1286 setproctitle \
1287 setregid \
1288 setreuid \
1289 setrlimit \
1290 setsid \
1291 setvbuf \
1292 sigaction \
1293 sigvec \
1294 snprintf \
1295 socketpair \
1296 strdup \
1297 strerror \
1298 strlcat \
1299 strlcpy \
1300 strmode \
1301 strnvis \
1302 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001303 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001304 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001305 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001306 sysconf \
1307 tcgetpgrp \
1308 truncate \
1309 unsetenv \
1310 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001311 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001312 vhangup \
1313 vsnprintf \
1314 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001315)
Tim Rice13aae5e2001-10-21 17:53:58 -07001316
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001317# IRIX has a const char return value for gai_strerror()
1318AC_CHECK_FUNCS(gai_strerror,[
1319 AC_DEFINE(HAVE_GAI_STRERROR)
1320 AC_TRY_COMPILE([
1321#include <sys/types.h>
1322#include <sys/socket.h>
1323#include <netdb.h>
1324
1325const char *gai_strerror(int);],[
1326char *str;
1327
1328str = gai_strerror(0);],[
1329 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1330 [Define if gai_strerror() returns const char *])])])
1331
Tim Rice7df8d392005-09-19 09:33:39 -07001332AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1333 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001334
Darren Tuckerf1159b52003-07-07 19:44:01 +10001335dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001336AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001337AC_CHECK_DECL(strsep,
1338 [AC_CHECK_FUNCS(strsep)],
1339 [],
1340 [
1341#ifdef HAVE_STRING_H
1342# include <string.h>
1343#endif
1344 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001345
Darren Tuckerb2427c82003-09-10 15:22:44 +10001346dnl tcsendbreak might be a macro
1347AC_CHECK_DECL(tcsendbreak,
1348 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001349 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001350 [#include <termios.h>]
1351)
1352
Darren Tucker5bb14002004-04-23 18:53:10 +10001353AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1354
Darren Tucker128a0892006-07-12 19:02:56 +10001355AC_CHECK_DECLS(SHUT_RD, , ,
1356 [
1357#include <sys/types.h>
1358#include <sys/socket.h>
1359 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001360
1361AC_CHECK_DECLS(O_NONBLOCK, , ,
1362 [
1363#include <sys/types.h>
1364#ifdef HAVE_SYS_STAT_H
1365# include <sys/stat.h>
1366#endif
1367#ifdef HAVE_FCNTL_H
1368# include <fcntl.h>
1369#endif
1370 ])
1371
Darren Tuckered0b5922006-09-03 22:44:49 +10001372AC_CHECK_DECLS(writev, , , [
1373#include <sys/types.h>
1374#include <sys/uio.h>
1375#include <unistd.h>
1376 ])
1377
Darren Tucker6d862a52007-04-29 14:39:02 +10001378AC_CHECK_DECLS(MAXSYMLINKS, , , [
1379#include <sys/param.h>
1380 ])
1381
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001382AC_CHECK_DECLS(offsetof, , , [
1383#include <stddef.h>
1384 ])
1385
Darren Tucker2a6b0292003-12-31 14:59:17 +11001386AC_CHECK_FUNCS(setresuid, [
1387 dnl Some platorms have setresuid that isn't implemented, test for this
1388 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001389 AC_RUN_IFELSE(
1390 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001391#include <stdlib.h>
1392#include <errno.h>
1393int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001394 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001395 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001396 [AC_DEFINE(BROKEN_SETRESUID, 1,
1397 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001398 AC_MSG_RESULT(not implemented)],
1399 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001400 )
1401])
Darren Tuckere937be32003-12-17 18:53:26 +11001402
Darren Tucker2a6b0292003-12-31 14:59:17 +11001403AC_CHECK_FUNCS(setresgid, [
1404 dnl Some platorms have setresgid that isn't implemented, test for this
1405 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001406 AC_RUN_IFELSE(
1407 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001408#include <stdlib.h>
1409#include <errno.h>
1410int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001411 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001412 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001413 [AC_DEFINE(BROKEN_SETRESGID, 1,
1414 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001415 AC_MSG_RESULT(not implemented)],
1416 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001417 )
1418])
Darren Tuckere937be32003-12-17 18:53:26 +11001419
Damien Millerad833b32000-08-23 10:46:23 +10001420dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001421AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001422dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001423AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001424AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001425dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001426AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001427AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001428
Damien Millera8e06ce2003-11-21 23:48:55 +11001429AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001430 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1431 [AC_CHECK_LIB(bsd, daemon,
1432 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001433)
1434
Damien Millera8e06ce2003-11-21 23:48:55 +11001435AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001436 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1437 [Define if your libraries define getpagesize()])],
1438 [AC_CHECK_LIB(ucb, getpagesize,
1439 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001440)
1441
Damien Millercb170cb2000-07-01 16:52:55 +10001442# Check for broken snprintf
1443if test "x$ac_cv_func_snprintf" = "xyes" ; then
1444 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001445 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001446 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001447#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001448int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001449 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001450 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001451 [
1452 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001453 AC_DEFINE(BROKEN_SNPRINTF, 1,
1454 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001455 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001456 ],
1457 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001458 )
1459fi
1460
Damien Miller57f39152005-11-24 19:58:19 +11001461# If we don't have a working asprintf, then we strongly depend on vsnprintf
1462# returning the right thing on overflow: the number of characters it tried to
1463# create (as per SUSv3)
1464if test "x$ac_cv_func_asprintf" != "xyes" && \
1465 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1466 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1467 AC_RUN_IFELSE(
1468 [AC_LANG_SOURCE([[
1469#include <sys/types.h>
1470#include <stdio.h>
1471#include <stdarg.h>
1472
1473int x_snprintf(char *str,size_t count,const char *fmt,...)
1474{
1475 size_t ret; va_list ap;
1476 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1477 return ret;
1478}
1479int main(void)
1480{
1481 char x[1];
1482 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1483} ]])],
1484 [AC_MSG_RESULT(yes)],
1485 [
1486 AC_MSG_RESULT(no)
1487 AC_DEFINE(BROKEN_SNPRINTF, 1,
1488 [Define if your snprintf is busted])
1489 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1490 ],
1491 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1492 )
1493fi
1494
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001495# On systems where [v]snprintf is broken, but is declared in stdio,
1496# check that the fmt argument is const char * or just char *.
1497# This is only useful for when BROKEN_SNPRINTF
1498AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1499AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1500 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1501 int main(void) { snprintf(0, 0, 0); }
1502 ]])],
1503 [AC_MSG_RESULT(yes)
1504 AC_DEFINE(SNPRINTF_CONST, [const],
1505 [Define as const if snprintf() can declare const char *fmt])],
1506 [AC_MSG_RESULT(no)
1507 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1508
Damien Millerb4097182004-05-23 14:09:40 +10001509# Check for missing getpeereid (or equiv) support
1510NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001511if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001512 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1513 AC_TRY_COMPILE(
1514 [#include <sys/types.h>
1515 #include <sys/socket.h>],
1516 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001517 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001518 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001519 ],
Damien Millerb4097182004-05-23 14:09:40 +10001520 [AC_MSG_RESULT(no)
1521 NO_PEERCHECK=1]
1522 )
1523fi
1524
Damien Millere8328192003-01-07 15:18:32 +11001525dnl see whether mkstemp() requires XXXXXX
1526if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1527AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001528AC_RUN_IFELSE(
1529 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001530#include <stdlib.h>
1531main() { char template[]="conftest.mkstemp-test";
1532if (mkstemp(template) == -1)
1533 exit(1);
1534unlink(template); exit(0);
1535}
Darren Tucker314d89e2005-10-17 23:29:23 +10001536 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001537 [
1538 AC_MSG_RESULT(no)
1539 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001540 [
Damien Millere8328192003-01-07 15:18:32 +11001541 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001542 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001543 ],
1544 [
1545 AC_MSG_RESULT(yes)
1546 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001547 ]
Damien Millere8328192003-01-07 15:18:32 +11001548)
1549fi
1550
Darren Tucker70a3d552003-08-21 17:58:29 +10001551dnl make sure that openpty does not reacquire controlling terminal
1552if test ! -z "$check_for_openpty_ctty_bug"; then
1553 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001554 AC_RUN_IFELSE(
1555 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001556#include <stdio.h>
1557#include <sys/fcntl.h>
1558#include <sys/types.h>
1559#include <sys/wait.h>
1560
1561int
1562main()
1563{
1564 pid_t pid;
1565 int fd, ptyfd, ttyfd, status;
1566
1567 pid = fork();
1568 if (pid < 0) { /* failed */
1569 exit(1);
1570 } else if (pid > 0) { /* parent */
1571 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001572 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001573 exit(WEXITSTATUS(status));
1574 else
1575 exit(2);
1576 } else { /* child */
1577 close(0); close(1); close(2);
1578 setsid();
1579 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1580 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1581 if (fd >= 0)
1582 exit(3); /* Acquired ctty: broken */
1583 else
1584 exit(0); /* Did not acquire ctty: OK */
1585 }
1586}
Darren Tucker314d89e2005-10-17 23:29:23 +10001587 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001588 [
1589 AC_MSG_RESULT(yes)
1590 ],
1591 [
1592 AC_MSG_RESULT(no)
1593 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001594 ],
1595 [
1596 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001597 ]
1598 )
1599fi
1600
Tim Rice8bb561b2005-03-17 16:23:19 -08001601if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1602 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001603 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001604 AC_RUN_IFELSE(
1605 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001606#include <stdio.h>
1607#include <sys/socket.h>
1608#include <netdb.h>
1609#include <errno.h>
1610#include <netinet/in.h>
1611
1612#define TEST_PORT "2222"
1613
1614int
1615main(void)
1616{
1617 int err, sock;
1618 struct addrinfo *gai_ai, *ai, hints;
1619 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1620
1621 memset(&hints, 0, sizeof(hints));
1622 hints.ai_family = PF_UNSPEC;
1623 hints.ai_socktype = SOCK_STREAM;
1624 hints.ai_flags = AI_PASSIVE;
1625
1626 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1627 if (err != 0) {
1628 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1629 exit(1);
1630 }
1631
1632 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1633 if (ai->ai_family != AF_INET6)
1634 continue;
1635
1636 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1637 sizeof(ntop), strport, sizeof(strport),
1638 NI_NUMERICHOST|NI_NUMERICSERV);
1639
1640 if (err != 0) {
1641 if (err == EAI_SYSTEM)
1642 perror("getnameinfo EAI_SYSTEM");
1643 else
1644 fprintf(stderr, "getnameinfo failed: %s\n",
1645 gai_strerror(err));
1646 exit(2);
1647 }
1648
1649 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1650 if (sock < 0)
1651 perror("socket");
1652 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1653 if (errno == EBADF)
1654 exit(3);
1655 }
1656 }
1657 exit(0);
1658}
Darren Tucker314d89e2005-10-17 23:29:23 +10001659 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001660 [
1661 AC_MSG_RESULT(yes)
1662 ],
1663 [
1664 AC_MSG_RESULT(no)
1665 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001666 ],
1667 [
1668 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001669 ]
1670 )
1671fi
1672
Tim Rice8bb561b2005-03-17 16:23:19 -08001673if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1674 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001675 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001676 AC_RUN_IFELSE(
1677 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001678#include <stdio.h>
1679#include <sys/socket.h>
1680#include <netdb.h>
1681#include <errno.h>
1682#include <netinet/in.h>
1683
1684#define TEST_PORT "2222"
1685
1686int
1687main(void)
1688{
1689 int err, sock;
1690 struct addrinfo *gai_ai, *ai, hints;
1691 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1692
1693 memset(&hints, 0, sizeof(hints));
1694 hints.ai_family = PF_UNSPEC;
1695 hints.ai_socktype = SOCK_STREAM;
1696 hints.ai_flags = AI_PASSIVE;
1697
1698 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1699 if (err != 0) {
1700 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1701 exit(1);
1702 }
1703
1704 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1705 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1706 continue;
1707
1708 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1709 sizeof(ntop), strport, sizeof(strport),
1710 NI_NUMERICHOST|NI_NUMERICSERV);
1711
1712 if (ai->ai_family == AF_INET && err != 0) {
1713 perror("getnameinfo");
1714 exit(2);
1715 }
1716 }
1717 exit(0);
1718}
Darren Tucker314d89e2005-10-17 23:29:23 +10001719 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001720 [
1721 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001722 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1723 [Define if you have a getaddrinfo that fails
1724 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001725 ],
1726 [
1727 AC_MSG_RESULT(no)
1728 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001729 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001730 [
Darren Tucker314d89e2005-10-17 23:29:23 +10001731 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001732 ]
1733 )
1734fi
1735
Darren Tuckera56f1912004-11-02 20:30:54 +11001736if test "x$check_for_conflicting_getspnam" = "x1"; then
1737 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1738 AC_COMPILE_IFELSE(
1739 [
1740#include <shadow.h>
1741int main(void) {exit(0);}
1742 ],
1743 [
1744 AC_MSG_RESULT(no)
1745 ],
1746 [
1747 AC_MSG_RESULT(yes)
1748 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1749 [Conflicting defs for getspnam])
1750 ]
1751 )
1752fi
1753
Damien Miller606f8802000-09-16 15:39:56 +11001754AC_FUNC_GETPGRP
1755
Tim Riceaef73712002-05-11 13:17:42 -07001756# Search for OpenSSL
1757saved_CPPFLAGS="$CPPFLAGS"
1758saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001759AC_ARG_WITH(ssl-dir,
1760 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1761 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001762 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001763 case "$withval" in
1764 # Relative paths
1765 ./*|../*) withval="`pwd`/$withval"
1766 esac
Tim Riceaef73712002-05-11 13:17:42 -07001767 if test -d "$withval/lib"; then
1768 if test -n "${need_dash_r}"; then
1769 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1770 else
1771 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1772 fi
1773 else
1774 if test -n "${need_dash_r}"; then
1775 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1776 else
1777 LDFLAGS="-L${withval} ${LDFLAGS}"
1778 fi
1779 fi
1780 if test -d "$withval/include"; then
1781 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1782 else
1783 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1784 fi
Damien Millera22ba012000-03-02 23:09:20 +11001785 fi
1786 ]
1787)
Tim Rice3d5352e2004-02-12 09:27:21 -08001788LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001789AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1790 [Define if your ssl headers are included
1791 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001792 [
Tim Riceaef73712002-05-11 13:17:42 -07001793 dnl Check default openssl install dir
1794 if test -n "${need_dash_r}"; then
1795 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001796 else
Tim Riceaef73712002-05-11 13:17:42 -07001797 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001798 fi
Tim Riceaef73712002-05-11 13:17:42 -07001799 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1800 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1801 [
1802 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1803 ]
1804 )
1805 ]
1806)
1807
Tim Riced730b782002-08-13 18:52:10 -07001808# Determine OpenSSL header version
1809AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001810AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001811 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001812#include <stdio.h>
1813#include <string.h>
1814#include <openssl/opensslv.h>
1815#define DATA "conftest.sslincver"
1816int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001817 FILE *fd;
1818 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001819
Damien Millera8e06ce2003-11-21 23:48:55 +11001820 fd = fopen(DATA,"w");
1821 if(fd == NULL)
1822 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001823
1824 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1825 exit(1);
1826
1827 exit(0);
1828}
Darren Tucker623d92f2004-09-12 22:36:15 +10001829 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001830 [
1831 ssl_header_ver=`cat conftest.sslincver`
1832 AC_MSG_RESULT($ssl_header_ver)
1833 ],
1834 [
1835 AC_MSG_RESULT(not found)
1836 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001837 ],
1838 [
1839 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001840 ]
1841)
1842
1843# Determine OpenSSL library version
1844AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001845AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001846 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001847#include <stdio.h>
1848#include <string.h>
1849#include <openssl/opensslv.h>
1850#include <openssl/crypto.h>
1851#define DATA "conftest.ssllibver"
1852int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001853 FILE *fd;
1854 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001855
Damien Millera8e06ce2003-11-21 23:48:55 +11001856 fd = fopen(DATA,"w");
1857 if(fd == NULL)
1858 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001859
1860 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1861 exit(1);
1862
1863 exit(0);
1864}
Darren Tucker623d92f2004-09-12 22:36:15 +10001865 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001866 [
1867 ssl_library_ver=`cat conftest.ssllibver`
1868 AC_MSG_RESULT($ssl_library_ver)
1869 ],
1870 [
1871 AC_MSG_RESULT(not found)
1872 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001873 ],
1874 [
1875 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001876 ]
1877)
Damien Millera22ba012000-03-02 23:09:20 +11001878
Damien Miller9975e482007-03-05 11:51:27 +11001879AC_ARG_WITH(openssl-header-check,
1880 [ --without-openssl-header-check Disable OpenSSL version consistency check],
1881 [ if test "x$withval" = "xno" ; then
1882 openssl_check_nonfatal=1
1883 fi
1884 ]
1885)
1886
Damien Millerec932372002-01-22 22:16:03 +11001887# Sanity check OpenSSL headers
1888AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001889AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001890 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001891#include <string.h>
1892#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001893int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001894 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001895 [
1896 AC_MSG_RESULT(yes)
1897 ],
1898 [
1899 AC_MSG_RESULT(no)
Damien Miller9975e482007-03-05 11:51:27 +11001900 if test "x$openssl_check_nonfatal" = "x"; then
1901 AC_MSG_ERROR([Your OpenSSL headers do not match your
1902library. Check config.log for details.
1903If you are sure your installation is consistent, you can disable the check
1904by running "./configure --without-openssl-header-check".
1905Also see contrib/findssl.sh for help identifying header/library mismatches.
1906])
1907 else
1908 AC_MSG_WARN([Your OpenSSL headers do not match your
1909library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10001910Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11001911 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001912 ],
1913 [
1914 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001915 ]
1916)
1917
Darren Tucker639bbe82006-08-20 20:17:53 +10001918AC_MSG_CHECKING([if programs using OpenSSL functions will link])
1919AC_LINK_IFELSE(
1920 [AC_LANG_SOURCE([[
1921#include <openssl/evp.h>
1922int main(void) { SSLeay_add_all_algorithms(); }
1923 ]])],
1924 [
1925 AC_MSG_RESULT(yes)
1926 ],
1927 [
1928 AC_MSG_RESULT(no)
1929 saved_LIBS="$LIBS"
1930 LIBS="$LIBS -ldl"
1931 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
1932 AC_LINK_IFELSE(
1933 [AC_LANG_SOURCE([[
1934#include <openssl/evp.h>
1935int main(void) { SSLeay_add_all_algorithms(); }
1936 ]])],
1937 [
1938 AC_MSG_RESULT(yes)
1939 ],
1940 [
1941 AC_MSG_RESULT(no)
1942 LIBS="$saved_LIBS"
1943 ]
1944 )
1945 ]
1946)
1947
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11001948AC_ARG_WITH(ssl-engine,
1949 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
1950 [ if test "x$withval" != "xno" ; then
1951 AC_MSG_CHECKING(for OpenSSL ENGINE support)
1952 AC_TRY_COMPILE(
1953 [ #include <openssl/engine.h>],
1954 [
Darren Tucker5e8381e2006-09-29 20:16:51 +10001955ENGINE_load_builtin_engines();ENGINE_register_all_complete();
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11001956 ],
1957 [ AC_MSG_RESULT(yes)
1958 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
1959 [Enable OpenSSL engine support])
1960 ],
1961 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
1962 )
1963 fi ]
1964)
1965
Darren Tucker129d0bb2005-12-19 17:40:40 +11001966# Check for OpenSSL without EVP_aes_{192,256}_cbc
1967AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10001968AC_LINK_IFELSE(
Darren Tucker129d0bb2005-12-19 17:40:40 +11001969 [AC_LANG_SOURCE([[
1970#include <string.h>
1971#include <openssl/evp.h>
Darren Tuckercc7c2122006-02-02 18:44:19 +11001972int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
Darren Tucker129d0bb2005-12-19 17:40:40 +11001973 ]])],
1974 [
1975 AC_MSG_RESULT(no)
1976 ],
1977 [
1978 AC_MSG_RESULT(yes)
1979 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
1980 [libcrypto is missing AES 192 and 256 bit functions])
1981 ]
1982)
1983
Tim Rice3d5352e2004-02-12 09:27:21 -08001984# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1985# because the system crypt() is more featureful.
1986if test "x$check_for_libcrypt_before" = "x1"; then
1987 AC_CHECK_LIB(crypt, crypt)
1988fi
1989
Damien Millera8e06ce2003-11-21 23:48:55 +11001990# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001991# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001992if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001993 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001994fi
1995
Damien Milleraf87af12006-03-15 13:02:28 +11001996# Search for SHA256 support in libc and/or OpenSSL
1997AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
1998
Tim Rice99203ec2007-03-26 09:35:28 -07001999saved_LIBS="$LIBS"
2000AC_CHECK_LIB(iaf, ia_openinfo, [
2001 LIBS="$LIBS -liaf"
2002 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"])
2003])
2004LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002005
2006### Configure cryptographic random number support
2007
2008# Check wheter OpenSSL seeds itself
2009AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002010AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002011 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11002012#include <string.h>
2013#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07002014int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10002015 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002016 [
2017 OPENSSL_SEEDS_ITSELF=yes
2018 AC_MSG_RESULT(yes)
2019 ],
2020 [
2021 AC_MSG_RESULT(no)
2022 # Default to use of the rand helper if OpenSSL doesn't
2023 # seed itself
2024 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10002025 ],
2026 [
2027 AC_MSG_WARN([cross compiling: assuming yes])
2028 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08002029 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002030 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002031 ]
2032)
2033
Darren Tucker3e6bde42006-08-20 20:03:50 +10002034# Check for PAM libs
2035PAM_MSG="no"
2036AC_ARG_WITH(pam,
2037 [ --with-pam Enable PAM support ],
2038 [
2039 if test "x$withval" != "xno" ; then
2040 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2041 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2042 AC_MSG_ERROR([PAM headers not found])
2043 fi
2044
2045 saved_LIBS="$LIBS"
2046 AC_CHECK_LIB(dl, dlopen, , )
2047 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2048 AC_CHECK_FUNCS(pam_getenvlist)
2049 AC_CHECK_FUNCS(pam_putenv)
2050 LIBS="$saved_LIBS"
2051
2052 PAM_MSG="yes"
2053
Darren Tucker20e9f972007-03-25 18:26:01 +10002054 SSHDLIBS="$SSHDLIBS -lpam"
Darren Tucker3e6bde42006-08-20 20:03:50 +10002055 AC_DEFINE(USE_PAM, 1,
2056 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002057
Darren Tucker3e6bde42006-08-20 20:03:50 +10002058 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002059 case "$LIBS" in
2060 *-ldl*)
2061 # libdl already in LIBS
2062 ;;
2063 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002064 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002065 ;;
2066 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002067 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002068 fi
2069 ]
2070)
2071
2072# Check for older PAM
2073if test "x$PAM_MSG" = "xyes" ; then
2074 # Check PAM strerror arguments (old PAM)
2075 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2076 AC_TRY_COMPILE(
2077 [
2078#include <stdlib.h>
2079#if defined(HAVE_SECURITY_PAM_APPL_H)
2080#include <security/pam_appl.h>
2081#elif defined (HAVE_PAM_PAM_APPL_H)
2082#include <pam/pam_appl.h>
2083#endif
2084 ],
2085 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2086 [AC_MSG_RESULT(no)],
2087 [
2088 AC_DEFINE(HAVE_OLD_PAM, 1,
2089 [Define if you have an old version of PAM
2090 which takes only one argument to pam_strerror])
2091 AC_MSG_RESULT(yes)
2092 PAM_MSG="yes (old library)"
2093 ]
2094 )
2095fi
Damien Miller6c21c512002-01-22 21:57:53 +11002096
2097# Do we want to force the use of the rand helper?
2098AC_ARG_WITH(rand-helper,
2099 [ --with-rand-helper Use subprocess to gather strong randomness ],
2100 [
2101 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002102 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11002103 # the previous test showed it to be unseeded.
2104 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2105 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2106 OPENSSL_SEEDS_ITSELF=yes
2107 USE_RAND_HELPER=""
2108 fi
2109 else
2110 USE_RAND_HELPER=yes
2111 fi
2112 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08002113)
Damien Miller6c21c512002-01-22 21:57:53 +11002114
2115# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08002116if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002117 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07002118 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2119 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11002120 RAND_MSG="OpenSSL internal ONLY"
2121 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08002122elif test ! -z "$USE_RAND_HELPER" ; then
2123 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11002124 RAND_MSG="ssh-rand-helper"
2125 INSTALL_SSH_RAND_HELPER="yes"
2126fi
2127AC_SUBST(INSTALL_SSH_RAND_HELPER)
2128
2129### Configuration of ssh-rand-helper
2130
2131# PRNGD TCP socket
2132AC_ARG_WITH(prngd-port,
2133 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2134 [
Damien Millere996d722002-01-23 11:20:59 +11002135 case "$withval" in
2136 no)
2137 withval=""
2138 ;;
2139 [[0-9]]*)
2140 ;;
2141 *)
2142 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2143 ;;
2144 esac
2145 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002146 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002147 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2148 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002149 fi
2150 ]
2151)
2152
2153# PRNGD Unix domain socket
2154AC_ARG_WITH(prngd-socket,
2155 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2156 [
Damien Millere996d722002-01-23 11:20:59 +11002157 case "$withval" in
2158 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11002159 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11002160 ;;
2161 no)
2162 withval=""
2163 ;;
2164 /*)
2165 ;;
2166 *)
2167 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2168 ;;
2169 esac
2170
2171 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002172 if test ! -z "$PRNGD_PORT" ; then
2173 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2174 fi
Damien Miller6385ba02002-01-23 08:12:36 +11002175 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002176 AC_MSG_WARN(Entropy socket is not readable)
2177 fi
2178 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002179 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2180 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002181 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08002182 ],
2183 [
2184 # Check for existing socket only if we don't have a random device already
2185 if test "$USE_RAND_HELPER" = yes ; then
2186 AC_MSG_CHECKING(for PRNGD/EGD socket)
2187 # Insert other locations here
2188 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2189 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2190 PRNGD_SOCKET="$sock"
2191 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2192 break;
2193 fi
2194 done
2195 if test ! -z "$PRNGD_SOCKET" ; then
2196 AC_MSG_RESULT($PRNGD_SOCKET)
2197 else
2198 AC_MSG_RESULT(not found)
2199 fi
2200 fi
Damien Miller6c21c512002-01-22 21:57:53 +11002201 ]
2202)
2203
2204# Change default command timeout for hashing entropy source
2205entropy_timeout=200
2206AC_ARG_WITH(entropy-timeout,
2207 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2208 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002209 if test -n "$withval" && test "x$withval" != "xno" && \
2210 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002211 entropy_timeout=$withval
2212 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002213 ]
Damien Miller6c21c512002-01-22 21:57:53 +11002214)
Tim Rice7df8d392005-09-19 09:33:39 -07002215AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2216 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11002217
Damien Millerd3f6ad22002-06-25 10:24:47 +10002218SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00002219AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00002220 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002221 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002222 if test -n "$withval" && test "x$withval" != "xno" && \
2223 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002224 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002225 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002226 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002227)
Tim Rice7df8d392005-09-19 09:33:39 -07002228AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2229 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002230AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002231
Tim Rice88f2ab52002-03-17 12:17:34 -08002232# We do this little dance with the search path to insure
2233# that programs that we select for use by installed programs
2234# (which may be run by the super-user) come from trusted
2235# locations before they come from the user's private area.
2236# This should help avoid accidentally configuring some
2237# random version of a program in someone's personal bin.
2238
2239OPATH=$PATH
2240PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002241test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002242test -d /sbin && PATH=$PATH:/sbin
2243test -d /usr/sbin && PATH=$PATH:/usr/sbin
2244PATH=$PATH:/etc:$OPATH
2245
Damien Millera8e06ce2003-11-21 23:48:55 +11002246# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002247OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2248OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2249OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2250OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2251OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2252OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2253OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2254OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2255OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2256OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2257OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2258OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2259OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2260OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2261OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2262OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002263# restore PATH
2264PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002265
2266# Where does ssh-rand-helper get its randomness from?
2267INSTALL_SSH_PRNG_CMDS=""
2268if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2269 if test ! -z "$PRNGD_PORT" ; then
2270 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2271 elif test ! -z "$PRNGD_SOCKET" ; then
2272 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2273 else
2274 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2275 RAND_HELPER_CMDHASH=yes
2276 INSTALL_SSH_PRNG_CMDS="yes"
2277 fi
2278fi
2279AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2280
2281
Ben Lindstromb5628642000-10-18 00:02:25 +00002282# Cheap hack to ensure NEWS-OS libraries are arranged right.
2283if test ! -z "$SONY" ; then
2284 LIBS="$LIBS -liberty";
2285fi
2286
Damien Miller57f39152005-11-24 19:58:19 +11002287# Check for long long datatypes
2288AC_CHECK_TYPES([long long, unsigned long long, long double])
2289
2290# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002291AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002292AC_CHECK_SIZEOF(short int, 2)
2293AC_CHECK_SIZEOF(int, 4)
2294AC_CHECK_SIZEOF(long int, 4)
2295AC_CHECK_SIZEOF(long long int, 8)
2296
Damien Millerfa2bb692002-04-23 23:22:25 +10002297# Sanity check long long for some platforms (AIX)
2298if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2299 ac_cv_sizeof_long_long_int=0
2300fi
2301
Darren Tucker537f1ed2005-10-25 18:38:33 +10002302# compute LLONG_MIN and LLONG_MAX if we don't know them.
2303if test -z "$have_llong_max"; then
2304 AC_MSG_CHECKING([for max value of long long])
2305 AC_RUN_IFELSE(
2306 [AC_LANG_SOURCE([[
2307#include <stdio.h>
2308/* Why is this so damn hard? */
2309#ifdef __GNUC__
2310# undef __GNUC__
2311#endif
2312#define __USE_ISOC99
2313#include <limits.h>
2314#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002315#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2316
2317/*
2318 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2319 * we do this the hard way.
2320 */
2321static int
2322fprint_ll(FILE *f, long long n)
2323{
2324 unsigned int i;
2325 int l[sizeof(long long) * 8];
2326
2327 if (n < 0)
2328 if (fprintf(f, "-") < 0)
2329 return -1;
2330 for (i = 0; n != 0; i++) {
2331 l[i] = my_abs(n % 10);
2332 n /= 10;
2333 }
2334 do {
2335 if (fprintf(f, "%d", l[--i]) < 0)
2336 return -1;
2337 } while (i != 0);
2338 if (fprintf(f, " ") < 0)
2339 return -1;
2340 return 0;
2341}
2342
Darren Tucker537f1ed2005-10-25 18:38:33 +10002343int main(void) {
2344 FILE *f;
2345 long long i, llmin, llmax = 0;
2346
2347 if((f = fopen(DATA,"w")) == NULL)
2348 exit(1);
2349
2350#if defined(LLONG_MIN) && defined(LLONG_MAX)
2351 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2352 llmin = LLONG_MIN;
2353 llmax = LLONG_MAX;
2354#else
2355 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2356 /* This will work on one's complement and two's complement */
2357 for (i = 1; i > llmax; i <<= 1, i++)
2358 llmax = i;
2359 llmin = llmax + 1LL; /* wrap */
2360#endif
2361
2362 /* Sanity check */
2363 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002364 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2365 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002366 fprintf(f, "unknown unknown\n");
2367 exit(2);
2368 }
2369
Darren Tuckerd1450db2006-03-13 19:06:51 +11002370 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002371 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002372 if (fprint_ll(f, llmax) < 0)
2373 exit(4);
2374 if (fclose(f) < 0)
2375 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002376 exit(0);
2377}
2378 ]])],
2379 [
2380 llong_min=`$AWK '{print $1}' conftest.llminmax`
2381 llong_max=`$AWK '{print $2}' conftest.llminmax`
2382
Darren Tucker537f1ed2005-10-25 18:38:33 +10002383 AC_MSG_RESULT($llong_max)
2384 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2385 [max value of long long calculated by configure])
2386 AC_MSG_CHECKING([for min value of long long])
2387 AC_MSG_RESULT($llong_min)
2388 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2389 [min value of long long calculated by configure])
2390 ],
2391 [
2392 AC_MSG_RESULT(not found)
2393 ],
2394 [
2395 AC_MSG_WARN([cross compiling: not checking])
2396 ]
2397 )
2398fi
2399
2400
Damien Millera22ba012000-03-02 23:09:20 +11002401# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002402AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2403 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002404 [ #include <sys/types.h> ],
2405 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002406 [ ac_cv_have_u_int="yes" ],
2407 [ ac_cv_have_u_int="no" ]
2408 )
2409])
2410if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002411 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002412 have_u_int=1
2413fi
2414
Damien Miller61e50f12000-05-08 20:49:37 +10002415AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2416 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002417 [ #include <sys/types.h> ],
2418 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002419 [ ac_cv_have_intxx_t="yes" ],
2420 [ ac_cv_have_intxx_t="no" ]
2421 )
2422])
2423if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002424 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002425 have_intxx_t=1
2426fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002427
2428if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002429 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002430then
2431 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2432 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002433 [ #include <stdint.h> ],
2434 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002435 [
2436 AC_DEFINE(HAVE_INTXX_T)
2437 AC_MSG_RESULT(yes)
2438 ],
2439 [ AC_MSG_RESULT(no) ]
2440 )
2441fi
2442
Damien Miller578783e2000-09-23 14:12:24 +11002443AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2444 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002445 [
2446#include <sys/types.h>
2447#ifdef HAVE_STDINT_H
2448# include <stdint.h>
2449#endif
2450#include <sys/socket.h>
2451#ifdef HAVE_SYS_BITYPES_H
2452# include <sys/bitypes.h>
2453#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002454 ],
2455 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002456 [ ac_cv_have_int64_t="yes" ],
2457 [ ac_cv_have_int64_t="no" ]
2458 )
2459])
2460if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002461 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002462fi
2463
Damien Miller61e50f12000-05-08 20:49:37 +10002464AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2465 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002466 [ #include <sys/types.h> ],
2467 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002468 [ ac_cv_have_u_intxx_t="yes" ],
2469 [ ac_cv_have_u_intxx_t="no" ]
2470 )
2471])
2472if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002473 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002474 have_u_intxx_t=1
2475fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002476
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002477if test -z "$have_u_intxx_t" ; then
2478 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2479 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002480 [ #include <sys/socket.h> ],
2481 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002482 [
2483 AC_DEFINE(HAVE_U_INTXX_T)
2484 AC_MSG_RESULT(yes)
2485 ],
2486 [ AC_MSG_RESULT(no) ]
2487 )
2488fi
2489
Damien Miller578783e2000-09-23 14:12:24 +11002490AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2491 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002492 [ #include <sys/types.h> ],
2493 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002494 [ ac_cv_have_u_int64_t="yes" ],
2495 [ ac_cv_have_u_int64_t="no" ]
2496 )
2497])
2498if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002499 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002500 have_u_int64_t=1
2501fi
2502
Tim Rice4cec93f2002-02-26 08:40:48 -08002503if test -z "$have_u_int64_t" ; then
2504 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2505 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002506 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002507 [ u_int64_t a; a = 1],
2508 [
2509 AC_DEFINE(HAVE_U_INT64_T)
2510 AC_MSG_RESULT(yes)
2511 ],
2512 [ AC_MSG_RESULT(no) ]
2513 )
2514fi
2515
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002516if test -z "$have_u_intxx_t" ; then
2517 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2518 AC_TRY_COMPILE(
2519 [
2520#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002521 ],
2522 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002523 [ ac_cv_have_uintxx_t="yes" ],
2524 [ ac_cv_have_uintxx_t="no" ]
2525 )
2526 ])
2527 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002528 AC_DEFINE(HAVE_UINTXX_T, 1,
2529 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002530 fi
2531fi
2532
2533if test -z "$have_uintxx_t" ; then
2534 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2535 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002536 [ #include <stdint.h> ],
2537 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002538 [
2539 AC_DEFINE(HAVE_UINTXX_T)
2540 AC_MSG_RESULT(yes)
2541 ],
2542 [ AC_MSG_RESULT(no) ]
2543 )
2544fi
2545
Damien Milleredb82922000-06-20 13:25:52 +10002546if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002547 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002548then
2549 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2550 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002551 [
2552#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002553 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002554 [
Damien Miller70494d12000-04-03 15:57:06 +10002555 int8_t a; int16_t b; int32_t c;
2556 u_int8_t e; u_int16_t f; u_int32_t g;
2557 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002558 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002559 [
2560 AC_DEFINE(HAVE_U_INTXX_T)
2561 AC_DEFINE(HAVE_INTXX_T)
2562 AC_MSG_RESULT(yes)
2563 ],
2564 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002565 )
Damien Millerb29ea912000-01-15 14:12:03 +11002566fi
2567
Damien Miller58be7382001-09-15 21:31:54 +10002568
2569AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2570 AC_TRY_COMPILE(
2571 [
2572#include <sys/types.h>
2573 ],
2574 [ u_char foo; foo = 125; ],
2575 [ ac_cv_have_u_char="yes" ],
2576 [ ac_cv_have_u_char="no" ]
2577 )
2578])
2579if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002580 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002581fi
2582
Tim Rice13aae5e2001-10-21 17:53:58 -07002583TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002584
Tim Rice200a5c02002-02-26 22:12:34 -08002585AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002586
Damien Miller848b9932005-02-24 12:12:34 +11002587AC_CHECK_TYPES(in_addr_t,,,
2588[#include <sys/types.h>
2589#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002590
Damien Miller61e50f12000-05-08 20:49:37 +10002591AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2592 AC_TRY_COMPILE(
2593 [
2594#include <sys/types.h>
2595 ],
2596 [ size_t foo; foo = 1235; ],
2597 [ ac_cv_have_size_t="yes" ],
2598 [ ac_cv_have_size_t="no" ]
2599 )
2600])
2601if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002602 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002603fi
Damien Miller95058511999-12-29 10:36:45 +11002604
Damien Miller615f9392000-05-17 22:53:33 +10002605AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2606 AC_TRY_COMPILE(
2607 [
2608#include <sys/types.h>
2609 ],
2610 [ ssize_t foo; foo = 1235; ],
2611 [ ac_cv_have_ssize_t="yes" ],
2612 [ ac_cv_have_ssize_t="no" ]
2613 )
2614])
2615if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002616 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002617fi
2618
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002619AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2620 AC_TRY_COMPILE(
2621 [
2622#include <time.h>
2623 ],
2624 [ clock_t foo; foo = 1235; ],
2625 [ ac_cv_have_clock_t="yes" ],
2626 [ ac_cv_have_clock_t="no" ]
2627 )
2628])
2629if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002630 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002631fi
2632
Damien Millerb54b40e2000-06-23 08:23:34 +10002633AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2634 AC_TRY_COMPILE(
2635 [
2636#include <sys/types.h>
2637#include <sys/socket.h>
2638 ],
2639 [ sa_family_t foo; foo = 1235; ],
2640 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002641 [ AC_TRY_COMPILE(
2642 [
2643#include <sys/types.h>
2644#include <sys/socket.h>
2645#include <netinet/in.h>
2646 ],
2647 [ sa_family_t foo; foo = 1235; ],
2648 [ ac_cv_have_sa_family_t="yes" ],
2649
Damien Millerb54b40e2000-06-23 08:23:34 +10002650 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002651 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002652 )
2653])
2654if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002655 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2656 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002657fi
2658
Damien Miller0f91b4e2000-06-18 15:43:25 +10002659AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2660 AC_TRY_COMPILE(
2661 [
2662#include <sys/types.h>
2663 ],
2664 [ pid_t foo; foo = 1235; ],
2665 [ ac_cv_have_pid_t="yes" ],
2666 [ ac_cv_have_pid_t="no" ]
2667 )
2668])
2669if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002670 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002671fi
2672
2673AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2674 AC_TRY_COMPILE(
2675 [
2676#include <sys/types.h>
2677 ],
2678 [ mode_t foo; foo = 1235; ],
2679 [ ac_cv_have_mode_t="yes" ],
2680 [ ac_cv_have_mode_t="no" ]
2681 )
2682])
2683if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002684 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002685fi
2686
Damien Miller61e50f12000-05-08 20:49:37 +10002687
2688AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2689 AC_TRY_COMPILE(
2690 [
Damien Miller81171112000-04-23 11:14:01 +10002691#include <sys/types.h>
2692#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002693 ],
2694 [ struct sockaddr_storage s; ],
2695 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2696 [ ac_cv_have_struct_sockaddr_storage="no" ]
2697 )
2698])
2699if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002700 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2701 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002702fi
Damien Miller34132e52000-01-14 15:45:46 +11002703
Damien Miller61e50f12000-05-08 20:49:37 +10002704AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2705 AC_TRY_COMPILE(
2706 [
Damien Miller7b22d652000-06-18 14:07:04 +10002707#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002708#include <netinet/in.h>
2709 ],
2710 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2711 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2712 [ ac_cv_have_struct_sockaddr_in6="no" ]
2713 )
2714])
2715if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002716 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2717 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002718fi
Damien Miller34132e52000-01-14 15:45:46 +11002719
Damien Miller61e50f12000-05-08 20:49:37 +10002720AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2721 AC_TRY_COMPILE(
2722 [
Damien Miller7b22d652000-06-18 14:07:04 +10002723#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002724#include <netinet/in.h>
2725 ],
2726 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2727 [ ac_cv_have_struct_in6_addr="yes" ],
2728 [ ac_cv_have_struct_in6_addr="no" ]
2729 )
2730])
2731if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002732 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2733 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002734fi
Damien Miller34132e52000-01-14 15:45:46 +11002735
Damien Miller61e50f12000-05-08 20:49:37 +10002736AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2737 AC_TRY_COMPILE(
2738 [
Damien Miller81171112000-04-23 11:14:01 +10002739#include <sys/types.h>
2740#include <sys/socket.h>
2741#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002742 ],
2743 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2744 [ ac_cv_have_struct_addrinfo="yes" ],
2745 [ ac_cv_have_struct_addrinfo="no" ]
2746 )
2747])
2748if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002749 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2750 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002751fi
2752
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002753AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2754 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002755 [ #include <sys/time.h> ],
2756 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002757 [ ac_cv_have_struct_timeval="yes" ],
2758 [ ac_cv_have_struct_timeval="no" ]
2759 )
2760])
2761if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002762 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002763 have_struct_timeval=1
2764fi
2765
Tim Rice4e4dc562003-03-18 10:21:40 -08002766AC_CHECK_TYPES(struct timespec)
2767
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002768# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002769if test "x$ac_cv_have_int64_t" = "xno" && \
2770 test "x$ac_cv_sizeof_long_int" != "x8" && \
2771 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002772 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2773 echo "an alternative compiler (I.E., GCC) before continuing."
2774 echo ""
2775 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002776else
2777dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002778 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002779 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002780#include <stdio.h>
2781#include <string.h>
2782#ifdef HAVE_SNPRINTF
2783main()
2784{
2785 char buf[50];
2786 char expected_out[50];
2787 int mazsize = 50 ;
2788#if (SIZEOF_LONG_INT == 8)
2789 long int num = 0x7fffffffffffffff;
2790#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002791 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002792#endif
2793 strcpy(expected_out, "9223372036854775807");
2794 snprintf(buf, mazsize, "%lld", num);
2795 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002796 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002797 exit(0);
2798}
2799#else
2800main() { exit(0); }
2801#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002802 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002803 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002804 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002805fi
2806
Damien Miller78315eb2000-09-29 23:01:36 +11002807dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002808OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2809OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2810OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2811OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2812OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002813OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002814OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2815OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002816OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002817OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2818OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2819OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2820OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002821OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2822OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2823OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2824OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002825
2826AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002827AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2828 [Define if we don't have struct __res_state in resolv.h])],
2829[
2830#include <stdio.h>
2831#if HAVE_SYS_TYPES_H
2832# include <sys/types.h>
2833#endif
2834#include <netinet/in.h>
2835#include <arpa/nameser.h>
2836#include <resolv.h>
2837])
andre2ff7b5d2000-06-03 14:57:40 +00002838
Damien Miller61e50f12000-05-08 20:49:37 +10002839AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2840 ac_cv_have_ss_family_in_struct_ss, [
2841 AC_TRY_COMPILE(
2842 [
Damien Miller81171112000-04-23 11:14:01 +10002843#include <sys/types.h>
2844#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002845 ],
2846 [ struct sockaddr_storage s; s.ss_family = 1; ],
2847 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2848 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2849 )
2850])
2851if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002852 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002853fi
2854
Damien Miller61e50f12000-05-08 20:49:37 +10002855AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2856 ac_cv_have___ss_family_in_struct_ss, [
2857 AC_TRY_COMPILE(
2858 [
Damien Miller81171112000-04-23 11:14:01 +10002859#include <sys/types.h>
2860#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002861 ],
2862 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2863 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2864 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2865 )
2866])
2867if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002868 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2869 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002870fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002871
Damien Millerad833b32000-08-23 10:46:23 +10002872AC_CACHE_CHECK([for pw_class field in struct passwd],
2873 ac_cv_have_pw_class_in_struct_passwd, [
2874 AC_TRY_COMPILE(
2875 [
Damien Millerad833b32000-08-23 10:46:23 +10002876#include <pwd.h>
2877 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002878 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002879 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2880 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2881 )
2882])
2883if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002884 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2885 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002886fi
2887
Kevin Steves82456952001-06-22 21:14:18 +00002888AC_CACHE_CHECK([for pw_expire field in struct passwd],
2889 ac_cv_have_pw_expire_in_struct_passwd, [
2890 AC_TRY_COMPILE(
2891 [
2892#include <pwd.h>
2893 ],
2894 [ struct passwd p; p.pw_expire = 0; ],
2895 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2896 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2897 )
2898])
2899if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002900 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2901 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002902fi
2903
2904AC_CACHE_CHECK([for pw_change field in struct passwd],
2905 ac_cv_have_pw_change_in_struct_passwd, [
2906 AC_TRY_COMPILE(
2907 [
2908#include <pwd.h>
2909 ],
2910 [ struct passwd p; p.pw_change = 0; ],
2911 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2912 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2913 )
2914])
2915if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002916 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2917 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002918fi
Damien Miller61e50f12000-05-08 20:49:37 +10002919
Tim Rice28bbb0c2002-05-27 17:37:32 -07002920dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002921AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2922 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002923 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002924 [
Tim Riceae49fe62002-04-12 10:26:21 -07002925#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002926#include <sys/socket.h>
2927#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002928int main() {
2929#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002930#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002931exit(1);
2932#endif
2933struct msghdr m;
2934m.msg_accrights = 0;
2935exit(0);
2936}
Kevin Steves939c9db2002-03-22 17:23:25 +00002937 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002938 [ ac_cv_have_accrights_in_msghdr="yes" ],
2939 [ ac_cv_have_accrights_in_msghdr="no" ]
2940 )
2941])
2942if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002943 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2944 [Define if your system uses access rights style
2945 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002946fi
2947
Kevin Stevesa44e0352002-04-07 16:18:03 +00002948AC_CACHE_CHECK([for msg_control field in struct msghdr],
2949 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002950 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002951 [
Tim Riceae49fe62002-04-12 10:26:21 -07002952#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002953#include <sys/socket.h>
2954#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002955int main() {
2956#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002957#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002958exit(1);
2959#endif
2960struct msghdr m;
2961m.msg_control = 0;
2962exit(0);
2963}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002964 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002965 [ ac_cv_have_control_in_msghdr="yes" ],
2966 [ ac_cv_have_control_in_msghdr="no" ]
2967 )
2968])
2969if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002970 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2971 [Define if your system uses ancillary data style
2972 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002973fi
2974
Damien Miller61e50f12000-05-08 20:49:37 +10002975AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002976 AC_TRY_LINK([],
2977 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002978 [ ac_cv_libc_defines___progname="yes" ],
2979 [ ac_cv_libc_defines___progname="no" ]
2980 )
2981])
2982if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002983 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002984fi
2985
Kevin Steves4846f4a2002-03-22 18:19:53 +00002986AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2987 AC_TRY_LINK([
2988#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002989],
2990 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002991 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2992 [ ac_cv_cc_implements___FUNCTION__="no" ]
2993 )
2994])
2995if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002996 AC_DEFINE(HAVE___FUNCTION__, 1,
2997 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002998fi
2999
3000AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3001 AC_TRY_LINK([
3002#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003003],
3004 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003005 [ ac_cv_cc_implements___func__="yes" ],
3006 [ ac_cv_cc_implements___func__="no" ]
3007 )
3008])
3009if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003010 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003011fi
3012
Damien Miller57f39152005-11-24 19:58:19 +11003013AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3014 AC_TRY_LINK(
3015 [#include <stdarg.h>
3016 va_list x,y;],
3017 [va_copy(x,y);],
3018 [ ac_cv_have_va_copy="yes" ],
3019 [ ac_cv_have_va_copy="no" ]
3020 )
3021])
3022if test "x$ac_cv_have_va_copy" = "xyes" ; then
3023 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3024fi
3025
3026AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3027 AC_TRY_LINK(
3028 [#include <stdarg.h>
3029 va_list x,y;],
3030 [__va_copy(x,y);],
3031 [ ac_cv_have___va_copy="yes" ],
3032 [ ac_cv_have___va_copy="no" ]
3033 )
3034])
3035if test "x$ac_cv_have___va_copy" = "xyes" ; then
3036 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3037fi
3038
Damien Miller4f8e6692001-07-14 13:22:53 +10003039AC_CACHE_CHECK([whether getopt has optreset support],
3040 ac_cv_have_getopt_optreset, [
3041 AC_TRY_LINK(
3042 [
3043#include <getopt.h>
3044 ],
3045 [ extern int optreset; optreset = 0; ],
3046 [ ac_cv_have_getopt_optreset="yes" ],
3047 [ ac_cv_have_getopt_optreset="no" ]
3048 )
3049])
3050if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003051 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3052 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003053fi
Damien Millera22ba012000-03-02 23:09:20 +11003054
Damien Millerecbb26d2000-07-15 14:59:14 +10003055AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003056 AC_TRY_LINK([],
3057 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10003058 [ ac_cv_libc_defines_sys_errlist="yes" ],
3059 [ ac_cv_libc_defines_sys_errlist="no" ]
3060 )
3061])
3062if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003063 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3064 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003065fi
3066
3067
Damien Miller11fa2cc2000-08-16 10:35:58 +10003068AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003069 AC_TRY_LINK([],
3070 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10003071 [ ac_cv_libc_defines_sys_nerr="yes" ],
3072 [ ac_cv_libc_defines_sys_nerr="no" ]
3073 )
3074])
3075if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003076 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003077fi
3078
Damien Millera8e06ce2003-11-21 23:48:55 +11003079SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003080# Check whether user wants sectok support
3081AC_ARG_WITH(sectok,
3082 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10003083 [
3084 if test "x$withval" != "xno" ; then
3085 if test "x$withval" != "xyes" ; then
3086 CPPFLAGS="$CPPFLAGS -I${withval}"
3087 LDFLAGS="$LDFLAGS -L${withval}"
3088 if test ! -z "$need_dash_r" ; then
3089 LDFLAGS="$LDFLAGS -R${withval}"
3090 fi
3091 if test ! -z "$blibpath" ; then
3092 blibpath="$blibpath:${withval}"
3093 fi
3094 fi
3095 AC_CHECK_HEADERS(sectok.h)
3096 if test "$ac_cv_header_sectok_h" != yes; then
3097 AC_MSG_ERROR(Can't find sectok.h)
3098 fi
3099 AC_CHECK_LIB(sectok, sectok_open)
3100 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3101 AC_MSG_ERROR(Can't find libsectok)
3102 fi
Tim Rice7df8d392005-09-19 09:33:39 -07003103 AC_DEFINE(SMARTCARD, 1,
3104 [Define if you want smartcard support])
3105 AC_DEFINE(USE_SECTOK, 1,
3106 [Define if you want smartcard support
3107 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11003108 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003109 fi
3110 ]
3111)
3112
3113# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08003114OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003115AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10003116 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08003117 [
3118 if test "x$withval" != "xno" ; then
3119 if test "x$withval" != "xyes" ; then
3120 OPENSC_CONFIG=$withval/bin/opensc-config
3121 else
3122 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3123 fi
3124 if test "$OPENSC_CONFIG" != "no"; then
3125 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3126 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3127 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
Darren Tucker0ee3cbf2006-09-23 16:25:19 +10003128 LIBS="$LIBS $LIBOPENSC_LIBS"
Tim Rice12ee8e22005-03-17 13:37:04 -08003129 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07003130 AC_DEFINE(USE_OPENSC, 1,
3131 [Define if you want smartcard support
3132 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08003133 SCARD_MSG="yes, using OpenSC"
3134 fi
3135 fi
3136 ]
3137)
Damien Miller85de5802001-09-18 14:01:11 +10003138
Darren Tucker5f88d342003-10-15 16:57:57 +10003139# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11003140AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07003141 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3142 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003143 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003144 # Needed by our getrrsetbyname()
3145 AC_SEARCH_LIBS(res_query, resolv)
3146 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10003147 AC_MSG_CHECKING(if res_query will link)
3148 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3149 [AC_MSG_RESULT(no)
3150 saved_LIBS="$LIBS"
3151 LIBS="$LIBS -lresolv"
3152 AC_MSG_CHECKING(for res_query in -lresolv)
3153 AC_LINK_IFELSE([
3154#include <resolv.h>
3155int main()
3156{
3157 res_query (0, 0, 0, 0, 0);
3158 return 0;
3159}
3160 ],
3161 [LIBS="$LIBS -lresolv"
3162 AC_MSG_RESULT(yes)],
3163 [LIBS="$saved_LIBS"
3164 AC_MSG_RESULT(no)])
3165 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10003166 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003167 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003168 [#include <sys/types.h>
3169 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10003170 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07003171 [AC_DEFINE(HAVE_HEADER_AD, 1,
3172 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10003173 [#include <arpa/nameser.h>])
3174 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003175
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003176AC_MSG_CHECKING(if struct __res_state _res is an extern)
3177AC_LINK_IFELSE([
3178#include <stdio.h>
3179#if HAVE_SYS_TYPES_H
3180# include <sys/types.h>
3181#endif
3182#include <netinet/in.h>
3183#include <arpa/nameser.h>
3184#include <resolv.h>
3185extern struct __res_state _res;
3186int main() { return 0; }
3187 ],
3188 [AC_MSG_RESULT(yes)
3189 AC_DEFINE(HAVE__RES_EXTERN, 1,
3190 [Define if you have struct __res_state _res as an extern])
3191 ],
3192 [ AC_MSG_RESULT(no) ]
3193)
3194
Damien Miller73b42d22006-04-22 21:26:08 +10003195# Check whether user wants SELinux support
3196SELINUX_MSG="no"
3197LIBSELINUX=""
3198AC_ARG_WITH(selinux,
3199 [ --with-selinux Enable SELinux support],
3200 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003201 save_LIBS="$LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003202 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3203 SELINUX_MSG="yes"
3204 AC_CHECK_HEADER([selinux/selinux.h], ,
3205 AC_MSG_ERROR(SELinux support requires selinux.h header))
3206 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3207 AC_MSG_ERROR(SELinux support requires libselinux library))
Darren Tucker20e9f972007-03-25 18:26:01 +10003208 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Damien Miller73b42d22006-04-22 21:26:08 +10003209 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
Darren Tuckeradc947d2006-10-07 09:07:20 +10003210 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003211 fi ]
3212)
Damien Miller73b42d22006-04-22 21:26:08 +10003213
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003214# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003215KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003216AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11003217 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003218 [ if test "x$withval" != "xno" ; then
3219 if test "x$withval" = "xyes" ; then
3220 KRB5ROOT="/usr/local"
3221 else
3222 KRB5ROOT=${withval}
3223 fi
3224
Tim Rice7df8d392005-09-19 09:33:39 -07003225 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003226 KRB5_MSG="yes"
3227
3228 AC_MSG_CHECKING(for krb5-config)
3229 if test -x $KRB5ROOT/bin/krb5-config ; then
3230 KRB5CONF=$KRB5ROOT/bin/krb5-config
3231 AC_MSG_RESULT($KRB5CONF)
3232
3233 AC_MSG_CHECKING(for gssapi support)
3234 if $KRB5CONF | grep gssapi >/dev/null ; then
3235 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003236 AC_DEFINE(GSSAPI, 1,
3237 [Define this if you want GSSAPI
3238 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003239 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003240 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11003241 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11003242 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003243 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003244 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3245 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003246 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003247 AC_MSG_CHECKING(whether we are using Heimdal)
3248 AC_TRY_COMPILE([ #include <krb5.h> ],
3249 [ char *tmp = heimdal_version; ],
3250 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003251 AC_DEFINE(HEIMDAL, 1,
3252 [Define this if you are using the
3253 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003254 AC_MSG_RESULT(no)
3255 )
3256 else
3257 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003258 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003259 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11003260 AC_MSG_CHECKING(whether we are using Heimdal)
3261 AC_TRY_COMPILE([ #include <krb5.h> ],
3262 [ char *tmp = heimdal_version; ],
3263 [ AC_MSG_RESULT(yes)
3264 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10003265 K5LIBS="-lkrb5 -ldes"
3266 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08003267 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10003268 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11003269 ],
3270 [ AC_MSG_RESULT(no)
3271 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3272 ]
3273 )
Damien Miller200d0a72003-06-30 19:21:36 +10003274 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003275
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003276 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3277 [ AC_DEFINE(GSSAPI)
3278 K5LIBS="-lgssapi $K5LIBS" ],
3279 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3280 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11003281 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003282 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3283 $K5LIBS)
3284 ],
3285 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003286
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003287 AC_CHECK_HEADER(gssapi.h, ,
3288 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003289 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003290 AC_CHECK_HEADERS(gssapi.h, ,
3291 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003292 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003293 ]
3294 )
3295
3296 oldCPP="$CPPFLAGS"
3297 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3298 AC_CHECK_HEADER(gssapi_krb5.h, ,
3299 [ CPPFLAGS="$oldCPP" ])
3300
Damien Millera8e06ce2003-11-21 23:48:55 +11003301 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003302 if test ! -z "$need_dash_r" ; then
3303 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3304 fi
3305 if test ! -z "$blibpath" ; then
3306 blibpath="$blibpath:${KRB5ROOT}/lib"
3307 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003308
3309 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3310 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3311 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3312
3313 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003314 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3315 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003316 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003317 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003318)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003319
Damien Millera22ba012000-03-02 23:09:20 +11003320# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003321
Damien Millerf58c6722002-05-13 13:15:42 +10003322PRIVSEP_PATH=/var/empty
3323AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003324 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003325 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003326 if test -n "$withval" && test "x$withval" != "xno" && \
3327 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003328 PRIVSEP_PATH=$withval
3329 fi
3330 ]
3331)
3332AC_SUBST(PRIVSEP_PATH)
3333
Damien Millera22ba012000-03-02 23:09:20 +11003334AC_ARG_WITH(xauth,
3335 [ --with-xauth=PATH Specify path to xauth program ],
3336 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003337 if test -n "$withval" && test "x$withval" != "xno" && \
3338 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003339 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003340 fi
3341 ],
3342 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003343 TestPath="$PATH"
3344 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3345 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3346 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3347 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3348 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003349 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003350 xauth_path="/usr/openwin/bin/xauth"
3351 fi
3352 ]
3353)
3354
Damien Miller7d901272003-01-13 16:55:22 +11003355STRIP_OPT=-s
3356AC_ARG_ENABLE(strip,
3357 [ --disable-strip Disable calling strip(1) on install],
3358 [
3359 if test "x$enableval" = "xno" ; then
3360 STRIP_OPT=
3361 fi
3362 ]
3363)
3364AC_SUBST(STRIP_OPT)
3365
Damien Millera19cf472000-11-29 13:28:50 +11003366if test -z "$xauth_path" ; then
3367 XAUTH_PATH="undefined"
3368 AC_SUBST(XAUTH_PATH)
3369else
Tim Rice7df8d392005-09-19 09:33:39 -07003370 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3371 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003372 XAUTH_PATH=$xauth_path
3373 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003374fi
Damien Millera22ba012000-03-02 23:09:20 +11003375
3376# Check for mail directory (last resort if we cannot get it from headers)
3377if test ! -z "$MAIL" ; then
3378 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003379 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3380 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003381fi
3382
Darren Tucker623d92f2004-09-12 22:36:15 +10003383if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003384 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3385 disable_ptmx_check=yes
3386fi
Damien Millera22ba012000-03-02 23:09:20 +11003387if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003388 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003389 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003390 [
Tim Rice7df8d392005-09-19 09:33:39 -07003391 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3392 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003393 have_dev_ptmx=1
3394 ]
3395 )
3396 fi
Damien Millera22ba012000-03-02 23:09:20 +11003397fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003398
Darren Tucker623d92f2004-09-12 22:36:15 +10003399if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003400 AC_CHECK_FILE("/dev/ptc",
3401 [
Tim Rice7df8d392005-09-19 09:33:39 -07003402 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3403 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003404 have_dev_ptc=1
3405 ]
3406 )
3407else
3408 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3409fi
Damien Miller204ad072000-03-02 23:56:12 +11003410
Damien Millera22ba012000-03-02 23:09:20 +11003411# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003412AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003413 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003414 [
Damien Miller897741e2001-04-16 10:41:46 +10003415 case "$withval" in
3416 man|cat|doc)
3417 MANTYPE=$withval
3418 ;;
3419 *)
3420 AC_MSG_ERROR(invalid man type: $withval)
3421 ;;
3422 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003423 ]
3424)
Ben Lindstrombc709922001-04-18 18:04:21 +00003425if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003426 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3427 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003428 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3429 MANTYPE=doc
3430 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3431 MANTYPE=man
3432 else
3433 MANTYPE=cat
3434 fi
3435fi
Damien Miller670a4b82000-01-22 13:53:11 +11003436AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003437if test "$MANTYPE" = "doc"; then
3438 mansubdir=man;
3439else
3440 mansubdir=$MANTYPE;
3441fi
3442AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003443
Damien Millera22ba012000-03-02 23:09:20 +11003444# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003445MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003446AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003447 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003448 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003449 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003450 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3451 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003452 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003453 fi
3454 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003455)
3456
Damien Millera22ba012000-03-02 23:09:20 +11003457# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003458AC_ARG_WITH(shadow,
3459 [ --without-shadow Disable shadow password support],
3460 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003461 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003462 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003463 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003464 fi
3465 ]
3466)
3467
Damien Miller1f335fb2000-06-26 11:31:33 +10003468if test -z "$disable_shadow" ; then
3469 AC_MSG_CHECKING([if the systems has expire shadow information])
3470 AC_TRY_COMPILE(
3471 [
3472#include <sys/types.h>
3473#include <shadow.h>
3474 struct spwd sp;
3475 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3476 [ sp_expire_available=yes ], []
3477 )
3478
3479 if test "x$sp_expire_available" = "xyes" ; then
3480 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003481 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3482 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003483 else
3484 AC_MSG_RESULT(no)
3485 fi
3486fi
3487
Damien Millera22ba012000-03-02 23:09:20 +11003488# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003489if test ! -z "$IPADDR_IN_DISPLAY" ; then
3490 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003491 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3492 [Define if you need to use IP address
3493 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003494else
Damien Millera8e06ce2003-11-21 23:48:55 +11003495 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003496 AC_ARG_WITH(ipaddr-display,
3497 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3498 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003499 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003500 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003501 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003502 fi
3503 ]
3504 )
3505fi
Damien Miller76112de1999-12-21 11:18:08 +11003506
Darren Tuckere1a790d2003-09-16 11:52:19 +10003507# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003508AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003509 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003510 [ if test "x$enableval" = "xno"; then
3511 AC_MSG_NOTICE([/etc/default/login handling disabled])
3512 etc_default_login=no
3513 else
3514 etc_default_login=yes
3515 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003516 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3517 then
3518 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3519 etc_default_login=no
3520 else
3521 etc_default_login=yes
3522 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003523)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003524
Darren Tucker2f9573d2005-02-10 22:28:54 +11003525if test "x$etc_default_login" != "xno"; then
3526 AC_CHECK_FILE("/etc/default/login",
3527 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003528 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003529 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3530 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003531 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003532fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003533
Tim Rice43a1c132002-04-17 21:19:14 -07003534dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003535if test $ac_cv_func_login_getcapbool = "yes" && \
3536 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003537 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003538fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003539
Damien Millera22ba012000-03-02 23:09:20 +11003540# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003541SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003542AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003543 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003544 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003545 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003546 AC_MSG_WARN([
3547--with-default-path=PATH has no effect on this system.
3548Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003549 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003550 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003551 AC_MSG_WARN([
3552--with-default-path=PATH will only be used if PATH is not defined in
3553$external_path_file .])
3554 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003555 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003556 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003557 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003558 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003559 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3560 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003561 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003562 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003563 AC_MSG_WARN([
3564If PATH is defined in $external_path_file, ensure the path to scp is included,
3565otherwise scp will not work.])
3566 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003567 AC_RUN_IFELSE(
3568 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003569/* find out what STDPATH is */
3570#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003571#ifdef HAVE_PATHS_H
3572# include <paths.h>
3573#endif
3574#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003575# ifdef _PATH_USERPATH /* Irix */
3576# define _PATH_STDPATH _PATH_USERPATH
3577# else
3578# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3579# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003580#endif
3581#include <sys/types.h>
3582#include <sys/stat.h>
3583#include <fcntl.h>
3584#define DATA "conftest.stdpath"
3585
3586main()
3587{
3588 FILE *fd;
3589 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003590
Tim Rice59ea0a02001-03-10 13:50:45 -08003591 fd = fopen(DATA,"w");
3592 if(fd == NULL)
3593 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003594
Tim Rice59ea0a02001-03-10 13:50:45 -08003595 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3596 exit(1);
3597
3598 exit(0);
3599}
Darren Tucker314d89e2005-10-17 23:29:23 +10003600 ]])],
3601 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003602 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3603 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3604 )
3605# make sure $bindir is in USER_PATH so scp will work
3606 t_bindir=`eval echo ${bindir}`
3607 case $t_bindir in
3608 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3609 esac
3610 case $t_bindir in
3611 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3612 esac
3613 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3614 if test $? -ne 0 ; then
3615 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3616 if test $? -ne 0 ; then
3617 user_path=$user_path:$t_bindir
3618 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3619 fi
3620 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003621 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003622)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003623if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003624 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003625 AC_SUBST(user_path)
3626fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003627
Damien Millera18bbd32002-05-13 10:48:57 +10003628# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003629AC_ARG_WITH(superuser-path,
3630 [ --with-superuser-path= Specify different path for super-user],
3631 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003632 if test -n "$withval" && test "x$withval" != "xno" && \
3633 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003634 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3635 [Define if you want a different $PATH
3636 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003637 superuser_path=$withval
3638 fi
3639 ]
3640)
3641
3642
Damien Miller61e50f12000-05-08 20:49:37 +10003643AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003644IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003645AC_ARG_WITH(4in6,
3646 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3647 [
3648 if test "x$withval" != "xno" ; then
3649 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003650 AC_DEFINE(IPV4_IN_IPV6, 1,
3651 [Detect IPv4 in IPv6 mapped addresses
3652 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003653 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003654 else
3655 AC_MSG_RESULT(no)
3656 fi
3657 ],[
3658 if test "x$inet6_default_4in6" = "xyes"; then
3659 AC_MSG_RESULT([yes (default)])
3660 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003661 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003662 else
3663 AC_MSG_RESULT([no (default)])
3664 fi
3665 ]
3666)
3667
Damien Miller60396b02001-02-18 17:01:00 +11003668# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003669BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003670AC_ARG_WITH(bsd-auth,
3671 [ --with-bsd-auth Enable BSD auth support],
3672 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003673 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003674 AC_DEFINE(BSD_AUTH, 1,
3675 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003676 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003677 fi
3678 ]
3679)
3680
Damien Millera22ba012000-03-02 23:09:20 +11003681# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003682piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003683# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003684if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003685 piddir=`eval echo ${sysconfdir}`
3686 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003687 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003688 esac
3689fi
3690
Tim Rice88f2ab52002-03-17 12:17:34 -08003691AC_ARG_WITH(pid-dir,
3692 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3693 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003694 if test -n "$withval" && test "x$withval" != "xno" && \
3695 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003696 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003697 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003698 AC_MSG_WARN([** no $piddir directory on this system **])
3699 fi
3700 fi
3701 ]
3702)
3703
Tim Rice7df8d392005-09-19 09:33:39 -07003704AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003705AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003706
andre2ff7b5d2000-06-03 14:57:40 +00003707dnl allow user to disable some login recording features
3708AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003709 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003710 [
3711 if test "x$enableval" = "xno" ; then
3712 AC_DEFINE(DISABLE_LASTLOG)
3713 fi
3714 ]
andre2ff7b5d2000-06-03 14:57:40 +00003715)
3716AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003717 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003718 [
3719 if test "x$enableval" = "xno" ; then
3720 AC_DEFINE(DISABLE_UTMP)
3721 fi
3722 ]
andre2ff7b5d2000-06-03 14:57:40 +00003723)
3724AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003725 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003726 [
3727 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003728 AC_DEFINE(DISABLE_UTMPX, 1,
3729 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003730 fi
3731 ]
andre2ff7b5d2000-06-03 14:57:40 +00003732)
3733AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003734 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003735 [
3736 if test "x$enableval" = "xno" ; then
3737 AC_DEFINE(DISABLE_WTMP)
3738 fi
3739 ]
andre2ff7b5d2000-06-03 14:57:40 +00003740)
3741AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003742 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003743 [
3744 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003745 AC_DEFINE(DISABLE_WTMPX, 1,
3746 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003747 fi
3748 ]
andre2ff7b5d2000-06-03 14:57:40 +00003749)
3750AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003751 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003752 [
3753 if test "x$enableval" = "xno" ; then
3754 AC_DEFINE(DISABLE_LOGIN)
3755 fi
3756 ]
andre2ff7b5d2000-06-03 14:57:40 +00003757)
3758AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003759 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003760 [
3761 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003762 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3763 [Define if you don't want to use pututline()
3764 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003765 fi
3766 ]
andre2ff7b5d2000-06-03 14:57:40 +00003767)
3768AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003769 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003770 [
3771 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003772 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3773 [Define if you don't want to use pututxline()
3774 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003775 fi
3776 ]
andre2ff7b5d2000-06-03 14:57:40 +00003777)
3778AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003779 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003780 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003781 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003782 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003783 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003784 conf_lastlog_location=$withval
3785 fi
3786 ]
3787)
andre2ff7b5d2000-06-03 14:57:40 +00003788
3789dnl lastlog, [uw]tmpx? detection
3790dnl NOTE: set the paths in the platform section to avoid the
3791dnl need for command-line parameters
3792dnl lastlog and [uw]tmp are subject to a file search if all else fails
3793
3794dnl lastlog detection
3795dnl NOTE: the code itself will detect if lastlog is a directory
3796AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3797AC_TRY_COMPILE([
3798#include <sys/types.h>
3799#include <utmp.h>
3800#ifdef HAVE_LASTLOG_H
3801# include <lastlog.h>
3802#endif
Damien Miller2994e082000-06-04 15:51:47 +10003803#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003804# include <paths.h>
3805#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003806#ifdef HAVE_LOGIN_H
3807# include <login.h>
3808#endif
andre2ff7b5d2000-06-03 14:57:40 +00003809 ],
3810 [ char *lastlog = LASTLOG_FILE; ],
3811 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003812 [
3813 AC_MSG_RESULT(no)
3814 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3815 AC_TRY_COMPILE([
3816#include <sys/types.h>
3817#include <utmp.h>
3818#ifdef HAVE_LASTLOG_H
3819# include <lastlog.h>
3820#endif
3821#ifdef HAVE_PATHS_H
3822# include <paths.h>
3823#endif
3824 ],
3825 [ char *lastlog = _PATH_LASTLOG; ],
3826 [ AC_MSG_RESULT(yes) ],
3827 [
andree441aa32000-06-12 22:34:38 +00003828 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003829 system_lastlog_path=no
3830 ])
3831 ]
andre2ff7b5d2000-06-03 14:57:40 +00003832)
Damien Miller2994e082000-06-04 15:51:47 +10003833
andre2ff7b5d2000-06-03 14:57:40 +00003834if test -z "$conf_lastlog_location"; then
3835 if test x"$system_lastlog_path" = x"no" ; then
3836 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003837 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003838 conf_lastlog_location=$f
3839 fi
3840 done
3841 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003842 AC_MSG_WARN([** Cannot find lastlog **])
3843 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003844 fi
3845 fi
3846fi
3847
3848if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003849 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3850 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003851fi
andre2ff7b5d2000-06-03 14:57:40 +00003852
3853dnl utmp detection
3854AC_MSG_CHECKING([if your system defines UTMP_FILE])
3855AC_TRY_COMPILE([
3856#include <sys/types.h>
3857#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003858#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003859# include <paths.h>
3860#endif
3861 ],
3862 [ char *utmp = UTMP_FILE; ],
3863 [ AC_MSG_RESULT(yes) ],
3864 [ AC_MSG_RESULT(no)
3865 system_utmp_path=no ]
3866)
3867if test -z "$conf_utmp_location"; then
3868 if test x"$system_utmp_path" = x"no" ; then
3869 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3870 if test -f $f ; then
3871 conf_utmp_location=$f
3872 fi
3873 done
3874 if test -z "$conf_utmp_location"; then
3875 AC_DEFINE(DISABLE_UTMP)
3876 fi
3877 fi
3878fi
3879if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003880 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3881 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003882fi
andre2ff7b5d2000-06-03 14:57:40 +00003883
3884dnl wtmp detection
3885AC_MSG_CHECKING([if your system defines WTMP_FILE])
3886AC_TRY_COMPILE([
3887#include <sys/types.h>
3888#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003889#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003890# include <paths.h>
3891#endif
3892 ],
3893 [ char *wtmp = WTMP_FILE; ],
3894 [ AC_MSG_RESULT(yes) ],
3895 [ AC_MSG_RESULT(no)
3896 system_wtmp_path=no ]
3897)
3898if test -z "$conf_wtmp_location"; then
3899 if test x"$system_wtmp_path" = x"no" ; then
3900 for f in /usr/adm/wtmp /var/log/wtmp; do
3901 if test -f $f ; then
3902 conf_wtmp_location=$f
3903 fi
3904 done
3905 if test -z "$conf_wtmp_location"; then
3906 AC_DEFINE(DISABLE_WTMP)
3907 fi
3908 fi
3909fi
3910if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003911 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3912 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003913fi
andre2ff7b5d2000-06-03 14:57:40 +00003914
3915
3916dnl utmpx detection - I don't know any system so perverse as to require
3917dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3918dnl there, though.
3919AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3920AC_TRY_COMPILE([
3921#include <sys/types.h>
3922#include <utmp.h>
3923#ifdef HAVE_UTMPX_H
3924#include <utmpx.h>
3925#endif
Damien Miller2994e082000-06-04 15:51:47 +10003926#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003927# include <paths.h>
3928#endif
3929 ],
3930 [ char *utmpx = UTMPX_FILE; ],
3931 [ AC_MSG_RESULT(yes) ],
3932 [ AC_MSG_RESULT(no)
3933 system_utmpx_path=no ]
3934)
3935if test -z "$conf_utmpx_location"; then
3936 if test x"$system_utmpx_path" = x"no" ; then
3937 AC_DEFINE(DISABLE_UTMPX)
3938 fi
3939else
Tim Rice7df8d392005-09-19 09:33:39 -07003940 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3941 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003942fi
andre2ff7b5d2000-06-03 14:57:40 +00003943
3944dnl wtmpx detection
3945AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3946AC_TRY_COMPILE([
3947#include <sys/types.h>
3948#include <utmp.h>
3949#ifdef HAVE_UTMPX_H
3950#include <utmpx.h>
3951#endif
Damien Miller2994e082000-06-04 15:51:47 +10003952#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003953# include <paths.h>
3954#endif
3955 ],
3956 [ char *wtmpx = WTMPX_FILE; ],
3957 [ AC_MSG_RESULT(yes) ],
3958 [ AC_MSG_RESULT(no)
3959 system_wtmpx_path=no ]
3960)
3961if test -z "$conf_wtmpx_location"; then
3962 if test x"$system_wtmpx_path" = x"no" ; then
3963 AC_DEFINE(DISABLE_WTMPX)
3964 fi
3965else
Tim Rice7df8d392005-09-19 09:33:39 -07003966 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3967 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003968fi
andre2ff7b5d2000-06-03 14:57:40 +00003969
Damien Miller4018c192000-04-30 09:30:44 +10003970
Damien Miller29ea30d2000-03-17 10:54:15 +11003971if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003972 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3973 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003974fi
3975
Darren Tucker7da23cb2005-08-03 00:20:15 +10003976dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3977dnl Add now.
3978CFLAGS="$CFLAGS $werror_flags"
3979
Damien Millerbac2d8a2000-09-05 16:13:06 +11003980AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10003981AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
3982 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
3983 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003984AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003985
Damien Miller7b22d652000-06-18 14:07:04 +10003986# Print summary of options
3987
Damien Miller7b22d652000-06-18 14:07:04 +10003988# Someone please show me a better way :)
3989A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3990B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3991C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3992D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003993E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003994F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003995G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003996H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3997I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3998J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003999
4000echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004001echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004002echo " User binaries: $B"
4003echo " System binaries: $C"
4004echo " Configuration files: $D"
4005echo " Askpass program: $E"
4006echo " Manual pages: $F"
4007echo " PID file: $G"
4008echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004009if test "x$external_path_file" = "x/etc/login.conf" ; then
4010echo " At runtime, sshd will use the path defined in $external_path_file"
4011echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004012else
Damien Millerf58c6722002-05-13 13:15:42 +10004013echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004014 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004015echo " (If PATH is set in $external_path_file it will be used instead. If"
4016echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4017 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004018fi
Damien Millera18bbd32002-05-13 10:48:57 +10004019if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004020echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004021fi
Damien Millerf58c6722002-05-13 13:15:42 +10004022echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004023echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004024echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004025echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004026echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004027echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004028echo " S/KEY support: $SKEY_MSG"
4029echo " TCP Wrappers support: $TCPW_MSG"
4030echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004031echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004032echo " Solaris process contract support: $SPC_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004033echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004034echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4035echo " BSD Auth support: $BSD_AUTH_MSG"
4036echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11004037if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004038echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004039fi
4040
Damien Miller7b22d652000-06-18 14:07:04 +10004041echo ""
4042
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004043echo " Host: ${host}"
4044echo " Compiler: ${CC}"
4045echo " Compiler flags: ${CFLAGS}"
4046echo "Preprocessor flags: ${CPPFLAGS}"
4047echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004048echo " Libraries: ${LIBS}"
4049if test ! -z "${SSHDLIBS}"; then
4050echo " +for sshd: ${SSHDLIBS}"
4051fi
Damien Miller7b22d652000-06-18 14:07:04 +10004052
4053echo ""
4054
Tim Rice6f1f7582004-05-30 21:38:51 -07004055if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004056 echo "SVR4 style packages are supported with \"make package\""
4057 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004058fi
4059
Damien Miller82cf0ce2000-12-20 13:34:48 +11004060if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004061 echo "PAM is enabled. You may need to install a PAM control file "
4062 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004063 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004064 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004065 echo ""
4066fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004067
Damien Miller6c21c512002-01-22 21:57:53 +11004068if test ! -z "$RAND_HELPER_CMDHASH" ; then
4069 echo "WARNING: you are using the builtin random number collection "
4070 echo "service. Please read WARNING.RNG and request that your OS "
4071 echo "vendor includes kernel-based random number collection in "
4072 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004073 echo ""
4074fi
Damien Miller60396b02001-02-18 17:01:00 +11004075
Damien Millerb4097182004-05-23 14:09:40 +10004076if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004077 echo "WARNING: the operating system that you are using does not"
4078 echo "appear to support getpeereid(), getpeerucred() or the"
4079 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4080 echo "enforce security checks to prevent unauthorised connections to"
4081 echo "ssh-agent. Their absence increases the risk that a malicious"
4082 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004083 echo ""
4084fi
4085
Darren Tuckerd9f88912005-02-20 21:01:48 +11004086if test "$AUDIT_MODULE" = "bsm" ; then
4087 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4088 echo "See the Solaris section in README.platform for details."
4089fi